query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
PUT /card_font_alignments/1 PUT /card_font_alignments/1.json
def update @card_font_alignment = CardFontAlignment.find(params[:id]) respond_to do |format| if @card_font_alignment.update_attributes(params[:card_font_alignment]) format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @card_font_alignment = CardFontAlignment.new(params[:card_font_alignment])\n\n respond_to do |format|\n if @card_font_alignment.save\n format.html { redirect_to @card_font_alignment, notice: 'Card font alignment was successfully created.' }\n format.json { render json: @card_font_alignment, status: :created, location: @card_font_alignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_font_alignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @card_font_alignment = CardFontAlignment.find(params[:id])\n @card_font_alignment.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_alignments_url }\n format.json { head :no_content }\n end\n end", "def update\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n if @card_font_family.update_attributes(params[:card_font_family])\n format.html { redirect_to @card_font_family, notice: 'Card font family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @card_font_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n respond_to do |format|\n if @font_set.update(font_set_params)\n format.html { redirect_to project_details_url(@project), notice: 'Font set was successfully updated.' }\n format.json { render :show, status: :ok, location: @font_set }\n else\n format.html { render :edit }\n format.json { render json: @font_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @card_font_alignment = CardFontAlignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_font_alignment }\n end\n end", "def show\n @card_font_alignment = CardFontAlignment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_alignment }\n end\n end", "def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_name = args[:font_name] if args.key?(:font_name)\n end", "def create\n @card_font_family = CardFontFamily.new(params[:card_font_family])\n\n respond_to do |format|\n if @card_font_family.save\n format.html { redirect_to @card_font_family, notice: 'Card font family was successfully created.' }\n format.json { render json: @card_font_family, status: :created, location: @card_font_family }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_font_family.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @card_font_family = CardFontFamily.find(params[:id])\n @card_font_family.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_families_url }\n format.json { head :no_content }\n end\n end", "def create\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.build(font_set_params)\n @font_families = get_font_family_array(@project)\n\n respond_to do |format|\n if @font_set.save\n format.html { redirect_to project_details_url(@project), notice: 'Font set was successfully created.' }\n format.json { render :show, status: :created, location: @font_set }\n else\n format.html { render :new }\n format.json { render json: @font_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @serif.update(serif_params)\n format.html { redirect_to @serif, notice: 'Serif was successfully updated.' }\n format.json { render :show, status: :ok, location: @serif }\n else\n format.html { render :edit }\n format.json { render json: @serif.errors, status: :unprocessable_entity }\n end\n end\n end", "def font_set_params\n params.require(:font_set).permit(:sass,\n :project_id,\n :name,\n :main_headline,\n :secondary_headline,\n :body,\n :byline,\n :pullquote,\n :blockquote,\n :big_number,\n :big_number_label)\n end", "def update\n @alignment = Alignment.find(params[:id])\n\n respond_to do |format|\n if @alignment.update_attributes(params[:alignment])\n format.html { redirect_to(@alignment, :notice => 'Alignment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @alignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_font_set_and_project\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n end", "def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_size = args[:font_size] if args.key?(:font_size)\n @median_height = args[:median_height] if args.key?(:median_height)\n @median_line_height = args[:median_line_height] if args.key?(:median_line_height)\n @median_line_space = args[:median_line_space] if args.key?(:median_line_space)\n @median_line_span = args[:median_line_span] if args.key?(:median_line_span)\n @median_width = args[:median_width] if args.key?(:median_width)\n @num_line_spaces = args[:num_line_spaces] if args.key?(:num_line_spaces)\n @num_lines = args[:num_lines] if args.key?(:num_lines)\n @num_symbols = args[:num_symbols] if args.key?(:num_symbols)\n end", "def update\n @serif = nil\n case params[:serif][:type]\n when \"ReplySerif\"\n @serif = ReplySerif.find(params[:id])\n when \"PopularSerif\"\n @serif = PopularSerif.find(params[:id])\n when \"NewSerif\"\n @serif = NewSerif.find(params[:id])\n else\n @serif = nil\n end\n\n respond_to do |format|\n if @serif.update_attributes(permitted_params)\n format.html { redirect_to :action => \"edit\", notice: 'Serif was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def change_font(font)\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, font_id())\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id())\n xf[:fontId] = Integer(font_id.to_i)\n # Modify xf array and retrieve new xf id\n @style_index = modify_xf(@workbook, xf)\n end", "def update\n @text_size = TextSize.find(params[:id])\n\n respond_to do |format|\n if @text_size.update_attributes(params[:text_size])\n format.html { redirect_to @text_size, notice: 'Text size was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_size.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_font(workbook, style_index)\n # xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(workbook.get_style(style_index))\n\n #modify fonts array\n font_id = xf[:fontId]\n font = workbook.fonts[font_id.to_s][:font]\n\n #else, just change the attribute itself, done in calling method.\n if workbook.fonts[font_id.to_s][:count] > 1 || font_id == 0\n old_size = workbook.fonts.size.to_s\n workbook.fonts[old_size] = {}\n workbook.fonts[old_size][:font] = deep_copy(font)\n workbook.fonts[old_size][:count] = 1\n workbook.fonts[font_id.to_s][:count] -= 1\n\n #modify styles array\n font_id = old_size\n\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fontId] = font_id\n xf[:applyFont] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1 #returns new style_index\n else\n return style_index\n end\n end", "def set_serif\n @serif = Serif.find(params[:id])\n end", "def set_font(key, font)\r\n # Add :Font key to content hash unless there is no key\r\n unless @content[pn(:Resources)].has_key?(pn(:Font))\r\n @content[pn(:Resources)].update(pn(:Font) => pd)\r\n end\r\n # Add font symbol to :Font hash\r\n unless @content[pn(:Resources)][pn(:Font)].has_key?(key)\r\n @content[pn(:Resources)][pn(:Font)].update(key => font.reference)\r\n end\r\n end", "def new\n @card_font_family = CardFontFamily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @card_font_family }\n end\n end", "def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end", "def update!(**args)\n @base_line = args[:base_line] if args.key?(:base_line)\n @character_height = args[:character_height] if args.key?(:character_height)\n @color = args[:color] if args.key?(:color)\n @confidence = args[:confidence] if args.key?(:confidence)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_size_float = args[:font_size_float] if args.key?(:font_size_float)\n @font_type = args[:font_type] if args.key?(:font_type)\n @has_uncertain_height = args[:has_uncertain_height] if args.key?(:has_uncertain_height)\n @horizontal_scale = args[:horizontal_scale] if args.key?(:horizontal_scale)\n @is_bold = args[:is_bold] if args.key?(:is_bold)\n @is_italic = args[:is_italic] if args.key?(:is_italic)\n @is_small_caps = args[:is_small_caps] if args.key?(:is_small_caps)\n @is_strikeout = args[:is_strikeout] if args.key?(:is_strikeout)\n @is_subscript = args[:is_subscript] if args.key?(:is_subscript)\n @is_superscript = args[:is_superscript] if args.key?(:is_superscript)\n @is_suspicious = args[:is_suspicious] if args.key?(:is_suspicious)\n @is_underlined = args[:is_underlined] if args.key?(:is_underlined)\n @not_ocrable_per_qa = args[:not_ocrable_per_qa] if args.key?(:not_ocrable_per_qa)\n @penalty = args[:penalty] if args.key?(:penalty)\n @serif_probability = args[:serif_probability] if args.key?(:serif_probability)\n end", "def load_single_font(name)\n \n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end", "def update_alignment\n\n inital_params = {is_valid:0, step: step, km: km, kcal: kcal}\n new_align = segments.create_with(inital_params).find_or_create_by(is_valid: 0)\n\n total_valid = segments.select(\"sum(step) as step, sum(km) as km, sum(kcal) as kcal\").where(\"is_valid = 1\").first\n\n unless total_valid.step.nil?\n new_align.step = step - total_valid.step\n new_align.km = km - total_valid.km\n new_align.kcal = kcal - total_valid.kcal\n end\n\n new_align.save!(:validate => false)\n end", "def show\n @card_font_family = CardFontFamily.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @card_font_family }\n end\n end", "def load_single_font(name)\n\n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end", "def add_font_family(pdf:, name:, root:)\n if root == 'OldStandard'\n # No Bold-Italic variant in OldStandard\n bold_italic_name = \"#{root}-Bold.ttf\"\n else\n bold_italic_name = \"#{root}-BoldItalic.ttf\"\n end\n\n pdf.font_families.update(\n name => {\n normal: Rails.root.join('vendor', 'fonts', root,\n \"#{root}-Regular.ttf\").to_s,\n italic: Rails.root.join('vendor', 'fonts', root,\n \"#{root}-Italic.ttf\").to_s,\n bold: Rails.root.join('vendor', 'fonts', root,\n \"#{root}-Bold.ttf\").to_s,\n bold_italic: Rails.root.join('vendor', 'fonts', root,\n bold_italic_name).to_s\n }\n )\n end", "def set_font\n font_families.update(\n 'HealthQuestPDF' => {\n normal: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-regular-webfont.ttf'),\n medium: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-bold-webfont.ttf'),\n bold: HealthQuest::Engine.root.join('lib', 'fonts', 'bitter-bold.ttf')\n }\n )\n font 'HealthQuestPDF'\n end", "def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end", "def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end", "def update\n @folha_fonte_recurso = Folha::FonteRecurso.find(params[:id])\n\n respond_to do |format|\n if @folha_fonte_recurso.update_attributes(params[:folha_fonte_recurso])\n format.html { redirect_to(@folha_fonte_recurso, :notice => 'Fonte recurso atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @folha_fonte_recurso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fonte_de_recurso.update(fonte_de_recurso_params)\n addlog(\"Fonte de recurso atualizada\")\n format.html { redirect_to @fonte_de_recurso, notice: 'Fonte de recurso atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @fonte_de_recurso }\n else\n format.html { render :edit }\n format.json { render json: @fonte_de_recurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def font_setup\n font_families.update(\"Montserrat\" => {\n :normal => \"vendor/assets/fonts/Montserrat/Montserrat-Regular.ttf\",\n :italic => \"vendor/assets/fonts/Montserrat/Montserrat-Italic.ttf\",\n :bold => \"vendor/assets/fonts/Montserrat/Montserrat-Bold.ttf\",\n })\n font \"Montserrat\"\n end", "def update!(**args)\n @estimated_font_sizes = args[:estimated_font_sizes] if args.key?(:estimated_font_sizes)\n @font_size_histogram = args[:font_size_histogram] if args.key?(:font_size_histogram)\n @mean_symbols_per_block = args[:mean_symbols_per_block] if args.key?(:mean_symbols_per_block)\n @mean_symbols_per_line = args[:mean_symbols_per_line] if args.key?(:mean_symbols_per_line)\n @mean_symbols_per_paragraph = args[:mean_symbols_per_paragraph] if args.key?(:mean_symbols_per_paragraph)\n @mean_symbols_per_word = args[:mean_symbols_per_word] if args.key?(:mean_symbols_per_word)\n @mean_words_per_block = args[:mean_words_per_block] if args.key?(:mean_words_per_block)\n @mean_words_per_line = args[:mean_words_per_line] if args.key?(:mean_words_per_line)\n @mean_words_per_paragraph = args[:mean_words_per_paragraph] if args.key?(:mean_words_per_paragraph)\n @median_block_space = args[:median_block_space] if args.key?(:median_block_space)\n @median_even_printed_box = args[:median_even_printed_box] if args.key?(:median_even_printed_box)\n @median_full_even_printed_box = args[:median_full_even_printed_box] if args.key?(:median_full_even_printed_box)\n @median_full_odd_printed_box = args[:median_full_odd_printed_box] if args.key?(:median_full_odd_printed_box)\n @median_full_printed_box = args[:median_full_printed_box] if args.key?(:median_full_printed_box)\n @median_height = args[:median_height] if args.key?(:median_height)\n @median_horizontal_dpi = args[:median_horizontal_dpi] if args.key?(:median_horizontal_dpi)\n @median_line_height = args[:median_line_height] if args.key?(:median_line_height)\n @median_line_space = args[:median_line_space] if args.key?(:median_line_space)\n @median_line_span = args[:median_line_span] if args.key?(:median_line_span)\n @median_odd_printed_box = args[:median_odd_printed_box] if args.key?(:median_odd_printed_box)\n @median_paragraph_indent = args[:median_paragraph_indent] if args.key?(:median_paragraph_indent)\n @median_paragraph_space = args[:median_paragraph_space] if args.key?(:median_paragraph_space)\n @median_printed_box = args[:median_printed_box] if args.key?(:median_printed_box)\n @median_symbols_per_block = args[:median_symbols_per_block] if args.key?(:median_symbols_per_block)\n @median_symbols_per_line = args[:median_symbols_per_line] if args.key?(:median_symbols_per_line)\n @median_symbols_per_paragraph = args[:median_symbols_per_paragraph] if args.key?(:median_symbols_per_paragraph)\n @median_symbols_per_word = args[:median_symbols_per_word] if args.key?(:median_symbols_per_word)\n @median_vertical_dpi = args[:median_vertical_dpi] if args.key?(:median_vertical_dpi)\n @median_width = args[:median_width] if args.key?(:median_width)\n @median_words_per_block = args[:median_words_per_block] if args.key?(:median_words_per_block)\n @median_words_per_line = args[:median_words_per_line] if args.key?(:median_words_per_line)\n @median_words_per_paragraph = args[:median_words_per_paragraph] if args.key?(:median_words_per_paragraph)\n @num_block_spaces = args[:num_block_spaces] if args.key?(:num_block_spaces)\n @num_blocks = args[:num_blocks] if args.key?(:num_blocks)\n @num_line_spaces = args[:num_line_spaces] if args.key?(:num_line_spaces)\n @num_lines = args[:num_lines] if args.key?(:num_lines)\n @num_non_graphic_blocks = args[:num_non_graphic_blocks] if args.key?(:num_non_graphic_blocks)\n @num_pages = args[:num_pages] if args.key?(:num_pages)\n @num_paragraph_spaces = args[:num_paragraph_spaces] if args.key?(:num_paragraph_spaces)\n @num_paragraphs = args[:num_paragraphs] if args.key?(:num_paragraphs)\n @num_symbols = args[:num_symbols] if args.key?(:num_symbols)\n @num_words = args[:num_words] if args.key?(:num_words)\n end", "def update\n @texts = Text.all\n\n puts params\n\n respond_to do |format|\n\n if @agreement.update(agreement_params)\n format.html { redirect_to @agreement, notice: 'Certificado atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @agreement }\n else\n format.html { render :edit }\n format.json { render json: @agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "def replace_font(name, source_font, target_font, embed = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil)\n data, _status_code, _headers = replace_font_with_http_info(name, source_font, target_font, embed, password, folder, storage, fonts_folder)\n data\n end", "def update!(**args)\n @abbreviated_heading_text = args[:abbreviated_heading_text] if args.key?(:abbreviated_heading_text)\n @abbrv_embedding = args[:abbrv_embedding] if args.key?(:abbrv_embedding)\n @heading_embedding = args[:heading_embedding] if args.key?(:heading_embedding)\n @normalized_heading_text = args[:normalized_heading_text] if args.key?(:normalized_heading_text)\n @passage_embedding = args[:passage_embedding] if args.key?(:passage_embedding)\n @passage_text = args[:passage_text] if args.key?(:passage_text)\n end", "def destroy\n @font_set = FontSet.find(params[:id])\n project = @font_set.project\n @font_set.destroy\n respond_to do |format|\n format.html { redirect_to project_details_url(project), notice: 'Font set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end", "def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end", "def update\n respond_to do |format|\n if @guides_text.update(guides_text_params)\n format.html { redirect_to @guides_text, notice: 'Text was successfully updated.' }\n format.json { render :show, status: :ok, location: @guides_text }\n else\n format.html { render :edit }\n format.json { render json: @guides_text.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @font_color = args[:font_color] if args.key?(:font_color)\n @format_type = args[:format_type] if args.key?(:format_type)\n end", "def create\n @alignment = Alignment.new(params[:alignment])\n\n respond_to do |format|\n if @alignment.save\n format.html { redirect_to(@alignment, :notice => 'Alignment was successfully created.') }\n format.xml { render :xml => @alignment, :status => :created, :location => @alignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @alignment = args[:alignment] if args.key?(:alignment)\n @width = args[:width] if args.key?(:width)\n end", "def set_fonts\n font_families.update(\"Arial\" => {\n :normal => \"#{Rails.root}/vendor/assets/fonts/Arial.ttf\",\n :bold => \"#{Rails.root}/vendor/assets/fonts/Arial-Bold.ttf\"\n })\n font \"Arial\"\n end", "def font=(value)\n @font = value\n end", "def change_font_name(fontname)\n @font_name = fontname\n @text_entry.update_font\n self.redraw\n end", "def id\n read_attribute(:font_id)\n end", "def replace_font_with_http_info(name, source_font, target_font, embed = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.replace_font ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.replace_font\"\n end\n # verify the required parameter 'source_font' is set\n if @api_client.config.client_side_validation && source_font.nil?\n fail ArgumentError, \"Missing the required parameter 'source_font' when calling SlidesApi.replace_font\"\n end\n # verify the required parameter 'target_font' is set\n if @api_client.config.client_side_validation && target_font.nil?\n fail ArgumentError, \"Missing the required parameter 'target_font' when calling SlidesApi.replace_font\"\n end\n # resource path\n local_var_path = '/slides/{name}/fonts/{sourceFont}/replace/{targetFont}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'sourceFont', source_font)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'targetFont', target_font)\n\n # query parameters\n query_params = {}\n query_params[:'embed'] = @api_client.prepare_for_query(embed) unless embed.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n query_params[:'fontsFolder'] = @api_client.prepare_for_query(fonts_folder) unless fonts_folder.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'FontsData')\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @texttocorrect.update(texttocorrect_params)\n format.html { redirect_to @texttocorrect, notice: 'Texttocorrect was successfully updated.' }\n format.json { render :show, status: :ok, location: @texttocorrect }\n else\n format.html { render :edit }\n format.json { render json: @texttocorrect.errors, status: :unprocessable_entity }\n end\n end\n end", "def load_fonts\n\n # Load fonts.\n self.load_single_font('Across The Road')\n self.load_single_font('Alabama')\n self.load_single_font('Arial')\n self.load_single_font('Arial Narrow')\n self.load_single_font('Arty Signature')\n self.load_single_font('Asem Kandis')\n self.load_single_font('Autograf')\n self.load_single_font('Born Ready')\n self.load_single_font('Brittany Signature')\n self.load_single_font('Bulgatti')\n self.load_single_font('Courier New')\n self.load_single_font('Estelly')\n self.load_single_font('Friday Vibes')\n self.load_single_font('From Skyler')\n self.load_single_font('Gallatone')\n self.load_single_font('Halimun')\n self.load_single_font('Hello Santtiny')\n self.load_single_font('Just Realize')\n self.load_single_font('Just Signature')\n self.load_single_font('Mayestica')\n self.load_single_font('Menlo')\n self.load_single_font('Notera')\n self.load_single_font('Prestige Signature')\n self.load_single_font('Reinata')\n self.load_single_font('Santos Dumont')\n self.load_single_font('SF Mono')\n self.load_single_font('Shopping List')\n self.load_single_font('Signatures')\n self.load_single_font('Signerica')\n self.load_single_font('Silver Pen')\n self.load_single_font('Sophistica')\n self.load_single_font('Source Code Pro')\n self.load_single_font('Southampton')\n self.load_single_font('Thankfully')\n self.load_single_font('The Jacklyn')\n self.load_single_font('Tomatoes')\n self.load_single_font('Wanted Signature')\n self.load_single_font('White Angelica')\n self.load_single_font('Whitney')\n self.load_single_font('Whitney Bold')\n self.load_single_font('Whitney Index Rounded')\n self.load_single_font('Whitney Index Squared')\n self.load_single_font('Xtreem')\n self.load_single_font('Gotham Condensed')\n\n end", "def update\n respond_to do |format|\n if @ascaffold.update(ascaffold_params)\n format.html { redirect_to @ascaffold, notice: 'Ascaffold was successfully updated.' }\n format.json { render :show, status: :ok, location: @ascaffold }\n else\n format.html { render :edit }\n format.json { render json: @ascaffold.errors, status: :unprocessable_entity }\n end\n end\n end", "def align=(align)\n set_align(align)\n generate_buffers\n end", "def modify_alignment(workbook, style_index, is_horizontal, alignment)\n old_xf_obj = workbook.get_style(style_index)\n\n xf_obj = deep_copy(old_xf_obj)\n\n if xf_obj[:alignment].nil? || xf_obj[:alignment][:attributes].nil?\n xf_obj[:alignment] = {:attributes=>{:horizontal=>nil, :vertical=>nil}}\n end\n\n if is_horizontal\n xf_obj[:alignment][:attributes][:horizontal] = alignment.to_s\n else\n xf_obj[:alignment][:attributes][:vertical] = alignment.to_s\n end\n\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy(xf_obj)\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy(xf_obj)]\n end\n\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:applyAlignment] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n workbook.cell_xfs[:xf].size-1\n end", "def update\n @glyph = Glyph.find(params[:id])\n\n respond_to do |format|\n if @glyph.update_attributes(params[:glyph])\n format.html { redirect_to @glyph, notice: 'Glyph was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glyph.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @bold = args[:bold] if args.key?(:bold)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_type = args[:font_type] if args.key?(:font_type)\n @font_weight = args[:font_weight] if args.key?(:font_weight)\n @handwritten = args[:handwritten] if args.key?(:handwritten)\n @italic = args[:italic] if args.key?(:italic)\n @letter_spacing = args[:letter_spacing] if args.key?(:letter_spacing)\n @pixel_font_size = args[:pixel_font_size] if args.key?(:pixel_font_size)\n @smallcaps = args[:smallcaps] if args.key?(:smallcaps)\n @strikeout = args[:strikeout] if args.key?(:strikeout)\n @subscript = args[:subscript] if args.key?(:subscript)\n @superscript = args[:superscript] if args.key?(:superscript)\n @text_color = args[:text_color] if args.key?(:text_color)\n @underlined = args[:underlined] if args.key?(:underlined)\n end", "def update\n @alignment_position = AlignmentPosition.find(params[:id])\n\n respond_to do |format|\n if @alignment_position.update_attributes(params[:alignment_position])\n format.html { redirect_to(@alignment_position, :notice => 'Alignment position was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @alignment_position.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n style = Style.find(params[:id])\n style.update(update_params)\n save_style style.stylable_id\n head :ok\n end", "def change_font_name(font_name='Verdana')\n validate_worksheet\n # Get copy of font object with modified name\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_font(font)\n end", "def add_font(font_filename, mimetype)\n font_filename2 = File.join( @dcpdir, File.basename(font_filename) )\n File.copy(font_filename, font_filename2)\n @packing_list << DCPPKLAsset.create_asset( \n\tfont_filename2,\n\tShellCommands.uuid_gen,\n\tmimetype,\n\tasdcp_digest( font_filename2 ),\n\tFile.size(font_filename2))\n end", "def insert_text_format\n attributes.fetch(:insertTextFormat)\n end", "def font=(font)\n set_font(font)\n generate_buffers\n end", "def update\n @text.readability_index = @text.difficulty_method\n @text.flesh_index = @text.rudolf_flesh_method\n #@text.speed_index = '15'\n\n respond_to do |format|\n if @text.update(text_params)\n format.html { redirect_to @text, notice: \"Text was successfully updated.\" }\n format.json { render :show, status: :ok, location: @text }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_embedded_attributes(atts)\n atts.each do |att, val|\n @embedding[att] = val\n end\n end", "def align\n @genome = Genome.find(params[:id])\n @proteins = Protein.all\n @method = params[:method]\n\n if params[:method] == 'local'\n @message = 'Local alignment'\n align_all_local\n elsif params[:method] == 'global'\n @message = 'Global alignment'\n align_all_global\n end\n\n end", "def textalignment=(textAlignment)\n @elementHash[:textalignment] = textAlignment\n end", "def update\n respond_to do |format|\n if @text_on_pdf.update(text_on_pdf_params)\n format.html { redirect_to @text_on_pdf, notice: 'Text on pdf was successfully updated.' }\n format.json { render :show, status: :ok, location: @text_on_pdf }\n else\n format.html { render :edit }\n format.json { render json: @text_on_pdf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @award_ceremony.update(award_ceremony_params)\n format.html { redirect_to @award_ceremony, notice: 'Award ceremony was successfully updated.' }\n format.json { render :show, status: :ok, location: @award_ceremony }\n else\n format.html { render :edit }\n format.json { render json: @award_ceremony.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @serif = Serif.new(serif_params)\n\n respond_to do |format|\n if @serif.save\n format.html { redirect_to @serif, notice: 'Serif was successfully created.' }\n format.json { render :show, status: :created, location: @serif }\n else\n format.html { render :new }\n format.json { render json: @serif.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_font_sizes(font_sizes:)\n {\n method: \"Page.setFontSizes\",\n params: { fontSizes: font_sizes }.compact\n }\n end", "def set_text(font, size)\n\t \[email protected](font, size)\n\t end", "def update\n respond_to do |format|\n if @model_acronym.update(model_acronym_params)\n format.html { redirect_to @model_acronym, notice: 'Model acronym was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @model_acronym.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_font_id\n @mutex.synchronize { @current_font_id += 1 }\n end", "def update\n respond_to do |format|\n params[:family][:name] = params[:family][:name].split(\" \").map{|a| a.capitalize}.join(\" \")\n if @family.update(family_params)\n format.json { render :show, status: :ok, location: @family }\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n else\n format.json { render json: @family.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end", "def set_font(face, size)\n @curr_font = Gauges::FontRef.get(face, size)\n end", "def update\n respond_to do |format|\n if @attention_center.update(attention_center_params)\n format.html { redirect_to @attention_center, notice: 'Attention center was successfully updated.' }\n format.json { render :show, status: :ok, location: @attention_center }\n else\n format.html { render :edit }\n format.json { render json: @attention_center.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @color = args[:color] if args.key?(:color)\n @font_family = args[:font_family] if args.key?(:font_family)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_weight = args[:font_weight] if args.key?(:font_weight)\n @text_anchor = args[:text_anchor] if args.key?(:text_anchor)\n @text_decoration = args[:text_decoration] if args.key?(:text_decoration)\n @text_style = args[:text_style] if args.key?(:text_style)\n end", "def update\n if @textual_content.update textual_content_params\n render :show, status: :ok, location: [@card, @textual_content]\n else\n render json: @textual_content.errors, status: :unprocessable_entity\n end\n end", "def set_alignment_with_action(toolbar_name, alignment)\n opera_desktop_action(\"Set alignment\", toolbar_name, alignment)\n sleep(0.1)\n end", "def serif_params\n params[:serif]\n end", "def set_font_path()\n Dir.entries(@output_styles).each do |filename|\n next if filename =~ /^\\.\\.?$/\n filepath = \"#{@output_styles}/#{filename}\"\n\n text = File.read(filepath)\n new_text = text.gsub(/..\\/font/, \"#{@fonts_path}\")\n File.write(filepath, new_text)\n end\n end", "def destroy\n @alignment = Alignment.get(params[:id])\n alignments = Alignment.all(:alignment_name => @alignment.alignment_name)\n alignments.each do |a|\n a.deleted_at = Time.now\n a.save\n end\n\n respond_to do |format|\n format.html { redirect_to(alignments_url) }\n format.xml { head :ok }\n end\n end", "def convert_font_args(params)\n return unless params\n font = {\n :_name => params[:name],\n :_color => params[:color],\n :_size => params[:size],\n :_bold => params[:bold],\n :_italic => params[:italic],\n :_underline => params[:underline],\n :_pitch_family => params[:pitch_family],\n :_charset => params[:charset],\n :_baseline => params[:baseline] || 0\n }\n\n # Convert font size units.\n font[:_size] *= 100 if font[:_size] && font[:_size] != 0\n\n font\n end", "def SetFont(family, style='', size=0)\n\t\t# save previous values\n\t\t@prevfont_family = @font_family;\n\t\t@prevfont_style = @font_style;\n\n\t\tfamily=family.downcase;\n\t\tif (family=='')\n\t\t\tfamily=@font_family;\n\t\tend\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\telsif ((family==\"symbol\") or (family==\"zapfdingbats\"))\n\t\t\tstyle='';\n\t\tend\n\t\t\n\t\tstyle=style.upcase;\n\n\t\tif (style.include?('U'))\n\t\t\t@underline=true;\n\t\t\tstyle= style.gsub('U','');\n\t\telse\n\t\t\t@underline=false;\n\t\tend\n\t\tif (style.include?('D'))\n\t\t\t@deleted=true;\n\t\t\tstyle= style.gsub('D','');\n\t\telse\n\t\t\t@deleted=false;\n\t\tend\n\t\tif (style=='IB')\n\t\t\tstyle='BI';\n\t\tend\n\t\tif (size==0)\n\t\t\tsize=@font_size_pt;\n\t\tend\n\n\t\t# try to add font (if not already added)\n\t\tAddFont(family, style);\n\t\t\n\t\t#Test if font is already selected\n\t\tif ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))\n\t\t\treturn;\n\t\tend\n\t\t\n\t\tfontkey = family + style;\n\t\tstyle = '' if (@fonts[fontkey].nil? and !@fonts[family].nil?)\n \n\t\t#Test if used for the first time\n\t\tif (@fonts[fontkey].nil?)\n\t\t\t#Check if one of the standard fonts\n\t\t\tif (!@core_fonts[fontkey].nil?)\n\t\t\t\tif @@fpdf_charwidths[fontkey].nil?\n\t\t\t\t\t#Load metric file\n\t\t\t\t\tfile = family;\n\t\t\t\t\tif ((family!='symbol') and (family!='zapfdingbats'))\n\t\t\t\t\t\tfile += style.downcase;\n\t\t\t\t\tend\n\t\t\t\t\tif (getfontpath(file + '.rb').nil?)\n\t\t\t\t\t\t# try to load the basic file without styles\n\t\t\t\t\t\tfile = family;\n\t\t\t\t\t\tfontkey = family;\n\t\t\t\t\tend\n\t\t\t\t\trequire(getfontpath(file + '.rb'));\n \t\tfont_desc = TCPDFFontDescriptor.font(file)\n\t\t\t\t\tif ((@is_unicode and ctg.nil?) or ((!@is_unicode) and (@@fpdf_charwidths[fontkey].nil?)) )\n\t\t\t\t\t\tError(\"Could not include font metric file [\" + fontkey + \"]: \" + getfontpath(file + \".rb\"));\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ti = @fonts.length + 1;\n\n\t\t\t\tif (@is_unicode)\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\telse\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tError('Undefined font: ' + family + ' ' + style);\n\t\t\tend\n\t\tend\n\t\t#Select it\n\t\t@font_family = family;\n\t\t@font_style = style;\n\t\t@font_size_pt = size;\n\t\t@font_size = size / @k;\n\t\t@current_font = @fonts[fontkey]; # was & may need deep copy?\n\t\tif (@page>0)\n\t\t\tout(sprintf('BT /F%d %.2f Tf ET', @current_font['i'], @font_size_pt));\n\t\tend\n\tend", "def update!(**args)\n @aligned_ocr_texts = args[:aligned_ocr_texts] if args.key?(:aligned_ocr_texts)\n @aligned_time = args[:aligned_time] if args.key?(:aligned_time)\n @context_text = args[:context_text] if args.key?(:context_text)\n @label_text = args[:label_text] if args.key?(:label_text)\n @text_similarity_features = args[:text_similarity_features] if args.key?(:text_similarity_features)\n @text_span_at_aligned_time = args[:text_span_at_aligned_time] if args.key?(:text_span_at_aligned_time)\n end", "def update\n @body_style_size = BodyStyleSize.find(params[:id])\n\n respond_to do |format|\n if @body_style_size.update_attributes(params[:body_style_size])\n format.html { redirect_to @body_style_size, notice: 'Body style size was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @body_style_size.errors, status: :unprocessable_entity }\n end\n end\n end", "def font_id=(font_id)\n raise InvalidFontIdError unless valid_font_id_ranges.any? { |range| range.include? font_id }\n @font_id = font_id\n end", "def update\n @ad_style = Format.find(params[:id])\n\n respond_to do |format|\n if @ad_style.update_attributes(params[:ad_style])\n format.html { redirect_to(@ad_style, :notice => 'Ad style was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ad_style.errors, :status => :unprocessable_entity }\n end\n end\n end", "def align(align=nil)\n @options[:align] = align unless align.nil?\n @options[:align]\n end", "def font idx\n @fonts[idx]\n end", "def send_award_letter\n update_attribute(:award_letter_sent_at, Time.now)\n update_attribute(:award_letter_text, award_letter_text)\n end", "def set_alignment_with_action(toolbar_name, alignment)\n opera_desktop_action(\"Set alignment\", toolbar_name, alignment)\n sleep(0.1) \n end", "def get_font_latin_attributes(font)\n return [] unless font\n\n attributes = []\n attributes << 'typeface' << font[:_name] if ptrue?(font[:_name])\n attributes << 'pitchFamily' << font[:_pitch_family] if font[:_pitch_family]\n attributes << 'charset' << font[:_charset] if font[:_charset]\n\n attributes\n end", "def update\n respond_to do |format|\n if @asama_tanim.update(asama_tanim_params)\n format.html { redirect_to @asama_tanim, notice: 'Asama tanim was successfully updated.' }\n format.json { render :show, status: :ok, location: @asama_tanim }\n else\n format.html { render :edit }\n format.json { render json: @asama_tanim.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_data_font(data_type)\n @maqj_default_font = contents.font.dup unless @maqj_default_font\n contents.font.name = QuestData::FONTNAMES[data_type] ? \n QuestData::FONTNAMES[data_type] : @maqj_default_font.name\n contents.font.size = QuestData::FONTSIZES[data_type] ? \n QuestData::FONTSIZES[data_type] : @maqj_default_font.size\n contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ? \n QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold\n contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?\n QuestData::FONTITALICS[data_type] : @maqj_default_font.italic\n case data_type\n when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color\n when :name then change_color(quest_name_colour(@quest)) if @quest\n else\n change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)\n end\n end", "def set_font_from_path(font, bold_font)\n font_name = Pathname.new(font).basename\n @pdf.font_families.update(\n \"#{font_name}\" => {\n normal: font,\n italic: font,\n bold: bold_font,\n bold_italic: bold_font\n }\n )\n @pdf.font(font_name)\n end", "def font_id(style_index)\n xf_id(style_index)[:fontId]\n end", "def text_align(alignment)\n Kernel.raise ArgumentError, \"Unknown alignment constant: #{alignment}\" unless ALIGN_TYPE_NAMES.key?(alignment.to_i)\n primitive \"text-align #{ALIGN_TYPE_NAMES[alignment.to_i]}\"\n end" ]
[ "0.6871999", "0.6703782", "0.66521555", "0.6265116", "0.58375394", "0.579937", "0.5797196", "0.579588", "0.575264", "0.56762516", "0.5571101", "0.53469473", "0.531404", "0.5297938", "0.5182652", "0.51479363", "0.51136196", "0.5072741", "0.50480294", "0.5035415", "0.5008951", "0.49861842", "0.498486", "0.49830994", "0.49543402", "0.49098", "0.4899107", "0.48986945", "0.48757008", "0.4867005", "0.48401096", "0.48401096", "0.48323685", "0.48253524", "0.48175877", "0.48158023", "0.4811918", "0.48109147", "0.47827786", "0.4780884", "0.47710627", "0.47710627", "0.47702613", "0.47669563", "0.47661117", "0.47625327", "0.475367", "0.47515133", "0.47396114", "0.47384694", "0.471486", "0.46977893", "0.46897924", "0.46838754", "0.4679758", "0.46694428", "0.46656188", "0.46494868", "0.4649359", "0.464006", "0.46372887", "0.4633001", "0.4632858", "0.46303952", "0.46284705", "0.4620797", "0.46188876", "0.4617756", "0.46121472", "0.46097857", "0.4601013", "0.45886093", "0.45867026", "0.45836622", "0.45814195", "0.4579402", "0.45761403", "0.45747042", "0.45613384", "0.4554353", "0.45506427", "0.45505294", "0.4547721", "0.45461366", "0.45389947", "0.4530806", "0.4529748", "0.4524942", "0.45196968", "0.45194158", "0.45157704", "0.4509785", "0.45079872", "0.45074013", "0.45051986", "0.44976303", "0.44967014", "0.44878805", "0.44829676", "0.44813716" ]
0.75992566
0
DELETE /card_font_alignments/1 DELETE /card_font_alignments/1.json
def destroy @card_font_alignment = CardFontAlignment.find(params[:id]) @card_font_alignment.destroy respond_to do |format| format.html { redirect_to card_font_alignments_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @card_font_family = CardFontFamily.find(params[:id])\n @card_font_family.destroy\n\n respond_to do |format|\n format.html { redirect_to card_font_families_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alignment = Alignment.get(params[:id])\n alignments = Alignment.all(:alignment_name => @alignment.alignment_name)\n alignments.each do |a|\n a.deleted_at = Time.now\n a.save\n end\n\n respond_to do |format|\n format.html { redirect_to(alignments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @serif.destroy\n respond_to do |format|\n format.html { redirect_to serifs_url, notice: 'Serif was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @font_set = FontSet.find(params[:id])\n project = @font_set.project\n @font_set.destroy\n respond_to do |format|\n format.html { redirect_to project_details_url(project), notice: 'Font set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.delete\n render json: {messsage: \"Movie/Series Card was successfully deleted.\"}, status: 204\n end", "def destroy\n @text_size = TextSize.find(params[:id])\n @text_size.destroy\n\n respond_to do |format|\n format.html { redirect_to text_sizes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad_matrix_category_headline.destroy\n respond_to do |format|\n format.html { redirect_to ad_matrix_category_headlines_url, notice: 'Ad matrix category headline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fonte_de_recurso.destroy\n addlog(\"Fonte de recurso apagada\")\n respond_to do |format|\n format.html { redirect_to fontes_de_recurso_url, notice: 'Fonte de recurso apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_text.destroy\n respond_to do |format|\n format.html { redirect_to request_texts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mtb_among_card_type = MtbAmongCardType.find(params[:id])\n @mtb_among_card_type.destroy\n\n respond_to do |format|\n format.html { redirect_to mtb_among_card_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @individual_format.destroy\n respond_to do |format|\n format.html { redirect_to individual_formats_url, notice: 'Individual format was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @entry_card.destroy\n respond_to do |format|\n format.html { redirect_to entry_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bundles_items_design = BundlesItemsDesign.find(params[:id])\n @bundles_items_design.destroy\n\n respond_to do |format|\n format.html { redirect_to bundles_items_designs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_cardapio = ItemCardapio.find(params[:id])\n @item_cardapio.destroy\n\n respond_to do |format|\n format.html { redirect_to item_cardapios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @textual_content.destroy\n render json: { message: 'Textual content deleted sucussfully.' }, status: 200\n end", "def destroy\n @ad_style = Format.find(params[:id])\n @ad_style.destroy\n\n respond_to do |format|\n format.html { redirect_to(ad_styles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @card_highlight.destroy\n respond_to do |format|\n format.html { redirect_to card_highlights_url, notice: 'Card highlight was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transcendence.destroy\n respond_to do |format|\n format.html { redirect_to transcendences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @specific_gravity.destroy\n respond_to do |format|\n format.html { redirect_to @batch, notice: 'Specific gravity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @award_ceremony.destroy\n respond_to do |format|\n format.html { redirect_to award_ceremonies_url, notice: 'Award ceremony was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_in_column.destroy\n respond_to do |format|\n format.html { redirect_to card_in_columns_url, notice: 'Card in column was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @background_annoncment.destroy\n respond_to do |format|\n format.html { redirect_to background_annoncments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fantasy_draft_style.destroy\n respond_to do |format|\n format.html { redirect_to fantasy_draft_styles_url, notice: 'Fantasy draft style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @master_text.destroy\n @master_text.project.recalculate_counts!\n respond_to do |format|\n format.html { redirect_to project_master_texts_path(@master_text.project), notice: \"Master text was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @attendace3.destroy\n respond_to do |format|\n format.html { redirect_to attendace3s_url, notice: \"Attendace3 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @mtb_among_card_expantion = MtbAmongCardExpantion.find(params[:id])\n @mtb_among_card_expantion.destroy\n\n respond_to do |format|\n format.html { redirect_to mtb_among_card_expantions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @japan_style = JapanStyle.find(params[:id])\n @japan_style.destroy\n\n respond_to do |format|\n format.html { redirect_to japan_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asama_tanim.destroy\n respond_to do |format|\n format.html { redirect_to asama_tanims_url, notice: 'Asama tanim was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stroke.destroy\n respond_to do |format|\n format.html { redirect_to strokes_url, notice: 'Stroke was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manga = Manga.find(params[:id])\n @manga.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @folha_fonte_recurso = Folha::FonteRecurso.find(params[:id])\n @folha_fonte_recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to(folha_fonte_recursos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @motion_graphic_customization.destroy\n respond_to do |format|\n format.html { redirect_to motion_graphic_customizations_url, notice: 'Motion graphic customization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @car_body_style = CarBodyStyle.find(params[:id])\n @car_body_style.destroy\n\n respond_to do |format|\n format.html { redirect_to car_body_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @glyph = Glyph.find(params[:id])\n @glyph.destroy\n\n respond_to do |format|\n format.html { redirect_to glyphs_url }\n format.json { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @txt3 = Txt3.find(params[:id])\n @txt3.destroy\n\n respond_to do |format|\n format.html { redirect_to txt3s_url }\n format.json { head :ok }\n end\n end", "def destroy\n @aliquotum = Aliquotum.find(params[:id])\n @aliquotum.destroy\n\n respond_to do |format|\n format.html { redirect_to aliquota_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cargo_manifest = CargoManifest.find(params[:id])\n num = @cargo_manifest.manifest_num\n attr= TransportGuideState.find_by_name_state('En Proceso').id\n CargoManifest.transaction do\n @cargo_manifest.cargo_manifest_details.each do |detail|\n tg=detail.transport_guide\n tg.update_attribute('transport_guide_state_id', attr)\n detail.delete\n end\n @cargo_manifest.delete\n CustomLogger.info(\"Se borra manifiesto de carga: #{@cargo_manifest.inspect}, usuario: #{current_user.inspect}, #{Time.now}\")\n end\n \n\n respond_to do |format|\n format.html { redirect_to cargo_manifests_url, notice: \"El Manifiesto de cargo #{num} ha sido borrado\"}\n format.json { head :no_content }\n end\n end", "def destroy\n @appellation.destroy\n respond_to do |format|\n format.html { redirect_to appellations_url, notice: \"Appellation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @guides_text.destroy\n respond_to do |format|\n format.html { redirect_to guides_texts_url, notice: 'Text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_award.destroy\n respond_to do |format|\n format.html { redirect_to club_awards_url, notice: 'Club award was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @agreement.destroy\n respond_to do |format|\n format.html { redirect_to agreements_url, notice: 'Agreement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manga.destroy\n respond_to do |format|\n format.html { redirect_to mangas_url, notice: 'Manga was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manga.destroy\n respond_to do |format|\n format.html { redirect_to mangas_url, notice: 'Manga was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @serif = Serif.find(params[:id])\n @serif.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => \"index\", notice: \"Serif was successfully deleted.\" }\n end\n end", "def destroy\n @texttocorrect.destroy\n respond_to do |format|\n format.html { redirect_to texttocorrects_url, notice: 'Texttocorrect was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @capacidad.destroy\n respond_to do |format|\n format.html { redirect_to capacidads_url, notice: 'Capacidad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @creative.destroy\n respond_to do |format|\n format.html { redirect_to campaign_creatives_url(@campaign), notice: 'Вид рекламы удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish_style.destroy\n respond_to do |format|\n format.html { redirect_to dish_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @adword_text.destroy\n respond_to do |format|\n format.html { redirect_to adword_texts_url, notice: 'Adword text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @org_award.destroy\n respond_to do |format|\n format.html { redirect_to org_awards_url, notice: 'Org award was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @frase.destroy\n respond_to do |format|\n format.html { redirect_to frases_url, notice: 'Frase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @construction_style = ConstructionStyle.find(params[:id])\n @construction_style.destroy\n\n respond_to do |format|\n format.html { redirect_to construction_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cartridge.destroy\n respond_to do |format|\n format.html { redirect_to cartridges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @txt4 = Txt4.find(params[:id])\n @txt4.destroy\n\n respond_to do |format|\n format.html { redirect_to txt4s_url }\n format.json { head :ok }\n end\n end", "def destroy\n @accolade.destroy\n respond_to do |format|\n format.html { redirect_to accolades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @graphic_card.destroy\n respond_to do |format|\n format.html { redirect_to graphic_cards_url, notice: 'Graphic card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pharmacy.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @guideline.destroy\n respond_to do |format|\n format.html { redirect_to guidelines_url, notice: \"Guideline was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @guideline.destroy\n respond_to do |format|\n format.html { redirect_to guidelines_url, notice: 'Guideline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank_card_type.destroy\n respond_to do |format|\n format.html { redirect_to bank_card_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_set = CardSet.find(params[:id])\n @card_set.destroy\n\n respond_to do |format|\n format.html { redirect_to card_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card_set.destroy\n respond_to do |format|\n format.html { redirect_to card_sets_url, notice: 'Card set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_award_cfg.destroy\n respond_to do |format|\n format.html { redirect_to admin_activity_award_cfgs_url, notice: 'Activity award cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ascaffold.destroy\n respond_to do |format|\n format.html { redirect_to ascaffolds_url, notice: 'Ascaffold was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @assembly_guide = AssemblyGuide.find(params[:id])\n @assembly_guide.destroy\n\n respond_to do |format|\n format.html { redirect_to assembly_guides_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if(params.has_key?(:card_id))\n @Waste3Card = Waste3Card.find_by_card_id(params[:card_id])\n @Waste3Card.destroy\n else\n Waste3Card.delete_all\n end\n render json: {}, status: :no_content\n end", "def destroy\n @body_style_size = BodyStyleSize.find(params[:id])\n @body_style_size.destroy\n\n respond_to do |format|\n format.html { redirect_to body_style_sizes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @archetype = Archetype.find(params[:id])\n @archetype.destroy\n\n respond_to do |format|\n format.html { redirect_to archetypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.update!(deleted_at: Time.now)\n head :no_content\n end", "def destroy\n @asset_scrapping_entry.destroy\n respond_to do |format|\n format.html { redirect_to asset_scrapping_entries_url, notice: 'Asset scrapping entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to tarot_cards_path(@tarot) }\n format.json { head :no_content }\n end\n end", "def destroy\n @magic_card_type.destroy\n respond_to do |format|\n format.html { redirect_to magic_card_types_url, notice: 'Magic card type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @declaration_container.destroy\n\n respond_to do |format|\n format.html { redirect_to declaration_containers_url(:declaration_id => @declaration_container.declaration_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.card_parameters.destroy_all\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'Card was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def destroy\n @typerelsequence.destroy\n respond_to do |format|\n format.html { redirect_to typerelsequences_url, notice: 'Typerelsequence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_custom_text.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_custom_texts_url, notice: 'Custom text was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transform.destroy\n respond_to do |format|\n format.html { redirect_to transforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @card = Card.destroy(params[:id])\n # render json: 200\n end", "def destroy\n @card.destroy\n\n head :no_content\n end", "def destroy\n @attr.destroy\n respond_to do |format|\n format.html { redirect_to attrs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @stylejg.destroy\n respond_to do |format|\n format.html { redirect_to stylejgs_url, notice: 'Stylejg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ammolist_taxon_caliber.destroy\n respond_to do |format|\n format.html { redirect_to ammolist_taxon_calibers_url, notice: 'Ammolist taxon caliber was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserve_stat_has_manifestation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reserve_stat_has_manifestations_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @body_style = BodyStyle.find(params[:id])\n @body_style.destroy\n\n respond_to do |format|\n format.html { redirect_to body_styles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @arc_type.destroy\n respond_to do |format|\n format.html { redirect_to arc_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mtb_card = MtbCard.find(params[:id])\n @mtb_card.destroy\n\n respond_to do |format|\n format.html { redirect_to mtb_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@card = Card.find(params[:id])\n @card.destroy\n\n respond_to do |format|\n format.html { redirect_to cards_url, :notice => 'Card successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fourth_story_text = FourthStoryText.last\n @fourth_story_text.destroy\n $update_delete_time = true\n respond_to do |format|\n format.html { redirect_to fourth_story_texts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @text_manager.destroy\n respond_to do |format|\n format.html { redirect_to text_managers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alignment_position = AlignmentPosition.find(params[:id])\n @alignment_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(alignment_positions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @malethrowing_disc_head.destroy\n respond_to do |format|\n format.html { redirect_to malethrowing_disc_heads_url, notice: 'Malethrowing disc head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @akce.destroy\n respond_to do |format|\n format.html { redirect_to akces_url, notice: 'Akce was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thead.destroy\n respond_to do |format|\n format.html { redirect_to theads_url, notice: 'Thead was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxfree.destroy\n respond_to do |format|\n format.html { redirect_to taxfrees_url, notice: 'Taxfree was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.71274936", "0.6468942", "0.6320602", "0.6299824", "0.62126994", "0.62065506", "0.6121495", "0.6116161", "0.6101788", "0.6070829", "0.6050019", "0.60187566", "0.6017648", "0.6014885", "0.6010507", "0.60102403", "0.59999573", "0.5997424", "0.5997238", "0.5990842", "0.59759396", "0.5969223", "0.59682655", "0.59604704", "0.5960149", "0.5958155", "0.5955963", "0.5945892", "0.5940479", "0.59353834", "0.5931972", "0.59308743", "0.59307235", "0.5928375", "0.592425", "0.591807", "0.59168893", "0.59155285", "0.5906542", "0.5898044", "0.5895691", "0.5893363", "0.58926785", "0.58926785", "0.58918494", "0.5889581", "0.5888413", "0.58873045", "0.5885458", "0.58798033", "0.5879623", "0.58759475", "0.58759415", "0.5875528", "0.5866613", "0.58664656", "0.58653367", "0.58648574", "0.58636206", "0.5862445", "0.5861847", "0.58617836", "0.5859961", "0.5859113", "0.5857418", "0.5852567", "0.58507955", "0.58502644", "0.5848626", "0.5848437", "0.5846677", "0.5846354", "0.5845454", "0.5834854", "0.5833856", "0.5832141", "0.5829911", "0.58295715", "0.58259827", "0.5822812", "0.5821973", "0.5820438", "0.5817127", "0.5813109", "0.5813083", "0.5812853", "0.5809385", "0.5808516", "0.58079505", "0.58065695", "0.58054185", "0.58047783", "0.5803782", "0.58033764", "0.58022094", "0.5801764", "0.5799667", "0.57991445", "0.57948154", "0.5794163" ]
0.79836345
0
Provide the full list of features and tags
def route_list(library, paths) if paths && !paths.empty? && paths.first =~ /^(?:features|tags)$/ case paths.shift when "features"; cmd = Commands::ListFeaturesCommand when "tags"; cmd = Commands::ListTagsCommand end cmd.new(final_options(library, paths)).call(request) else core_route_list(library,paths) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_features *args\r\n puts \"not implemented yet\"\r\n end", "def listfeatures\n myfeatures=Array.new\n for f in self.features\n myfeatures << f.title\n myfeatures << f.description\n end\n return myfeatures.join(\" \")\n end", "def features\n []\n end", "def features\n []\n end", "def features\n features = {}\n sexp_newtype_block.each do |s|\n if s[0] == :command and\n s[1][0..1] == [:@ident, \"feature\"] and\n s[2][0] == :args_add_block\n\n name = s[2][1][0][1][1][1]\n desc = s[2][1][1][1][1][1]\n\n features[name] = desc\n end\n end\n\n features\n end", "def get_required_features(features)\n end", "def features\n @features ||= {}\n @features.keys\n end", "def get_tags(feature)\n tags = []\n feature.custom_fields.each { |field| tags = field.value if field.name = 'Tag' }\n tags\n end", "def define_features\n @fvs.each do |vector, label|\n vector.each do |term, value|\n @features.add(term)\n end\n end\n end", "def feature_names\n raise NotImplementedError\n end", "def display_features\n puts\n puts \"Features:\"\n @features.each { |feature| puts \" * #{feature}\"}\n puts\n end", "def features(version)\n feature_setup.include?(version) ? feature_names : []\n end", "def features\n validate_loaded\n resource = FEATURES % { id: @id }\n response = Request.new(client, :get, resource).perform\n response.body[:data]\n end", "def feature(name, &block); begin; yield; features << name; rescue Exception; end; end", "def all_tags(test_case)\n test_case.tags + test_case.feature.tags\n end", "def loaded_features; end", "def features\n return @discovery_document['features'] || []\n end", "def all_features\r\n feature_objects.inject([]) {|r, obj| r + obj.features }\r\n end", "def features\n s = Set.new\n @plugins.each { |x| s += x.features }\n s\n end", "def active_tags\n active_tags = [:global]\n active_tags << feature_tag.to_sym if feature_tag\n active_tags + super\n end", "def features_requested\n if !defined?(@_requested_features)\n @_requested_features = ENV[\"VAGRANT_EXPERIMENTAL\"].to_s.downcase.split(',')\n end\n @_requested_features\n end", "def features\n @inventory.features(self).to_a\n end", "def features\n set_members(FeaturesKey)\n end", "def feature_objects\r\n states\r\n end", "def show_tags\n tag_list = \"\"\n self.tags.each do |t|\n tag_list << \"#{t.name} \"\n end\n tag_list\n end", "def use(*features); end", "def feature\n @item_attributes.feature.collect {|f| f.to_s}\n end", "def list_of_tags\n tag_list\n end", "def feature_vector\n out = []\n field_names.each { |f| out << @profile[f] }\n out\n end", "def feature_args(ci_gcc_config)\n return [] if ci_gcc_config[:features].nil?\n\n ci_gcc_config[:features].map { |f| \"-f#{f}\" }\n end", "def feature_set(*args, &b)\n describe(*args, &b)\n end", "def feature_set\n @inventory.features(self)\n end", "def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end", "def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end", "def add_loaded_features(loaded_features); end", "def feature(name)\n features[name]\n end", "def supported_features\n\t\treturn self.supported_feature_oids.collect {|oid| FEATURE_NAMES[oid] || oid }\n\tend", "def features\n @client.smembers(FeaturesKey.to_s).to_set\n end", "def update_features\n self.feature_descriptions = BasketItem.describe_feature_selections(feature_selections)\n end", "def append_features(mod) end", "def get_features()#:nodoc:\n # These features are more or less accurate. Many values couldn't be verified because\n # they are used in context of Java programming language a sometimes Nokogiri just\n # dont't provide any information on the feature\n\n features = {\n \"external-general-entities\" => false,\n \"external-parameter-entities\" => false,\n \"is-standalone\" => false, #Zjistit jak ziskat z dokumentu standalone\n \"lexical-handler/parameter-entities\" => false,\n \"namespaces\" => true,\n \"namespace-prefixes\" => true,\n \"resolve-dtd-uris\" => false,\n \"string-interning\" => false,\n \"unicode-normalization-checking\" => true, #Nokogiri probably supports this, needs to be verified\n \"use-attributes2\" => false,\n \"use-locator2\" => false,\n \"use-entity-resolver2\" => false,\n \"validation\" => true, #Nokogiri is probably reporting erros\n \"xmlns-uris\" => true, #Nokogiri is probably treating xmlns declarations as part of xmlns namespace\n \"xml-1.1\" => false #Don't know\n }\n\n return features\n end", "def features\n model.instance_variable_get(\"@features\")\n end", "def featuredocs\n str = \"\"\n @features ||= {}\n return nil if @features.empty?\n names = @features.keys.sort { |a,b| a.to_s <=> b.to_s }\n names.each do |name|\n doc = @features[name].docs.gsub(/\\n\\s+/, \" \")\n str += \"- *#{name}*: #{doc}\\n\"\n end\n\n if providers.length > 0\n headers = [\"Provider\", names].flatten\n data = {}\n providers.each do |provname|\n data[provname] = []\n prov = provider(provname)\n names.each do |name|\n if prov.feature?(name)\n data[provname] << \"*X*\"\n else\n data[provname] << \"\"\n end\n end\n end\n str += doctable(headers, data)\n end\n str\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def tag_list\n #tags sie bierze z asocjacji\n tags.map { |t| t.name }.join(\",\")\n end", "def tag_list\n\t\tself.tags.map(&:name).join(\", \")\n\tend", "def features\n @features ||= Features.from_grpc @grpc\n end", "def supported_tags\n [\n # attributes\n :name,\n\n # simple tags\n\n # multiple tags\n :fingerprints, :configurations, :tests\n ]\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def enable_features(feature_names)\n self.enabled_features = feature_names\n end", "def tag_list\n tags.map(&:name).join(', ')\n end", "def tag_list\n tags.collect(&:name).join(', ')\n end", "def tag_list\n tags.collect(&:name).join(', ')\n end", "def tags() ; info[:tags] ; end", "def tags() ; info[:tags] ; end", "def taglist\n\tself.tags.map {|t| t.name}\n end", "def features\n feature_files.map do |feature_file|\n file_contents = feature_file.download\n {\n title: file_contents.split(\"\\n\").grep(/^\\s*Feature/).join,\n text: feature_file.download,\n }\n end\n end", "def add_features(doc, features)\n fm = REXML::Element.new('featureManager', doc)\n features.each do |feature|\n f = REXML::Element.new('feature', fm)\n f.add_text(feature)\n end\n end", "def index\n @featurenames = Featurename.all\n end", "def scan_ff_for_tag feature\n if feature[:gherkin][\"tags\"]\n feature[:gherkin][\"tags\"].each do |tag|\n if tag[\"name\"] == Observer.tag\n f = feature.clone\n @@tag_features << f\n @num = false\n puts \"\"\n end\n end\n end\n end", "def features\n\t\tcollection = []\n\t\tclasses.each do |_class|\n\t\t\t_class.features.each do |feature|\n\t\t\t\tcollection << feature\n\t\t\tend\n\t\tend\n\t\trace.features.each do |feature|\n\t\t\tcollection << feature\n\t\tend\n\t\tfeats.each do |feat|\n\t\t\tcollection << feat\n\t\tend\n\t\tcollection\n\tend", "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end", "def feature(document)\n #log.debug \"FEATURE\"\n feature = document[:feature]\n return unless document[:feature]\n return if has_exclude_tags?(feature[:tags].map { |t| t[:name].gsub(/^@/, '') })\n\n @feature = YARD::CodeObjects::Lucid::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|\n f.comments = feature[:comments] ? feature[:comments].map{|comment| comment[:text]}.join(\"\\n\") : ''\n f.description = feature[:description] || ''\n f.add_file(@file,feature[:location][:line])\n f.keyword = feature[:keyword]\n f.value = feature[:name]\n f.tags = []\n\n feature[:tags].each {|feature_tag| find_or_create_tag(feature_tag[:name],f) }\n end\n feature[:children].each { |s|\n case s[:type]\n when :Background\n background(s)\n when :ScenarioOutline\n scenario_outline(s)\n when :Scenario\n scenario(s)\n end\n }\n end", "def run_all\n run(\"features\")\n end", "def tags\n ['any'] + @tags\n end", "def tags\n ['any'] + @tags\n end", "def tags() []; end", "def all_tags\n\t\ttags.map(&:name).join(\", \")\n\tend", "def tag_names #helper method\n # gets tag names in an array\n self.tags.map { |tag| tag.name }\n end", "def tag_names\n self.tags.map(&:name).join(\", \")\n end", "def supported_tags\n [\n # attributes\n\n # simple tags\n :attack_class, :attack_score, :attack_type, :attack_value, :capec,\n :cwe_id, :description, :dissa_asc, :normalized_url, :oval, :owasp2007,\n :owasp2010, :owasp2013, :recommendation, :vuln_method, :vuln_param,\n :vuln_type, :vuln_url, :web_site\n # nested tags\n ]\nend", "def add_features(doc, features)\n fm = REXML::Element.new('featureManager', doc)\n features.each do |feature|\n f = REXML::Element.new('feature', fm)\n f.add_text(feature)\n end\n end", "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end", "def tag_list\n tags.join(\", \")\n end", "def supported_tags\n [\n # attributes\n :port, :svc_name, :protocol, :severity, :plugin_id, :plugin_name, :plugin_family,\n # simple tags\n :solution, :risk_factor, :description, :plugin_publication_date,\n :metasploit_name, :cvss_vector, :cvss_temporal_vector, :synopsis,\n :exploit_available, :patch_publication_date, :plugin_modification_date,\n :cvss_temporal_score, :cvss_base_score, :plugin_output,\n :plugin_version, :exploitability_ease, :vuln_publication_date,\n :exploit_framework_canvas, :exploit_framework_metasploit,\n :exploit_framework_core,\n # multiple tags\n :bid_entries, :cve_entries, :see_also_entries, :xref_entries,\n # compliance tags\n :cm_actual_value, :cm_audit_file, :cm_check_id, :cm_check_name, :cm_info,\n :cm_output, :cm_policy_value, :cm_reference, :cm_result, :cm_see_also,\n :cm_solution\n ]\n end", "def tag_names\n self.tags.map{ |t| t.name }.join(\", \")\n end", "def tag_list\n\t\t@tag_list ||= self.tags.map { |tag| tag.name }.join(', ')\n\tend", "def tag_list\n data[:tag_list]\n end", "def tag_list\n data[:tag_list]\n end", "def tag_list\n tag_list_array = self.tags.to_a\n tag_list_array.delete_if { |tag| Tag.main_tags.include?(tag.name) }\n tag_list_array.map(&:name).join(\", \")\n end", "def features(name)\n page = Islay::Pages.definitions[name]\n raise \"The page '#{name}' has not been defined\" if page.nil?\n\n if record = page.record\n record.published_features\n else\n []\n end\n end", "def supported_tags\n [\n # attributes\n :nexpose_id, :title, :severity, :pci_severity, :cvss_score, :cvss_vector,\n :published, :added, :modified,\n\n # simple tags\n :description, :solution,\n\n # multiple tags\n :references, :tags\n ]\n end", "def append_features(base)\n puts \"#{base} is appended with new features\"\n end", "def tag_list\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \") #When we joined the array Ruby called the default #to_s method on every one of these Tag instances \n\tend", "def tag_list\n #converting all tag objects to an array of tag names\n self.tags.collect do |tag|\n tag.name\n end.join(\", \") #join the array of tag names with a comma\n end", "def tags\n attributes[:tags] || []\n end", "def add_tags\n self.tag_list = 'bug, feature, improvement, feedback, discussion, help'\n end", "def feature(name, docs, hash = {})\n # Not needed to describe the type\n nil\n end", "def added_skill_types\r\n features_set(FEATURE_STYPE_ADD)\r\n end", "def features\n features = Hash[api.get_features(app).body.map{|feature| [feature['name'], feature['enabled']]}]\n actual_features = Hash[api.get_features(target_app).body.map{|feature| [feature['name'], feature['enabled']]}]\n\n features_to_enable = features.select{|feature, enabled| enabled && !actual_features[feature]}\n features_to_disable = actual_features.select{|feature, enabled| enabled && !features[feature]}\n\n action(\"Copying labs features from #{app} and restarting #{target_app}\") do\n features_to_enable.each do |feature|\n puts \"Adding #{feature} to #{target_app}\"\n api.post_feature(feature, target_app)\n end\n\n features_to_disable.each do |feature|\n puts \"Deleting #{feature} from #{target_app}\"\n api.delete_feature(feature, target_app)\n end\n end\n end", "def get_featured\n\t\t{:recent => \"Recently Started\", :ending => \"Ending Soon\", :small => \"Small Projects\"}\n\tend", "def description\n @tags.map { |tag| tag.to_s.capitalize }.join(\", \")\n end", "def initialize\n self.features = {}\n end", "def features(code = nil)\n return @features if code.nil?\n @features.select {|ft| ft.code == code }\n end" ]
[ "0.769541", "0.74670553", "0.73784107", "0.73259884", "0.7012389", "0.7011172", "0.6973233", "0.69281054", "0.685066", "0.6830926", "0.6725033", "0.67118484", "0.6696911", "0.66394097", "0.6598604", "0.6576555", "0.6515748", "0.6512176", "0.64971125", "0.64894074", "0.6434925", "0.64248145", "0.6410362", "0.63690686", "0.6346892", "0.6344526", "0.63422", "0.6330619", "0.63253975", "0.6321173", "0.63154745", "0.6299681", "0.62978077", "0.62978077", "0.6289256", "0.62772155", "0.6267997", "0.6241631", "0.6235092", "0.62126344", "0.61990947", "0.6192451", "0.6181906", "0.61601335", "0.6156168", "0.6156168", "0.6156168", "0.6156168", "0.6156168", "0.6153522", "0.6128439", "0.6124262", "0.61172545", "0.61135036", "0.61135036", "0.61135036", "0.61052936", "0.60778654", "0.6064493", "0.6064493", "0.60631865", "0.60631865", "0.60629153", "0.6044207", "0.60128164", "0.6008347", "0.60066134", "0.59950054", "0.5972744", "0.5957152", "0.5952949", "0.5947217", "0.5947217", "0.5946739", "0.5932399", "0.592854", "0.5923743", "0.5923482", "0.5919836", "0.5915156", "0.59096247", "0.5902625", "0.5897103", "0.589187", "0.5890912", "0.5890912", "0.5875278", "0.5875184", "0.5875164", "0.58698124", "0.585875", "0.585402", "0.58473873", "0.5845884", "0.5845135", "0.58306974", "0.58281124", "0.5820346", "0.5818191", "0.58180463", "0.58180374" ]
0.0
-1
create 2 int elements array from 9,9 or 9
def split_number(s) if s =~ /(\d+),(\d+)/ [$1.to_i,$2.to_i] else [s.to_i,s.to_i] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_int_array\n [first.time_to_int, last.time_to_int]\n end", "def array_array(rn, cn, iv = 1)\n Array.new(rn) { Array.new(cn, iv) }\nend", "def array_to_integer_array_method\n @card_integer_array = []\n @card_array.each do |integer|\n new_integer = integer.to_i\n @card_integer_array << new_integer\n end\n return @card_integer_array\n end", "def coord(a, b)\n final_array = []\n first_array = (1..a).to_a\n second_array = (1..b).to_a\n first_array.each do |first_num|\n second_array.each do |second_num|\n coordinates = \"(#{first_num}, #{second_num})\"\n final_array.push(coordinates)\n end\n end\n final_array \nend", "def repeated_number_ranges(arr)\n\n\nend", "def basic_7\n new_array = []\n i = 1\n while i <= 255\n new_array.push(i)\n i += 2\n end\n return new_array\nend", "def make_array min,sec\n (\"%d%02d*\" % [min,sec]).gsub(/^0+([^*])/,'\\1').split(//)\nend", "def array_to_integer_array_method(card_array)\n card_integer_array = []\n card_array.each do |integer|\n new_integer = integer.to_i\n card_integer_array << new_integer\n end\n return card_integer_array\nend", "def array_with_two_elements\n ary = Array.new\n Array.new(2)\nend", "def make_array\n <<-CODE\n next_int;\n t1 = array_new(state, _int);\n j = _int - 1;\n for(; j >= 0; j--) {\n t2 = stack_pop();\n array_set(state, t1, j, t2);\n }\n\n cpu_perform_hook(state, c, BASIC_CLASS(array),\n global->sym_from_literal, t1);\n stack_push(t1);\n CODE\n end", "def digitArray(num)\n\tdigs = []\n\twhile num > 9\n\t\tnum, last_digit = num.divmod(10)\n\t\tdigs << last_digit\n\tend\n\tdigs << num\n\tdigs\nend", "def crear_serie(n)\n array = [1, 2]\n\n # times indica cuantas vecesdebe ejecutarse un fragmento de codigo\n (n - 2).times {\n array << array [-1] + array [-2]\n }\n \n return array\nend", "def my_array_splitting_method(source)\n new_array=[[], []]\n \n source.each do |x|\n if x.is_a?(Integer)\n new_array[0]<<x\n else \n new_array[1]<<x\n end\n end\nnew_array\n\nend", "def board_2d\n # slice the array into groups of 4 to create 2d-array\n @board.enum_slice(4).to_a\n end", "def group(i)\n case i\n when 0..2 then (0..2).to_a\n when 3..5 then (3..5).to_a\n when 6..8 then (6..8).to_a\n end\n end", "def number_ndigit_pair(array, digit_offset)\n pair_array = []\n array.each do |number|\n pair_array << [number, (number / 10 ** (digit_offset) % 10)]\n end\n pair_array\n end", "def element_times_index(numbers)\n \n i = 0 # i represents to the index current index always\n \n new_array = []\n \n while i < numbers.length # We cant do less than or equal to here\n \n new_array << numbers[i] * i # You can shovel directly into a new array\n i += 1\n end\n return new_array\nend", "def element_times_index(numbers)\n \n new_arr = []\n\n i = 0 \n while i < numbers.length\n new_num = numbers[i] * i\n new_arr << new_num\n i += 1\n end\n\n return new_arr\nend", "def create_array(one, two, three)\n\treturn [one, two, three]\nend", "def fill_array rows, cols, num, val\n num = 0 if num < 0\n array = Array.new(rows) { Array.new(cols) { -1 } }\n (0...num).each { |i|\n row = (i / cols).floor\n col = i % cols\n array[row][col] = val\n }\n array\n end", "def two_d_translate(arr)\r\n newArray = []\r\n arr.each do |ele|\r\n ele[1].times do\r\n newArray << ele[0]\r\n end\r\n end\r\n return newArray\r\nend", "def to_digit_array\n self.to_s.each_char.map(&:to_i)\n end", "def element_times_index(numbers)\n\tmulti = []\n \n\ti = 0\n\twhile i < numbers.length\n\t\titem = numbers[i]*i\n\t\tmulti << item\n\t\ti += 1\n end\n\n\treturn multi\nend", "def digit_array(card_number)\n card_number.to_s.gsub(/ +/, '').reverse.split(//).map{|digit| digit.to_i}\n end", "def make_array(startArrayValue, endArrayValue)\n\tresultArray = []\n\tfor i in startArrayValue..endArrayValue\n\t\tresultArray.push(i)\n\tend\n\treturn resultArray\nend", "def *(second)\n ret = []\n case second\n when Integer\n second.times { |i| ret += dup }\n when String\n return join(second)\n when Array\n each { |x| second.each { |y| ret << [x,y].flatten } }\n else\n raise TypeError.new(\"can't convert #{second.class} into Integer\")\n end\n return ret\n end", "def element_times_index(numbers)\n new_nums = []\n \n i = 0\n while i < numbers.length\n new_nums << numbers[i] * i\n \n i += 1\n end\n \n return new_nums\n end", "def ary(n); Array.new(n){rand}; end", "def initialize_board(input)\n board = Array.new(9) {Array.new(9) {Array.new(10, 0)}}; \n for y in (0...9)\n for x in (0...9)\n board[y][x][0] = Integer(input[y*9+x]) \n for p in (1...10)\n if board[y][x][0] == 0\n board[y][x][p] = p\n else\n board[y][x][p] = 0\n end\n end\n end\n end\n return board\n end", "def array_times_two(array)\n new_array = array.map{ |el| el * 2}\n end", "def array_with_two_elements\n @my_two_array = Array.new(2)\nend", "def mtdarray\n\t10.times do |num|\n\t\tsquare = num * num\n\t\treturn num, square if num > 4\n\tend\nend", "def array_translate(array)\n new_arr = []\n \n array.each_with_index do |subArray, idx|\n if idx % 2 == 1\n subArray = ele\n else\n subArray = num\n \n #num.times { new_arr << ele }\n end\n end\n\n #return new_arr\nend", "def sequence(int, int1)\n arr = []\n int.times {|i| arr << int1 + (int1 * i) }\n arr\nend", "def beer(arr, x, y)\n\tbuild = Array.new\n\tarr << x << y \nend", "def even_nums(max)\n\tnew_arry = []\n \tcount = 0\n while count <= max\n new_arry << count\n count += 2\n\n end\n return new_arry\nend", "def create_odd_array\n $y = (1..255).reject { |i| i % 2 == 0 }\nend", "def make_ranges(ids)\n \tint_array = ids.collect{|s| s.to_i}\n\n\tint_array = int_array.sort\n\tnew_ids = []\n\tr = []\n\tz = int_array[0].to_i\n\tr[0] = z\n\tint_array.each do |n|\n\t if n > z+1\n\t \tnew_ids << r\n\t \tr = [n]\n\t else\n\t r[1] = n\n\t \tend\n\t \tz = n\n\tend\n\tnew_ids << r\n\tnew_ids\n end", "def to_int_array(input)\n input.chars.to_a.collect { |x| x.to_i }\n end", "def create_array_new(size)\n Array.new(size) { Array.new(size) { '0' } }\nend", "def two_d_translate(arr)\n new_arr = []\n\n arr.each do |subArray|\n ele = subArray[0]\n num = subArray[1]\n\n num.times { new_arr << ele }\n end\n\n return new_arr\nend", "def odd_num\n y = []\n [*1..255].map do |i| \n if i % 2 != 0\n y << i\n end\n end\n y\nend", "def base_10_ary_to_base_2_ary(base10ary)\n base2ary = []\n base10ary.each do |digit|\n base2ary << digit.to_s(2).split(//).map { |x| x.to_i }\n end\n base2ary\n end", "def odd_indexed_integers(array)\n\nend", "def to_array_of(type, base_ptr, num)\n base_ptr = base_ptr.to_ptr\n\n (0...num).map { |i| type.new(base_ptr + i*type.size) }\n end", "def to_ints(hex)\n r = hex[1..2]\n g = hex[3..4]\n b = hex[5..6]\n ints = []\n [r,g, b].each do |s|\n ints ,< s.to_hexend\n end\n ints\nend", "def double_numbers(array)\n\tarray.map { |integer| integer * 2 }\t\nend", "def beer(arr, x, y)\n build = Array.new \n arr << x << y \nend", "def initialize\n @array = []\n x,y = 0,0\n while x < 8\n while y < 8\n @array << [x,y]\n y += 1\n end\n x += 1\n y = 0\n end\n @array\n end", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend", "def array_init(width)\r\n height = 2 ** width # ** used for exponential\r\n array = Array.new(height){Array.new(width + 4)} # plus 4 to account for table values\r\n array.each{|x| x.fill(0)} # initialize all values to 0\r\nend", "def magic_array(ma)\nma.flatten.sort.map{|n|n*2}.uniq.delete_if{|n|n%3==0}\nend", "def element_times_index(numbers)\n new_arry = []\n i = 0\n while i < numbers.length\n new_arry << numbers[i] * i\n i += 1\n end\n return new_arry\n\nend", "def generate_numbers\n\t[rand(1..20), rand(1..20)]\nend", "def mtdarray\n\t10.times do |num|\n\t\tsquare = num + num\n\t\treturn num, square if num > 5\n\tend\nend", "def double_arr(nums)\n numb_arr = [] # create empty arr\n i = 0 # the indice counter start @ 0\n\n while i < nums.length # for the length of indices in array \n new_num = nums[i] * 2 # variable new_num = looped var i * 2\n numb_arr << new_num # shovel the value of new_num into empty arr\n i += 1 # iterate into next indice of passed array\n end\n return numb_arr # the new array\n puts numb_arr # display the result of the new array\nend", "def generate_numbers\n (0...ARRAY_LENGTH).each do |i|\n y = ((1 << 31) & @mt[i]) + ((2**31 -1) & (@mt[(i+1)%ARRAY_LENGTH] % ARRAY_LENGTH))\n @mt[i] = @mt[(i + 397) % ARRAY_LENGTH] ^ (y >> 1)\n if (y % 2) != 0\n @mt[i] = @mt[i] ^ GENERATE_CONST\n end\n end\n end", "def array\n \t(1..size).map{ |i| \"#{fill}\" }\n end", "def repa(array, x)\n result = []\n (1..x).each do\n result.concat(array)\n end\n return result\nend", "def get_array_values(init,type)\n if type == \"fecha\"\n final = Time.new.year\n unidad = \"\"\n elsif type == \"rango\"\n final = 5000\n unidad = \"m2\"\n elsif type == \"aforo\"\n final = 500\n unidad = \"\"\n end\n array_ = []\n\n #((final.to_i).downto(Integer(init))).each do |n|\n (Integer(init)..(final.to_i)).each do |n|\n array_ << \"#{n}#{unidad}\"\n end\n return array_\n end", "def array_converter *arrays\n arrays.flatten.map(&:to_i)\nend", "def make_board\n board = Array.new(8) { Array.new(8) { Array.new(2) } }\n board.each_with_index do |row, row_i|\n row.each_with_index { |column, column_i| column[0], column[1] = row_i, column_i }\n end\n end", "def makeArrayConsecutive2(statues)\n max_value = statues.max\n min_value = statues.min\n result_array = []\n\n if min_value == max_value\n 0\n else\n for i in range(min_value, max_value)\n result_array.append(i)\n end\n end\n result_array.size - statues.size\nend", "def merge_arrays (first, second)\n\nlarge_array = []\n\n 11.times do |i|\n smaller_array = []\n smaller_array << first[i]\n smaller_array << second[i]\n large_array << smaller_array\n end\n return large_array\n\nend", "def nest_array(board)\n nested_board = []\n 9.times { nested_board << board.slice!(0..8)}\n return nested_board\nend", "def generate_array\n\t\t@array_of_integers = []\n\t\ti = 0 \n\t\twhile i < 10\n\t\t \tnum = rand(9) \n\t\t \t@array_of_integers.push(num)\n\t\t \ti = i + 1\n\t\tend\n\t\tputs @array_of_integers\n\tend", "def make_integer_array(number_in_words)\n number_in_words = eliminate_and(number_in_words.strip.squeeze(' ')).split(' ')\n numbers_array = []\n number_in_words.each do |number|\n numbers_array << if power_of_ten? number\n 10**POWER_OF_TEN[number]\n else\n EXCEPTIONS[number]\n end\n end\n numbers_array\n end", "def even_numbers_less_than num\n even_numbers_array = []\n i=0\nwhile i<num do\n even_numbers_array.push(i)\n i+=2\nend\n return even_numbers_array\nend", "def double_numbers(input_array)\n doubled_array =[]\n input_array.each {|num| doubled_array << num*2} \n doubled_array\nend", "def num_array(num)\n arr = Array.new\n \n until num <= 0\n arr.push(num % 10)\n num = num / 10\n end\n\n until arr.length == 4\n arr.push(0)\n end\n arr\nend", "def two_d_translate(arr)\n result = []\n\tarr.each do |subArray|\n subArray[1].times do \n result.push(subArray[0])\n end\n end\n return result\nend", "def even_nums(max) # max is some int\n new_arr = [] # initialize new array\n i = 0 # indice counter @ 0\n\n while i <= max # while i is less than or equal to the given int\n if i % 2 == 0 # if i is not divisible by 0\n new_arr << i # add the number into the new array\n end\n\n i += 1\n end\n return new_arr\nend", "def amplify(num)\n\tarr = []\n\t(1..num).each do |n|\n \tn % 4 == 0 ? arr << n * 10 : arr << n\n\tend\n\treturn arr\nend", "def array_with_two_elements\n @my_two_array=array_with_two_elements \nend", "def even_nums(max)\n newArr = []\n i = 0\n while i <= max\n if i % 2 == 0\n newArr << i\n end\n i+=1\n end\n return newArr\n end", "def getArray(n=3)\n return (1..n).to_a\nend", "def return_array(array1, array2)\nfor num in array2\n if num%2 == 0\n array1.push(num)\n end\nend\nreturn array1\nend", "def array_times_two!(array)\n array.map!{ |el| el *2}\n end", "def sequence(num)\n Array.new(num) { |i| i+1 }\nend", "def grid(n, m)\n Array.new(n) { Array.new(n) } # If you attempted to write this as Array.new(n, Array.new(m)) the contents would be repeated for each array rather\nend", "def slices(n)\n digits.each_cons(n).to_a\n end", "def repeated_number_ranges(numbers)\n result = []\n initializer = nil\n i = 0\n while i < numbers.length\n if numbers[i] == numbers[i + 1]\n initializer = i if initializer.nil?\n elsif !initializer.nil?\n result << [initializer, i]\n initializer = nil\n end\n i += 1\n end\n result\nend", "def element_times_index(numbers)\n i = 0\n count = 0\n while i < numbers.length\n numbers[i] = numbers[i] * count\n count += 1\n i += 1\n end\n return numbers\nend", "def int_to_chess(number_list)\n # if its just one element return an array inside an array\n chess_notation = []\n number_list.each do |square|\n square_notation = []\n letter = num_to_letter(square[0])\n number = square[1]\n square_notation.push(letter, number)\n chess_notation.push(square_notation)\n end\n # todo: flatten if theres only one element inside!\n chess_notation\nend", "def generate_tic_tac_array \n game_array = Array.new\n 3.times{game_array.push([nil,nil,nil])}\n game_array\nend", "def array\n\t\t#create an array of\n\t\tarray = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n\tend", "def even_numbers_less_than num\n # i = 0\n # even_numbers = []\n # while i < num\n # even_numbers.push i\n # i += 2\n # end\n # return even_numbers\n\n array = []\n (0...num).each do |i|\n if i%2 == 0\n array.push i\n end\n end\n return array\nend", "def my_array_splitting_method(source)\nnew_arr = Array.new(2)\n new_arr[0] = source.select {|item| item.is_a?(Integer) }\n new_arr[1] = source.reject {|item| item.is_a?(Integer)}\n return new_arr\nend", "def odd_integers(array)\nend", "def array_times_two(array)\nend", "def double_to_single_method\n #single_digit_array = []\n @multiplied_integer_array.each do |value|\n if value > 9\n value = value - 9\n @single_digit_array << value\n else\n value = value\n @single_digit_array << value\n end\n end\n return @single_digit_array\n end", "def secret_numbers\n\t\t(1..5).to_a \n\tend", "def odd_array(numbers)\n odd_value = []\n \n numbers.each_with_index do |value, idx|\n odd_value << value if idx.even?\n end\n odd_value\nend", "def my_array_splitting_method(source)\n \n ints = []\n other = []\n out = []\n \n source.each {|idx| if idx.is_a?(Integer) then ints.push(idx) else other.push(idx) end}\n out.push(ints, other)\n \n p out\nend", "def get_row_cells row\n\t\treturn (row * 9...row * 9 + 9).to_a\n\tend", "def pairs_for_run(run)\r\n\t\ttemp = Array.new\r\n\t\t0.upto(run.size-2) do |index1|\r\n\t\t\t(index1+1).upto(run.size-1) do |index2|\r\n\t\t\t\ttemp << ([] << run[index1] << run[index2])\r\n\t\t\tend\r\n\t\tend\r\n\t\ttemp\r\n\tend", "def coerce(other)\n return [other, self.to_i]\n end", "def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one ]\n end", "def split_in_two(number, length)\n [number.slice(0, length), number.slice(length, 10 - length)]\n end", "def grid(n, m)\n arr = Array.new(n) { Array.new(m, :N) }\n arr\nend", "def digit_list(input)\n\n new_arr = input.to_s.chars\n \n new_arr.map {|element| element = element.to_i }\nend" ]
[ "0.6767372", "0.61888653", "0.6142381", "0.61267924", "0.6008856", "0.5995122", "0.5972692", "0.5951399", "0.5947525", "0.58859634", "0.58641994", "0.5814177", "0.58049464", "0.57993966", "0.57968676", "0.57758325", "0.5775428", "0.576886", "0.5762753", "0.57480526", "0.5747031", "0.5744715", "0.57436275", "0.5743555", "0.57025313", "0.57001597", "0.5697127", "0.56954205", "0.5691581", "0.56907254", "0.56907177", "0.5670907", "0.5669431", "0.5668027", "0.5667282", "0.5644828", "0.56433356", "0.56425023", "0.5637988", "0.5629233", "0.56286263", "0.56214374", "0.5618402", "0.56157464", "0.56108725", "0.5603571", "0.56007063", "0.55950826", "0.558806", "0.55768824", "0.5565076", "0.55552274", "0.5546327", "0.5544031", "0.55395144", "0.5531334", "0.5528785", "0.55278736", "0.55278313", "0.55258864", "0.5517219", "0.5514953", "0.5513451", "0.55132234", "0.55032337", "0.54950345", "0.5494052", "0.5482702", "0.5479982", "0.54769593", "0.54718244", "0.54682654", "0.54659384", "0.54651636", "0.5464842", "0.546129", "0.5453357", "0.5448121", "0.5447644", "0.5439032", "0.5437038", "0.5436704", "0.54338956", "0.5433259", "0.543022", "0.5427213", "0.54239994", "0.5421824", "0.54205525", "0.5416323", "0.5415972", "0.5414105", "0.5413767", "0.5406929", "0.54067326", "0.54040325", "0.54010415", "0.53970593", "0.5388831", "0.53884673", "0.53884417" ]
0.0
-1
Very often the .to server returns a partial response, which is a response containing an empty line. It seems to be a very poorlydesigned throttle mechanism.
def response_incomplete? content_for_scanner.strip == "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def throttled_response; end", "def throttled_responder; end", "def throttled_responder=(_arg0); end", "def throttled_response_retry_after_header; end", "def make_response_wrapper(tweet)\n response = model.make_response(meta(tweet).mentionless, meta(tweet).limit)\n retries ||= 0\n while response.end_with? \"...\" and retries < 5\n log \"Not tweeting #{response}\"\n response = model.make_response(meta(tweet).mentionless, meta(tweet).limit)\n retries += 1 \n end\n return response\n end", "def __try_partial_retry(request, response)\n response = response.response if response.is_a?(ErrorResponse)\n\n return unless response\n\n unless response.headers.key?(\"accept-ranges\") &&\n response.headers[\"accept-ranges\"] == \"bytes\" && # there's nothing else supported though...\n (original_body = response.body)\n response.close if response.respond_to?(:close)\n return\n end\n\n request.partial_response = response\n\n size = original_body.bytesize\n\n request.headers[\"range\"] = \"bytes=#{size}-\"\n end", "def noop\n write_noop\n multi_response\n end", "def throttled_response_retry_after_header=(_arg0); end", "def stream\n 10_000_000.times do |i|\n response.stream.write \"This is line#{i}\\n\"\n end\n ensure\n response.stream.close\n end", "def throttle; end", "def buffered_messages; end", "def chunked?; end", "def raw_response; end", "def ignore_bad_chunking; end", "def ignore_bad_chunking; end", "def handle_response(response)\n loop do\n begin\n bytes = @client.write_nonblock(response)\n msg_response\n break if bytes >= response.size\n response.slice!(0, bytes)\n rescue Errno::EAGAIN\n IO.select(nil,[@client], nil)\n retry # spam untill send all\n end\n end\n end", "def fix_length response\r\n size = 0\r\n response.body.each {|str| size += str.scan(/\\n/).size}\r\n size += response.headers['Content-Length'].to_i\r\n response.headers['Content-Length'] = size.to_s\r\n return response\r\n end", "def noop\n write_noop\n response_processor.consume_all_responses_until_mn\n end", "def body\n last_response.body\nend", "def send_pending; end", "def pending_response_requests; end", "def finalize_response(resp)\n resp.tap do |r|\n r.response[:limit] = r.response.items.size - 1\n r.response[:moreItems] = false\n end\n end", "def fixup_head_response( response )\n\t\tself.log.debug \"Truncating entity body of HEAD response.\"\n\t\tresponse.headers.content_length = response.get_content_length\n\t\tresponse.body = ''\n\tend", "def trimbuffer\n if @buflines.length > 200\n @buflines = @buflines[(@buflines.length - 200) .. @buflines.length]\n end\n if @buffer.length > 200\n @buffer = @buffer[(@buffer.length - 200) .. @buffer.length]\n end\n end", "def after_limit\n response = yield\n update!(response)\n sleep(wait_time)\n response\n end", "def perform\n unless (response = session.last_response)\n raise HTTY::NoResponseError\n end\n unless (body = response.body).to_s.empty?\n puts body\n end\n self\n end", "def eol_old # :nologin: :norobots:\n headers[\"Content-Type\"] = \"application/xml\"\n @max_secs = params[:max_secs] ? params[:max_secs].to_i : nil\n @timer_start = Time.now()\n eol_data(['unvetted', 'vetted'])\n render(:action => \"eol\", :layout => false)\n end", "def readpartial(size = BUFFER_SIZE)\n return unless @pending_response\n\n chunk = @parser.read(size)\n return chunk if chunk\n\n finished = (read_more(size) == :eof) || @parser.finished?\n chunk = @parser.read(size)\n finish_response if finished\n\n chunk || \"\".b\n end", "def fixup_response( response )\n\t\tif RubyProf.running?\n\t\t\tprofile = RubyProf.stop\n\n\t\t\tresponse.body.truncate( 0 )\n\t\t\tprinter = RubyProf::CallStackPrinter.new( profile )\n\t\t\tprinter.print( response.body, min_percent: 2 )\n\t\t\tresponse.content_type = 'text/html'\n\t\tend\n\n\t\tsuper\n\tend", "def throttle\n sleep @throttle if @@last_request + @throttle > Time.now\n @@last_request = Time.now\n end", "def response_body; end", "def response_body; end", "def ensure_one_pending_request\n return if is_disconnected?\n\n if @lock.synchronize { @pending_requests } < 1\n send_data('')\n end\n end", "def send_request_with_lazy_pirate\n attempt = 0\n\n begin\n attempt += 1\n send_request_with_timeout(attempt)\n parse_response\n rescue RequestTimeout\n retry if attempt < CLIENT_RETRIES\n failure(:RPC_FAILED, \"The server repeatedly failed to respond within #{timeout} seconds\")\n end\n end", "def send_response(msg, no_linebreak = false)\n msg += LBRK unless no_linebreak\n send_data msg\n end", "def get_message_body(url)\n response = RestClient::Request.execute method: :get,\n url: url,\n user: USERNAME,\n password: PASSWORD,\n :content_type => :json,\n :accept => :json\n\n if response.headers[:x_ratelimit_remaining].to_i < 3\n reset_time = Time.at(response.headers[:x_ratelimit_reset].to_i)\n delay = (reset_time - Time.now) + 5\n puts 'SLEEPING FOR: '+ delay.to_s\n sleep delay\n end\n\n JSON(response)['text']\n end", "def finish\n @length = @body.length if @body.is_a?(DelayedBody) && !@headers[RodaResponseHeaders::CONTENT_LENGTH]\n super\n end", "def stream_result(out, work)\n buffer = Rubinjam::HEADER.dup\n loop do\n break if buffer.empty?\n 20.times do # check often -> don't hang for long\n if !work.alive?\n out.print buffer # we are done, write the remaining buffer\n out.print work.value.sub(Rubinjam::HEADER, '')\n return\n end\n sleep 1\n end\n out.print buffer.slice!(0, 1)\n out.flush\n end\n\n # we already sent the '200 OK' ... tell the user something useful ...\n out.print \"\\nraise 'code generation took too long'\"\nend", "def work()\n # FIXME : .rel[...].get doesn't update $client.rate_limit...\n\n rate_limit = $client.rate_limit\n dbgp \"#{rate_limit.remaining} API calls left.\"\n\n # A little buffer in case we use a feature from octokit\n # which doesn't update rate_limit on `$client`.\n if rate_limit.remaining < 5 then\n reset = rate_limit.resets_in + 10\n puts \"💤 zleepy timez (back in #{reset} seconds)\"\n sleep(reset)\n end\n\n begin\n yield\n rescue Octokit::BadGateway, Octokit::InternalServerError => e\n puts \"Uuuh... github is having a bad time :( #{e.response_status}\"\n pp \"=====\"\n pp \"=====\"\n pp e.response_body\n pp \"=====\"\n pp e.response_headers\n pp \"=====\"\n pp \"=====\"\n sleep 10\n retry\n end\nend", "def rewrite_response(triplet)\n _, headers, _ = triplet\n headers.delete('Transfer-Encoding') if chunked? headers\n headers.delete('Transfer-Encoding')\n triplet\n end", "def render_to_string(*)\n if self.response_body = super\n string = \"\"\n self.response_body.each { |r| string << r }\n string\n end\n ensure\n self.response_body = nil\n end", "def render_nothing(status=200)\n @_status = status\n return \" \"\n end", "def send_response\n\t\t\tsend_headers\n\t\t\tsend_body\n\t\t\tsend_trailer\n\t\t\tclose_connection_after_writing unless (@keep_connection_open and (@status || 200) < 500)\n\t\tend", "def generic_Generate_Response(initial,headers,body)\n\ts=initial\n\ts << \"\\r\\n\" << headers # headers start in second line\n\tif body.length>0\n\t\ts << \"\\r\\n\" << body # body start after a blank line, first \\r\\n is for change line from headers, second is for blank line\n\tend\n\treturn s\nend", "def no_content\n halt 204, \"\"\n end", "def slow_headers_get(host, rate_limit, keep_alive)\r\n\trequest = \"GET / HTTP/1.1\\r\\n\"\r\n request += \"Host: #{$host}\\r\\n\"\r\n request += \"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0\\r\\n\"\r\n request += \"Keep-Alive: #{keep_alive}\\r\\n\"\r\n request += \"Content-Length: \" + (1 + rand(10000..1000000)).to_s + \"\\r\\n\"\r\n request += \"Accept: *.*\\r\\n\"\r\n request += \"X-a: \" + (1 + rand(1..10000)).to_s + \"\\r\\n\"\r\n\tTCPSocket.open(host, 80) do |socket|\r\n\t\tsocket.write request\r\n\t\tloop {\r\n\t\t\tbegin \t\t\t\r\n\t\t\t\t# Writing one character to socket\r\n\t\t\t\tsocket.write \"X-c: \" + (1 + rand(1..10000)).to_s + \"\\r\\n\"\t\r\n\t\t\t\t# Printing request indicator to console\t\t\t\r\n\t\t\t\tprint '.'\r\n\t\t\t\t# Suspending this thread for 1 second to rate limit data sent to target\r\n\t\t\t\tsleep rate_limit\r\n\t\t\trescue\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t}\t\r\n\tend\t\r\nend", "def process_message(headers, payload)\n return if throttled?\n return unless filtered?(payload)\n\n @throttle += 1\n display_message(payload)\n end", "def partial_status\n authorize_muni_admin!(:read, @network)\n\n # TODO: Find out why I need to reload network?\n # Perhaps its because another process is updating netowrk?\n # If that is the case, though, then we've got reload problems\n # everywhere if multiple processes are running parallel each app instance.\n @network.reload\n\n @last_log = params[:log].to_i\n @last_err = params[:err].to_i\n @limit = (params[:limit] || 10000000).to_i # makes take(@limit) work if no limit.\n\n @errors = @network.processing_errors.drop(@last_err).take(@limit) if @last_err\n @logs = @network.processing_log.drop(@last_log).take(@limit) if @last_log\n\n resp = { :errors => @errors, :logs => @logs, :last_log => @last_log, :last_err => @last_err }\n\n resp[:route_codes] = render_to_string(:partial => \"route_codes\")\n resp[:services_count] = @network.services.count\n resp[:routes_count] = @network.routes.count\n resp[:vj_count] = @network.vehicle_journey_count\n\n if (@network.processing_completed_at)\n resp[:completed_at] = @network.processing_completed_at.strftime(\"%m-%d-%Y %H:%M %Z\")\n else\n if @network.processing_lock.nil? || @network.processing_job.nil?\n resp[:completed_at] = \"Aborted\"\n end\n end\n\n if (@network.processing_started_at)\n resp[:started_at] = @network.processing_started_at.strftime(\"%m-%d-%Y %H:%M %Z\")\n end\n if (@network.processing_completed_at) && (@network.file_path)\n resp[:process_file] = render_to_string(:partial => \"file_download_link\")\n end\n if (@network.processing_progress)\n resp[:progress] = @network.processing_progress\n end\n\n respond_to do |format|\n format.json { render :json => resp.to_json }\n end\n end", "def response_body=(_arg0); end", "def response\n buffer_available_data\n @buffer[@cursor..-1]\n end", "def allow_double_render\n self.instance_variable_set(:@_response_body, nil)\n end", "def upstream_response\n http = EM::HttpRequest.new(url).get\n logger.debug \"Received #{http.response_header.status} from NextBus\"\n http.response\n end", "def head!\n request! :head\n end", "def flush_buffer\n if @timer\n @timer.cancel\n @timer = nil\n end\n unless @buffer.empty?\n internal_send_request('append_output', :text => @buffer)\n @buffer = ''\n end\n end", "def no_content(socket)\n socket.print http_header(204, \"No Content\")\n socket.print EMPTY_LINE\n end", "def pre_process\n Goliath::Connection::AsyncResponse\n end", "def drain\n # while resp = self.read(0.05)\n\n while resp = self.read(0.005) # not sure how low I can go here, this really speeds things up.\n end\n end", "def ignore_bad_chunking=(_arg0); end", "def process_response(public_request_id) \n\n # if data was received then \n unless @active_requests[public_request_id][:arduino_responses].empty? \n public_responses = []\n http_header = \"HTTP/1.1 200 OK\\r\\nContent-Type: application/json\\r\\n\\r\\n\"\n public_response = \"#{http_header}[\\r\\n\"\n\n # create a hash key with device/response pairs\n @active_requests[public_request_id][:arduino_responses].each do | device, response |\n response.match /.*?([\\[\\{].*[\\}\\]]+)/m\n public_responses << \"{\\r\\n#{device}:#{$1}\\r\\n}\"\n end\n\n # convert device/response pairs from hash into a json formatted string\n public_responses.each_with_index do | response, index |\n public_response += response\n if index == public_responses.length - 1 \n public_response += \"\\r\\n]\" \n else \n public_response += \",\\r\\n\" \n end \n end\n\n # respond back to public request with data in json format\n puts \"[Controller:process_response] public response #{public_response}\"\n @active_requests[public_request_id][:public_response] = public_response\n @public_server.respond @active_requests[public_request_id][:public_response], public_request_id\n\n else\n http_header = \"HTTP/1.1 404 Not Found\\r\\nContent-Type: application/json\\r\\n\\r\\n\"\n public_response = \"#{http_header}Resources Not Found\"\n @public_server.respond public_response, public_request_id\n\n end\n \n @active_requests.delete(public_request_id) unless @active_requests[public_request_id][:arduino_responses].empty? \n \n end", "def throttle\n 5\n end", "def force_http10_response_state\n super\n end", "def stuff_999_response(env, err)\n env.tap do\n _1.reason_phrase = \"#{err.class} #{err.message}\"\n _1.response_body = ''\n _1.response_headers = Faraday::Utils::Headers.new\n _1.status = HTTPDisk::ERROR_STATUS\n end\n Faraday::Response.new(env)\n end", "def test_very_long_request\n header_length = 10000\n \n result = Net::HTTP.start @@HOST, @@PORT do | http |\n request = Net::HTTP::Get.new '/index.html'\n request[ 'request_header' ] = ( 1..header_length ).collect { 'a' }.reduce(:+)\n \n begin \n http.request request\n rescue\n end \n end \n end", "def throttle\n elapsed = Time.now - self.last_call\n if elapsed < 0.4\n puts 'throttling...'\n sleep(0.04 - elapsed)\n end\n self.last_call = Time.now\n end", "def handle_request\n request = \"\"\n loop do\n begin\n request << @client.readpartial(1024*2)\n msg_request\n break if request.end_with?(\"\\r\\n\\r\\n\")\n rescue Errno::EAGAIN\n # buffer not empty, wait availability\n IO.select([@client], nil, nil)\n retry\n rescue EOFError\n break # all data read\n end\n end\n request\n end", "def partial_request(uri, range)\nbegin\nresponse = open(uri, 'Range' => range)\nrescue OpenURI::HTTPError => e\nresponse = e.io\nend\n\nputs \"Status code: #{response.status.inspect}\"\nputs \"Representation size: #{Response.size}\"\nputs \" Content Range: #{response.meta['content-range']}\"\nputs \" Etag: #{response.meta['etag']}\"\nend", "def eol # :nologin: :norobots:\n headers[\"Content-Type\"] = \"application/xml\"\n @max_secs = params[:max_secs] ? params[:max_secs].to_i : nil\n @timer_start = Time.now()\n @data = EolData.new()\n render(:action => \"eol\", :layout => false)\n end", "def body_write_callback\n @body_write_callback ||= proc do |stream, size, num, object|\n headers\n result = body(chunk = stream.read_string(size * num))\n @response_body << chunk if result == :unyielded\n result != :abort ? size * num : -1\n end\n end", "def response\n parse_request\n do_something\n put_response\n end", "def respond_with(status_code)\n response.status = status_code\n response.write \"\"\n nil\n end", "def sp_request(n=1, *_)\n line_count = convert_integer(n, \"space count\")\n force_break\n line_count.times do \n break if @page_line_count == 0\n put_line_paginated ''\n end\n end", "def parse_body(line)\n return :break if @length&.zero?\n\n if @transfer_encoding == \"chunked\"\n parse_body_chunked(line)\n else\n puts \"Http2: Adding #{line.to_s.bytesize} to the body.\" if @debug\n @response.body << line\n @http2.on_content_call(@args, line)\n return :break if @response.content_length && @response.body.length >= @response.content_length # rubocop:disable Style/RedundantReturn\n end\n end", "def test_monkey_slash_recent_endpoint\n # See Email: monkey/recent constantly timing out\n skip_message = 'Dickson & Jorge are looking into monkey/recent timing out in the db: This sql took 38 seconds to run in stg and only .005 second in production.'\n assign_http(Config['monkey']['host'])\n\n get '/recent', {}\n skip(\"#{skip_message} -- #{@parsed_response['message']}\") if @parsed_response['message'] =~ /Gateway\\:\\:GatewayTimeout/\n assert_response(@response, :success)\n end", "def putlongresp(content)\n content.each_line do |line|\n putline line.sub(/^\\./, '..')\n end\n putline '.'\n end", "def http_head(request, response)\n # This is implemented by changing the HEAD request to a GET request,\n # and dropping the response body.\n sub_request = request.clone\n sub_request.method = 'GET'\n\n begin\n @server.invoke_method(sub_request, response, false)\n response.body = ''\n rescue Exception::NotImplemented => e\n # Some clients may do HEAD requests on collections, however, GET\n # requests and HEAD requests _may_ not be defined on a collection,\n # which would trigger a 501.\n # This breaks some clients though, so we're transforming these\n # 501s into 200s.\n response.status = 200\n response.body = ''\n response.update_header('Content-Type', 'text/plain')\n response.update_header('X-Sabre-Real-Status', e.http_code)\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def parse_response!; end", "def send_http_and_sysread(req)\n send_http(req).sysread 2_048\n end", "def now_serving(line)\n if line.length >= 1 \n puts \"Currently serving #{line.first}.\"\n line.shift\n else\n puts \"There is nobody waiting to be served!\"\nend\nend", "def response_body\n nil\n end", "def response\n payload\n rescue Net::OpenTimeout => e\n Rails.logger.debug(e)\n end", "def respond_on s\n headers = { STATUS_KEY => @status.to_s }.merge @headers\n s.headers stringify_headers(headers)\n if String === @body\n s.data @body\n else\n stream.log :error, \"unexpected @body: #{caller[0]}\"\n end\n rescue ::HTTP2::Error::StreamClosed\n stream.log :warn, \"stream closed early by client\"\n end", "def respond_with(status_code)\n response.status = status_code\n response.write ''\n nil\n end", "def ignore_bad_chunking\n @agent.ignore_bad_chunking\n end", "def send!\n return if @buffer.empty?\n recursive_send(@buffer)\n @buffer.clear\n end", "def index\n @messages = Message.where(\" messages.room_id = ? and messages.to is NULL\", params[:room_id])\n totalMessages = (@messages.size>10) ? 9 : @messages.size\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages.reverse[0..totalMessages].reverse }\n end\n end", "def five_hundred(_error)\n json_response({ message: Message.something_went_wrong }, :internal_server_error)\n end", "def stream_one_chunk\n loop do\n if @io.eof?\n @connection.send_data \"0\\r\\n\\r\\n\" if @http_chunks\n succeed\n break\n end\n\n if @connection.respond_to?(:get_outbound_data_size) && (@connection.get_outbound_data_size > FileStreamer::BackpressureLevel)\n EventMachine::next_tick { stream_one_chunk }\n break\n end\n\n if @io.read(CHUNK_SIZE, @buff)\n @connection.send_data(\"#{@buff.length.to_s(16)}\\r\\n\") if @http_chunks\n @connection.send_data(@buff)\n @connection.send_data(\"\\r\\n\") if @http_chunks\n end\n end\n end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def write_timeout; end" ]
[ "0.66611904", "0.6575084", "0.6134941", "0.60901916", "0.5844265", "0.5816639", "0.56759536", "0.5622337", "0.5590571", "0.55352026", "0.54892385", "0.5463631", "0.5436551", "0.5425716", "0.5425716", "0.53885895", "0.536749", "0.53576344", "0.5345211", "0.5335408", "0.53249496", "0.5323357", "0.53044283", "0.5284073", "0.52773434", "0.52732795", "0.52702683", "0.52687514", "0.5233193", "0.5225433", "0.51862705", "0.51862705", "0.5168338", "0.5154934", "0.5154088", "0.51409566", "0.51390827", "0.51368403", "0.51357555", "0.5130809", "0.51239103", "0.51059246", "0.5085243", "0.50713515", "0.50707495", "0.50363237", "0.50324196", "0.5030331", "0.5025026", "0.5022174", "0.50190735", "0.5016966", "0.50022405", "0.5000802", "0.49985713", "0.4996238", "0.49960664", "0.49953154", "0.4994655", "0.49853498", "0.49784946", "0.49768493", "0.4969689", "0.49680126", "0.49625045", "0.49597716", "0.49586448", "0.49574634", "0.49534032", "0.49390042", "0.49384055", "0.49310985", "0.49238408", "0.49229357", "0.4919981", "0.4913092", "0.49091512", "0.4903722", "0.4899054", "0.48971295", "0.48958302", "0.48789954", "0.48785412", "0.48749676", "0.4872742", "0.48718378", "0.48713616", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48681885", "0.48646447" ]
0.0
-1
def set_user_info(user_info) self.city = user_info["city"] if self.city.blank? self.state = user_info["regionName"] if self.state.blank? self.pin_code = user_info["zip"] if self.pin_code.blank? self.save end
def seller? self.has_role? :seller end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info_params\n params.require(:user_info).permit(:user_id, :name, :tel, :address,:province,:city,:county,:is_default)\n end", "def set_user_info\n @user_info = UserInfo.find_by_user_id(session[:user_id])\n if (@user_info == nil)\n @user_info = UserInfo.new(:user_id =>session[:user_id]).save\n end\n end", "def create\n @user_info = UserInfo.new(user_info_params)\n @user_infos = UserInfo.all\n if @user_info.is_default == true\n @user_infos.each do |userinfo|\n userinfo.is_default = false\n userinfo.save\n end\n @user_info.is_default = true\n end\n @user_info.user = current_user\n @user_info.save\n end", "def userinfo=(userinfo)\n if userinfo.nil?\n return nil\n end\n check_userinfo(*userinfo)\n set_userinfo(*userinfo)\n # returns userinfo\n end", "def set_user_info\n @user_info = UserInfo.find(params[:id])\n end", "def set_attributes(email,password,first_name,last_name)#called by sign_in api in apis controller\n self.email = email\n self.password = password\n self.first_name = first_name\n self.last_name = last_name\n self.save\n end", "def update\n super\n\n @user = current_user\n @user.latitude = params[:user][:latitude]\n @user.longitude = params[:user][:longitude]\n @user.save\n end", "def add_user_personal_info(email, first_name, last_name, phone=nil)\n user_email.set email\n user_first_name.set first_name\n user_last_name.set last_name\n user_phone.set phone if phone\n end", "def set_user_city\n @user_city = UserCity.find(params[:id])\n end", "def create\n @user_detail = UserDetail.new(params[:user_detail])\n @valid_user = User.find(:first, :conditions => [\"username = ? \", session[:user_id]])\n @user_detail.user_id = @valid_user.id\n @valid_user.user_detail = @user_detail\n @valid_user.save\n @state_first = GeoinfoState.find(:first, :order => 'name asc')\n if params[:user_detail][:state_id]\n @state_first = GeoinfoState.find(params[:user_detail][:state_id])\n end\n @cities_first = GeoinfoCity.where(:state_id => @state_first ? @state_first.id : '0').find :all, :order => \"name asc\"\n @selected_city = nil\n if params[:user_detail][:city_id] \n @selected_city = GeoinfoCity.where(:id => params[:user_detail][:city_id]).first\n\n end\n respond_to do |format|\n if @user_detail.save\n if params[:logo] then\n @user_detail.savelogo(params[:logo])\n end\n format.html { redirect_to(@user_detail, :notice => 'User detail was successfully created.') }\n format.xml { render :xml => @user_detail, :status => :created, :location => @user_detail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_values\n self.username = self.user.nil??nil:self.user.username\n self.imei = self.device.imei.nil??nil:self.device.imei\n end", "def user_info_params\n params.require(:user_info).permit(:user_id, :hometown, :birthday, :school, :job, :quotes)\n end", "def set_user_attributes(user_hash)\n self.name = user_hash[:name]\n self.email = user_hash[:email]\n self.password = user_hash[:password]\n self.password_confirmation = user_hash[:password_confirmation]\n self.admin = false\n self.confirmed = false\n end", "def set_city\n end", "def create\n super\n location = request.location\n @user.latitude = location.latitude\n @user.longitude = location.longitude\n @user.save\n end", "def update_account_info(info)\n self.name = info['name']\n self.email = info['email']\n self.nickname = info['nickname']\n self.image = info['image']\n self.email = info['email']\n self.website = nil # Override to define\n end", "def update!(**args)\n @user_info = args[:user_info] if args.key?(:user_info)\n end", "def user_location(user)\n geo = user.geolocation\n geo.latitude = 32.7157\n geo.longitude = -117.1611\n geo.fetch_address\n geo.save\n end", "def city_params\n params.permit(:name, :region_id)\n user_data = {\n name: params.fetch(:name, nil).to_s,\n }\n end", "def set_mobile_user_city\n @mobile_user_city = MobileUserCity.find(params[:id])\n end", "def set_defaults\n self.name_first = self.name_first.capitalize\n self.name_last = self.name_last.capitalize\n self.name_mi = self.name_mi.nil? ? \"\" : self.name_mi.capitalize\n self.name_full = self.name_last+\", \"+self.name_first + \" \" + self.name_mi\n self.login = self.login.downcase if !self.login.nil?\n self.email = self.email.downcase if !self.email.nil?\n \n if self.user_type == \"citizen\"\n self.phone_primary = self.phone_primary.gsub(/[^0-9]/,\"\")\n self.phone_secondary = self.phone_secondary.gsub(/[^0-9]/,\"\")\n if self.email.blank?\n self.email = self.login+\"@jobs.aidt.edu\"\n end\n end\n end", "def assign_fields(user)\n self.screen_name = user.screen_name\n self.name = user.name\n description_urls = user.attrs[:entities].try(:fetch, :description).try(:fetch, :urls, nil)\n self.description = description_urls ? expand_urls(user.description, description_urls) : user.description\n self.location = user.location\n self.profile_image_url = user.profile_image_url_https\n url_urls = user.attrs[:entities].try(:fetch, :url, nil).try(:fetch, :urls, nil)\n self.url = url_urls ? expand_urls(user.url, url_urls) : user.url\n self.followers_count = user.followers_count\n self.statuses_count = user.statuses_count\n self.friends_count = user.friends_count\n self.joined_twitter_at = user.created_at\n self.lang = user.lang\n self.time_zone = user.time_zone\n self.verified = user.verified\n self.following = user.following\n self\n end", "def map_user_attributes(omniauth)\n info = omniauth.info\n raw_info = omniauth.extra.raw_info\n\n self.login = info.nickname\n self.name = info.name || ''\n self.email = info.email || ''\n self.avatar_url = info.image || ''\n\n self.company = raw_info.company\n self.location = raw_info.location\n self.followers = raw_info.followers\n self # return self\n end", "def update\n @user = User.find(params[:id])\n @user.password = params[:user][:password] unless params[:user][:password] == nil\n @user.password_confirmation = params[:user][:password_confirmation] unless params[:user][:password_confirmation] == nil\n @user.city = params[:user][:city] unless params[:user][:city] == nil\n @user.dob = params[:user][:dob] unless params[:user][:dob] == nil\n @user.first_name = params[:user][:first_name] unless params[:user][:first_name] == nil\n @user.gender = params[:user][:gender] unless params[:user][:gender] == nil\n @user.last_name = params[:user][:last_name] unless params[:user][:last_name] == nil\n @user.state = params[:user][:state] unless params[:user][:state] == nil\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to '/', :notice => \"#{ @user.first_name } #{ @user.last_name } was successfully updated.\" }\n format.json { head :no_content }\n else\n @button_text = 'Update info'\n @show_tos = false\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_customer_information(params={})\r\n @PARAM_HASH['NAME1'] = params[:first_name]\r\n @PARAM_HASH['NAME2'] = params[:last_name]\r\n @PARAM_HASH['ADDR1'] = params[:address1]\r\n @PARAM_HASH['ADDR2'] = params[:address2]\r\n @PARAM_HASH['CITY'] = params[:city]\r\n @PARAM_HASH['STATE'] = params[:state]\r\n @PARAM_HASH['ZIPCODE'] = params[:zip_code]\r\n @PARAM_HASH['COUNTRY'] = params[:country]\r\n @PARAM_HASH['PHONE'] = params[:phone]\r\n @PARAM_HASH['EMAIL'] = params[:email]\r\n end", "def user_info_params\n \tparams.require(:user_info).permit(:biography, :location, :linkedin, :twitter, :github, :website, :cover_photo, :avatar)\n end", "def apply_omniauth(omniauth)\n info = omniauth[\"info\"]\n\n user_name = %Q(#{info[\"first_name\"]} #{info[\"last_name\"]})\n user_name.gsub!(/\\s+/, \" \").strip!\n\n self.provider = omniauth[\"provider\"]\n self.uid = omniauth[\"uid\"]\n self.name = user_name if self.name.blank?\n self.email = info[\"email\"] if info[\"email\"] && self.email.blank?\n self\n end", "def update_address\n address_zip = ZipCodes.identify(zip_code) || {}\n self.city = address_zip[:city]\n self.state = address_zip[:state_name]\n self.state_code = address_zip[:state_code]\n end", "def update!(**args)\n @region_code = args[:region_code] if args.key?(:region_code)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def address_params\n params.require(:address).permit(:flat_number,:street_name,:landmark, :user_id, :type,:pin_code).merge(city_id: params[:city_id])\n end", "def create\n @user = User.new(user_params)\n\n if @user.kind==\"professional\"\n city = City.find_by_id(@user.city_id)\n city.status=\"ativo\"\n city.save\n end\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to new_user_registration_path, notice: 'Usuario criado, espere a ativação do seu cadastro.' }\n format.json { render :show, status: :created, location: new_user_registration_path }\n else\n format.html { render :new }\n format.json { render json: edit_user_registration_path, status: :unprocessable_entity }\n end\n end\n end", "def set_userinfo\n @userinfo = Userinfo.find(params[:id])\n end", "def copy_user_attributes\n self.user_firstname = user.firstname\n self.user_lastname = user.lastname\n self.user_street1 = user.street1\n self.user_street2 = user.street2\n self.user_postal_code = user.postal_code\n self.user_city = user.city\n end", "def set_defaults!\n self.country = 'United States' if self.country.blank?\n self.is_primary = true if self.is_primary.nil?\n if !self.is_primary && new_record?\n self.reviewed = false\n end\n if state.blank? && ::Geocode::ZipCode.is_valid_usa_zip_code?(zip)\n zips = ::Geocode::ZipCode.search_by_zip_code(zip)\n if zips.present?\n self.state = zips.first.state\n end\n end\n end", "def user_info_params\n params.require(:user_info).permit(:first_name, :last_name, :hometown, :major, :age, :description, :share_email, :avatar)\n end", "def copy_lead_info_to_user(user)\n return unless user && lead_info = session[:lead_info]\n\n user.name ||= lead_info[:name]\n user.gender ||= lead_info[:gender]\n user.date_of_birth ||= lead_info[:date_of_birth]\n user.relationship_status ||= lead_info[:relationship_status]\n # lead_info[:assessment_uuid] ???\n end", "def update_details\n user = User.find_by_id(params[:user_id])\n if user.update_attributes(:username => params[:user_name], :phone => params[:phone],\n :city => params[:city])\n render :json=> {:success=>true, :id=>user.id, :email=>user.email}, :status=>200\n return\n else\n warden.custom_failure!\n render :json=> user.errors, :status=>422\n end\n end", "def set_attrs_from_params\n sanitize_params\n @transaction.updated_by_user = current_user\n @transaction.user = User.yr(@year).where(email: params[:user_email]).first\n end", "def user_details\n\t\t@user_data = Hash.new\n\t\t@user_data[\"first_name\"] = @first_name\n\t\t@user_data[\"username\"] = @username\n\t\t@user_data[\"password\"] = @password\n\t\t@user_data[\"balance\"] = @balance\n\tend", "def city_attributes=(city_attributes)\n city_zip = city_attributes[:zip_code]\n subject_city = City.find_or_create_by(zip_code: city_zip)\n self.city = subject_city\n end", "def update\n \n @user = User.find(params[:id])\n \n bSave = true\n \n if(bSave)\n bSave = @user.update_attribute(:bio,params[:user][:bio])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:location,params[:user][:location])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:first_name,params[:user][:first_name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:last_name,params[:user][:last_name])\n end\n if(bSave)\n bSave = @user.update_attribute(:name,params[:user][:name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:email,params[:user][:email])\n #@user.email = params[:user][:email]\n #bSave = @user.save\n end\n \n #debugger\n respond_to do |format|\n if bSave\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def setCustomerAttributes(customernumber, email, firstname, lastname, salutation, password, shopId, street, city, zipcode, country)\n #if string_country\n customer_properties = {\n :number => customernumber,\n :email => email,\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :password => password,\n :shopId => shopId,\n :billing => {\n :firstname => firstname,\n :lastname => lastname,\n :salutation => salutation,\n :street => street,\n :city => city,\n :zipcode => zipcode,\n :country => country\n }\n }\n createCustomer(customer_properties)\n end", "def set_customer_information(params={})\r\n @PARAM_HASH['NAME1'] = params[:first_name]\r\n @PARAM_HASH['NAME2'] = params[:last_name]\r\n @PARAM_HASH['ADDR1'] = params[:address1]\r\n @PARAM_HASH['ADDR2'] = params[:address2]\r\n @PARAM_HASH['CITY'] = params[:city]\r\n @PARAM_HASH['STATE'] = params[:state]\r\n @PARAM_HASH['ZIPCODE'] = params[:zip_code]\r\n @PARAM_HASH['COUNTRY'] = params[:country]\r\n @PARAM_HASH['PHONE'] = params[:phone]\r\n @PARAM_HASH['EMAIL'] = params[:email]\r\n @PARAM_HASH['COMPANY_NAME'] = params[:company_name] || ''\r\n @PARAM_HASH['STORED_INDICATOR'] = params[:stored_indicator] || ''\r\n @PARAM_HASH['STORED_TYPE'] = params[:stored_type] || ''\r\n @PARAM_HASH['STORED_ID'] = params[:stored_id] || ''\r\n end", "def create\n @user_address = UserAddress.new(user_address_params.merge(city: current_city, user: current_user))\n\n respond_to do |format|\n if @user_address.save\n format.html { redirect_to user_addresses_path, notice: 'User address was successfully created.' }\n else\n format.json { render json: @user_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_params\n params.require(:user).permit(:region_id ,:interestversion_id,:username, :sex, :address, :tel, :content, :capital)\n end", "def update\n params[:user].delete(:password) if params[:user][:password].blank?\n params[:user].delete(:password_confirmation) if params[:user][:password_confirmation].blank?\n params[:user][:walk_in_first_time] = false\n @user = User.find(params[:id])\n city_id = params[:user_city]\n #business_city_id = params[:businessprofile_city]\n if params[:user][:address_attributes]\n params[:user][:address_attributes].delete :city_attributes\n end\n program = Program.find(params[:program_id]) rescue nil\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n\n @user.set_city(city_id) unless city_id.blank?\n # @user.business_profile.set_city(business_city_id) unless business_city_id.blank?\n\n unless @user.has_role?('Admin')\n previous_course = @user.previous_courses.last\n unless previous_course.nil?\n previous_course.program = program unless program.nil?\n previous_course.save\n end\n end\n\n @user.save\n unless current_user.admin?\n sign_in @user, :bypass => true\n end\n format.html { redirect_to @user, notice: I18n.t('successfully_updated', resource: t('profile')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_information_params\n params.require(:user_information)\n .permit(:user_id, :first_name, :last_name, :address, :city,\n :province, :postal_code, :home_phone_number, :work_phone_number,\n :cell_phone_number, :t_shirt_size, :age_group, :emergency_contact_name,\n :emergency_contact_number, :notes, :availability, :unavailability, :code_of_conduct)\n end", "def update_contact_info post\n AddressManager::set_user_address post.user, post\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n @city = args[:city] if args.key?(:city)\n @country = args[:country] if args.key?(:country)\n @email = args[:email] if args.key?(:email)\n @phone = args[:phone] if args.key?(:phone)\n @postal_code = args[:postal_code] if args.key?(:postal_code)\n @state = args[:state] if args.key?(:state)\n @web_url = args[:web_url] if args.key?(:web_url)\n end", "def update!(**args)\n @city = args[:city] if args.key?(:city)\n @country = args[:country] if args.key?(:country)\n @country_code = args[:country_code] if args.key?(:country_code)\n @state = args[:state] if args.key?(:state)\n @sub_location = args[:sub_location] if args.key?(:sub_location)\n @world_region = args[:world_region] if args.key?(:world_region)\n end", "def update!(**args)\n @city = args[:city] if args.key?(:city)\n @country = args[:country] if args.key?(:country)\n @country_code = args[:country_code] if args.key?(:country_code)\n @state = args[:state] if args.key?(:state)\n @sub_location = args[:sub_location] if args.key?(:sub_location)\n @world_region = args[:world_region] if args.key?(:world_region)\n end", "def initialize(**new_customer_hash)\n\t\t@first_name = new_customer_hash[:info_first_name]\n\t\t@last_name = new_customer_hash[:info_last_name]\n\t\t@active = false \n\t\t@street_address = new_customer_hash[:info_street_address]\n\t\t@city = new_customer_hash[:info_city]\n\t\t@state = new_customer_hash[:info_state]\n\t\t@postal_code = new_customer_hash[:info_postal_code]\n\t\t@phone = new_customer_hash[:info_phone_number]\n\t\t@payment = nil\n\tend", "def user_params\n params.require(:user).permit(:name, :city)\n end", "def user_address_params\n params.require(:user_address).permit(:user_id, :formatted_address, :postal_code, :latitude, :longitude, :city, :country_name, :region_name)\n end", "def add_lat_longt\n users = User.find(:all)\n for user in users\n if !user.city.blank? && !user.country_id.blank?\n address = Country.get_alt_longt(user.city,user.country_id)\n if address != nil\n user.update_attributes(:lat => address.latitude, :longt => address.longitude)\n end\n end\n end \n end", "def user=(user)\n self.email = user.email\n self.name = user.name\n end", "def apply_omniauth(omniauth)\n #add some info about the user\n self.login ||= omniauth['user_info']['nickname']\n self.picture_url = omniauth['user_info']['image']\n self.email ||= omniauth['user_info']['email']\n #self.nickname = omniauth['user_info']['nickname'] if nickname.blank?\n \n # unless omniauth['credentials'].blank?\n # user_tokens.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n # else\n user_tokens.build(:provider => omniauth['provider'], :uid => omniauth['uid'], \n :token => omniauth['credentials']['token'], :token_secret => omniauth['credentials']['secret'])\n # end\n #self.confirm!# unless user.email.blank?\n end", "def update\n \n oldUser = User.find(current_user.id)\n @user = User.find(current_user.id)\n\n successfully_updated = if needs_password?(@user, account_update_params)\n @user.update_with_password(account_update_params)\n else\n # remove the virtual current_password attribute update_without_password\n # doesn't know how to ignore it\n params[:user].delete(:current_password)\n @user.update_without_password(account_update_params)\n end\n\n if successfully_updated\n \n ## Move the user profile photo from tmp to user directory\n if @user.profile_photo!=\"\"\n move_tmp_user_photo(@user)\n end\n \n #update latitude longitude here ...\n if @user.user_type == \"fan\" || @user.user_type == \"artist\"\n #//check if the address has been changed\n addressChanged = !((oldUser.country_id == @user.country_id) && (oldUser.state_id == @user.state_id) && (oldUser.zip [email protected]) && (oldUser.city == @user.city))\n if addressChanged\n fullAddress = \"\"\n countryName = \"\"\n stateName = \"\"\n if @user.country_id.to_i > 0\n countryRow = Country.where(\"id = ? \",@user.country_id.to_i).take\n if countryRow != nil\n countryName = countryRow.country_name\n end\n end\n \n if @user.state_id.to_i > 0\n stateRow = State.where(\"id = ? \",@user.state_id.to_i).take\n if stateRow != nil\n stateName = stateRow.state_name\n end\n end\n \n if @user.zip.to_s != \"\"\n fullAddress = URI.encode(@user.zip)\n end\n \n if @user.city.to_s !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(@user.city)\n else\n fullAddress += \",\"+URI.encode(@user.city)\n end \n end\n \n if stateName !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(stateName)\n else\n fullAddress += \",\"+URI.encode(stateName)\n end \n end\n \n if countryName !=\"\"\n if fullAddress.blank?\n fullAddress = URI.encode(countryName)\n else\n fullAddress += \",\"+URI.encode(countryName)\n end \n end\n \n #render text: fullAddress and return\n if !fullAddress.blank?\n lat_long = Geocoder.coordinates(fullAddress)\n cUser = User.find(@user.id);\n if lat_long!=nil\n cUser.update_attributes(:latitude => lat_long[0],:longitude => lat_long[1])\n end \n end \n end \n end\n \n set_flash_message :notice, :updated\n # Sign in the user bypassing validation in case his password changed\n sign_in @user, :bypass => true\n redirect_to after_update_path_for(@user)\n else\n render \"edit\"\n end\n end", "def updateUser(linkedInInfo, user)\n user.update_attributes(:firstName => getValueFromLinkedInInfo(linkedInInfo, 'firstName'),\n :lastName => getValueFromLinkedInInfo(linkedInInfo, 'lastName'),\n :location => getValueFromLinkedInInfo(linkedInInfo, 'location'),\n :industry => getValueFromLinkedInInfo(linkedInInfo, 'industry'),\n :numConnections => getValueFromLinkedInInfo(linkedInInfo, 'numConnections'),\n :position => getValueFromLinkedInInfo(linkedInInfo, 'title'),\n :company => getValueFromLinkedInInfo(linkedInInfo, 'company'),\n :emailAddress => getValueFromLinkedInInfo(linkedInInfo, 'emailAddress'))\n user.save\n return user\n end", "def set_customer_information(name1, name2, addr1, city, state, zip, addr2='', country='')\n @PARAM_HASH['NAME1'] = name1\n @PARAM_HASH['NAME2'] = name2\n @PARAM_HASH['ADDR1'] = addr1\n @PARAM_HASH['CITY'] = city\n @PARAM_HASH['STATE'] = state\n @PARAM_HASH['ZIPCODE'] = zip\n @PARAM_HASH['ADDR2'] = addr2\n @PARAM_HASH['COUNTRY'] = country\n end", "def set_location(civicrm_model)\n # Split in case suffix is in postal code\n if self.postal_code.present?\n zip = self.postal_code.split('-')[0]\n alf_zip = ALF::Zipcode.where('ZIP', zip).first\n end\n\n # Set country based on\n country = CIVICRM::Country.where(iso_code: self.country).take\n\n # If zip is found use to populate civicrm model\n if alf_zip.present?\n civicrm_model.city = alf_zip.City\n\n # Get the state from CIVICRM\n state = CIVICRM::StateProvince.where(abbreviation: alf_zip.State).take\n # IF state then add\n if state.present?\n civicrm_model.state_province_id = state.id\n # set country in case it is in F1 wrong\n country = CIVICRM::Country.where(id: state.country_id).take\n # Otherwise try to create a state\n else\n # Cannot create without a country\n if country.present?\n state = CIVICRM::StateProvince.new(name: alf_zip.State, abbreviation: alf_zip.State, country_id: country.id)\n # If this state is saved then set it to MODEL\n if state.valid? && state.save\n civicrm_model.state_province_id = state.id\n end\n end\n end\n\n # Get the county from CIVICRM (after state since we need state)\n county = CIVICRM::County.where('lower(name) = ?', alf_zip.County.downcase).take\n # If county then add\n if county.present?\n civicrm_model.county_id = county.id\n # Otherwise try to create the county\n else\n # Cannot create without a state\n if state.present?\n county = CIVICRM::County.new(name: alf_zip.County, state_province_id: state.id)\n if county.valid? && county.save\n civicrm_model.county_id = county.id\n end\n end\n end\n\n # Set country\n if country.present?\n civicrm_model.country_id = country.id\n end\n\n # IF an ALF zipcode model is not found\n else\n # check for state from f1 address model\n state = CIVICRM::StateProvince.where(abbreviation: self.st_province).take\n if state.present?\n civicrm_model.state_province_id = state.id\n end\n\n # check for county from f1 address model\n county = CIVICRM::StateProvince.where(abbreviation: self.county).take\n if county.present?\n civicrm_model.county_id = county.id\n end\n\n # Add country if found\n if country.present?\n civicrm_model.country_id = country.id\n end\n\n end\n\n # Set zip codes\n if self.postal_code.present?\n civicrm_model.postal_code = self.postal_code.split('-')[0]\n civicrm_model.postal_code_suffix = self.postal_code.split('-')[1]\n end\n\n civicrm_model\n end", "def set_attributes(pic)\n self.image = pic.images.standard_resolution.url unless pic.images.nil\n self.latitude = pic.location.latitude\n self.longitude = pic.location.longitude\n self.user_name = pic.user.full_name \n self.location = pic.location.name unless pic.location.nil?\n self.link = pic.link\n self.instagram_id = pic.id\n self.caption = pic.caption.text unless pic.caption.nil?\n self.save\n end", "def replicate_address_from_current_user_details(id, user)\n\n address = Address.find(id)\n\n address.update(\n line1: user.line1,\n line2: user.line2,\n line3: user.line3,\n town_city: user.townCity,\n county: user.county,\n postcode: user.postcode\n )\n\n end", "def setUserField(userName, fieldName, fieldValue)\n\n if userName != nil && fieldName != \"password\"\n user = loadUser(userName)\n user[fieldName] = fieldValue\n saveUser(userName, user)\n end\n end", "def update\n @user = User.find(params[:id])\n @user.username = params[\"user\"][\"username\"]\n @user.email = params[\"user\"][\"email\"]\n @user.user_detail.first_name = params[\"user_detail\"][\"first_name\"]\n @user.user_detail.last_name = params[\"user_detail\"][\"last_name\"]\n @user.user_detail.dob = params[\"user_detail\"][\"dob\"]\n @user.user_detail.address = params[\"user_detail\"][\"address\"]\n if @user.save\n redirect_to :users\n else \n flash[\"alert\"] = @user.errors.full_messages.to_sentence\n puts @user.errors.full_messages.to_sentence\n redirect_to :action => 'edit'\n end\n end", "def user_params\n params[:user].permit(:username, :password, :name, :lastname, :email, :password, :city_id)\n end", "def user_params\n params.require(:user).permit(:name, :country_id, :state_id, :city_id)\n end", "def user_info_params\n params.require(:user_info).permit(:first_name, :last_name, :photo)\n end", "def user_contact_information_params\n params.require(:user_contact_information).permit(:address_1, :address_2, :zipcode, :city, :state, :mobile_phone, :home_phone, :work_phone, :user_id)\n end", "def user_params\n params.require(:user).permit(:username, :email, :password, :firstname, :lastname, :country, :city, )\n end", "def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end", "def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end", "def set_owner_info\n property.owner_email = '[email protected]'\n country_info = {\n 'AU' => ['Australia', '1800 442586'],\n 'AT' => ['Austria', '0800 296669'],\n 'BE' => ['Belgium', '(+32) 03 808 09 54'],\n 'CA' => ['Canada', '1800 4045160'],\n 'DK' => ['Denmark', '8088 7970'],\n 'FR' => ['France', '0800 905 849'],\n 'DE' => ['Germany', '0800 1826013'],\n 'IE' => ['Ireland', '1800 552175'],\n 'IT' => ['Italy', '800 871005'],\n 'LU' => ['Luxembourg', '8002 6106'],\n 'NL' => ['Netherlands', '(+31) 088 202 12 12'],\n 'NO' => ['Norway', '800 19321'],\n 'PL' => ['Poland', '(+48) 22 3988048'],\n 'PT' => ['Portugal', '8008 31532'],\n 'ES' => ['Spain', '900 983103'],\n 'SE' => ['Sweden', '020 794849'],\n 'CH' => ['Switzerland', '0800 561913'],\n 'GB' => ['United Kingdom', '0800 0516731'],\n 'US' => ['United States', '1 800 7197573']\n }\n info = meta_data['BasicInformationV3']\n if country_info.has_key?(info['Country'])\n property.owner_city, property.owner_phone_number = country_info[info['Country']]\n end\n end", "def clone_address_to_user\n if user.present?\n user.build_bill_address(bill_address.clone.attributes) if user.bill_address.blank? && bill_address.present?\n user.build_ship_address(ship_address.clone.attributes) if user.ship_address.blank? && ship_address.present?\n user.save\n end\n end", "def define_city\n @city = Faker::Address.city\n @city = '' unless @set_blank == false\n end", "def save_information\n\t\t#Is user logged in?\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\t\t\n\t\t#Check information\n\t\trender :json=>{:success=>false, :msg=>'Data error. Please refresh the page and try again.'} and return if (!params.has_key?(:information))\n\t\t\n\t\t#Set user information\n\t\tparams[:information].each do |keyval|\n\t\t\t@user[(keyval[0].to_sym)] = keyval[1]\n\t\tend\n\t\[email protected]\n\t\t\n\t\t#Change password?\n\t\tif (params.has_key?(:password))\n\t\t\tif (!params[:password][:old_password].empty? || !params[:password][:new_password].empty?)\n\t\t\t\t#Check old password\n\t\t\t\tuser = User.check_credentials({:email=>@user.email, :password=>params[:password][:old_password]})\n\t\t\t\trender :json=>{:success=>false, :msg=>'Your old password does not match.'} and return if user.nil?\n\t\t\t\t\n\t\t\t\[email protected]_password(params[:password][:new_password])\n\t\t\t\t\n\t\t\t\trender :json=>{:success=>true, :msg=>'Password changed.'} and return\n\t\t\tend\n\t\tend\n\t\t\n\t\trender :json=>{:success=>true, :msg=>'Information saved.'}\n\tend", "def userinfo_params\n params.permit(:firstname, :lastname, :school, :email, :password)\n end", "def update_user_details_in_chargify\n unless self.account.chargify_customer_id.blank?\n\n if self.roles.any? { |r| r.title == 'account_holder' }\n chargify_customer = Chargify::Customer.find_by_reference(self.account.id)\n chargify_customer.first_name = self.firstname\n chargify_customer.last_name = self.lastname\n chargify_customer.email = self.email\n chargify_customer.save\n end\n end\n end", "def user_params\n params.require(:user).permit(:name, :email,:phone, :password, :password_confirmation, :address, :city, :pincode, :state, :country)\n end", "def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info[\"person\"]\n end", "def update!(**args)\n @address_data = args[:address_data] if args.key?(:address_data)\n @email_data = args[:email_data] if args.key?(:email_data)\n @phone_data = args[:phone_data] if args.key?(:phone_data)\n @verification_method = args[:verification_method] if args.key?(:verification_method)\n end", "def edit_identity\n if request.post?\n #OPTIMIZE: presently, one database save per field. Take it all in one go.\n begin\n [ :feed_real_name,\n :feed_aliases,\n :feed_preferred_calling_name,\n :profile_status_message,\n :feed_description,\n :feed_gender,\n :feed_birth_time_pref,\n :feed_email,\n :feed_show_email,\n :feed_country_living_code\n ].each { |e|\n @profile_user[e] = params[e]\n }\n rescue ActiveRecord::RecordInvalid => e\n flash.now[:notice] = e.message\n return\n end\n\n @profile_user[:feed_birth_time] = DateTime.new(params[:feed_birth_time]['(1i)'].to_i,\n params[:feed_birth_time]['(2i)'].to_i, params[:feed_birth_time]['(3i)'].to_i)\n #better method exists?\n #{}.index or {}.rassoc(Ruby 1.9), but we need a case insenstive search!\n #Create new method city_list_downcased and use like this?\n #<tt>city_list_downcased.index params[:feed_city].downcase</tt>\n @profile_user[:feed_city_has_code] = \"no\"\n city_list.each { |k,v| #60,000 rounds in worst case!!\n if v.to_s.downcase == params[:feed_city].downcase\n @profile_user[:feed_city] = k.to_s #From symbol\n @profile_user[:feed_city_has_code] = \"yes\"\n break\n end\n }\n @profile_user[:feed_city] = params[:feed_city] if @profile_user[:feed_city_has_code] == \"no\"\n flash[:highlight] = \"Profile updated!\" if flash[:notice].blank?\n redirect_to @kopal_route.home\n end\n end", "def user_address_params\n params.require(:user_address).permit(:firstname, :lastname, :address_line, :city, :postcode, :user_id)\n end", "def user_params\n\n params.require(:user).permit(:first_name, :last_name,:email, :country_id, :city_id, :email_confirmation)\n \n end", "def set_user_location\n return unless (search_params[:lat] && search_params[:long]) ||\n search_params[:zip_code]\n\n user_location_object(search_params[:lat], search_params[:long],\n search_params[:zip_code])\n end", "def apply_omniauth(omniauth)\n self.email = omniauth['user_info']['email'] if email.blank?\n\n if nick.blank?\n self.nick = (omniauth['user_info']['first_name'] || omniauth['user_info']['nickname'] ||\n omniauth['user_info']['name'] ||omniauth['user_info']['email'])\n end\n\n self.email_alert = false\n self.sms_alert = false\n self.weekend = false\n\n authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end", "def set_userinfo(user, password = nil)\n unless password\n user, password = split_userinfo(user)\n end\n @user = user\n @password = password if password\n\n [@user, @password]\n end", "def save_city\n user = current_user\n params.permit(:name, :country_name, :province_name, :state_name, :country_id, :province_id, :state_id, :id, :name, :access_token, :state)\n if user.admin?\n if !(params[:name].nil? || params[:country_name].nil? || params[:province_name].nil? || params[:state_name].nil?)\n city = City.where(\n name: params[:name],\n country_name: params[:country_name],\n province_name: params[:province_name],\n state_name: params[:state_name]).first\n if (city.nil?) # Insert\n city = City.new(\n name: params[:name],\n country_id: BSON::ObjectId.from_string(params[:country_id]),\n country_name: params[:country_name],\n province_id: BSON::ObjectId.from_string(params[:province_id]),\n province_name: params[:province_name],\n state_id: BSON::ObjectId.from_string(params[:state_id]),\n state_name: params[:state_name])\n if city.save\n render json: {status: 'SUCCESS', message:'Saved City', data:city},status: :ok\n else\n render json: {status: 'ERROR', message:'City not saved', data: nil},status: :unprocessable_entity\n end\n else\n render json: {status: 'ERROR', message:'City already exists', data: city},status: :unprocessable_entity\n end\n end \n elsif user.admin_country?\n if !(params[:name].nil? || params[:country_name].nil? || params[:province_name].nil? || params[:state_name].nil?)\n city = City.where(\n name: params[:name],\n country_name: params[:country_name],\n province_name: params[:province_name],\n state_name: params[:state_name]).first\n if (city.nil?) # Insert\n if (user['country_id'] == BSON::ObjectId.from_string(params[:country_id]))\n city = City.new(\n name: params[:name],\n country_id: BSON::ObjectId.from_string(params[:country_id]),\n country_name: params[:country_name],\n province_id: BSON::ObjectId.from_string(params[:province_id]),\n province_name: params[:province_name],\n state_id: BSON::ObjectId.from_string(params[:state_id]),\n state_name: params[:state_name])\n if city.save\n render json: {status: 'SUCCESS', message:'Saved City', data:city},status: :ok\n else\n render json: {status: 'ERROR', message:'City not saved', data: nil},status: :unprocessable_entity\n end\n else\n render json: {status: 'ERROR', message:'Action not allowed', data: nil},status: :unprocessable_entity \n end\n else\n render json: {status: 'ERROR', message:'City already exists', data: city},status: :unprocessable_entity\n end\n end \n end \n end", "def createuser(clazz, info, gender, location, pass = 'webeng12')\n ret = clazz.new\n info.each_pair do |k, v|\n ret[k] = v\n end\n ret.gender = Gender.find_by_sex(gender)\n ret.location = Location.find_by_postal_code(location)\n ret.password, ret.password_confirmation = pass, pass \n ret\nend", "def set_cities_user\n @cities_user = CitiesUser.find(params[:id])\n end", "def update!(**args)\n @contact_info = args[:contact_info] if args.key?(:contact_info)\n @country_code = args[:country_code] if args.key?(:country_code)\n end", "def user_params\n # params.require(:user).permit(:phone, :user_state_id, :first_name, :last_name, :date_of_birth, :picture, :city, :have_car, :code_token)\n params.require(:user).permit(:phone, :first_name, :last_name, :date_of_birth, :picture, :city, :have_car, :code_token)\n end", "def user_loc=(loc)\n self['user_loc'] = loc\n end", "def creator_info\n redirect_to root_path and return if @user != current_user\n if request.put?\n @user.update_attributes(params[:user])\n @user.errors.add(:avatar, \"is required\") if @user.avatar_missing?\n @user.errors.add(:tagline, \"is required\") if @user.tagline.blank?\n redirect_to creator_payment_path(@user) and return unless @user.avatar_missing? || @user.tagline.blank?\n end\n @nav = \"signup\"\n end", "def user_param\n params.require(:user).permit(:fName,:lName,:email,:password,:address ,:password_confirmation, :pCode, :city, :role, :telephone, :province)\n end", "def user_params\n params.require(:user).permit(:name, :line1, :line2, :city, :state, :zip, :phone)\n end", "def address_params\n params[:address].permit(:user_id, :street, :city, :pin, :title)\n end", "def set_latlng!\n if ! self.physical_address1.blank? && ! self.physical_address_city.blank? && ! self.physical_address_state.blank? && ! self.physical_address_zip.blank? \n phys_addr = Geokit::Geocoders::YahooGeocoder.geocode self.physical_address1 + \",\" + \n self.physical_address_city + \",\" + self.physical_address_state + \" \" + self.physical_address_zip\n if phys_addr && ! phys_addr.lat.blank? && ! phys_addr.lng.blank? \n latlng = AddrLatlng.new(:agent_id => self.id, :lat => phys_addr.lat, :lng => phys_addr.lng)\n self.addr_latlng = latlng\n self.save\n end\n else\n if ! self.addr_latlng.blank?\n self.addr_latlng.destroy\n end\n end\n end", "def set_user_info\n @user_info = UserInfo.find(params[:id])\n authorize @user_info\n end", "def user_params\n params.require(:user).permit(:name, :first_name, :last_name, :email, :password, :password_confirmation, :salt, :encrypted_password, profile_attributes: [:id, :city, :state, :website])\n end", "def user_params\n params.require(:user).permit(:first_name, :last_name, :email, :contact_number,:bio, :country, :password, :city, :profile_img_url)\n end" ]
[ "0.6915106", "0.6828433", "0.66585535", "0.6629932", "0.6568477", "0.6528027", "0.6522978", "0.640044", "0.6382904", "0.63738525", "0.6366468", "0.634885", "0.6348685", "0.63207006", "0.631028", "0.6279979", "0.6269031", "0.6266146", "0.6260505", "0.6207813", "0.6197286", "0.6181929", "0.6154029", "0.61521876", "0.61452544", "0.6129753", "0.61294156", "0.61156934", "0.6113432", "0.6091597", "0.6090779", "0.6075543", "0.60659283", "0.60601485", "0.605763", "0.6051975", "0.6051431", "0.6046724", "0.6032463", "0.6032003", "0.60311335", "0.6021385", "0.60209584", "0.6019024", "0.60077876", "0.5996356", "0.5994126", "0.59769064", "0.5966803", "0.59634596", "0.59634596", "0.5954195", "0.5943486", "0.5942967", "0.594012", "0.59335935", "0.5933402", "0.5932157", "0.5927907", "0.5921274", "0.5917732", "0.5910785", "0.5902584", "0.58987015", "0.5896415", "0.5894794", "0.5881476", "0.588136", "0.58799785", "0.587969", "0.58772707", "0.58772707", "0.5874824", "0.5861124", "0.5859377", "0.58521557", "0.5850262", "0.5849203", "0.5840159", "0.5836868", "0.58265907", "0.5823467", "0.58212066", "0.5811911", "0.5811428", "0.5811119", "0.5810058", "0.5809583", "0.58089745", "0.5805631", "0.5781677", "0.5781542", "0.5773809", "0.57722414", "0.5771525", "0.5769844", "0.5768996", "0.5768297", "0.5767686", "0.5764692", "0.57608116" ]
0.0
-1
changed result=result.with_appended_backtrace(test_step.source.last) if test_step.respond_to?(:source) for result = result since the '.last' method is missing for the param sent to this class every last step of the test in : /Users/guillemsannicolas/.gem/ruby/2.1.1/gems/cucumbercore1.2.0/lib/cucumber/core/test/runner.rb opts = $default_d_caps imho its because of the gets.chomp, because when starting a test with arguments, the gets.chomp doesn't work in : /Users/guillemsannicolas/.gem/ruby/2.1.2/gems/appium_lib7.0.0/lib/appium_lib/driver.rb:296
def desired_caps_real_device desired_caps = { caps: { platformName: 'iOS', versionNumber: '9.0', deviceName: 'iPad de Guillem', newCommandTimeout: 1000, udid: '52257b7d0ae102e2d79f02448b5486aca8c6e715', autoAcceptAlerts: true, bundleId: 'com.kg.GoldenManager', #newCommandTimeout: 10, #app: APP_PATH, fullReset: false, fastReset: true } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_step; end", "def step_result; end", "def running_test_step; end", "def test_steps; end", "def test_steps; end", "def add_test_step(step_result)\n current_executable.steps.push(step_result)\n @step_context.push(step_result)\n step_result\n end", "def after_test_step(step,result)\n unless result.passed?\n # only the first non-passed step\n failed_step[:step] ||= step\n failed_step[:result] ||= result\n end\n end", "def upa_steps=(_arg0); end", "def after_test_step(test_step, result)\n #puts test_step.to_yaml\n puts \"after #{test_step.class} result is #{result}\"\n puts result.to_yaml\n #p result.kind_of? Cucumber::Core::Test::Result::Passed\n #p result.kind_of? Cucumber::Core::Test::Result::Skipped\n end", "def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)\n tc_before_step_result(exception, keyword, multiline_arg, source_indent, status, step_match, background)\n super\n end", "def execute_last &decision\n return execute_line @test_lines[-1], &decision\n end", "def after_step(_step_result, _scenario)\n raise NotImplementedError.new \\\n \"#{self.class.name}#after_step must be implemented in subclass.\"\n end", "def execute(step)\n end", "def running_test_case; end", "def prev_line=(_arg0); end", "def lead_captured\n end", "def step1\n\n end", "def before_test_case(*args)\n @test_steps =[]\n @scenario_tags = []\n @failed_step = {}\n end", "def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)\n # Do nothing\n end", "def backtrace_includes=(_arg0); end", "def step1\n \n end", "def make_step\n @result\n end", "def print_error_android_app\n puts \"\\nTo run test on android app\"\n puts \"\\n Usage : cucumber PLATFORM=android APP_PATH=path/to/app\"\nend", "def caller\n %x{\n function getErrorObject(){\n try { throw Error('') } catch(err) { return err; }\n }\n\n\n var err = getErrorObject();\n }\n stack = `err.stack`\n caller_lines = stack.split(\"\\n\")[4..-1]\n caller_lines.reject! { |l| l.strip.empty? }\n\n result_formatter = lambda do |filename, line, method=nil|\n \"#{filename}:#{line} in `(#{method ? method : 'unknown method'})'\"\n end\n\n caller_lines.map do |raw_line|\n if match = /\\s*at (.*) \\((\\S+):(\\d+):\\d+/.match(raw_line)\n method, filename, line = match.captures\n result_formatter[filename, line, method]\n elsif match = /\\s*at (\\S+):(\\d+):\\d+/.match(raw_line)\n filename, line = match.captures\n result_formatter[filename, line]\n # catch phantom/no 2nd line/col #\n elsif match = /\\s*at (.*) \\((\\S+):(\\d+)/.match(raw_line)\n method, filename, line = match.captures\n result_formatter[filename, line, method]\n elsif match = /\\s*at (.*):(\\d+)/.match(raw_line)\n filename, line = match.captures\n result_formatter[filename, line]\n # Firefox - Opal.modules[\"rspec/core/metadata\"]/</</</</def.$populate@http://192.168.59.103:9292/assets/rspec/core/metadata.self.js?body=1:102:13\n elsif match = /(.*?)@(\\S+):(\\d+):\\d+/.match(raw_line)\n method, filename, line = match.captures\n result_formatter[filename, line, method]\n # webkit - http://192.168.59.103:9292/assets/opal/rspec/sprockets_runner.js:45117:314\n elsif match = /(\\S+):(\\d+):\\d+/.match(raw_line)\n filename, line = match.captures\n result_formatter[filename, line]\n else\n \"#{filename}:-1 in `(can't parse this stack trace)`\"\n end\n end\n end", "def cucumber_task(target,environment,url,prefix=\"\")\n cuke_task = CapyBrowser::Rake::CucumberTask.new(target,environment,url,prefix)\n desc cuke_task.description\n task( cuke_task.target, [:command_line_arguments] => CapyBrowser::Rake.dependencies) do |task,args|\n args.with_defaults(:command_line_arguments => \"\")\n puts CapyBrowser::Rake.cucumber(cuke_task.command_line( args.command_line_arguments)).invoke!\n end\nend", "def test_case; end", "def get_test_filename\n c = caller\n l = c.find do |l|\n l.match(/test\\//) and\n #(not l.match(/test\\/unit/)) and\n (not l.match(/test\\/flowtestbase/))\n end\n \"#{l} (#{c.size} lines)\"\nend", "def test_case_data(test_case)\n steps_as_string = test_case.test_steps.map{|step| step.source.last}\n .select{|step| step.is_a?(Cucumber::Core::Ast::Step)}\n .reject{|step| step.is_a?(Cucumber::Hooks::BeforeHook)}.map do | g_step |\n str = g_step.send(:keyword)+g_step.send(:name)\n str += g_step.multiline_arg.raw.map{|l|\"\\n| #{l.join(' | ')} |\"}.join if g_step.multiline_arg.data_table?\n str\n end.join(\"\\n\")\n {'title'=>extract_title(test_case),\n 'type_id'=>type_id(test_case),\n 'custom_steps'=>steps_as_string,\n 'refs'=>refs(test_case)\n }\n end", "def stack_trace=(_arg0); end", "def test_step_started(source, step_name, *args)\n test = source.test\n suite_name, test_name = _test_details(test)\n\n @manager.allure_start_step(suite_name, test_name, step_name)\n end", "def full_backtrace=(_arg0); end", "def backtrace; end", "def add_step(step,sample)\t\n\n\t\t\t\t# setting job working directory\n\t\t\t\tworking_dir = \"\"\t\n\t\t\t\tif self.local \n\t\t\t\t\tworking_dir = self.local+\"/\"+self.name\n\t\t\t\telse\n\t\t\t\t\tworking_dir = self.output\n\n\t\t\t\t\tif step.is_multi?\t\n\t\t\t\t\t\tfolder = (self.custom_output) ? self.custom_output : @shortname \n\t\t\t\t\t\tworking_dir += \"/#{folder}\"\n\t\t\t\t\telse\n\t\t\t\t\t\tfolder =\n\t\t\t\t\t\tif self.custom_output \n\t\t\t\t\t\t\tself.custom_output\n\t\t\t\t\t\telsif self.custom_name\n\t\t\t\t\t\t\tself.custom_name\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstep.name\n\t\t\t\t\t\tend\n\t\t\t\t\t\tworking_dir += \"/#{sample.name}/#{folder}\"\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\t\t# set job cpus number to the higher step cpus (this in case of multiple steps)\n\t\t\t\tself.cpus = step.cpus if step.cpus > self.cpus\n\t\t\t\t\n\t\t\t\t# set number of nodes for job\n\t\t\t\tself.nodes = (step.nodes) ? step.nodes : @nodes\n\n\t\t\t\t# set the memory used\n\t\t\t\tself.mem = step.mem\n\n\t\t\t\t# adding job working directory\n\t\t\t\tunless step.name.start_with? \"_\"\n\t\t\t\t\tself.command_line << \"if [ ! -f #{working_dir}/checkpoint ]\"\n\t\t\t\t\tself.command_line << \"then\"\n\t\t\t\t\tself.command_line << logger(step, \"start\")\n\t\t\t\t\tself.command_line << \"\\nmkdir -p #{working_dir}\"\n\t\t\t\t\tself.command_line << \"cd #{working_dir}\"\n\t\t\t\tend\n\n\t\t\t\t# generate command lines for this step\n\t\t\t\tif step.run.kind_of? Array\n\t\t\t\t\tstep.run.each_with_index do |cmd, i|\n\t\t\t\t\t\tcommand = generate_cmd_line(cmd,sample,step)\n\t\t\t\t\t\t# TODO verify that logger works in this case\n\t\t\t\t\t\t# self.command_line << \"#{command} || { echo \\\"FAILED `date`: #{step.name}:#{i}\\\" ; exit 1; }\"\n\t\t\t\t\t\tself.command_line << \"#{command} || { #{logger(step, \"FAILED #{i}\" )}; exit 1; }\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tcommand = generate_cmd_line(step.run,sample,step)\n\t\t\t\t\t# TODO verify that logger works in this case\n\t\t\t\t\t# self.command_line << \"#{command} || { echo \\\"FAILED `date`: #{step.name} \\\" ; exit 1; }\"\n\t\t\t\t\tself.command_line << \"#{command} || { #{logger(step, \"FAILED\" )}; exit 1; }\"\n\t\t\t\tend\n\t\t\t\tself.command_line << logger(step, \"finished\")\n self.command_line << \"touch #{working_dir}/checkpoint\"\n\t\t\t\tself.command_line << \"else\"\n\t\t\t\tself.command_line << logger(step, \"already executed, skipping this step\")\n\t\t\t\tself.command_line << \"fi\"\n\t\t\t\n\t\t\t\t# check if a temporary (i.e. different from 'output') directory is set\n\t\t\t\tif self.local\n\t\t\t\t\tfinal_output = \"\"\n\n\t\t\t\t\tif step.is_multi?\t\n\t\t\t\t\t\tfolder = (self.custom_output) ? self.custom_output : @shortname \n\t\t\t\t\t\tfinal_output = self.output+\"/#{folder}\"\t \n\t\t\t\t\telse\n\t\t\t\t\t\tfolder = (self.custom_output) ? self.custom_output : step.name\n\t\t\t\t\t\tfinal_output = self.output+\"/#{sample.name}/#{folder}\"\n\t\t\t\t\tend\n\n\t\t\t\t\tself.command_line << \"mkdir -p #{final_output}\"\n\t\t\t\t\tself.command_line << \"cp -r #{working_dir}/* #{final_output}\"\n\t\t\t\t\tself.command_line << \"rm -fr #{working_dir}\"\n\t\t\t\tend\n\n\t\t\tend", "def visit_step(step)\n tc_before_step(step)\n super\n tc_after_step(step)\n end", "def test_sample3\n\n @action.tap_non_exist_elememnt\n\n rescue StandardError => e\n @action.error_handling(scenario_name: method_name, error_obj: e)\n end", "def after_step_result(keyword, step_match, multiline_arg, status,\n exception, source_indent, background)\n return if @hide_this_step\n # One-line message to print\n message = ''\n # A bit of a hack here to support Scenario Outlines\n # Apparently, at the time of calling after_step_result, a StepMatch in\n # a Scenario Outline has a `name` attribute (and no arguments to\n # format, because they don't get pattern-matched until the Examples:\n # section that fills them in), whereas a StepMatch in a normal scenario\n # has no value set for its `name` attribute, and *does* have arguments\n # to format. This behavior is exploited here for the sake of replacing\n # the `<...>` angle brackets that appear in Scenario Outline steps.\n #\n # In other words, if `step_match` has a `name`, assume it's in a\n # Scenario Outline, and replace the angle brackets (so the bracketed\n # parameter can be displayed in an HTML page)\n if step_match.name\n step_name = keyword + step_match.name.gsub('<', '&lt;').gsub('>', '&gt;')\n # Otherwise, wrap the arguments in bold tags\n else\n step_name = keyword + step_match.format_args(\"<b>%s</b>\")\n end\n\n # Output the step name with appropriate colorization\n stat = status_map(status)\n message = \"#{stat}:#{step_name}\"\n\n # Add the source file and line number where this step was defined\n message += source_message(step_match.file_colon_line)\n\n # Include additional info for undefined and failed steps\n if status == :undefined\n message += \"<br/>(Undefined Step)\"\n elsif status == :failed && exception\n message += backtrace(exception)\n end\n\n # Output the final message for this step\n @data << [message]\n\n # Output any multiline args that followed this step\n @multiline.each do |row|\n @data << row\n end\n @multiline = []\n end", "def runTest(browser)\n puts \"Step 2: At step description here\"\n #Do shit here\n #....\n puts \"Step 3: ....\"\n #Do more shit here\n #....\n\n puts \"Expected Result:\"\n puts \"Result that we expect to happen.\"\n\n if true #Test passed condition here\n self.passed = true\n puts \"TEST PASSED. Add some description/details here\"\n else #Test failed condition here\n self.passed = false\n puts \"TEST FAILED. Show what we have screwed up\"\n end\n end", "def handle(vm_tracepoint); end", "def step(name, opts = T.unsafe(nil)); end", "def send_result(test_case,result,id,testrun)\n testrail_status = case \n when result.passed?\n {id:1,comment: 'passed'}\n when result.failed?\n {id:5,comment: 'failed'}\n when result.undefined?\n {id:7,comment: 'undefined step'}\n when result.pending?\n {id:6,comment: 'pending step'}\n end\n unless result.passed?\n # the before step can fail. So we have to check\n if @failed_step[:step].source.last.is_a?(Cucumber::Hooks::BeforeHook)\n failed_step = 'failed in the before hook'\n location = 'before hook'\n elsif @failed_step[:step].source.last.is_a?(Cucumber::Hooks::AfterHook)\n failed_step = 'failed in the after hook'\n location = 'after hook'\n else\n failed_step = \"#{@failed_step[:step].source.last.keyword}#{@failed_step[:step].source.last.name}\"\n location=@failed_step[:step].source.last.file_colon_line\n end\n failure_message = <<-FAILURE\n Error message: #{testrail_status[:comment]} #{result.exception.message}\n Step: #{failed_step}\n Location: #{location}\n FAILURE\n else\n failure_message = nil\n end\n #only send defects if the test is not passed\n report_on_result = {status_id:testrail_status[:id],comment:failure_message,defects:testrail_status[:id]==1 ? '' : defects(test_case)}\n begin\n testrail_api_client.send_post(\"add_result_for_case/#{testrun}/#{id}\",report_on_result)\n rescue => e\n if e.message =~ /No \\(active\\) test found for the run\\/case combination/\n add_case_to_test_run(id,testrun)\n retry\n else\n puts \"#{e.message} testrun=#{testrun} test case id=#{id}\"\n end\n end\n end", "def backtrace\n end", "def skip_backtrace=(_arg0); end", "def on_test_run_finished(event)\n print_cucumber_failures\n end", "def test_step_screenshot(source, step_name, file)\n test = source.test\n suite_name, test_name = _test_details(test)\n\n @manager.allure_add_attachment(suite_name, test_name, file, step: step_name, title: File.basename(file))\n end", "def advance_test_sequence()\n run_data = @test_sequence.shift\n # if test sequence is empty test is completed, let's report success\n if run_data == nil\n EventMachine.stop()\n exit(SUCCESS_EXIT_STATUS)\n end\n # otherwise let's run next test step\n method = run_data[0]\n if method == nil\n abort(\"No method specified\")\n end\n send(method, run_data[1])\n end", "def last_context=(_arg0); end", "def print_error_android_web\n puts \"\\nTo run test on android mobile web\"\n puts \"\\n Usage : cucumber PLATFORM=android BROWSER=browser_name\"\n puts \"\\n Supported browsers are \\\"chrome\\\" and \\\"native\\\"\"\nend", "def step msg\n end", "def exception_message(scenario)\n step = scenario.failed?\n return unless step == true\n\n log(\"\\n\\n--------------------------\")\n log(\"Motivo:\\n\")\n log(scenario.exception.message.to_s)\n log(\"--------------------------\\n\\n\")\nend", "def _new_step(e, mstat)\n step = @record.add_step(e, @depth)\n res = ___step_trial(step, mstat)\n step.cmt\n res\n rescue CommError, Interlock, Interrupt, InvalidARGS\n mstat.result = __set_err(step)\n raise\n end", "def stacktrace=(_arg0); end", "def upa_steps; end", "def step_two()\r\nend", "def debug it\n PryByebug::BreakCommand.new.send :add_breakpoint, \"Testo::Test#run\", nil\n # How to \"next next step\" automatically when the breakpoint is hit?\n\n begin\n run it\n raise \"Cannot reproduce. It might be a heisebug.\"\n rescue\n $!\n end\nend", "def process_testcase(line_buffer)\n line_buffer\n end", "def main_method(file_path, student_full_code)\n my_test = seperate_and_filter_trace(student_full_code, file_path,\n 'cp/traceprinter/', 'output.txt')\n Dir.chdir('/home')\n #puts my_test\n my_test\nend", "def setup\n\n opt=which_test\n #opt = parse_args\n puts \"opt is #{opt}\"\n\n #Set default values\n if opt[:browser].nil?\n opt[:browser]=\"chrome\"\n end\n if opt[:root].nil?\n opt[:root]=\"localhost:4020/dg\"\n end\n if opt[:num_trials].nil?\n opt[:num_trials]=\"1\"\n end\n if opt[:num_cases].nil?\n opt[:num_cases]=\"100\"\n end\n if opt[:delay].nil?\n opt[:delay]=\"1\"\n end\n if opt[:filename].nil?\n opt[:filename]=\"testLoginResultDefault\"\n end\n if opt[:path].nil?\n #opt[:path]=\"Google Drive/CODAP @ Concord/Software Development/QA\"\n opt[:path]=\"Documents/CODAP data/\"\n end\n if opt[:sleep_time].nil?\n opt[:sleep_time]=\"1\"\n end\n if opt[:write].nil?\n opt[:write]=false\n end\n\n if opt[:browser]==\"chrome\"\n @browser = Selenium::WebDriver.for :chrome\n elsif opt[:browser]==\"firefox\"\n @browser = Selenium::WebDriver.for :firefox\n elsif opt[:browser]=='safari'\n @browser = Selenium::WebDriver.for :safari\n elsif opt[:browser]=='ie'\n @browser = Selenium::WebDriver.for :ie\n end\n\n $ROOT_DIR = opt[:root]\n $dir_path = opt[:path]\n $new_file =opt[:write]\n\n if opt[:root].include? \"localhost\"\n $build = \"http://#{opt[:root]}\"\n $save_filename = \"#{opt[:filename]}_localhost.csv\"\n else\n if opt[:version].nil?\n opt[:version]=\"latest\"\n end\n $build = \"http://#{opt[:root]}/#{opt[:version]}\"\n $save_filename = \"#{opt[:filename]}_#{opt[:version]}.csv\"\n end\n\n puts $save_filename\n\n @input_trials = opt[:num_trials]\n @input_cases = opt[:num_cases]\n @input_delay = opt[:delay]\n @input_sleep = opt[:sleep_time]\n\n @time = (Time.now+1*24*3600).strftime(\"%m-%d-%Y %H:%M\")\n @platform = @browser.capabilities.platform\n @browser_name = @browser.capabilities.browser_name\n @browser_version = @browser.capabilities.version\n puts \"Time:#{@time}; Platform: #{@platform}; Browser: #{@browser_name} v.#{@browser_version}; Testing: #{$build}\"\n\n #ENV['base_url'] = '#{$build}?di=http://concord-consortium.github.io/codap-data-interactives/Markov/index.html'\n ENV['base_url'] = 'http://codap.concord.org/releases/latest/?di=http://concord-consortium.github.io/codap-data-interactives/Markov/index.html'\n\n @wait= Selenium::WebDriver::Wait.new(:timeout=>60)\nend", "def process_line line\n if line.include?(\"@\") && @add_tags_to_main\n @nd[:main_tags] << line \n elsif line.include?(\"Feature:\")\n @nd[:feature] = line.sub(\"Feature:\",\"\")\n @add_tags_to_main = false\n elsif line.include?(\"Scenario:\")\n @nd[:scenarios].push({:name => line.sub(\"Scenario:\",\"\"), :steps => []})\n @add_to_s = true\n elsif\n begin\n @nd[:scenarios].last[:steps].push(line) if @add_to_s\n @add_to_s = true \n rescue\n end\n end\n end", "def _test_message ; process_test_case(\"message\") ; end", "def store_failure_on_next message\r\n raise 'Not supported in Selenium Core at the moment'\r\n end", "def run_enhanced\n begin\n @test.call\n @status = :pass\n rescue => e\n e.set_backtrace(Thread.__backtrace(false, 1_000)) if defined? Maglev\n @status = :fail\n @exception = e\n end\n end", "def on_test_step_started(event)\n event.test_step.hook? ? handle_hook_started(event.test_step) : handle_step_started(event.test_step)\n end", "def testStep(description)\n warn 'testStep method is deprecated, please use stepStart or stepEnd commands instead.'\n executeScript($START_STEP_COMMAND, {:name => description})\n end", "def stest_method_1(test); end", "def test_step_finished(source, step_name, status = :passed, *args)\n test = source.test\n suite_name, test_name = _test_details(test)\n\n @manager.allure_stop_step(suite_name, test_name, step_name, status)\n end", "def stack_trace; end", "def finish\n @test_output = @test_output.join.split(\"\\n\")\n @test_description = @test_output.shift\n end", "def backtrace_includes; end", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def test_cases; end", "def process_output(output)\n raise ArgumentError unless output and output.is_a? Array\n\n begin # parse failing scenarios (between FailingScenarios and BlankLine)\n if i = output.find_index {|line| line =~ Regex::FailingScenarios}\n temp = output[i+1..-1]\n i = temp.find_index {|line| line =~ Regex::BlankLine}\n @scenarios[:failed] = temp.first(i)\n end\n rescue => e\n raise\n end\n\n begin # parse result counts\n #result_lines = output.grep Regex::StepResult\n #unless result_lines.count == 1\n # log output\n # raise TestFailedError, \"invalid cucumber results\" + output.collect{|l| \"#{l}\\n\"}.inspect\n #end\n #num_steps, num_passed = result_lines.first.scan(Regex::StepResult).first\n\n result_lines = output.grep Regex::StepResultFull \n unless result_lines.count == 1\n log output\n raise TestFailedError, \"invalid cucumber results\" + output.collect{|l| \"#{l}\\n\"}.inspect\n end\n num_steps, num_failed, num_skipped, num_undefined, num_passed = result_lines.first.scan(Regex::StepResultFull).first\n num_passed ||= 0\n num_skipped ||= 0\n num_failed ||= 0\n num_undefined ||= 0\n num_passed = num_passed.to_i\n num_skipped = num_skipped.to_i\n num_failed = num_failed.to_i\n num_steps = num_steps.to_i\n num_undefined = num_undefined.to_i\n # FIXME: This is terrible\n #puts \"#{num_steps}: #{num_failed} #{num_skipped} #{num_passed} #{num_undefined}\"\n if num_failed + num_undefined > 0 or num_passed < num_steps\n log output\n end\n num_steps -= num_skipped\n @scenarios[:steps] = {:total => num_steps, :passed => num_passed}\n raise FastReturn.new(@scenarios[:steps], output)\n rescue => e\n raise\n end\n\n end", "def loadtest()\n\n # Redirect $stdout (Console output) to nil\n\n # Workout the delay time of the script\n $scriptdelaytime = $scriptdelaytime + $ramp_up_time\n\n # Sleep for that delay time, so we can start ramping up users incrementally\n sleep $scriptdelaytime\n\n # Get which cucumber scenario by using the $vuser_inc variable.\n cucumber_scenario = $vuser_scenarios[$vuser_inc]\n # Increase this variable by 1 so the other scenarios can use it\n $vuser_inc = $vuser_inc + 1\n\n # convervate the cucumber scenario name, into the class name\n scenario_name = cucumber_scenario.gsub('(','').gsub(')', '').gsub(/ /, '_').capitalize\n\n # create an instance of the class from the (step_defitions/performance) file\n script = Module.const_get(scenario_name).new\n\n # Increase the variable which keeps track of running virtual users\n $running_v_users = $running_v_users + 1\n\n iteration = 0\n\n # Loop through for the duration of the test, this will run the test each time it loops\n while ((Time.new.to_i) < ($starttime + $duration)) do\n\n iteration += 1\n\n # Works out the start time of the current test (iteration)\n scriptstart_time = Time.now\n\n # We'll run the test in a try/except block to ensure it doesn't kill the thread\n begin\n # Call the threads action step\n script.v_action()\n\n # As the test has finished, work out the duration\n script_duration = (Time.now - scriptstart_time) * 1000\n\n # If the duration is above the x axis current value, let's increase it\n if ((script_duration / 1000) > $max_x) then\n $max_x = (script_duration / 1000).ceil + 1\n end\n\n # If the current cucumber scenario have no results, lets define their arrays\n if ($results_scenarios[cucumber_scenario].nil?) then\n $results_scenarios[cucumber_scenario] = []\n $results_scenarios_graph[cucumber_scenario] = {}\n end\n\n # Add the duration of the test to an array so we can work our max/min/avg etc...\n $results_scenarios[cucumber_scenario] << script_duration\n\n # For each second we need to build up an average, so need to build up another array\n # based on the current time\n current_time_id = $duration - (($starttime + $duration) - Time.new.to_i) + 1\n\n # If the array doesn't exist for the current time, then lets define it\n if($results_scenarios_graph[cucumber_scenario][current_time_id].nil? == true) then\n $results_scenarios_graph[cucumber_scenario][current_time_id] = Array.new()\n end\n\n # Add the value to the array\n $results_scenarios_graph[cucumber_scenario][current_time_id].push(script_duration)\n\n rescue Exception=>e\n # If it fails, keep a log of why, then carry on\n\n error = {}\n error['error_message'] = e.to_s + '<br>' + e.backtrace.to_s\n error['error_iteration'] = iteration\n error['error_script'] = cucumber_scenario\n\n # $stdout.puts 'Error: ' + e + \"\\n\" + backtrace.map {|l| \" #{l}\\n\"}.join\n\n\n $scenario_errors[cucumber_scenario] += 1\n\n #$stdout.puts $scenario_errors\n\n $error_log << error\n\n $total_failures += 1\n # $stdout.puts 'Error: ' + e + \"\\n\" + backtrace.map {|l| \" #{l}\\n\"}.join\n end\n\n $scenario_iterations[cucumber_scenario] += 1\n\n\n # Sleep a second between each scenario. This will need to be parametised soon\n sleep(1)\n\n end\n # Once the test has finished, lets decrease the $running_v_users value\n $running_v_users = $running_v_users - 1\n\nend", "def step_run_flrtvc(step,\n target)\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')\n mine_this_step_hash = mine_this_step(step, target)\n if mine_this_step_hash[false].nil?\n Log.log_debug('Doing mine_this_step (target=' + target +\n ') step=' + step.to_s)\n #\n lslpp_file = get_flrtvc_name(:lslpp, target)\n Log.log_debug(' lslpp_file=' + lslpp_file)\n #\n url_file = get_flrtvc_name(:URL, target)\n Log.log_debug(' url_file=' + url_file)\n #\n emgr_file = get_flrtvc_name(:emgr, target)\n Log.log_debug(' emgr_file=' + emgr_file)\n #\n flrtvc_file = get_flrtvc_name(:flrtvc, target)\n Log.log_debug(' flrtvc_file=' + flrtvc_file)\n #\n # TODO : 'master' target is not supported consistently so far\n if target == 'master'\n #\n cmd1 = \"/usr/bin/lslpp -Lcq > #{lslpp_file}\"\n Utils.execute(cmd1)\n #\n cmd2 = \"/usr/sbin/emgr -lv3 > #{emgr_file}\"\n Utils.execute(cmd2)\n else\n #\n cmd1 = '/usr/bin/lslpp -Lcq'\n lslpp_output = ''\n remote_cmd_rc = Remote.c_rsh(target, cmd1, lslpp_output)\n if remote_cmd_rc == 0\n File.open(lslpp_file, 'w') { |file| file.write(lslpp_output) }\n Log.log_debug(' lslpp_file ' + lslpp_file + ' written')\n end\n #\n cmd2 = '/usr/sbin/emgr -lv3'\n emgr_output = ''\n remote_cmd_rc = Remote.c_rsh(target, cmd2, emgr_output)\n if remote_cmd_rc == 0\n File.open(emgr_file, 'w') { |file| file.write(emgr_output) }\n Log.log_debug(' emgr_file ' + emgr_file + ' written')\n end\n end\n #\n cmd = if @level != :all\n \"/usr/bin/flrtvc.ksh -l #{lslpp_file} -e #{emgr_file} \\\n-t #{@level}\" # {apar_s} {filesets_s} {csv_s}\n else\n \"/usr/bin/flrtvc.ksh -l #{lslpp_file} -e #{emgr_file}\" \\\n # {apar_s} {filesets_s} {csv_s}\n end\n #\n flrtvc_command_output = []\n Utils.execute2(cmd, flrtvc_command_output)\n # persist to yaml\n target_yml_file = get_flrtvc_name(:YML, target, step)\n File.write(target_yml_file, flrtvc_command_output[0].to_yaml)\n flrtvc_output = flrtvc_command_output[0]\n else\n Log.log_debug('NOT Doing mine_this_step (target=' + target +\n ') step=' + step.to_s)\n flrtvc_output = mine_this_step_hash[false]\n end\n flrtvc_output\n end", "def test_second_take\n\n @dashboard.register_participant :troublemaker, TroubleMaker\n\n pdef = Ruote.define do\n define 'sub0' do\n set '__on_error__' => 'redo'\n end\n sequence :on_error => 'sub0' do\n troublemaker\n end\n end\n\n wfid = @dashboard.launch(pdef)\n r = @dashboard.wait_for(wfid)\n\n assert_equal 'terminated', r['action']\n assert_equal 3, r['workitem']['fields']['_trace'].size\n end", "def end_step(_step_result, _scenario)\n raise NotImplementedError.new \\\n \"#{self.class.name}#end_step must be implemented in subclass.\"\n end", "def run_step_one\n puts \"Executing Step ONE\"\n end", "def backtrace_cleaner; end", "def moveToFailed _args\n \"moveToFailed _args;\" \n end", "def misty ci, &blk\n print 'stack: '; p ci.ctx.stack\n puts 'vars: '; p ci.ctx.vars\n print 'next instruction: '; p ci.peek\n gets\n ci.step\nend", "def cucumber_wrapper\n cucumber = `cucumber features/#{@feature.gsub(\" \", \"_\")}.feature`\n File.open(\"features/step_definitions/#{@feature.gsub(\" \", \"_\")}.steps.rb\", 'w') do |parsed_steps|\n parsed_steps.write cucumber.split(\"You can implement step definitions for undefined steps with these snippets:\\n\\n\").last\n end\n end", "def step_name(keyword, step_match, status, source_indent, background, file_colon_line)\n step_name = step_match.format_args(lambda{|param| \"*#{param}*\"})\n @test_steps << \"#{keyword}#{step_name}\"\n end", "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n # assign the user inputs to variables\n scenario_file_name = runner.getStringArgumentValue('scenario_file_name', user_arguments)\n scenario_number = runner.getDoubleArgumentValue('scenario_number', user_arguments)\n \n #hash of scenarios\n hash_of_scenarios = {1 => 'baseline_scenario',\n 2 => 'highefficiency_scenario',\n 3 => 'REopt_scenario',\n 4 => 'evcharging_scenario',\n 5 => 'thermalstorage_scenario'\n }\n #check if scenario_number is used.\n if scenario_number != 0\n runner.registerInfo(\"replacing argument scenario_file_name: #{scenario_file_name} with scenario_number: #{scenario_number}\")\n if hash_of_scenarios[scenario_number.round].nil?\n runner.registerError(\"scenario_number: #{scenario_number} is not in hash_of_scenarios!\")\n return false\n end\n scenario_file_name = hash_of_scenarios[scenario_number.round]\n end\n \n #TODO try and get simulation_dir value\n #scenario_file_override = \"#{simulation_dir}/urbanopt/scenario_file_override.json\"\n scenario_file_override = \"../../urbanopt/scenario_file_override.json\"\n if File.exist?(scenario_file_override)\n runner.registerError(\"scenario_file_override File: #{scenario_file_override} already exists!\")\n return false\n end\n\n scenario_hash = {scenario_file: scenario_file_name}\n #write_size = File.write(scenario_file_override, scenario_hash.to_json)\n write_size = File.write(scenario_file_override, JSON.pretty_generate(scenario_hash))\n if write_size >= 0\n runner.registerFinalCondition(\"saved scenario_file_override.json\")\n else\n runner.registerWarning(\"saved scenario_file_override.json was size zero!\")\n end \n return true\n end", "def take_screenshot(scenario)\n if scenario.failed?\n scenario_name = \"#{(convert_turkish_characters scenario.name)}\"\n scenario_name= scenario_name.split(\" \").join('-').delete(',')\n puts scenario_name\n time = Time.now.strftime(\"%H.%M-%m.%d.%Y\")\n time=time.to_s\n page.save_screenshot(File.absolute_path(\"features/screenshots/FAIL-#{time}-count-#{$screenshot_counter}-#{scenario_name[0..50]}.png\"))\n end\nend", "def smoke_test()\n return [\"case_aaaa\"]\n end", "def augment_fail(send, line)\n @phase = :execute\n @code = make_runnable(@code)\n\n begin\n open(\"log/simplemode.log\", 'a') do |file|\n file.puts '--------------------------------'\n file.puts Time.now\n file.puts '--------------------------------'\n file.puts @augmented_code\n file.puts \"\\n\\n\\n\"\n\n @augmented_code = nil\n end\n ensure\n send.call([\n {:write_file => {:filename => @filename, :content => @code}},\n {:execute => {:command => \"env PYTHONPATH=$LIB$/python #{VM_PYTHON} -B #{@filename}\",\n :stdout => 'executeoutput',\n :stderr => 'executeerror'}}])\n return {:type => :warning, :message => 'Start im vereinfachten Modus.'}\n end\n end", "def stacktrace; end", "def example_passed(example)\n end", "def source_line=(_); end", "def backtrace\n Spec::deprecate(\"ExampleGroupProxy#backtrace\",\"ExampleGroupProxy#location\")\n @backtrace\n end", "def _test_text ; process_test_case(\"text\") ; end", "def prev_line; end", "def previous_code_line(line_number); end", "def pre_process(expectations, source)\n\t\tsource\n\tend", "def failures=(_arg0); end", "def failures=(_arg0); end", "def print_error_ios_app\n puts \"\\nTo run test on iOS App\"\n puts \"\\n Usage : cucumber PLATFORM=iOS APP_PATH=path/to/app\"\nend", "def steps\n find_solution\n end", "def run!\n test_result = Tester::Runner.run(file)\n if test_result.stdout.to_s.strip.empty?\n new_reason = reason\n else\n new_reason = test_result.stdout \n end\n # Capture the exit status, and map to a result object\n result = case test_result.exitstatus\n when 0; Result::Pass\n when 1; Result::Fail\n when 2; Result::Skip\n when nil; Result::NoResult\n else\n new_reason = (test_result.stderr.strip + \"\\n\" + test_result.stdout.strip).strip\n Result::Error\n end\n Tester::Test.new(file, base, result, new_reason, stack)\n end", "def add_meta!(options)\n flow_file = OrigenTesters::Flow.callstack.last\n called_from = caller.find { |l| l =~ /^#{flow_file}:.*/ }\n if called_from\n # Splitting on ':' when file names are included will yield a different index for everything in Windows\n called_from.gsub!(flow_file, '')\n called_from = called_from.split(':')\n options[:source_file] = flow_file # called_from[0]\n options[:source_line_number] = called_from[1].to_i\n end\n end" ]
[ "0.6453773", "0.62225586", "0.6113109", "0.6041522", "0.6041522", "0.59822506", "0.5867729", "0.5698059", "0.56823534", "0.56716484", "0.56681186", "0.56371284", "0.5624875", "0.5608675", "0.5582108", "0.5564949", "0.54617673", "0.5446146", "0.543751", "0.54187435", "0.53808975", "0.5369744", "0.5359077", "0.5319298", "0.531903", "0.5305533", "0.5298609", "0.52975005", "0.52820206", "0.5272438", "0.52624816", "0.5262158", "0.52531224", "0.52487266", "0.52399683", "0.522936", "0.5212372", "0.5206109", "0.52058244", "0.5201787", "0.51976764", "0.51727194", "0.51685244", "0.5163096", "0.51624966", "0.5156974", "0.51522154", "0.5149892", "0.51447314", "0.51415193", "0.512593", "0.51216817", "0.5117425", "0.51031303", "0.5090604", "0.5082311", "0.50803524", "0.508025", "0.5076127", "0.50651586", "0.50602347", "0.50572014", "0.505552", "0.50526625", "0.50462055", "0.5042889", "0.5033798", "0.5024856", "0.50219285", "0.50219285", "0.50219285", "0.500913", "0.4994797", "0.4993898", "0.49877", "0.49862018", "0.49850214", "0.49847102", "0.49814117", "0.49593836", "0.4950422", "0.4943694", "0.49410316", "0.4938566", "0.49380073", "0.49350545", "0.49286813", "0.4923141", "0.49169508", "0.491678", "0.4911671", "0.4908788", "0.49067673", "0.49047983", "0.48981324", "0.48975265", "0.48975265", "0.4895671", "0.48932153", "0.48871034", "0.48782355" ]
0.0
-1
Either return an instance of +Time+ with the same UTC offset as +self+ or an instance of +Time+ representing the same time in the local system timezone depending on the setting of on the setting of +ActiveSupport.to_time_preserves_timezone+.
def to_time preserve_timezone ? getlocal(utc_offset) : getlocal end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_time\n if preserve_timezone\n @to_time_with_instance_offset ||= getlocal(utc_offset)\n else\n @to_time_with_system_offset ||= getlocal\n end\n end", "def in_time_zone(zone = ::Time.zone)\n ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.send!(:get_zone, zone))\n end", "def to_time\n\t\tself.offset == 0 ? ::Time.utc_time(year, month, day, hour, min, sec, sec_fraction * (RUBY_VERSION < '1.9' ? 86400000000 : 1000000)) : self\n\tend", "def local(*args)\n time = Time.utc(*args)\n ActiveSupport::TimeWithZone.new(nil, self, time)\n end", "def time_in_zone\n # Time.zone should be UTC\n Time.zone.at((time+utc_offset)/1000)\n end", "def in_time_zone(new_zone = ::Time.zone)\n return self if time_zone == new_zone\n utc.in_time_zone(new_zone)\n end", "def time\n @time ||= incorporate_utc_offset(@utc, utc_offset)\n end", "def to_time\n if_period(super) do |p,t|\n # Ruby 2.4.0 changed the behaviour of to_time so that it preserves the\n # offset instead of converting to the system local timezone.\n #\n # When self has an associated TimezonePeriod, this implementation will\n # preserve the offset on all versions of Ruby.\n LocalTime.at(t.to_i, t.subsec * 1_000_000).localize(p)\n end\n end", "def current_offset\n ::Time.new.utc_offset\n end", "def to_time\n t = ::Time.at utc_reference\n Time.new t.utc\n end", "def utc\n @utc ||= zone.local_to_utc(@time)\n end", "def utc\n @utc ||= incorporate_utc_offset(@time, -utc_offset)\n end", "def now\n time_now.utc.in_time_zone(self)\n end", "def time\n if @timezone then\n Time.use_zone(@timezone) {\n Time.zone.now\n }\n else\n Time.now\n end\n end", "def convert_to_local_time(utc_time)\n utc_time + Time.current.utc_offset\n end", "def zoneless\n\t\t(self + self.utc_offset).utc\n\tend", "def getutc\n return Time.at(self).utc\n end", "def at(*args)\n Time.at(*args).utc.in_time_zone(self)\n end", "def time_offset\n calc_time_offset unless @time_offset\n @time_offset\n end", "def to_time\n # Thread-safety: It is possible that the value of @time may be\n # calculated multiple times in concurrently executing threads. It is not\n # worth the overhead of locking to ensure that @time is only\n # calculated once.\n\n unless @time\n if @timestamp\n @time = Time.at(@timestamp).utc\n elsif @timestamp_with_offset\n @time = time_with_offset(Time.at(@timestamp_with_offset.timestamp), @timestamp_with_offset.utc_offset)\n else\n # Avoid using Rational unless necessary.\n u = usec\n s = u == 0 ? sec : Rational(sec * 1000000 + u, 1000000)\n @time = Time.new(year, mon, mday, hour, min, s, offset)\n end\n end\n\n @time\n end", "def calc_time_offset\n @last_time_offset = Time.now\n @time_offset = official_time - Time.now.localtime \n end", "def time\n Time.zone = self.time_zone\n Time.zone\n end", "def parsed_time(timezone = patient.timezone)\n self.datetime.in_time_zone(timezone)\n end", "def local_timezone\n tzname = Time.new.zone\n q, r = Time.new.utc_offset.divmod(3600)\n sign = (q < 0) ? '-' : '+'\n tzoffset = sign + \"%02d\" % q.abs.to_s + ':' + r.to_f.div(60).to_s\n \"#{tzname} (UTC#{tzoffset})\"\n end", "def as_of_time\n Conversions.string_to_utc_time attributes_before_type_cast['as_of_time']\n end", "def adjust_timezone(offset)\n if offset\n ActiveSupport::TimeZone[offset]\n adjusted_time = Time.now + offset.seconds\n allow(Time).to receive(:now).and_return(adjusted_time)\n end\nend", "def create_time_in_utc(datetime, tz = nil)\n create_time_in_tz(datetime, tz).in_time_zone(\"Etc/UTC\") # Return the time in UTC\n end", "def time\n Time.now.localtime + self.time_offset\n end", "def tz\n time_zone_adjustment.to_r / (24 * 60)\n end", "def tz\n time_zone_adjustment.to_r / (24 * 60)\n end", "def new_time(year, mon, mday, hour, min, sec, microsec, offset = nil)\n return if year.nil? || (year == 0 && mon == 0 && mday == 0)\n if offset\n time = ::Time.utc(year, mon, mday, hour, min, sec, microsec) rescue nil\n return unless time\n time -= offset\n is_utc? ? time : time.getlocal\n else\n fast_string_to_time_zone.local(year, mon, mday, hour, min, sec, microsec) rescue nil\n end\n end", "def time_convertion(time, time_zone)\n time.getutc.getlocal(time_zone)\n end", "def time\n \tself[:time].try(:in_time_zone, \"Eastern Time (US & Canada)\")\n end", "def adjust_timezone(offset)\n if offset\n ActiveSupport::TimeZone[offset]\n adjusted_time = Time.now + offset.seconds\n Time.stub(:now).and_return(adjusted_time)\n end\n end", "def time_with_offset(time, new_offset)\n time = time.getutc + new_offset\n nsec_part = Rational(time.nsec, 1_000_000_000)\n Time.new(time.year, time.mon, time.mday, time.hour, time.min, time.sec + nsec_part, new_offset)\n end", "def my_now\n utc = Time.now.utc\n now = Time.utc(utc.year, utc.month, utc.day, 6 - timezone)\n end", "def local(*args)\n new(Time.utc(*args), zone)\n end", "def to_time\r\n #MES- From activerecord-1.13.2\\lib\\active_record\\connection_adapters\\abstract\\schema_definitions.rb\r\n # Function was called string_to_time\r\n time_array = ParseDate.parsedate(self)[0..5]\r\n # treat 0000-00-00 00:00:00 as nil\r\n #MES- Next line WAS the following, but we don't have access to Base here\r\n #Time.send(Base.default_timezone, *time_array) rescue nil\r\n Time.utc(*time_array) rescue nil\r\n end", "def local(*args)\n Time.utc(*args)\n end", "def current_timezone_offset\n 0\n end", "def utc_now()\n tz = TZInfo::Timezone.get('Etc/UTC')\n tz.now.to_datetime\n end", "def local_offset\n @time.getlocal.utc_offset\n end", "def localtime(utc_offset = nil)\n utc.getlocal(utc_offset)\n end", "def now\n new(zone.utc_to_local(Time.now.utc), zone)\n end", "def to_time\n # Thread-safety: It is possible that the value of @time may be \n # calculated multiple times in concurrently executing threads. It is not \n # worth the overhead of locking to ensure that @time is only \n # calculated once.\n \n unless @time\n result = if @timestamp\n Time.at(@timestamp).utc\n else\n Time.utc(year, mon, mday, hour, min, sec, usec)\n end\n\n return result if frozen?\n @time = result\n end\n \n @time \n end", "def timezone_with_offset(time, timezone, date)\n date ||= time\n DateTime.new(date.year, date.month, date.day, time.hour, time.min, time.sec, format_offset(timezone))\n end", "def force_zone(time, tzid)\n offset = timezone_offset(tzid, moment: time)\n raise ArgumentError.new(\"Unknown TZID: #{tzid}\") if offset.nil?\n Time.new(time.year, time.month, time.mday, time.hour, time.min, time.sec, offset)\n end", "def current_time\n begin\n Time.parse(self.localtime)\n rescue\n nil\n end\n end", "def convert_to_utc_time(utc_time)\n utc_time - Time.current.utc_offset\n end", "def in_time_zone(tz)\n\n tz_offset = Schedule::Offset.new(Time.now.in_time_zone(tz))\n utc_offset = Schedule::Offset.new(TIMEZONE_ABBREVIATION_NAMES[@timezone] ? Time.now.in_time_zone(TIMEZONE_ABBREVIATION_NAMES[@timezone]) : @timezone, true)\n\n offset = utc_offset\n minute = @minute\n hour = @hour\n day = @day\n\n # This loop firstly changes the minute, hour, and day values to UTC,\n # then changes them from UTC to the timezone in tz\n\n 2.times do\n\n minute += offset.minute\n # Check if the minute value is impossible, i.e. less than 0 or more than 59\n # If so tick increment or decrement the hour value\n if minute < 0\n hour -= 1\n minute = 60 - (-minute)\n elsif minute >= 60\n hour += 1\n minute = minute - 60\n end\n\n hour += offset.hour\n\n if hour < 0\n day -= 1\n hour = 24 - (-hour)\n elsif hour >= 24\n day += 1\n hour = hour - 24\n end\n\n offset = tz_offset\n end\n\n return WeekTime.new(day, hour, minute, second, offset.to_s)\n end", "def with_timezone\n Time.use_zone(current_user_timezone) { yield }\n end", "def getlocal(utc_offset = nil)\n utc = getutc\n\n Time.utc(\n utc.year, utc.month, utc.day,\n utc.hour, utc.min, utc.sec + utc.sec_fraction\n ).getlocal(utc_offset)\n end", "def to_time\n self\n end", "def in_time_zone(zone = ::Time.zone)\n if zone\n ::Time.find_zone!(zone).local(year, month, day)\n else\n to_time\n end\n end", "def tz\n ActiveSupport::TimeZone.new timezone\n end", "def set_timezone\n loc = Location.find(self.location_id)\n self.time_zone, self.localGMToffset = loc.time_zone, loc.localGMToffset\n end", "def set_time_zone\n # Make sure blank is always nil\n self.time_zone = nil if time_zone.blank?\n # If there are coordinates, use them to set the time zone, and reject\n # changes to the time zone if the coordinates have not changed\n if georeferenced?\n if coordinates_changed?\n lat = ( latitude_changed? || private_latitude.blank? ) ? latitude : private_latitude\n lng = ( longitude_changed? || private_longitude.blank? ) ? longitude : private_longitude\n self.time_zone = TimeZoneGeometry.time_zone_from_lat_lng( lat, lng ).try(:name)\n self.zic_time_zone = ActiveSupport::TimeZone::MAPPING[time_zone] unless time_zone.blank?\n elsif time_zone_changed?\n self.time_zone = time_zone_was\n self.zic_time_zone = zic_time_zone_was\n end\n end\n # Try to assign a reasonable default time zone\n if time_zone.blank?\n self.time_zone = nil\n self.time_zone ||= user.time_zone if user && !user.time_zone.blank?\n self.time_zone ||= Time.zone.try(:name) unless time_observed_at.blank?\n self.time_zone ||= 'UTC'\n end\n if !time_zone.blank? && !ActiveSupport::TimeZone::MAPPING[time_zone] && ActiveSupport::TimeZone[time_zone]\n # We've got a zic time zone\n self.zic_time_zone = time_zone\n self.time_zone = if rails_tz = ActiveSupport::TimeZone::MAPPING.invert[time_zone]\n rails_tz\n elsif ActiveSupport::TimeZone::INAT_MAPPING[time_zone]\n # Now we're in trouble, b/c the client specified a valid IANA time\n # zone that TZInfo knows about, but it's one Rails chooses to ignore\n # and doesn't provide any mapping for so... we have to map it\n ActiveSupport::TimeZone::INAT_MAPPING[time_zone]\n elsif time_zone =~ /^Etc\\//\n # If we don't have custom mapping and there's no fancy Rails wrapper\n # and it's one of these weird oceanic Etc zones, use that as the\n # time_zone. Rails can use that to cast times into other zones, even\n # if it doesn't recognize it as its own zone\n time_zone\n else\n ActiveSupport::TimeZone[time_zone].name\n end\n end\n self.time_zone ||= user.time_zone if user && !user.time_zone.blank?\n self.zic_time_zone ||= ActiveSupport::TimeZone::MAPPING[time_zone] unless time_zone.blank?\n if !zic_time_zone.blank? && ActiveSupport::TimeZone::MAPPING[zic_time_zone] && ActiveSupport::TimeZone[zic_time_zone]\n self.zic_time_zone = ActiveSupport::TimeZone::MAPPING[zic_time_zone]\n end\n true\n end", "def v_time_zone_inutilisee\n @time_zone ||= (self.time_zone.blank? ? nil : ActiveSupport::TimeZone[self.time_zone])\n end", "def to_utc_time\n Time.utc(1970, 1, 1, @hour, @minute, @second)\n end", "def create(time)\n TZTime::LocalTime.new(time, @time_zone)\n end", "def as_of_time\n Conversions.string_to_utc_time attributes['as_of_time']\n end", "def convert(local_time, from_time_zone=nil)\n if from_time_zone\n b = self.class.new(from_time_zone)\n t = b.at(local_time).getutc\n utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.usec)\n elsif local_time.respond_to?(:getutc)\n t = local_time.getutc\n utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.usec)\n else\n nil\n end\n end", "def poa_time\n # Check if there's a recipient, and if it has a timezone, it it does use that to set tz\n representative_tz_from_recipient = @hearing.representative_recipient&.timezone\n return normalized_time(representative_tz_from_recipient) if representative_tz_from_recipient.present?\n # If there's a virtual hearing, use that tz even if it's empty\n return normalized_time(@hearing.virtual_hearing[:representative_tz]) if @hearing.virtual_hearing.present?\n\n # No recipient and no virtual hearing? Use the normalized_time fallback\n normalized_time(nil)\n end", "def scheduled_for_time_to_utc\n self.scheduled_for = ActiveSupport::TimeZone\n .new(self.user.timezone)\n .local_to_utc(self.scheduled_for)\n end", "def to_time\n # Thread-safety: It is possible that the value of @time may be\n # calculated multiple times in concurrently executing threads. It is not\n # worth the overhead of locking to ensure that @time is only\n # calculated once.\n\n unless @time\n if @timestamp\n @time = Time.at(@timestamp).utc\n else\n # Avoid using Rational unless necessary.\n u = usec\n s = u == 0 ? sec : Rational(sec * 1000000 + u, 1000000)\n @time = Time.new(year, mon, mday, hour, min, s, offset)\n end\n end\n\n @time\n end", "def set_time_in_time_zone\n return true if time_observed_at.blank? || time_zone.blank?\n return true unless time_observed_at_changed? || time_zone_changed?\n \n # Render the time as a string\n time_s = time_observed_at_before_type_cast\n unless time_s.is_a? String\n time_s = time_observed_at_before_type_cast.strftime(\"%Y-%m-%d %H:%M:%S\")\n end\n \n # Get the time zone offset as a string and append it\n offset_s = Time.parse(time_s).in_time_zone(time_zone).formatted_offset(false)\n time_s += \" #{offset_s}\"\n \n self.time_observed_at = Time.parse(time_s)\n true\n end", "def time_zone=(value)\n if value.is_a? ActiveSupport::TimeZone\n super\n else\n zone = ::Time.find_zone(value) # nil if can't find time zone\n super zone\n end\n end", "def timezone\n @@tz || @@tz = TZInfo::Timezone.get(Time.now.zone)\n end", "def get_time(offset = 0)\n @now += offset + 1\n end", "def curr_date_in_timezone\n Time.now.getlocal(address_timezone_offset)\n end", "def to_zone(aHours=nil)\n\t\taHours ||= utc_offset/3600.0\n\t\tself.in_time_zone(aHours)+self.utc_offset-aHours.to_i.hours\n\tend", "def with_timezone\n Time.use_zone(current_user.try(:get_time_zone)) { yield }\n end", "def to_local_time\n Time.local(1970, 1, 1, @hour, @minute, @second)\n end", "def to_utc_time\n Time.utc(*gregorian_civil_coordinates)\n end", "def utc_offset() end", "def end_at\n super.in_time_zone(time_zone) if super && time_zone\n end", "def utc_offset\n @utc_offset || tzinfo&.current_period&.base_utc_offset\n end", "def utc_offset(time = T.unsafe(nil)); end", "def convert_timezone(time, to_timezone, from_timezone, **options)\n converted_time = time + timezone_difference_in_seconds(to_timezone, from_timezone)\n timezone_with_offset(converted_time, to_timezone, options[:date])\n end", "def local_to_utc(time, dst = true)\n tzinfo.local_to_utc(time, dst)\n end", "def localtime(offset=nil)\n if (0 == ::Time.now.method(:localtime).arity) && !offset.nil?\n raise ArgumentError, \"1.8 Time#localtime doesn't take an arg\"\n else\n @offset = offset\n end\n self\n end", "def to_time\r\n hsh = {:year => Time.now.year, :month => Time.now.month, :day => Time.now.day,\r\n :hour => Time.now.hour, :minute => Time.now.minute, :second => Time.now.second,\r\n :usec => Time.now.usec, :ampm => \"\" }\r\n hsh = hsh.update(self.symbolize_keys)\r\n [:year, :month, :day, :hour, :minute, :second, :usec].each {|key| hsh[key] = hsh[key].to_i }\r\n hsh[:hour] = 0 if hsh[:ampm].downcase == \"am\" && hsh[:hour] == 12\r\n hsh[:hour] += 12 if hsh[:ampm].downcase == \"pm\" && hsh[:hour] != 12\r\n Time.local(hsh[:year], hsh[:month], hsh[:day], hsh[:hour], hsh[:minute], hsh[:second], hsh[:usec])\r\n end", "def local_offset(time = Time.now)\n Time.at(time.to_i).to_datetime.offset\n end", "def time_zone_offset\n @session.chosen_office.time_zone_offset\n end", "def local_time\n iso_time\n end", "def time_zone\n return @time_zone_cache if @time_zone_cache\n\n # Get the office id from the session json store\n id = @session.store[:chosen_office_id]\n office = Office\n .where(business_id: @session.business_id, id: id)\n .first\n\n if office.present?\n @time_zone_cache = office.time_zone\n end\n\n @time_zone_cache\n\n end", "def in_time_zone(time)\n time.in_time_zone(time_zone)\n end", "def getlocal\n return Time.at(self).localtime\n end", "def utc(*args)\n new(zone.utc_to_local(Time.utc(*args)), zone)\n end", "def local_date_time\n # d = [:year, :mon, :day, :hour, :min, :sec].map{|q| @local_date_time.send(q)}\n # d << (utc_offset/24).to_f\n # #puts d\n # DateTime.new(*d) \n tz0 = utc_offset.to_s.split('.')\n tz = (tz0[0][0]=='-' ? '-' : '+')+('00'+tz0[0].to_i.abs.to_s)[-2,2]+':'\n tz += tz0.count>1 ? ('0'+((('.'+tz0[1]).to_f*100).to_i*0.6).to_i.to_s)[-2,2] : '00'\n @local_date_time.to_datetime.change(:offset => tz) ### \"#{utc_offset}:00\")\n end", "def getCurrentTime\n # Determine the current time and determine if we are in DST.\n return Time.mktime(@year, @month, @day, 0, 0, 0).gmtime\n end", "def time_zone=(_arg0); end", "def time_zone=(_arg0); end", "def to_zone(aHours=nil)\n\t\t\taHours ||= utc_offset/3600.0\n\t\t\tself.in_time_zone(aHours)+self.utc_offset-aHours.to_i.hours\n\t\tend", "def create_time_in_tz(datetime, tz = nil)\n if tz && (Time.zone.nil? || tz != Time.zone.name) # If tz passed in and not default tz\n saved_tz = Time.zone\n Time.zone = tz # Temporarily convert to new tz and create the time object\n t = Time.zone.parse(datetime) # Create the time object\n Time.zone = saved_tz # Restore original default\n else # tz not passed in or matches current tz\n t = Time.zone.parse(datetime) # Create the time object\n end\n t\n end", "def time_zone\n super\n end", "def time_zone\n ActiveSupport::TimeZone[\"Wellington\"]\n end", "def local_time_zone\n\tzone_name = ActiveSupport::TimeZone::MAPPING.keys.find do |name|\n\t ActiveSupport::TimeZone[name].utc_offset == Time.now.utc_offset\n\tend\n\tActiveSupport::TimeZone.find_tzinfo(zone_name).identifier\n end", "def __mongoize_time__\n ::Time.configured.local(*self)\n end", "def to_utc_time\n Time.utc(@year, @month, @day, @hour, @minute, @second)\n end" ]
[ "0.7982158", "0.7423729", "0.7405696", "0.71768165", "0.71360373", "0.70437497", "0.69747937", "0.68326616", "0.6791432", "0.6749216", "0.67035496", "0.66578543", "0.66567254", "0.6628229", "0.65607", "0.6537967", "0.6536521", "0.64913", "0.6469843", "0.6462923", "0.6429882", "0.6417778", "0.63835645", "0.6362106", "0.63587356", "0.63304865", "0.63299376", "0.63290375", "0.632356", "0.632356", "0.63105965", "0.62937886", "0.6256469", "0.62376076", "0.62201387", "0.6217662", "0.6211411", "0.6166434", "0.61452085", "0.6116427", "0.61065984", "0.6105998", "0.608415", "0.60716003", "0.60690325", "0.6066718", "0.6059677", "0.60577375", "0.6043623", "0.60333997", "0.6032671", "0.6025532", "0.6013699", "0.6002373", "0.6001221", "0.5986996", "0.598403", "0.59837115", "0.59738594", "0.5963009", "0.5942221", "0.5934674", "0.5932689", "0.5926953", "0.5905701", "0.5895657", "0.58886254", "0.58858913", "0.5884125", "0.58839154", "0.58819467", "0.58676374", "0.5858188", "0.584614", "0.58297515", "0.58175045", "0.5817399", "0.5811049", "0.5802391", "0.5794566", "0.57863736", "0.57763654", "0.57725555", "0.5770798", "0.57675606", "0.5767005", "0.57666326", "0.57637167", "0.5762407", "0.5750262", "0.57466495", "0.57422584", "0.57422584", "0.57372606", "0.5725853", "0.5720802", "0.571594", "0.570834", "0.56924695", "0.5688022" ]
0.7869158
1
Implementing topological sort using both Khan's and Tarian's algorithms
def topological_sort(vertices) sorted = [] queue = [] vertices.each do |vertex| queue << vertex if vertex.in_edges.empty? end until queue.empty? current = queue.shift sorted << current current.out_edges.dup.each do |edge| next_vertex = edge.to_vertex edge.destroy! if next_vertex.in_edges.empty? queue << next_vertex end end end sorted.count == vertices.count ? sorted : [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topological_sort(vertices)\n # kahn_sort(vertices)\n tarjan_sort(vertices)\nend", "def topological_sort(vertices)\n # Khan's algorithm\n sorted_arr = []\n queue = Queue.new\n # in_edges = {}\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.enq(vertex)\n end\n end\n\n # vertices.each do |vertex|\n # in_edge_cost = vertex.in_edges.reduce(0) { |sum, edge| sum += edge.cost }\n # in_edges[vertex] = in_edge_cost\n # queue << vertex if in_edge_cost == 0\n # end\n\n until queue.empty?\n u = queue.deq\n sorted_arr << u\n while u.out_edges.length != 0\n current_edge = u.out_edges[0]\n queue.enq(current_edge.to_vertex) if current_edge.to_vertex.in_edges == [current_edge]\n current_edge.destroy!\n end\n u.out_edges = []\n end\n\n # until queue.empty?\n # current = queue.shift\n #\n # current.out_edges.each do |edge|\n # to_vertex = edge.to_vertex\n # in_edges[to_vertex] -= edge.cost\n # queue << to_vertex if in_edges[to_vertex] == 0\n # end\n #\n # sorted arr << current\n # end\n\n if sorted_arr.length != vertices.length\n return []\n # vertices.length == order.length ? order : []\n end\n\n sorted_arr\n\n # Tarjan's algorithm (without cyce catching)\n # order = []\n # explored = Set.new\n #\n # vertices.each do |vertex|\n # dfs!(order, explored, vertex) unless explored.include?(vertex) #depth-first search\n # end\n #\n # order\n\nend", "def topological_sort(vertices)\n #Kahn's Algorithm\n #queue keeps the nodes that have not been sorted yet\n #whatever is popped off the stack goes to sorted and is done\n queue = []\n sorted = []\n\n #loop through vertices\n vertices.each do |vertex|\n #find vertices with no dependencies and push to queue\n queue << vertex if vertex.in_edges.empty?\n end\n\n #pop off from queue and check the out edges of each\n #after pop, delete the vertex all its out edges\n #push that vertex into the sorted array\n #look at each of the destination nodes and push them onto queue if no in edges\n #do this until the queue is empty\n until queue.empty?\n curr_node = queue.shift\n\n sorted << curr_node\n to_vertices = []\n\n #grabs all the vertices connected to the out edges of the curr_node\n curr_node.out_edges.reverse.each do |out_edge|\n # until curr_node.out_edges.empty?\n\n\n # p out_edge.to_vertex.value\n to_vertices << out_edge.to_vertex\n\n #destroy the edge after using it up\n #destroy not working like how I thought it would, maybe save destroy for after\n\n # out_edge.destroy!\n out_edge.destroy!\n end\n\n #need to check if these vertices are connected to anything after\n #curr_node's out edge deletion\n to_vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n #check all vertices connected by curr_node's out_edges\n #if those\n end\n\n if sorted.length == vertices.length\n return sorted\n else\n return []\n end\n\n \n # easy_read = []\n # sorted.each do |vertex|\n # easy_read << vertex.value\n # end\n # p easy_read\n\n\n\n #Tarjan's Algorithm\nend", "def topological_sort()\n TopologicalSort.new().topological_sort()\n end", "def topological_sort(vertices)\n \nend", "def topological_sort(vertices) # array => # layers of unordered sets (could implement these as subarrays)\n # Kahn's alg. #Coffman-Graham gives deterministic sorting\n #look for vertices w/o @in_edges; add to list\n #look for vertices w/o @in_edges (exclude @in_edges in list)\n #repeat until all vertices in the list\n\n #w/o queue\n list = []\n\n until list.length == vertices.length\n changed = false\n vertices.each do |vertex|\n if !list.include?(vertex) && ( vertex.in_edges.length == 0 ||\n vertex.in_edges.all?{|edge| list.include?(edge.from_vertex)} )\n list.push(vertex)\n changed = true\n end\n end\n\n return [] if !changed\n end\n\n list\n\n # #w/ queue (could also implement by enqueueing out-edges' to-vertices\n # for each node added to list, replacing queue.each w/ until queue.empty?)\n # list = []\n # queue = []\n #\n # full = vertices.length\n #\n # until list.length == full\n # changed = false\n # vertices.each do |vertex|\n # if vertex.in_edges.length == 0 && !list.include?(vertex)\n # queue.push(vertex)\n # end\n # end\n #\n # queue.each do |vertex|\n # vertex.out_edges.each {|edge| edge.destroy!} #causes spec's test to malfunction\n # list.push(queue.shift)\n # changed = true\n # end\n #\n # return [] if !changed\n # end\nend", "def k_topological_sort(vertices)\n topological_order = []\n\n degrees = {}\n #count the number of in edges for each vertex O(|V|)\n vertices.each { |vertex| degrees[vertex] = vertex.in_edges.length }\n\n #Select those with no in edges\n queue = degrees.select { |vertex, length| length == 0 }.keys\n\n until queue.empty?\n topological_order.push(queue.pop)\n\n #for each out edge, decrement the to vertexes incoming\n #edge count by one\n vertex.out_edges.each do |edge|\n degrees[edge.to_vertex] -= 1\n\n #If there are no more in edges, add it to the queue!\n if degrees[edge.to_vertex] == 0\n queue.unshift(edge.to_vertex)\n end\n end\n end\n #When there is a cycle, the queue will be empty before each node will\n #have been checked; therefore the results array will equal\n #the vertex array iff there is a topological ordering.\n if topological_order.length == vertices.length\n topological_order\n else\n []\n end\n end", "def tarian_topological_sort(vertices)\n sorted = []\n visited = Set.new\n\n vertices.each do |vertex|\n dfs!(vertex, visited, sorted) unless visited.include?(vertex)\n end\n\n sorted\nend", "def topo_sort(dependencies) # tarjan's algorithm\n dependencies.default = [] # no need for #default_proc because array never gets mutated\n seen = {}\n ordering = []\n dependencies.keys.each do |vertex|\n resolve!(vertex, dependencies, ordering, seen) unless seen[vertex]\n end\n ordering\nend", "def topological_sort(vertices)\n # visited = Set.new\n # # visited = Array.new(vertices.length, false)\n # cycle = [false]\n # result = []\n #\n # vertices.each do |vertex|\n # unless visited.include?(vertex)\n # visit(vertex, visited, result, cycle)\n # end\n # end\n #\n # if cycle == [true]\n # return []\n # else\n # return result\n # end\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n queue = []\n result = []\n vertices.each do |vert|\n queue << vert if vert.in_edges.empty?\n end\n # byebug\n count = 0\n until queue.empty?\n vertex = queue.pop\n result << vertex\n to_destroy = []\n for i in (0..(vertex.out_edges.length - 1))\n edge = vertex.out_edges[i]\n if edge.to_vertex.in_edges.length == 1\n queue.push(edge.to_vertex)\n end\n to_destroy << edge\n i += 1\n end\n to_destroy.each do |edge|\n edge.destroy!\n end\n count += 1\n end\n result\nend", "def topological_sort\n\t\tcount = size\n\t\t@explored_nodes = Array.new(count, false)\n\t\t@current_label = count\n\t\t@topological_order = Array.new(count, nil)\n\t\tcount.times do |label|\n\t\t\tdfs_topological_order(label) unless @explored_nodes[label]\n\t\tend\n\t\ttopological_order\n\tend", "def topological_sort(vertices)\n sorted = []\n top = new Queue() \n graph.vertices.each do |vertex|\n if vertex.in_edges.empty? \n top.enqueue(vertex)\n end \n end \nd\n until top.empty? \n current = top.pop \n sorted << current \n current.out_edges.each do |edge|\n if edge.destination.in_edges.empty? \n top.enqueue(edges)\n end \n end \n graph.delete_edge(edge)\n graph.delete_vertex(current); \n end \n\n \n\nend", "def topological_sort\n result_size = 0\n result = Array.new(@vertices.length)\n visited = Set.new\n\n visit = lambda { |v|\n return if visited.include? v\n v.successors.each do |u|\n visit.call u\n end\n visited.add v\n result_size += 1\n result[-result_size] = v\n }\n\n @vertices.each do |v|\n next if visited.include? v\n visit.call v\n end\n\n result\n end", "def topological_sort(vertices) # Kahn's Algorithm. Queue is breadth first search\n sorted = []\n top_queue = []\n in_edge_count = Hash.new(0)\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.length\n top_queue.unshift(vertex) if vertex.in_edges.empty?\n end\n until top_queue.empty?\n # debugger\n current = top_queue.pop\n sorted << current\n current.out_edges.each do |edge|\n top_queue.unshift(edge.to_vertex) if in_edge_count[edge.to_vertex] <= 1\n in_edge_count[edge.to_vertex] -= 1\n end\n # current.destroy!\n\n end\n if sorted.length == vertices.length\n return sorted\n else\n return []\n end\nend", "def topological_sort(&blk)\n processed_nodes = []\n unprocessed_allowable_nodes = (0...self.size).map{|i| yield(self, i).size==0 ? self[i] : nil }.compact\n while unprocessed_allowable_nodes.size > 0\n node = unprocessed_allowable_nodes.pop\n processed_nodes.push node\n new_nodes = []\n self.each.with_index do |node, i|\n next if processed_nodes.include?(node) || unprocessed_allowable_nodes.include?(node)\n dependencies = yield(self, i)\n dependencies.reject! {|j| processed_nodes.include?(self[j])}\n if dependencies.size == 0\n unprocessed_allowable_nodes << node\n end\n end\n end\n raise CyclesInTopologicalSort, \"Can't do topological sort on Array; it has cycles\" \\\n unless processed_nodes.size == self.size\n processed_nodes\n end", "def topological_sort(entry, graph_trait = nil)\n topo = []\n worklist = WorkList.new([entry])\n vpcount = Hash.new(0)\n worklist.process { |node|\n topo.push(node)\n succs = graph_trait ? graph_trait.successors(node) : node.successors\n succs.each { |succ|\n vc = (vpcount[succ] += 1)\n preds = graph_trait ? graph_trait.predecessors(succ) : succ.predecessors\n if vc == preds.length\n vpcount.delete(succ)\n worklist.enqueue(succ)\n end\n }\n }\n assert(\"topological_order: not all nodes marked\") { vpcount.empty? }\n topo\n end", "def topological_sort(vertices)\n\n # # Determine the in-degree of each node.\n # in_degrees = []\n #\n # vertices.each do |vertex|\n # in_degrees.push(vertex.in_edges.length)\n # end\n #\n # # Collect nodes with zero in-degree in a queue.\n # queue = []\n # in_degrees.each_with_index do |degree, idx|\n # queue.push(vertices[idx]) if degree == 0\n # end\n #\n # deletelist = []\n # # While the queue is not empty:\n # while(queue.length != 0)\n # # Pop node u from queue,\n # u = queue.shift()\n # # remove u from the graph,\n # vertices.delete(u)\n # # We maintain a list that records in which order the nodes are removed.\n # deletelist.push(u)\n # u.out_edges.each {|edge| edge.destroy!}\n #\n # # check if there is a new node with in-degree zero (among the neighbors of u)\n # in_degrees = []\n # vertices.each do |vertex|\n # in_degrees.push(vertex.in_edges.length)\n # end\n # # If yes, put that node into the queue.\n # in_degrees.each_with_index do |degree, idx|\n # queue.push(vertices[idx]) if (degree == 0) && (queue.include?(vertices[idx]) == false)\n # end\n # end\n #\n # # If the queue is empty:\n # # if we removed all nodes from the graph, return the list\n # return deletelist if vertices == []\n #\n # # else we return an empty list that indicates that an order is not possible due to a cycle\n # return []\n\n #I tried but I don't understand what the spec is saying\n in_edge_counts = {}\n queue = []\n\n vertices.each do |v|\n in_edge_counts[v] = v.in_edges.count\n queue << v if v.in_edges.empty?\n end\n\n sorted_vertices = []\n\n until queue.empty?\n vertex = queue.shift\n sorted_vertices << vertex\n\n vertex.out_edges.each do |e|\n to_vertex = e.to_vertex\n\n in_edge_counts[to_vertex] -= 1\n queue << to_vertex if in_edge_counts[to_vertex] == 0\n end\n end\n\n sorted_vertices\n\n # The time complexity of this implementation is O(2v + 2e)\n\nend", "def topological_sort()\n VERT_MAP.each_key do |key|\n depth_first_traversal(key)\n end\n @sorted_verts.reverse!\n end", "def topo_sort_it(graph)\n discovered = {}\n sorted_list = []\n stack = []\n\n graph.keys.each do |vtx|\n next if discovered[vtx]\n\n stack << [vtx, 0]\n discovered[vtx] = true\n\n while stack != []\n # p stack\n\n top_vtx = stack[-1][0]\n pos = stack[-1][1]\n next_vtx = graph[top_vtx][pos]\n\n if next_vtx\n stack[-1][1] += 1\n stack.push([next_vtx, 0]) unless discovered[next_vtx]\n discovered[next_vtx] = true\n else\n sorted_list << stack.pop.first\n end\n\n end\n end\n\n sorted_list.reverse\nend", "def topological_sort(vertices)\n order = []\n explored = Set.new \n\n vertices.each do |vertex|\n dfs!(order, explored, vertex) unless explored.include?(vertex)\n end \n\n order \n\nend", "def topological_sort(vertices)\n edge_count = {}\n sorted = []\n queue = []\n vertices.each do |vertex|\n edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n current = queue.shift\n sorted << current\n current.out_edges.each do |edge|\n destination = edge.to_vertex\n edge_count[destination] -= 1\n queue << destination if edge_count[destination] == 0\n end\n\n end\n sorted\nend", "def topological_sort(vertices)\n result = []\n queue = []\n visited_nodes = 0\n remaining_vert = vertices.dup\n while result.length < vertices.length\n # print 'hey'\n # print remaining_vert.map{|vert| vert.in_edges.length}\n # print remaining_vert.map{|vert| vert.value}\n remaining_vert.each do |vert|\n if vert.in_edges.length == 0\n queue.push(vert)\n new_vert = []\n remaining_vert.each do |vert2|\n new_vert.push(vert2) unless vert2 == vert\n end\n remaining_vert = new_vert\n end\n end\n # print 'hi'\n # print queue.map{|queue| queue.out_edges.length}\n return [] if remaining_vert.length>0 && queue.length == 0\n next_vert = queue.shift()\n next_vert.out_edges.each do |edge|\n edge.destroy!\n end\n result.push(next_vert)\n # print result.map{|queue| queue.out_edges.length}\n visited_nodes+=1\n end\n result\nend", "def topsort(start = nil, &block)\n result = []\n go = true\n back = Proc.new { |e| go = false }\n push = Proc.new { |v| result.unshift(v) if go }\n start ||= vertices[0]\n dfs({ :exit_vertex => push, :back_edge => back, :start => start })\n result.each { |v| block.call(v) } if block\n result\n end", "def topological_sort(vertices)\n order = []\n explored = Set.new\n temp = Set.new\n cycle = false\n vertices.each do |vertex|\n cycle = dfs!(order,explored,vertex,temp,cycle) unless explored.include?(vertex)\n return [] if cycle\n end\n order\nend", "def topological_sort(vertices)\n order = []\n explored = Set.new\n temp = Set.new\n cycle = false\n\n vertices.each do |vertex|\n cycle = dfs!(order, explored, vertex) unless explored.include?(vertex)\n return [] if cycle\n end\n\n order\nend", "def topological_sort(vertices)\n next_vertex = Queue.new\n result = []\n vertices.each do |vertex|\n next_vertex.push(vertex) if vertex.in_edges.length < 1\n end\n\n while !next_vertex.empty?\n vertex = next_vertex.pop\n vertex.out_edges.each do |edge|\n new_vertex = edge.to_vertex\n next_vertex.push(new_vertex) if new_vertex.in_edges.length <= 1\n end\n vertex.out_edges.each{|edge| edge.destroy!}\n result.push(vertex)\n end\n result\nend", "def topological_sort(vertices)\n visited = vertices.map { |v| [v, false] }.to_h\n result = []\n visited.each do |vertex, status|\n begin\n visit(vertex, visited, result) unless status\n rescue\n result = []\n break\n end\n end\n result\nend", "def topological_sort(vertices)\n sorted = []\n queue = []\n in_edge_counts = {}\n\n vertices.each do |vertex|\n in_edge_counts[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n sorted << current\n\n current.out_edges.each do |edge|\n destination = edge.to_vertex\n in_edge_counts[destination] -= 1\n queue << destination if in_edge_counts[destination] == 0\n end\n end\n sorted\nend", "def topological_sort(vertices)\n queue = []\n result = []\n count = {}\n vertices.each do |vertex|\n count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n vertex = queue.shift\n result << vertex\n vertex.out_edges.each do |edge|\n to = edge.to_vertex\n count[to] -= 1\n queue << to if count[to] == 0\n end\n end\n if count.values.reduce(:+).zero?\n result\n else\n []\n end\nend", "def topological_sort_khans(vertices)\n sorted = []\n queue = []\n in_degrees = {}\n\n vertices.each do |vertex|\n queue.unshift(vertex) if vertex.in_count == 0\n in_degrees[vertex] = vertex.in_count\n end\n\n until queue.empty?\n current = queue.pop\n sorted << current\n\n current.out_edges.each do |edge|\n destination = edge.to_vertex\n\n in_degrees[destination] -= 1\n queue.unshift(destination) if in_degrees[destination] == 0\n end\n\n end\n\n sorted\nend", "def topological_sort(vertices)\n res = []\n queue = []\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n vertex = queue.shift\n res << vertex\n out_edges = vertex.out_edges.dup\n out_edges.each do |edge|\n queue << edge.to_vertex if edge.to_vertex.in_edges.length == 1\n edge.destroy!\n end\n end\n res\nend", "def topological_sort(vertices)\n out_queue = []\n sorted = []\n sorted_hash = {}\n\n until sorted.length == vertices.length \n out_queue = vertices.select do |v| \n v.in_edges.empty? && !sorted_hash.include?(v.value)\n end\n # Break if Cyclic/Disconnected Graph\n return [] if out_queue.empty?\n\n until out_queue.empty?\n vertice = out_queue.shift\n sorted << vertice\n sorted_hash[vertice.value] = true\n vertice.out_edges[0].destroy! until vertice.out_edges.empty?\n end\n end\n\n sorted\nend", "def topological_sort(vertices)\n return []\nend", "def topological_sort(vertices)\n order = []\n explored = Set.new\n\n vertices.each do |vertex|\n dfs!(order, explored, vertex) unless explored.include?(vertex)\n end\n\n order\nend", "def topological_sort(vertices)\n sorted = []\n top = []\n\n vertices.each do |vertx|\n if vertx.in_edges.empty?\n top << vertx\n end\n end\n\n until top.empty?\n current = top.pop\n sorted << current\n\n edges = current.out_edges.dup\n\n edges.each do |edge|\n\n destination = edge.to_vertex\n\n edge.destroy!\n\n if destination.in_edges.empty?\n top << destination\n end\n\n end\n\n end\n return sorted if sorted.length == vertices.length\n []\nend", "def topological_sort(vertices)\n results = []\n queue = []\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue << vertex\n end\n end\n\n until queue.empty?\n current_node = queue.pop\n current_node.out_edges.each do |node|\n node.destroy!\n end\n end\nend", "def topological_sort(vertices)\n list = []\n queue = []\n\n queue = enqueue(vertices, queue)\n\n until queue.empty?\n vertex = queue.shift\n list << vertex\n\n new_vertices = vertex.out_edges.map(&:to_vertex)\n out_edges = vertex.out_edges.dup\n\n out_edges.each(&:destroy!)\n vertex.out_edges = []\n\n queue = enqueue(new_vertices, queue)\n end\n\n list.length == vertices.length ? list : []\nend", "def topological_sort(vertices)\n in_edges = {}\n result = []\n queue = vertices.select do |vertex|\n in_edges[vertex] = vertex.in_edges.length\n vertex.in_edges.empty?\n end\n\n until queue.empty?\n vertex = queue.pop\n result.push(vertex)\n vertex.out_edges.map(&:to_vertex).each do |vertex|\n in_edges[vertex] -= 1\n queue.unshift(vertex) if in_edges[vertex] == 0\n end\n end\n in_edges.all?{|vertex,count| count == 0} ? result : []\n\nend", "def topological_sort(vertices)\n queue = Queue.new\n sorted_arr = []\n in_edges_count = {}\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n in_edges_count[vertex] = vertex.in_edges.length\n end\n\n until queue.empty?\n test_vertex = queue.shift\n\n sorted_arr << test_vertex\n test_vertex.out_edges.each do |edge|\n destination_vertex = edge.to_vertex\n in_edges_count[destination_vertex] -= 1\n queue << destination_vertex if in_edges_count[destination_vertex].zero?\n end\n end\n\n return [] if sorted_arr.length < vertices.length\n sorted_arr\nend", "def topological_sort(vertices)\n in_edge_count = {}\n list = []\n queue = []\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n u = queue.shift\n list << u\n u.out_edges.each do |vertex|\n to_vertex = vertex.to_vertex\n in_edge_count[to_vertex] -= 1\n queue << to_vertex if in_edge_count[to_vertex] == 0\n end\n end\n list\nend", "def sort\n # Find a cycle in the move graph and pick a register to spill to break it.\n spillee = nil\n each_strongly_connected_component do |component|\n if component.size > 1\n fail if spillee # There is one cycle with 3 registers.\n spillee = component.first.src\n end\n end\n\n # Break the cycle.\n spill(spillee) if spillee\n\n tsort\n end", "def topological_sort(vertices)\n sorted = []\n top = []\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top << vertex\n end\n end\n\n until top.empty?\n vertex = top.shift\n sorted << vertex\n neighbors = vertex.out_edges.map(&:to_vertex)\n\n vertex.disconnect!\n\n neighbors.each do |neighbor|\n if neighbor.in_edges.empty?\n top << neighbor\n end\n end\n end\n\n return sorted if sorted.length == vertices.length\n\n []\nend", "def topological_sort(vertices)\n queue = []\n result = []\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.push(vertex)\n end\n end\n\n until queue.empty?\n vertex = queue.shift\n result << vertex\n\n vertex.out_edges.dup.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue.push(edge.to_vertex) \n end\n edge.destroy!\n end\n end\n \n if vertices.length == result.length\n return result\n else\n return []\n end\nend", "def topological_sort(vertices)\n sorted = []\n top = []\n \n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top << vertex\n end\n end\n\n until top.empty?\n current = top.pop\n sorted << current\n current.out_edges.each do |edge|\n if edge.to_vertex.in_edges.empty?\n top << edge.to_vertex\n end\n edge.destroy!\n end\n vertices.delete(current)\n end\n sorted\nend", "def topological_sort(vertices)\n in_edge_counts = {}\n sorted = []\n queue = []\n\n vertices.each do |vertex|\n in_edge_counts[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n sorted << current\n\n current.out_edges.each do |edge|\n in_edge_counts[edge.to_vertex] -= 1\n queue << edge.to_vertex if in_edge_counts[edge.to_vertex] == 0\n end\n\n end\n\n sorted.length == 2 ? [] : sorted\nend", "def topological_sort(vertices)\n queue = []\n list = []\n\n vertices.each do |v|\n if v.in_edges.empty?\n queue << v\n end\n end\n\n\n while queue.length > 0\n curr = queue.shift\n list << curr\n\n (curr.out_edges.length-1).downto(0) do |i|\n if curr.out_edges[i].to_vertex.in_edges.length == 1\n queue << curr.out_edges[i].to_vertex\n end\n curr.out_edges[i].destroy!\n end\n end\n\n vertices.length == list.length ? list : []\nend", "def topsort\n graph = RGL::DirectedAdjacencyGraph.new\n # init vertices\n items = @normal_sources\n items.each {|item| graph.add_vertex(item) }\n # init edges\n items.each do |item|\n item.dependencies.each do |dependency|\n # If we can find items that provide the required dependency...\n # (dependency could be a wildcard as well, hence items)\n dependency_cache[dependency] ||= provides_tree.glob(dependency)\n # ... we draw an edge from every required item to the dependant item\n dependency_cache[dependency].each do |required_item|\n graph.add_edge(required_item, item)\n end\n end\n end\n\n begin\n graph.topsorted_vertices\n rescue RGL::TopsortedGraphHasCycles => e\n output_cycles(graph)\n raise e # fail fast\n end\n end", "def topological_sort(vertices)\n sorted = []\n top = Queue.new\n vertices.each do |vertex|\n if vertex.in_edges.empty? \n top.enq(vertex)\n end\n end\n\n until top.empty?\n current = top.pop\n sorted << current\n while current.out_edges.length != 0\n edge = current.out_edges[0]\n if edge.to_vertex.in_edges == [edge]\n top.enq(edge.to_vertex)\n end\n edge.destroy!\n end\n\n end\n\n if sorted.length != vertices.length\n return []\n end\n\n sorted\nend", "def topological_sort(vertices)\n #Khan's\n sorted = []\n top = []\n has_in_edges = {}\n\n # O(|v|) time\n #take vertex if it has no in-edges\n vertices.each do |vertex|\n has_in_edges[vertex] = vertex.in_edges.length\n if vertex.in_edges.empty?\n top.push(vertex)\n end\n end\n\n # O(|e| set) time\n until top.empty?\n current = top.shift\n sorted.push(current)\n current.out_edges.each do |edge|\n to_vertex = edge.to_vertex\n has_in_edges[to_vertex] -= 1\n if has_in_edges[to_vertex] == 0\n top.push(to_vertex)\n end\n end\n\n end\n\n return sorted if sorted.length == vertices.length\n []\nend", "def topological_sort(vertices)\n sorted = []\n top_nodes_queue = []\n\n vertices.each do |vertix|\n top_nodes_queue.push(vertix) if vertix.in_edges.length == 0\n end\n\n until top_nodes_queue.empty?\n unpopped = top_nodes_queue.shift\n sorted << unpopped\n\n (unpopped.out_edges.length - 1).downto(0).each do |index|\n edge = unpopped.out_edges[index]\n if edge.to_vertex.in_edges.length == 1\n\n top_nodes_queue.push(edge.to_vertex)\n end\n to_vertex = edge.to_vertex\n edge.destroy!\n end\n end\n\n return [] unless vertices.length == sorted.length\n sorted\nend", "def topological_sort(vertices)\n\n sorted = []\n sub_ans = []\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n sub_ans.push(vertex)\n end\n end\n\n return sub_ans if sub_ans.empty?\n\n until sub_ans.empty?\n current = sub_ans.shift\n sorted << current\n current.out_edges.each do |edge|\n edge.to_vertex.in_edges.delete(edge)\n if edge.to_vertex.in_edges.empty?\n sub_ans.push(edge.to_vertex)\n end\n end\n end\n if sorted.length < vertices.length\n return []\n end\n sorted\nend", "def topological_sort(vertices)\n in_edge_store = {}\n queue = []\n\n vertices.each do |vertex|\n in_edge_store[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n ordered_vertices = []\n until queue.empty?\n current_vertex = queue.shift\n ordered_vertices << current_vertex\n current_vertex.out_edges.each do |edge|\n next_vertex = edge.to_vertex\n in_edge_store[next_vertex] -= 1\n queue << next_vertex if in_edge_store[next_vertex] == 0\n end\n end\n\n ordered_vertices\nend", "def topological_sort(vertices)\n vertex_queue = []\n sorted_queue = []\n\n vertex_count = {}\n\n #vertex queue has vertex which do not have any in_edges\n vertices.each do |vertex|\n vertex_count[vertex] = vertex.in_edges.count\n vertex_queue << vertex if vertex.in_edges.empty?\n end\n\n # while !vertex_queue.empty?\n until vetex_queue.empty?\n new_vertex = vertex_queue.shift\n sorted_queue << new_vertex\n\n new_vertex.out_edges.each do |out|\n to_vertex = out.to_vertex\n\n vertex_count[to_vertex] -= 1\n vertex_queue << to_vertex if vertex_count[to_vertex] == 0\n end\n end\n sorted_queue\nend", "def topological_sort(vertices)\n output = []\n # visited does not record leaf nodes unless there's a loop\n visited = []\n until vertices.empty?\n random_node = vertices[rand(vertices.length)]\n vertices.delete(random_node)\n dfs(random_node, output)\n end\n # if loop\n # if output.length == visited.length\n # return []\n # end\n return [] if output.nil?\n # if not loop\n # visited.each do |node|\n # p node.value\n # end\n output.reverse\nend", "def dfs_topological_sort\n # sorted by finished time reversely and collect node names only\n timestamp, = self.depth_first_search\n timestamp.sort {|a,b| b[1][1] <=> a[1][1]}.collect {|x| x.first }\n end", "def sort(array_of_nodes, order); end", "def topological_sort(vertices)\n in_edge_count = {}\n queue = []\n visited = {}\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n sorted = []\n\n until queue.empty?\n vertex = queue.pop\n sorted << vertex\n\n vertex.out_edges.each do |edge|\n to_vertex = edge.to_vertex\n in_edge_count[to_vertex] -= 1\n queue << to_vertex if in_edge_count[to_vertex] == 0\n end\n end\n sorted.length == vertices.length ? sorted : []\nend", "def topological_sort(vertices)\n queue = []\n sorted = []\n # keep track of vertex in_edges count so that\n # it doesnt get prematurely pushed into queue\n count = {}\n\n # find started vertexes\n vertices.each do |vertex|\n queue.push(vertex) if vertex.in_edges.empty?\n count[vertex] = vertex.in_edges.count\n end\n\n until queue.empty?\n vertex = queue.shift\n sorted << vertex\n vertex.out_edges.each do |edge|\n vert = edge.to_vertex\n count[vert] -= 1\n queue.push(vert) if count[vert] == 0\n end\n end\n\n sorted.count == vertices.count ? sorted : []\nend", "def topological_sort(vertices)\n sorted, queue = [], []\n\n vertices.each do |vtx|\n queue << vtx if vtx.in_edges.empty?\n end\n\n until queue.empty?\n next_vtx = queue.shift\n sorted << next_vtx\n #enumerable tracks index so destroy throws\n #off the each method\n until next_vtx.out_edges.empty?\n edge = next_vtx.out_edges.first\n dependent = edge.to_vertex\n edge.destroy!\n if dependent.in_edges.empty?\n queue << dependent\n end\n end\n vertices.delete(next_vtx)\n end\n return [] if vertices.count > 0\n sorted\nend", "def topological_sort(vertices)\n count = {}\n sorted = []\n free_queue = []\n\n vertices.each do |vertex|\n count[vertex.value] = vertex.in_edges.length\n if vertex.in_edges.empty?\n free_queue.unshift(vertex)\n end\n end\n\n until free_queue.empty?\n # debugger\n current = free_queue.pop\n # p free_queue.map{|e|e.value}\n sorted << current\n # p current.out_edges.length\n verts = []\n current.out_edges.each do |edge|\n count[edge.to_vertex.value] -= 1\n # vert = edge.to_vertex\n # verts << vert\n end\n\n\n vertices.each do |vertex|\n free_queue.unshift(vertex) if count[vertex.value] == 0 && sorted.index(vertex).nil?\n end\n\n end\n sorted = sorted.uniq\n return [] if sorted.length != vertices.length\n sorted\nend", "def topological_sort(vertices)\n num_edges = {}\n queue = []\n\n vertices.each do |vertex|\n num_edges[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n sorted = []\n\n while queue.length > 0\n vertex = queue.shift\n sorted.push(vertex)\n\n vertex.out_edges.each do |edge|\n to_vertex = edge.to_vertex\n\n num_edges[to_vertex] -= 1\n if num_edges[to_vertex] == 0\n queue.push(to_vertex)\n end\n end\n end\n\n if sorted.length == vertices.length\n sorted\n else\n []\n end\nend", "def topological_sort(vertices)\n sorted = []\n queue = []\n vertices.each do |v|\n queue << v if v.in_edges.empty?\n end\n until queue.empty?\n u = queue.shift\n until u.out_edges.empty?\n e = u.out_edges.pop\n v = e.to_vertex\n e.destroy!\n queue << v if v.in_edges.empty?\n end\n sorted << u\n vertices.delete(u)\n end\n vertices.empty? ? sorted : []\nend", "def topological_sort(graph)\n queue = []\n graph.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n sorted_result = []\n until queue.empty?\n curr_vertex = queue.shift\n curr_vertex.out_edges.reverse_each do |edge|\n edge.destroy!\n end\n sorted_result << curr_vertex\n graph.delete(curr_vertex)\n graph.each do |vertex|\n queue << vertex if vertex.in_edges.empty? && !queue.include?(vertex)\n end\n end\n graph.length.zero? ? sorted_result : []\nend", "def topological_sort(vertices)\n queue = vertices.select { |vertex| vertex.in_edges.empty? }\n sorted_vertices = []\n\n until queue.empty?\n vertex = queue.shift\n vertices.delete(vertex)\n vertex.out_edges.length.times do\n out_edge = vertex.out_edges[0]\n to_vertex = out_edge.to_vertex\n queue.push(to_vertex) if to_vertex.in_edges.length == 1\n out_edge.destroy!\n end\n\n sorted_vertices.push(vertex)\n end\n\n vertices.empty? ? sorted_vertices : []\nend", "def topological_sort(vertices)\n queue = []\n order = []\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n curr = queue.shift\n neighbors = []\n curr.out_edges.each {|edge| neighbors << edge.to_vertex }\n\n curr.out_edges.each {|edge| edge.destroy!}\n\n neighbors.each do |adj|\n queue << adj unless queue.include?(adj)\n end\n\n vertices.delete(curr)\n order << curr\n end\n\n return [] unless order.uniq.length == order.length\n order\nend", "def topological_sort(vertices)\n sorted = []\n queue = []\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current_vert = queue.shift\n sorted << current_vert\n current_vert.out_edges.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue << edge.to_vertex\n end\n end\n current_vert.out_edges.each do |edge|\n edge.destroy!\n end\n end\n\n return [] if sorted.length < vertices.length\n sorted\nend", "def topological_sort(vertices)\n queue = []\n result = []\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.push(vertex)\n end\n end\n\n until queue.empty?\n vertex = queue.shift\n result << vertex\n\n vertex.out_edges.reverse.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue.push(edge.to_vertex)\n end\n edge.destroy!\n end\n end\n\n if vertices.length == result.length\n return result\n else\n return []\n end\nend", "def topological_sort\r\n l = []\r\n @visited = {}\r\n s = @charNodes - @adjGraph.keys\r\n s.each do |node|\r\n visit node, l\r\n end\r\n @sortedAlphabet = l\r\n end", "def topological_sort(vertices)\n queue = fill_queue(vertices)\n result = []\n \n i = 0\n while queue \n vert = queue.pop\n vert.out_edges.map do |edge|\n queue.unshift(edge.to_vertex)\n edge.destroy! \n end\n result << vert\n fill_queue(vertices) if queue.empty? && !(vertices.empty?)\n end\n\n return vertices.empty? ? [] : result\nend", "def topology_sort\n topology = []\n permanently_visited = Set.new\n temporary_visited = []\n loop do\n next_task = each_task.find do |task|\n not (permanently_visited.include? task or temporary_visited.include? task)\n end\n return topology unless next_task\n visit(next_task, permanently_visited, temporary_visited).each do |task|\n topology.insert 0, task\n end\n end\n topology\n end", "def topo_sort_rec_wrap(graph, discovered = {}, sorted_list = [])\n graph.keys.each do |vtx|\n next if discovered[vtx]\n topo_sort_rec(graph, vtx, discovered, sorted_list)\n sorted_list << vtx\n end\n sorted_list.reverse\nend", "def topological_sort(vertices)\n arr = []\n next_v = []\n \n vertices.each do |v|\n if v.in_edges.empty?\n next_v.push(v) \n end \n end\n while next_v.length > 0\n current = next_v.shift\n arr.push(current)\n \n while current.out_edges.length > 0\n edge = current.out_edges.pop\n if edge.to_vertex.in_edges.length == 1\n next_v.push(edge.to_vertex) \n end \n edge.destroy!\n end\n end\n \n arr.length == vertices.length ? arr : []\n end", "def topological_sort(vertices)\n queue = []\n order = []\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n order << current\n\n current.out_edges.dup.each do |edge|\n to_vert = edge.to_vertex\n queue << to_vert if to_vert.in_edges.count <= 1\n edge.destroy!\n end\n end\n\n order.length == vertices.length ? order : []\nend", "def topological_sort(vertices)\n queue = []\n order = []\n in_edge_count = {}\n\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queeue.shift\n order << current\n\n current.out_edges.each do |edge|\n to_vert = edge.to_vertex\n in_edge_count[to_vert] -= 1\n queue << to_vert if in_edge_count[to_vert] == 0\n end\n\n end\n\n order.length == vertices.length ? order : []\nend", "def topological_sort(vertices)\n queue = []\n list = []\n new_to_list = []\n\n vertices.each do |vertex|\n queue.push(vertex) if vertex.in_edges.length == 0\n end\n\n while queue.length > 0\n new_to_list = [].concat(queue)\n\n while !queue.empty?\n vertex = queue.pop\n end\n\n # Add neighbors of removed wo in edges\n new_to_list.each do |vertex|\n vertex.out_edges.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue << edge.to_vertex\n end\n edge.destroy!\n end\n end\n\n # Add new_to_list to list\n list = list.concat(new_to_list)\n new_to_list = []\n end\n\n if vertices.length == list.length\n return list\n else\n return []\n end\nend", "def topological_sort(vertices)\n sorted = []\n top = Queue.new\n # collect node with no in edges\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top.enq(vertex)\n vertices.delete(vertex)\n end\n end\n\n # While the queue is not empty\n while !top.empty?\n current = top.pop\n sorted.push(current)\n\n # destroy edges\n counter = current.out_edges.length - 1\n while counter >= 0\n current.out_edges[counter].to_vertex.in_edges.delete(current.out_edges[counter])\n current.out_edges[counter]\n counter -= 1\n end\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top.enq(vertex)\n vertices.delete(vertex)\n end\n end\n end\n\n return [] if !vertices.empty?\n sorted\nend", "def topological_sort(vertices)\n queue = []\n list = []\n vertices.each { |vertex| queue << vertex if vertex.in_edges.empty? }\n\n until queue.empty?\n removal = queue.shift\n list << removal\n\n removal.out_edges.each do |edge|\n outer_vertex = edge.to_vertex\n\n outer_vertex.in_edges.delete(edge)\n\n queue << outer_vertex if outer_vertex.in_edges.empty?\n end\n end\n\n return list if list.length == vertices.length\n\n []\nend", "def topological_sort(vertices)\n sorted = []\n top = []\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top.push(vertex)\n end\n end\n until top.empty?\n current = top.pop\n sorted.push(current)\n current.out_edges.each do |edge|\n if (edge.to_vertex.in_edges - [edge]).empty?\n top.push(edge.to_vertex)\n end\n end\n current.out_edges.each do |edge|\n edge.destroy!\n end\n # vertices.delete(current)\n end\n sorted.length == vertices.length ? sorted : []\nend", "def topological_sort(vertices)\n sorted = []\n top_queue = []\n # vertices_hash = {}\n\n # vertices.each { |vertex| vertices_hash[vertex] = true }\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top_queue << vertex\n end\n end\n\n until top_queue.empty?\n current_vertex = top_queue.shift\n sorted << current_vertex\n\n until current_vertex.out_edges.empty?\n edge = current_vertex.out_edges[0]\n neighbor = edge.to_vertex\n edge.destroy!\n\n if neighbor.in_edges.empty?\n top_queue.push(neighbor)\n end\n\n end\n # vertices_hash.delete(current_vertex)\n end\n\n # vertices_hash.empty? ? sorted : []\n # Or\n sorted.length == vertices.length ? sorted : []\nend", "def topological_sort(vertices)\n queue = vertices.select { |node| node.in_edges.length == 0 }\n ordered_list = []\n\n degree = {}\n vertices.each { |node| degree[node.value] = node.in_edges.length }\n\n until queue.empty?\n curr_node = queue.pop\n ordered_list << curr_node\n\n curr_node.out_edges .map { |edge| edge.to_vertex }\n .each { |child| degree[child.value] -= 1 }\n\n queue = vertices.select do |node|\n degree[node.value] == 0 && !queue.include?(node) && !ordered_list.include?(node)\n end + queue\n end\n\n return degree.all? { |_, v| v == 0 } ? ordered_list : []\nend", "def topological_sort(vertices)\n list = []\n sorted = []\n count_set = {}\n\n vertices.each do |vertex|\n count_set[vertex] = vertex.in_edges.count\n list << vertex if vertex.in_edges.empty?\n end\n\n until list.empty?\n vertex = list.shift\n sorted << vertex\n\n vertex.out_edges.each do |edge|\n to = edge.to_vertex\n count_set[to] -= 1\n list << to if count_set[to] == 0\n end\n end\n\n if sorted.length == vertices.length\n sorted\n else\n []\n end\nend", "def install_order2(arr)\n arr.select! {|el| el[1] }\n hash = {}\n arr.each do |package|\n hash[package[0]] = Vertex.new(package[0]) unless hash[package[0]]\n hash[package[1]] = Vertex.new(package[1]) unless hash[package[1]]\n Edge.new(hash[package[1]],hash[package[0]])\n end\n topological_sort(hash.values).map {|vert| vert.value }\nend", "def topsort\n degree = {}\n zeros = []\n result = []\n\n # Collect each of our vertices, with the number of in-edges each has.\n @vertices.each do |name, wrapper|\n edges = wrapper.in_edges\n zeros << wrapper if edges.length == 0\n degree[wrapper.vertex] = edges\n end\n\n # Iterate over each 0-degree vertex, decrementing the degree of\n # each of its out-edges.\n while wrapper = zeros.pop do\n result << wrapper.vertex\n wrapper.out_edges.each do |edge|\n degree[edge.target].delete(edge)\n zeros << @vertices[edge.target] if degree[edge.target].length == 0\n end\n end\n\n # If we have any vertices left with non-zero in-degrees, then we've found a cycle.\n if cycles = degree.find_all { |vertex, edges| edges.length > 0 } and cycles.length > 0\n message = cycles.collect { |vertex, edges| edges.collect { |e| e.to_s }.join(\", \") }.join(\", \")\n raise Puppet::Error, \"Found dependency cycles in the following relationships: %s; try using the '--graph' option and open the '.dot' files in OmniGraffle or GraphViz\" % message\n end\n\n return result\n end", "def topological_sort(vertices)\n result = []\n visited = {}\n #Set visited hash to all false\n vertices.each { |vertex| visited[vertex] = false }\n\n # Until all nodes are visited\n until visited.all? { |vertex, visited| visited }\n\n #find the unvisited items.\n non_visited_vertices = visited.reject { |vertex, visited| visited }.keys\n\n #visit any unvisited vertex (arbitrarily the first)\n has_no_cycle = visit(non_visited_vertices[0],\n result, visited)\n\n # If there is a cycle then return an empty array.\n return [] if !has_no_cycle\n end\n\n #Return the result.\n result\n end", "def topological_sort(vertices)\n queue = []\n list = []\n vertices.each { |vertex| queue << vertex if vertex.in_edges.empty? }\n\n until queue.empty?\n removal = queue.shift\n list << removal\n\n removal.out_edges.each do |edge|\n outer_vertex = edge.to_vertex\n # remove the edge\n outer_vertex.in_edges.delete(edge)\n # check if that vertex has no more in_edges\n queue << outer_vertex if outer_vertex.in_edges.empty?\n end\n end\n # if successfully remove all vertices => the list will hold all the vertices => same length, else, it is not succeeded\n list.length == vertices.length ? list : []\nend", "def smooth_sort(array)\n orders = [0]\n trees = 0\n\n (0...array.length).each do |i|\n if trees > 1 && orders[trees - 2] == orders[trees - 1] + 1\n trees -= 1\n orders[trees - 1] += 1\n elsif trees > 0 && orders[trees - 1] == 1\n orders[trees += 1] = 0\n else\n orders[trees += 1] = 1\n end\n find_and_sift(array, i, trees - 1, orders)\n end\n (array.length - 1).downto(1) do |i|\n if orders[trees - 1] <= 1\n trees -= 1\n else\n right_index = i - 1\n left_index = right_index - LEONARDO_NUMS[orders[trees - 1] - 2]\n trees += 1\n orders[trees - 2] -= 1\n orders[trees - 1] = orders[trees - 2] - 1\n find_and_sift(array, left_index, trees - 2, orders)\n find_and_sift(array, right_index, trees - 1, orders)\n end\n end\n array\nend", "def sorted_with_order\n # Identify groups of nodes that can be executed concurrently\n groups = tsort_each.slice_when { |a, b| parents(a) != parents(b) }\n\n # Assign order to each node\n i = 0\n groups.flat_map do |group|\n group_with_order = group.product([i])\n i += group.size\n group_with_order\n end\n end", "def sort\n\n arr_len = @data.length\n start_build_idx = arr_len / 2 - 1 # The last half of the array is just leaves\n\n for i in (start_build_idx).downto(0)\n\n max_heapify(@data, arr_len, i) # Build the heap from the array\n end\n\n for i in (arr_len-1).downto(0)\n\n swap(@data, i, 0) # Move the current root to the end of the array\n max_heapify(@data, i, 0) # Heapify the remaining part of the array excluding the root which was just sorted to the end\n end\n\n puts(@data)\n end", "def tsort_each_node # :yields: node\n raise NotImplementedError.new\n end", "def install_order(arr)\n vertices = {}\n max = 0 \n arr.each do |tuple|\n vertices[tuple[0]] = Vertex.new(tuple[0]) unless verticles[tuple[0]]\n vertices[tuple[1]] = Vertex.new(tuple[1]) unless verticles[tuple[1]]\n # create an edge for each pair \n\n Edge.new(vertices[tuple[1]], vertices[tuple[0]])\n\n max = tuple.max if tuple.max > max \n end \n\n independent = []\n (1..max).each do |i| \n independent << i unless vertices[i]\n end \n\n independent + topological_sort(vertices.values).map { |v| v.value }\nend", "def install_order(arr)\n values = (1..arr.flatten.max).to_a\n vertices = values.map { |val| Vertex.new(val) }\n\n arr.each do |tuple|\n dependency = vertices[tuple[1] - 1]\n package = vertices[tuple[0] - 1]\n Edge.new(dependency, package)\n end\n\n topological_sort(vertices).map(&:value)\nend", "def tsort_cyclic(graph)\n fag = feedback_arc_graph(graph)\n reduced_graph = subtract_edges_graph(graph, fag)\n GraphHash.from(reduced_graph).tsort\n end", "def sort(start = nil, &block)\n result = []\n push = Proc.new { |v| result.unshift(v) }\n start ||= vertices[0]\n dfs({ :exit_vertex => push, :start => start })\n result.each { |v| block.call(v) } if block\n result\n end", "def tarjan_recursive\n @t_index = 0\n @t_stack = []\n @tg_index = {}\n @tg_lowlink = {}\n @t_result = []\n\n @g.each_key do |k|\n if @tg_index[k] == nil\n tarjan_helper(k)\n end\n end\n @t_result.sort!.reverse!\n end", "def tsort_each_node(&block)\n @dependencies.each_key(&block)\n end", "def heap_sort2(a)\r\n size = a.length\r\n temp = 0\r\n i = (size/2)-1\r\n\r\n while i >= 0\r\n sift_down(a,i,size)\r\n i-=1\r\n end\r\n\r\n i=size-1\r\n while i >= 1\r\n a[0], a[1] = a[1], a[0]\r\n sift_down(a, 0, i-1)\r\n i-=1\r\n end\r\n return a\r\nend", "def rec_sort unsorted, sorted\n if unsorted.length <= 0\n return sorted\n end\n#\n#start smallest using 'pop' word and move to sorted list\nsmallest = unsorted.pop\nstill_unsorted = []\n#if tested word from unsorted is less then put\n#smallest into still_unsorted and move tested to smallest\nunsorted.each do |tested_object|\n if tested_object < smallest\n still_unsorted.push smallest\n smallest = tested_object\n#otherwise put tested_object into still_unsorted\n else\n still_unsorted.push tested_object\n end\n#push smallest into sorted\n sorted.push smallest\n #calls method recursively again\n rec_sort still_unsorted, sorted\nend\nend", "def ordered_topologically\n FolderSort.new(self)\n end", "def tarjan\n @t_index = 0\n @t_stack = []\n @tg_index = {}\n @tg_lowlink = {}\n @t_result = []\n \n @t_pstack = []\n @t_forindex = Hash.new(0)\n @t_onstack = Hash.new(false)\n @g.each_key do |k|\n if @tg_index[k] == nil\n tarjan_iter(k)\n end\n end\n @t_result.sort!.reverse!\n end", "def dij(linkPackageMap, native)\nputs \"start dij\"\ndist = Hash.new();\nprevNode = Hash.new();\ntraversed = Array.new;\nallNodes = linkPackageMap.keys;\n#for i in 0..allNodes.length - 1\n#\tdist[allNodes[i]] = -1;\n#\tprevNode[allNodes[i]] = nil;\n#end\ndist[native] = 0;\nprevNode[native] = native;\n#q = PriorityQueue.new\n#q[native] = 0;\n\nq = Pqueue.new();\nq.push(native, 0);\n\n\nuntil q.isEmpty()\n\tu, distance = q.pop();\n\ttraversed.push(u);\n\t#puts u;\n\t#puts distance;\n\tuNeighborMap = linkPackageMap[u].map();\n\t#puts uNeighborMap.keys;\n\tuNeighbors = uNeighborMap.keys\n\tfor i in 0..uNeighbors.length - 1\n\t\t#puts uNeighbors[i]\n\t\tif !traversed.include?(uNeighbors[i]) then\n\t\t\tnewDistance = dist[u].to_i + uNeighborMap[uNeighbors[i]].to_i;\n\t\t\tif dist[uNeighbors[i]] == nil then\n\t\t\t\tdist[uNeighbors[i]] = newDistance\n\t\t\t\tprevNode[uNeighbors[i]] = u;\n\t\t\telse \n\t\t\t\tif newDistance < dist[uNeighbors[i]] then\n\t\t\t\tdist[uNeighbors[i]] = newDistance\n\t\t\t\tprevNode[uNeighbors[i]] = u;\n\t\t\t\tend\n\t\t\tend\n\t\t\tq.push(uNeighbors[i], dist[uNeighbors[i]].to_i);\n\t\t\t#q[uNeighbors[i]] = dist[uNeighbors[i]].to_i;\n\t\tend\n\t\t\t\n\tend\n\nend\n\n\n\nnodes = prevNode.keys;\n#puts nodes;\nnativeNeighbor = linkPackageMap[native].map();\n#nativeNeighbor.each{|key, value| puts \"key : #{key} value : #{value}\"}\nfor i in 0 .. nodes.length - 1\n\tif prevNode[nodes[i]] == native then\n\t\tprevNode[nodes[i]] = nodes[i];\n\telse\n\t\twhile(!nativeNeighbor.include?(prevNode[nodes[i]]) )\n\t\t\tprevNode[nodes[i]] = prevNode[prevNode[nodes[i]]];\n\t\tend\t\n\tend\nend\n\nreturn dist, prevNode;\nend" ]
[ "0.8047923", "0.794595", "0.7768589", "0.77582926", "0.76280963", "0.7583783", "0.74990153", "0.7447668", "0.7444663", "0.74279577", "0.7419171", "0.7347367", "0.734007", "0.73287576", "0.72477597", "0.72456425", "0.72105026", "0.71851456", "0.7158905", "0.715503", "0.7134244", "0.7120581", "0.71180826", "0.70929056", "0.7090735", "0.7083275", "0.70763546", "0.7057216", "0.70537317", "0.70526856", "0.70514053", "0.7023937", "0.70045394", "0.6995602", "0.6985884", "0.69803804", "0.69788784", "0.6970529", "0.69659686", "0.6956537", "0.6953865", "0.693316", "0.6930511", "0.6919812", "0.6889988", "0.68836737", "0.68813497", "0.68723696", "0.68651116", "0.68459576", "0.6840576", "0.68404603", "0.68291545", "0.6827794", "0.68269837", "0.68262297", "0.68116343", "0.6804984", "0.67885727", "0.67863804", "0.67825806", "0.67784786", "0.67752415", "0.6770616", "0.6766588", "0.6753893", "0.67494595", "0.6747005", "0.67411083", "0.6725057", "0.6717265", "0.669658", "0.66939706", "0.6688345", "0.668514", "0.6682395", "0.6677461", "0.6656515", "0.6630087", "0.65950155", "0.6583702", "0.64744985", "0.6410494", "0.6380305", "0.6309777", "0.6237342", "0.6237307", "0.62364477", "0.6224", "0.62130505", "0.6137886", "0.6086007", "0.60794646", "0.6044914", "0.60262537", "0.59984165", "0.5974521", "0.5972033", "0.5959006", "0.59230417" ]
0.66951555
72
Namespaces is the merge of the framework and platform namespaces. The namespace sources are the config's keys 'paths' and 'ember => path_namespaces'. The ember.rb should fill in any gaps in the namespaces and they should be ordered hierarchily for Ember creation (e.g. create 'App.Platform' before 'App.Platform.Main').
def find_by_namespace(name) @namespaces.select {|ns| ns[:namespace] == name} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_namespaces(namespaces); end", "def register_namespaces(namespaces); end", "def package_namespaces\n namespaces = [EPUB2_NAMESPACES]\n namespaces << EPUB3_NAMESPACES if @target.epub_version >= 3\n namespaces << IBOOKS_NAMESPACES if @target.epub_version >= 3 && @target.ibooks?\n namespaces.reduce(:merge)\n end", "def namespaces(*namespaces)\n namespaces.each do |ns|\n namespace ns\n end\n @namespaces\n end", "def define_namespaces #:nodoc:\n unless self.respond_to?(:namespaces)\n send(:define_singleton_method, :namespaces) { @namespaces }\n send(:define_method, :namespaces) { self.class.namespaces }\n end\n end", "def namespaces_by_prefix\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.prefix]=ns; m })\n end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end", "def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end", "def namespaces\n ns = {}\n\n JSON.parse(raw_namespaces)[\"results\"][\"bindings\"].each {|x|\n ns[x[\"prefix\"][\"value\"]] = x[\"namespace\"][\"value\"]\n }\n ns\n end", "def namespaces\n root ? root.namespaces : {}\n end", "def hidden_namespaces\n @hidden_namespaces ||= begin\n orm = options[:rails][:orm]\n test = options[:rails][:test_framework]\n template = options[:rails][:template_engine]\n\n [\n \"rails\",\n \"resource_route\",\n \"#{orm}:migration\",\n \"#{orm}:model\",\n \"#{test}:controller\",\n \"#{test}:helper\",\n \"#{test}:integration\",\n \"#{test}:system\",\n \"#{test}:mailer\",\n \"#{test}:model\",\n \"#{test}:scaffold\",\n \"#{test}:view\",\n \"#{test}:job\",\n \"#{template}:controller\",\n \"#{template}:scaffold\",\n \"#{template}:mailer\",\n \"action_text:install\",\n \"action_mailbox:install\"\n ]\n end\n end", "def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end", "def get_namespaces\n @paths.keys\n end", "def namespaces\n Dir[\"#{NAMESPACE_DIR}/*\"]\n .find_all { |dir| FileTest.directory?(dir) }\n .map { |dir| File.basename(dir) }\nend", "def get_namespaces\n raise NotImplementedError\n end", "def namespaces\n root ? root.collect_namespaces : {}\n end", "def namespaces_to_paths(namespaces)\n paths = []\n namespaces.each do |namespace|\n pieces = namespace.split(\":\")\n path = pieces.join(\"/\")\n paths << \"#{path}/#{pieces.last}\"\n paths << path\n end\n paths.uniq!\n paths\n end", "def add_namespaces node\n raw.root.namespace_definitions.each do |ns|\n node.add_namespace_definition ns.prefix, ns.href if ns.href != NS\n end\n end", "def build_namespace(*parts, prefix: nil, separator: ?.)\n [\n prefix,\n app_name,\n ( app_env if include_app_env? ),\n *parts\n ].compact.join(separator)\n end", "def unify_namespaces(ns1, ns2)\n return ns2, true if ns1 == '*'\n return ns1, true if ns2 == '*'\n return nil, false unless ns1 == ns2\n [ns1, true]\n end", "def namespaces\n @opts[:namespace]\n end", "def cleanup_namespaces\n namespaces.reject! { |namespace| namespace['prefix'].blank? || namespace['uri'].blank? } if namespaces.present?\n end", "def collect_namespaces(object); end", "def eager_load_namespaces; end", "def namespaces\n ns = {}\n ns[:envelope] = {key:'env', value: 'http://www.w3.org/2003/05/soap-envelope'}\n ns[:content] = {key:'ns1', value: 'http://tempuri.org/'}\n ns[:profile] = {key:'ns2', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Admin'}\n ns[:wsa] = {key:'ns3', value: 'http://www.w3.org/2005/08/addressing'}\n ns[:shipment] = {key:'ns4', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.WayBillGeneration'}\n ns[:pickup] = {key:'ns5', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Pickup'}\n ns\n end", "def namespaces(name = nil)\n if name\n namespaces.find(:name => name)\n else\n @namespaces.flatten\n end\n end", "def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end", "def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end", "def namespaces_by_uri\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.href]=ns; m })\n end", "def namespace=(value)\n self.namespaces = [value]\n end", "def namespaceNames\n @options[:namespaceNames] ||= fetch(:namespaceNames)\n end", "def load_namespaces\n\t\t\tnamespace_instructions = []\n\t\t\tns_pi = self.find_all { |i| i.is_a? REXML::Instruction and i.target == 'xml:ns' }\n\t\t\tns_pi.each do |i|\n\t\t\t\tif i.attributes.has_key?('name')\n i.attributes['prefix'] = i.attributes['name']\n elsif i.attributes.has_key?('prefix')\n i.attributes['name'] = i.attributes['prefix']\n else\n raise \"parse error namespace instruction missing required name or prefix attribute.\"\n end\n if i.attributes.has_key?('space')\n i.attributes['uri'] = i.attributes['space']\n elsif i.attributes.has_key?('uri')\n i.attributes['space'] = i.attributes['uri']\n else\n\t\t\t\t\traise \"parse error namespace instruction missing required space or uri attribute.\"\n\t\t\t\tend\n namespace_instructions << i\n\t\t\tend\n\t\t\treturn namespace_instructions\n\t\tend", "def namespace\n Matsuri::Platform.send(Matsuri::Config.environment).namespace || 'default'\n end", "def set_paths(paths, namespace = MAIN_NAMESPACE)\n unless paths.is_a?(::Array)\n paths = [paths]\n end\n @paths[namespace] = []\n paths.each do |path|\n add_path(path, namespace)\n end\n end", "def namespaces=(raw_namespaces)\n @namespaces = NamespaceSet.new(raw_namespaces)\n end", "def remove_namespaces_from_segments(segments)\n namespaces = controller_path.sub(controller_name,'').sub(/\\/$/,'').split('/')\n while namespaces.size > 0\n if segments[0].is_a?(ActionController::Routing::DividerSegment) && segments[1].is_a?(ActionController::Routing::StaticSegment) && segments[1].value == namespaces.first\n segments.shift; segments.shift # shift the '/' & 'namespace' segments\n update_name_prefix(\"#{namespaces.shift}_\")\n else\n break\n end\n end\n segments\n end", "def namespace\n @namespace ||= [request.args.namespace_name, request.args.application_name].compact.join('-')\n end", "def prefixes\n @prefixes ||= Hash[namespaces.sort_by { |k, v| k }.uniq { |k, v| v }].invert\n end", "def namespaces_for(filename, env={})\n @semaphore.synchronize do\n refresh(env)\n file = @files[filename]\n raise \"#{filename.dump} not found\" unless file\n file[:provide] + file[:require]\n end\n end", "def namespace_name\n @namespace_name ||= namespaces.join('::')\n end", "def goo_namespaces\n return if defined?(@@configured) && @@configured\n Goo.configure do |conf|\n conf.add_namespace(:omv, RDF::Vocabulary.new(\"http://omv.ontoware.org/2005/05/ontology#\"))\n conf.add_namespace(:skos, RDF::Vocabulary.new(\"http://www.w3.org/2004/02/skos/core#\"))\n conf.add_namespace(:owl, RDF::Vocabulary.new(\"http://www.w3.org/2002/07/owl#\"))\n conf.add_namespace(:rdfs, RDF::Vocabulary.new(\"http://www.w3.org/2000/01/rdf-schema#\"))\n conf.add_namespace(:metadata, RDF::Vocabulary.new(\"http://data.bioontology.org/metadata/\"), default = true)\n conf.add_namespace(:metadata_def, RDF::Vocabulary.new(\"http://data.bioontology.org/metadata/def/\"))\n conf.add_namespace(:dc, RDF::Vocabulary.new(\"http://purl.org/dc/elements/1.1/\"))\n conf.add_namespace(:xsd, RDF::Vocabulary.new(\"http://www.w3.org/2001/XMLSchema#\"))\n conf.add_namespace(:oboinowl_gen, RDF::Vocabulary.new(\"http://www.geneontology.org/formats/oboInOWL#\"))\n conf.add_namespace(:obo_purl, RDF::Vocabulary.new(\"http://purl.obolibrary.org/obo/\"))\n conf.add_namespace(:umls, RDF::Vocabulary.new(\"http://bioportal.bioontology.org/ontologies/umls/\"))\n conf.id_prefix = \"http://data.bioontology.org/\"\n conf.pluralize_models(true)\n end\n @@configured = true\n end", "def register_namespaces_with_builder(builder)\n return unless self.class.instance_variable_get(:@registered_namespaces)\n\n self.class.instance_variable_get(:@registered_namespaces).sort.each do |name, href|\n name = nil if name == \"xmlns\"\n builder.doc.root.add_namespace(name, href)\n end\n end", "def collect_namespaces\n # TODO: print warning message if a prefix refers to more than one URI in the document?\n ns = {}\n traverse {|j| ns.merge!(j.namespaces)}\n ns\n end", "def build_namespace_hierarchy(namespace)\n namespace_hierarchy(namespace).each do |subnamespace|\n @current_i_namespace = INamespace.create(:unique_name => \"#{@current_i_namespace.unique_name}\\\\#{subnamespace.text}\",\n :name => subnamespace.text,\n :parent_i_namespace => @current_i_namespace)\n end\n end", "def bootstrap_nodes\n node :namespace, { name: Krane::Rbac::Graph::Builder::ALL_NAMESPACES_PLACEHOLDER }\n end", "def fix_namespace api, namespace\n namespace.split(\"::\").map { |node| api.fix_namespace node }.join(\"::\")\n end", "def determine_namespaces(type)\n ns = { atom: Atom::NAMESPACES[:atom], apps: Atom::NAMESPACES[:apps] }\n\n case type.to_s\n when 'group', 'groupmember'\n ns[:gd] = Atom::NAMESPACES[:gd]\n end\n\n ns\n end", "def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end", "def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end", "def option_namespaces\n option_parser.on('-n', '--namespace NAME', 'add a namespace to output') do |name|\n options[:namespaces] ||= []\n options[:namespaces] << name\n end\n end", "def declare_namespaces\n foaf = Namespace.new(\"http://xmlns.com/foaf/0.1/\", \"foaf\")\n rdf = Namespace.new(\"http://www.w3.org/1999/02/22-rdf-syntax-ns\", \"rdf\", true)\n rdfs = Namespace.new(\"http://www.w3.org/2000/01/rdf-schema\", 'rdfs', true)\n xsd = Namespace.new('http://www.w3.org/2001/XMLSchema', 'xsd', true)\n owl = Namespace.new('http://www.w3.org/2002/07/owl', 'owl', true)\n end", "def on_axis_namespace(ast_node, context)\n nodes = XML::NodeSet.new\n name = ast_node.children[1]\n\n context.each do |context_node|\n next unless context_node.respond_to?(:available_namespaces)\n\n context_node.available_namespaces.each do |_, namespace|\n if namespace.name == name or name == '*'\n nodes << namespace\n end\n end\n end\n\n return nodes\n end", "def namespaces\n @namespaces ||= {\n wse: Akami::WSSE::WSE_NAMESPACE,\n ds: 'http://www.w3.org/2000/09/xmldsig#',\n wsu: Akami::WSSE::WSU_NAMESPACE,\n }\n end", "def namespaces\n @namespaces ||= {\n wse: Akami::WSSE::WSE_NAMESPACE,\n ds: 'http://www.w3.org/2000/09/xmldsig#',\n wsu: Akami::WSSE::WSU_NAMESPACE,\n }\n end", "def models_namespace\n options[:model_namespace]\n end", "def fix_namespaces(doc)\n if is_jruby?\n # Only needed in jruby, nokogiri's jruby implementation isn't weird\n # around namespaces in exactly the same way as MRI. We need to keep\n # track of the namespaces in outer contexts ourselves, and then see\n # if they are needed ourselves. :(\n namespaces = namespaces_stack.compact.reduce({}, :merge)\n default_ns = namespaces.delete(\"xmlns\")\n\n namespaces.each_pair do |attrib, uri|\n ns_prefix = attrib.sub(/\\Axmlns:/, '')\n\n # gotta make sure it's actually used in the doc to not add it\n # unecessarily. GAH.\n if doc.xpath(\"//*[starts-with(name(), '#{ns_prefix}:')][1]\").empty? &&\n doc.xpath(\"//@*[starts-with(name(), '#{ns_prefix}:')][1]\").empty?\n next\n end\n doc.root.add_namespace_definition(ns_prefix, uri)\n end\n\n if default_ns\n doc.root.default_namespace = default_ns\n # OMG nokogiri, really?\n default_ns = doc.root.namespace\n doc.xpath(\"//*[namespace-uri()='']\").each do |node|\n node.namespace = default_ns\n end\n end\n\n end\n return doc\n end", "def namespace(namespace = nil, options = {})\n return @namespace unless namespace\n\n @namespace = namespace.to_sym if namespace\n @base_namespace = options[:base].to_sym if options[:base]\n end", "def watch_namespaces(namespaces)\n @watching << namespaces.map do |namespace|\n module_name = Dependencies.to_constant_name(namespace)\n original_constants = Dependencies.qualified_const_defined?(module_name) ?\n Inflector.constantize(module_name).constants(false) : []\n\n @stack[module_name] << original_constants\n module_name\n end\n end", "def namespaces?\n [email protected](\"account\",\"namespaces\")\n if(t_namespaces[\"status\"].to_sym == :success)\n out={}\n t_namespaces[\"namespaces\"].each do |namespace|\n nm=Namespace.new(@linker,namespace[\"name\"],namespace[\"size\"],namespace[\"share_mode\"].to_sym,namespace[\"owner\"])\n out[nm.name]=nm\n end\n return out\n else\n return {}\n end\n end", "def namespace\n cfg_get(:namespace)\n end", "def prefix_for(ns_href)\n namespaces[ns_href] || add_namespace(ns_href)\n end", "def find_namespaces_for(model_name, options = {})\n # namespaces are visible in controller directory\n options[:base_path] ||= \"#{RAILS_ROOT}/app/controllers/\"\n dir = options[:dir].to_s\n path = options[:base_path] + dir\n \n controller_files = Dir.glob(\"#{path}*.rb\")\n\n if !controller_files.select {|f| f =~ /#{model_name.pluralize}_controller/}.empty?\n\n return dir.split(\"/\") # directory structure\n else\n\n\n Find.find(*Dir.glob(path + \"*\")) do |file|\n if path == file\n Find.prune # Don't look any further into this directory.\n \n elsif FileTest.directory?(file)\n namespaces = find_namespaces_for(model_name, \n options.merge(:dir => dir + File.basename(file) + \"/\") ) \n\n return namespaces if namespaces #we found something\n end\n\n next #directory\n end\n end\n \n # Controller not found so assume we should add no namespace\n return nil\n end", "def namespace\n @namestack.join(\"::\")\n end", "def merge_configurations cfg,cfg2\n cfg['prefix']||=cfg2['prefix']\n raise \"Attempting to merge configurations with differing prefixes: '#{cfg['prefix']}' vs. '#{cfg2['prefix']}' \" if cfg['prefix']!=cfg2['prefix']\n cfg['include']||=[]\n cfg['depend']||=[]\n cfg['interface']||=[]\n cfg['include']+=cfg2['include'] if cfg2['include']\n cfg['depend']+=cfg2['depend'] if cfg2['depend']\n cfg['interface']+=cfg2['interface'] if cfg2['interface']\n return cfg\nend", "def namespaces\n input.form_opts[:namespace]\n end", "def populate\n # Generate top-level modules, which recurses to all modules\n YARD::Registry.root.children\n .select { |x| [:class, :module].include?(x.type) }\n .each { |child| add_namespace(child) }\n end", "def load(namespaces = {})\n namespaces.each_pair { |name, uses| instance(name).use(uses) }\n end", "def clearNamespaces() \n @obj.clearNamespaces()\n end", "def merge(other, namespace: nil, &block)\n if namespace\n _container.merge!(\n other._container.each_with_object(::Concurrent::Hash.new) { |(key, item), hsh|\n hsh[PREFIX_NAMESPACE.call(namespace, key, config)] = item\n },\n &block\n )\n else\n _container.merge!(other._container, &block)\n end\n\n self\n end", "def namespace\n @namespace ||= self.class.to_s.split('::').first.gsub('_', '').sub('Application', '')\n end", "def namespace\n cfg_get(:namespace)\n end", "def add_namespace(source_ns_key, output_namespace, *args, &block)\n # raise 'expected arg1 not be empty string or an integer' if source_ns_key.empty? || source_ns_key.is_a?(Integer)\n # raise 'expected arg2 not be empty string or an integer' if output_namespace.empty? || output_namespace.is_a?(Integer)\n # raise 'expected arg3 not be empty' if args.empty?\n\n map = Map.new((source_ns + [source_ns_key]).join('.'),\n output_namespace,\n nil,\n :add_namespace)\n map.properties = args\n @mappings[map.container_key] = map\n\n map = self.class.new((source_ns + [source_ns_key]),\n output_namespace.to_s.split('.'),\n :add_namespace,\n args)\n\n map.instance_exec(&block) if block_given?\n @mappings.merge!(map.mappings)\n end", "def type_namespaces\n Hash[@types.values.map { |type| [type.prefix, namespaces[type.prefix]] }]\n end", "def namespace_declarations(ctx); end", "def namespace_declarations(ctx); end", "def alternate_namespaces\n return @alternate_name.keys()\n end", "def namespace=(ns); end", "def namespace=(ns); end", "def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end", "def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end", "def namespaces_by_prefix\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'namespaces' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ns\").inject(Hash.new) do |namespaces, namespace|\n prefix = namespace.attributes[\"canonical\"] || \"\"\n namespaces[prefix] = namespace.attributes[\"id\"].to_i\n namespaces\n end\n end", "def namespace(value)\n merge(namespace: value.to_s)\n end", "def combineNsBase(namespace, base)\n namespace && !namespace.empty? ? \"#{namespace}.#{base}\".to_sym : base.to_sym\nend", "def namespaces=(hash = {})\n hash = {} unless hash.is_a? Hash\n\n @namespaces ||= {}\n @namespaces.merge!(hash)\n end", "def namespace=(ns) @namespace = @store.namespace = ns; end", "def _prefixes\n @_prefixes ||= super + ['catalog', 'hyrax/base']\n end", "def fetch_or_store_namespaces(namespaces_path)\n path_map = fetch_or_store_namespace_recursively(@store, namespaces_path)\n\n # This mean one of the namespace and key are colliding\n # and we have to deal it upstream.\n unless path_map.is_a?(Concurrent::Map)\n raise NamespacesExpectedError, \"Expecting a `Namespaces` but found class: #{path_map.class.name} for namespaces_path: #{namespaces_path}\"\n end\n\n return path_map\n end", "def namespace(options={}, &block)\n model = Caracal::Core::Models::NamespaceModel.new(options, &block)\n if model.valid?\n ns = register_namespace(model)\n else\n raise Caracal::Errors::InvalidModelError, 'namespace must specify the :prefix and :href attributes.'\n end\n ns\n end", "def namespace_names\n @namespaces.map(&:name)\n end", "def push_component_dirs_to_loader(system, loader)\n system.config.component_dirs.each do |dir|\n dir.namespaces.each do |ns|\n loader.push_dir(\n system.root.join(dir.path, ns.path.to_s),\n namespace: module_for_namespace(ns, system.config.inflector)\n )\n end\n end\n\n loader\n end", "def get_namespace(node, prefix); end", "def owned_namespaces?\n namespaces?.reject {|key,value| !value.owner}\n end", "def sticking_namespaces(env)\n warden = env['warden']\n\n if warden && warden.user\n # When sticking per user, _only_ sticking the main connection could\n # result in the application trying to read data from a different\n # connection, while that data isn't available yet.\n #\n # To prevent this from happening, we scope sticking to all the\n # models that support load balancing. In the future (if we\n # determined this to be OK) we may be able to relax this.\n ::Gitlab::Database::LoadBalancing.base_models.map do |model|\n [model.sticking, :user, warden.user.id]\n end\n elsif env[STICK_OBJECT].present?\n env[STICK_OBJECT].to_a\n else\n []\n end\n end", "def default_namespace(url)\n @namespaces[''] = url\n end", "def on_namespace_loaded(namespace)\n if subdirs = lazy_subdirs.delete(namespace.name)\n subdirs.each do |subdir|\n set_autoloads_in_dir(subdir, namespace)\n end\n end\n end", "def on_namespace_loaded(namespace)\n if subdirs = lazy_subdirs.delete(namespace.name)\n subdirs.each do |subdir|\n set_autoloads_in_dir(subdir, namespace)\n end\n end\n end", "def inherited_namespace(prefix=inherited_prefix)\n namespace(prefix)\n end" ]
[ "0.6456702", "0.6456702", "0.6233856", "0.6162102", "0.60241044", "0.5940189", "0.5860923", "0.5860923", "0.5860923", "0.5860923", "0.58330727", "0.58330727", "0.57817405", "0.56819135", "0.5632387", "0.56297344", "0.5623337", "0.56091136", "0.5593876", "0.5561845", "0.5557636", "0.55076784", "0.5498397", "0.5486775", "0.5472035", "0.5435815", "0.5416375", "0.5400496", "0.5374199", "0.533057", "0.5312476", "0.5312476", "0.5298461", "0.52982646", "0.5285646", "0.5245314", "0.5243783", "0.52329993", "0.5215282", "0.5206952", "0.52035856", "0.5181826", "0.5169307", "0.5168075", "0.5165833", "0.51633966", "0.5159242", "0.51466364", "0.51427734", "0.51331973", "0.513308", "0.5116646", "0.5116646", "0.51038367", "0.5086795", "0.5084955", "0.5079685", "0.5079685", "0.5068808", "0.5065954", "0.5062144", "0.50571644", "0.50358665", "0.503327", "0.5031226", "0.50311345", "0.5030622", "0.5029407", "0.5026419", "0.5021237", "0.50181186", "0.5014691", "0.5010568", "0.50095564", "0.5006359", "0.5002038", "0.49851674", "0.4980955", "0.4980955", "0.497241", "0.49585873", "0.49585873", "0.4955065", "0.4955065", "0.4944861", "0.49395752", "0.493882", "0.49335596", "0.49193826", "0.49089152", "0.49056944", "0.48940152", "0.4893252", "0.4888752", "0.48727337", "0.4863709", "0.4861556", "0.48592573", "0.48591736", "0.48591736", "0.4859034" ]
0.0
-1
This method creates a new Micropost and associates it with the currently signed in user. The "before" flter ensures that there is a currently signed in user.
def create @micropost = current_user.microposts.build(params[:micropost]) if @micropost.save # Here on success. Already saved in the DB. flash[:success] = "New post accepted" # Now, redirect back to the root page to allow more new posts... redirect_to root_url else # Bad data values. Back to home page with null feeds list @feed_items = [] render 'static_pages/home' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n \t# Create a new micropsot object\n @micropost = current_user.microposts.build(micropost_params)\n # Save the micropsot to the database\n if @micropost.save\n flash[:success] = \"Micropost created!\"\n redirect_to root_url\n else\n # When there is an error in submitting a micropost, we still need this\n # variable\n @feed_items = []\n render 'static_pages/home'\n end\n end", "def create\n\t\t@micropost = current_user.microposts.build(micropost_params)\n\t\tif @micropost.save\n\t\t\tflash[:success] = \"Micropost created!\"\n\t\t\tredirect_to root_url\n\t\telse\n\t\t\t@feed_items = []\n\t\t\trender 'static_pages/home'\n\t\tend\n\tend", "def create\n if not logged_in?\n redirect_to '/'\n end\n \n datecode = to_datecode now \n user = current_user\n item = micropost_params;\n \n if item[:content].nil?\n return\n end\n \n if item[:mood].nil?\n return\n end\n\n item[:datecode] = datecode\n item[:user_id] = user.id\n target_item = user.microposts.find_by(datecode: datecode)\n if target_item.nil?\n @micropost = Micropost.new(item)\n else\n target_item.update(content: item[:content], mood: item[:mood], is_onechance: item[:is_onechance])\n @micropost = target_item\n end\n\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to @micropost, notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @micropost = current_user.microposts.build(params[:micropost])\n if @micropost.save\n flash[:success] = \"Mikeropost created!\"\n redirect_to root_path\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end", "def create\n @micropost = Micropost.new(params[:micropost])\n\t\[email protected]_id = current_user.id\n\t\[email protected] = current_user.username\n\t\[email protected]_time = Time.now\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to dashboard_path, notice: 'Successfully posted !' }\n format.json { render json: @micropost, status: :created, location: @micropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @micropost = current_user.microposts.build(micropost_params)\n\n if @micropost.save\n redirect_to @micropost, notice: 'Micropost was successfully created.'\n else\n render :new\n end\n end", "def create\n @micropost = current_user.microposts.build(params[:micropost])\n if @micropost.save\n flash[:success] = \"Post created!\"\n redirect_to root_path\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end", "def create\n@micropost = current_user.microposts.build(params[:micropost])\nif @micropost.save\nflash[:success] = \"Micropost created!\"\nredirect_to root_path\nelse\n@feed_items = []\n render 'static_pages/home'\nend\nend", "def create\n @micropost = current_user.microposts.new(micropost_params)\n respond_to do |format|\n if @micropost.save\n format.html do\n redirect_to @micropost, notice: t('created', name: 'Micropost')\n end\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json do\n render json: @micropost.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @micropost = current_user.microposts.build(micropost_params)\n\n\n respond_to do |format|\n if @micropost.save\n format.html { redirect_to root_url(:anchor => \"ideas\"), notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def handle_pending_micropost\n micropost = nil\n if current_user && session[:pending_micropost].present?\n micropost = current_user.microposts.build(session[:pending_micropost])\n micropost.save!\n session[:pending_micropost] = nil\n end\n micropost\n end", "def create\n @title = 'Microposts'\n @new_post = current_user.microposts.build(params[:micropost])\n if @new_post.save\n @user = User.find(current_user.id)\n feed = @user.feed\n @microposts = feed.page(params[:current_page]).per(5)\n end\n respond_to do |format|\n format.html { redirect_to '/wall' }\n format.js\n end\n end", "def create\n @micropost = spree_current_user.microposts.build(micropost_params)\n @micropost.handbag_id = params[:micropost][:handbag_id]\n if @micropost.save\n flash[:success] = \"Post added!\"\n redirect_to :back\n else\n flash[:error] = \"Make sure text is added.\"\n redirect_to :back\n end\n end", "def create\n @micropost = current_user.microposts.build(micropost_params)\n @micropost.image.attach(params[:micropost][:image])\n\n unless @micropost.save\n @feed_items = current_user.feed.paginate(page: params[:page])\n render 'static_pages/home'\n end\n\n unless params[:micropost][:tags_list].blank?\n tags = params[:micropost][:tags_list].split(\",\").map { |item| item.strip }\n tag_list = []\n tags.each do |tag|\n tagAux = Tag.find_or_create_by(content: tag)\n tag_list << tagAux\n end\n \n @micropost.addTag(tag_list)\n \n end\n\n flash[:success] = \"Micropost created!\"\n redirect_to root_url\n end", "def create\n @micropost = current_user.microposts.build(micropost_params)\n if @micropost.save\n # sucessful\n flash[:success] = \"Post created!\"\n redirect_to root_url\n else\n # not sucessful put error message and take to home page\n @feed_items = []\n render \"static_pages/home\"\n end\n end", "def create_prepare\n\t@micropost = current_user.microposts.build(params[:micropost])\n @micropost.invitees = {}\n\t\n\t@created = @micropost.save\n end", "def create\n @micropost = Micropost.new(micropost_params)\n if @micropost.content != nil && @micropost.content != ''\n if @micropost.save \n flash[:success] = \"Posted Succesfully!\"\n else\n flash[:failure] = \"Unable to post. Please try again!\"\n end\n else\n flash[:failure] = \"Please share what's in your mind !!!\"\n end\n redirect_to user_path(@micropost.user_id)\n end", "def create\n @product = Product.find(session[:product_id])\n @micropost = @product.microposts.build(micropost_params)\n @micropost.content = current_user.name + \": \" + @micropost.content\n if @micropost.save\n flash[:success] = \"Success\"\n redirect_to @product\n else\n flash[:fail] = \"fail\"\n end\n end", "def create\n @micropost = Micropost.new(micropost_params)\n @micropost.created = Time.now\n \n respond_to do |format|\n if @micropost.save\n format.html { redirect_to @micropost, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # only run login flow when there is no logged in user\n unless current_user.present?\n user = User.from_omniauth(request.env['omniauth.auth'])\n session[:user_id] = user.id\n end\n \n flash[:success] = \"Welcome, #{current_user.name}\"\n redirect_to user_notes_path(current_user)\n end", "def create\n @user = User.new(params[:user])\n if @user.save\n sign_in @user\n flash[:success] = \"Welcome to Micropost!\" # Mensaje a mostrar de bienvenida\n redirect_to @user # Redirecciona a la visualizacion del usuario creado\n else\n render 'new'\n end\n end", "def create\n @micrropost = Micrropost.new(params[:micrropost])\n\n respond_to do |format|\n if @micrropost.save\n format.html { redirect_to @micrropost, notice: 'Micrropost was successfully created.' }\n format.json { render json: @micrropost, status: :created, location: @micrropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micrropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_micropost = Admin::Micropost.new(admin_micropost_params)\n\n respond_to do |format|\n if @admin_micropost.save\n format.html { redirect_to @admin_micropost, notice: 'Micropost was successfully created.' }\n format.json { render :show, status: :created, location: @admin_micropost }\n else\n format.html { render :new }\n format.json { render json: @admin_micropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n self.current_user = User.from_omniauth(request.env['omniauth.auth'])\n\n if current_user\n redirect_to auctions_path\n else\n redirect_to auth_path(provider: authentication_data['provider'])\n end\n end", "def new\n @micropost = Micropost.new\n\n end", "def create\n @shot = Shot.new(shot_params)\n if current_user \n @shot.user = current_user\n end\n respond_to do |format|\n if @shot.save\n if @shot.user.nil?\n cookies[:created] = @shot.id\n notice = '<em>One-time message:</em> If you want to save this shot in order to edit it later, you must <a href=\"/auth/twitter?origin=/shot/save/' + @shot.slug + '\">Sign in with Twitter</a> now to claim it.'\n else \n notice = ''\n end \n format.html { redirect_to @shot, notice: notice }\n format.json { render :show, status: :created, location: @shot }\n else\n format.html { render :new }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tauth = request.env[\"omniauth.auth\"] #when press the link fb_login, response that is received from callback is stored in auth var\n\t\tsession[:omniauth] = auth.except('extra') #session var with info from response, except extra- info that we dont need\n\t\tcurrent_user = User.sign_in_from_omniauth(auth)\n\t\tsession[:user_id] = current_user.id\n\t\tredirect_to root_url, flash: { notice: \"#{current_user.name}, welcome to Like Machine.\"}\n\tend", "def make_microposts\n random = Random.new 1234\n\n # It's better to start with the 'users' array and access its elements than to use\n # User.find(<index>) which instantiates a new object every time => avoids objects proliferations.\n users = User.all\n\n user = users[random.rand(1..6) - 1] \n user.microposts.create!(:content => Faker::Lorem.sentence(5))\n\n (2..300).each do\n user = users[random.rand(1..6) - 1]\n content = Faker::Lorem.sentence(5)\n\n followed_id = random.rand(1..6)\n\n # A user can't reply to another user that he's not following\n if ( user.following?(users[followed_id - 1]) )\n\n followed_user = users[followed_id - 1]\n\n # It's better to put the new micro in a var that can be referred by both the user \n # (and the replied user if it'll turn into a reply). That way, we ensure that both users refer to the same micro.\n # Remember: micro and user.microposts.last are distinct objects (although they both share the same micro id)!\n micro = user.microposts.create!(:content => content)\n\n followed_user.replies << micro\n else\n user.microposts.create!(:content => content)\n end\n end\nend", "def create\n\t\tauth_params = request.env['omniauth.auth']\n\t\tparams = request.env['omniauth.params']\n\n\t\tuser_tmp = User.find_by(uid: auth_params['uid'])\n\t\tuser = User.from_omniauth(auth_params)\n\t\treferer = User.find_by(id: params['referer'].to_i)\n\n\t\tif !user_tmp && user\n\t\t\tsend_notification_user(user, 25, 'You logged in for the first time!', '', '', false)\n\t\t\tuser.hasLoggedInThisRound = true\n\t\t\tuser.save\n\t\telsif !user.hasLoggedInThisRound\n\t\t\tsend_notification_user(user, 1, 'You logged in this round!', '', '', false)\n\t\t\tuser.points += 1\n\t\t\tuser.hasLoggedInThisRound = true\n\t\t\tuser.save\n\t\tend\n\n\t\tif user_tmp == nil && referer != nil && user.uid != referer.uid \n\t\t\tsend_notification_user(referer, 5, 'You refered ' + user.name + '!', '', '', false)\n\t\t\treferer.points += 5\n\t\t\treferer.save\n\t\tend\n\t\t\n\t\tsession[:user_id] = user.id\n\t\tsession[:return_to] ||= request.referer\n\n\t\tif (params['mobile'].to_i == 1)\n\t\t\tredirect_to '/mobile/login/'\n\t\telse\n\t\t\tredirect_to root_path\n\t\tend\n\tend", "def create\n @mymicropost = Mymicropost.new(mymicropost_params)\n\n respond_to do |format|\n if @mymicropost.save\n format.html { redirect_to @mymicropost, notice: 'Mymicropost was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mymicropost }\n else\n format.html { render action: 'new' }\n format.json { render json: @mymicropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_micropost\n @micropost = current_user.microposts.find(params[:id])\n end", "def create\n @comment = @micropost.comments.new (comment_params)\n @comment.user = current_user\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @micropost, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @micropost }\n else\n format.html { render :new }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def authorized_user\n @micropost = Micropost.find(params[:id])\n redirect_to root_path unless current_user?(@micropost.user)\n end", "def authorized_user\n @micropost = Micropost.find(params[:id])\n redirect_to root_path unless current_user?(@micropost.user)\n end", "def create\n oauth_verifier = params[:oauth_verifier]\n\n if oauth_verifier\n request_token = session[:tumblr_request_token]\n access_token = request_token.get_access_token(\n :oauth_verifier => oauth_verifier) \n\n self.current_user.tumblr_access_token = access_token.token\n self.current_user.tumblr_access_token_secret = access_token.secret\n\n self.current_user.save!\n end\n\n rescue => ex\n handle_exception(ex)\n end", "def correct_user; redirect_to root_url, flash: {success: \"Permission denied!\"} unless current_user? load_micropost.user end", "def correct_user\n check_owner_of(@micropost)\n end", "def create\n @twitter = true\n begin\n credentials = TwitterAPI::Base.get_yaml_credentials\n # Recreate consumer and request token that was used in new action\n req = TwitterAPI::Request.new(credentials, session[:rtoken], session[:rsecret])\n # Now verify with Twitter and get the final access token for user\n @result = \"Congratulations - cross-posting with Twitter is now set up!\"\n begin\n access_token = req.verify(params[:verifier])\n # save for next time\n @visitor_home.twitter_token = access_token.token\n @visitor_home.twitter_secret = access_token.secret\n @visitor_home.twitter_name = params[:twitter_name]\n if @visitor_home.save\n redirect_to :action => 'show'\n else\n @result = \"ublog login or database error - Twitter setup failed.\"\n render :template => \"yammers/create.html.erb\"\n end\n rescue\n @result = \"Twitter authorization failed! Your verification code was not accepted: \" + $!\n render :template => \"yammers/create.html.erb\"\n end\n rescue\n flash[:error] = $!\n @result = \"We're sorry but something went wrong.\"\n render :template => \"yammers/create.html.erb\"\n end\n end", "def create\n @micropost_toy = MicropostToy.new(micropost_toy_params)\n\n respond_to do |format|\n if @micropost_toy.save\n format.html { redirect_to @micropost_toy, notice: 'Micropost toy was successfully created.' }\n format.json { render :show, status: :created, location: @micropost_toy }\n else\n format.html { render :new }\n format.json { render json: @micropost_toy.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_microposts\n # Generate 50 posts for 6 users. Use Faker to generate some content for the Microposts.\n 50.times do\n User.all(:limit => 6).each do |user|\n user.microposts.create!(:content => Faker::Lorem.sentence(5))\n end\n end\nend", "def add_post\n if current_user.id.to_s == params[:user_id].to_s\n post = Post.new(:user_id => params[:user_id], :content => params[:content],\\\n :title => params[:title], :upvotes => 0, :downvotes => 0, :rank => 0)\n post.save!\n end\n end", "def make_microposts\r\n users = User.all(limit: 6)\r\n 50.times do\r\n content = Faker::Lorem.sentence(5)\r\n users.each { |user| user.microposts.create!(content: content) }\r\n end\r\nend", "def create\n @comment = Comment.new(:user => current_user, :micropost_id => params[:comment][:micropost_id], :content => params[:comment][:content])\n sql_parts = [\"INSERT INTO comments (content, user_id, micropost_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?)\", @comment.content, current_user.id, @comment.micropost_id, Time.now, Time.now]\n sql = ApplicationRecord.send(:sanitize_sql_array, sql_parts)\n result = ApplicationRecord.connection.execute(sql)\n redirect_to micropost_path(params[:comment][:micropost_id])\n end", "def create_publisher\n pub = Publisher.new(description: 'Your description goes here!', user: self)\n pub.save\n end", "def publish_now!\n self.status = Micropost::PUBLISHED\n self.published_at = self.publish_at\n save!\n end", "def create_valid_tweet(user: nil)\n user = create_valid_user if user.nil?\n user.tweets.create(content: 'I’m really tilting today!')\n end", "def create_meta\n meta = UserMetaDatum.new(:user_id => self.id)\n meta.save\n end", "def write!(other_user)\n wallposts.create!(posted_id: other_user.id)\n end", "def create\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_provider_and_uid(auth[\"provider\"], auth[\"uid\"]) || User.create_with_omniauth(auth)\n User.update(user.id, :fb_nickname => auth[\"info\"][\"nickname\"])\n session[:user_id] = user.id\n redirect_to root_url\n end", "def create\n @micsropost = Micsropost.new(params[:micsropost])\n\n respond_to do |format|\n if @micsropost.save\n format.html { redirect_to @micsropost, notice: 'Micsropost was successfully created.' }\n format.json { render json: @micsropost, status: :created, location: @micsropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micsropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # debugger\n # respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @session }\n # end\n user = User.from_auth(request.env[\"omniauth.auth\"])\n session[:user_id] = user.id\n flash[:notice] = \"Welcome #{user.nickname}\"\n redirect_to posts_path\n end", "def create\n @micropost = current_user.microposts.build(micropost_params)\n @micropost.image.attach(params[:micropost][:image])\n @micropost.parent_id = params[:parent_id]\n if @micropost.save\n flash[:succes] = I18n.t \"comment.success\"\n respond_to do |format|\n format.html\n format.js\n end\n else\n flash[:danger] = I18n.t \"comment.failed\"\n redirect_to request.referer || root_url\n end\n end", "def set_mymicropost\n @mymicropost = Mymicropost.find(params[:id])\n end", "def create\n\n\t\t# grab the authentication return\n\t\tauth = request.env[\"omniauth.auth\"]\n\n\t\t# now create a temporary user with the auth element etc\n\t\tuser = User.omniauth_create auth\n\n\t\t# now set the session_id \n\t\tsession[:id] = user.id\n\n\t\t# redirect back to the root which can successfully switch the pages of the application etc\n\t\tredirect_to root_url, :notice => \"Successful Authentication\"\t\n\tend", "def generate_feed_item(user)\r\n\tmicropost = FactoryGirl.create(:micropost, user: user)\r\n\t\r\n\tgenerate_participants(micropost, 2)\r\n\t\r\n\tRails.logger.debug(\"\\n\\nGenerating Feed Item With ID: #{micropost.id}\\nContent: #{micropost.content}\\nLocation: #{micropost.location}\\nTime: #{micropost.time}\\nUser ID: #{micropost.user.id}\\nUpdated At: #{micropost.updated_at}\\n\")\r\n\t\r\n\treturn micropost\r\nend", "def before_create(model)\n model.created_by = @@current_user if model.respond_to?(\"created_by\")\n end", "def create\n @micropost2 = Micropost2.new(params[:micropost2])\n\n respond_to do |format|\n if @micropost2.save\n format.html { redirect_to @micropost2, notice: 'Micropost2 was successfully created.' }\n format.json { render json: @micropost2, status: :created, location: @micropost2 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micropost2.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n self.current_user = User.from_omniauth(request.env['omniauth.auth'])\n\n if current_user\n # Send the email notifying the user!\n NotificationsMailer.signup(@user).deliver_later\n # byebug\n redirect_to request.referer\n else\n redirect_to auth_path(provider: 'github')\n end\n end", "def create\n #@usr = params[:user]\n \n if @usr = User.user_sess(sess_params)\n session[:session_token] = @usr.session_token\n #@current_user ||=\tsession[:session_token\t] && User.find_by_session_token(session[:session_token])\n flash[:notice] = \"You are logged in as ID:#{@usr.user_id} \" \n redirect_to movies_path\n else\n flash[:notice] = \"Wrong Email or ID\" \n redirect_to movies_path\n end\n \n end", "def set_micropost\n @micropost = Micropost.find(params[:id])\n end", "def set_micropost\n @micropost = Micropost.find(params[:id])\n end", "def micropost_params\n params.require(:micropost).permit(:content, :user_id)\n end", "def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n me=User.find(user.id)\n me.loggedin=true\n me.tutoring=false\n me.request=Request.new(class_name:\"3365f80a5cccb3e76443df3b736b26e8\")\n me.save\n render erb: :'sessions#create'\nend", "def set_micropost\n @micropost = Micropost.find(params[:id])\n end", "def set_micropost\n @micropost = Micropost.find(params[:id])\n end", "def set_micropost\n @micropost = Micropost.find(params[:id])\n end", "def set_micropost\n @micropost = Micropost.find(params[:id])\n end", "def set_micropost\n @micropost = Micropost.find(params[:id])\n end", "def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n \n redirect_to root_path\n end", "def create_blog!(attrs)\n attrs[:user_id] = self.id\n BlogCreationForm.create(attrs)\n end", "def create\n @timeline = Timeline.new(timeline_params)\n\n @timeline.user = current_user\n\n if @timeline.save\n if current_user\n redirect_to @timeline, notice: \"Timeline published.\"\n else\n session[:unsaved_timeline] = @timeline.id\n redirect_to \"/auth/facebook\"\n end\n else\n render :new\n end\n end", "def create\n omniauth = env['omniauth.auth']\n\n user = User.find_by(uid: omniauth['uid'])\n unless user\n # New user registration\n user = User.new(uid: omniauth['uid'])\n end\n user.email = omniauth['info']['email']\n user.save\n\n # p omniauth\n\n # Currently storing all the info\n session[:user_id] = omniauth\n\n flash[:notice] = t(:successfully_logged_in)\n redirect_to root_path\n end", "def require_creator\n unless logged_in? && current_user = @post.user\n flash[:error] = \"Can't be done\"\n redirect_to root_path\n end\n end", "def create\n @micrrapost = Micrrapost.new(params[:micrrapost])\n\n respond_to do |format|\n if @micrrapost.save\n format.html { redirect_to @micrrapost, notice: 'Micrrapost was successfully created.' }\n format.json { render json: @micrrapost, status: :created, location: @micrrapost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micrrapost.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_micropost\n @micropost = Micropost.find_by_id(params[:micropost_id])\n end", "def create\n @tweet = current_user.tweets.new tweet_params\n\n if current_user\n @tweet.user_id = current_user.id\n end\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: \"Tweet was successfully created.\" }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if(params[:message]) then\n @user = User.find(session[:user][:id])\n @user.add_post(params[:message])\n redirect_to posts_path, :method => :get\n end\n end", "def create\n # Use current_user below, so that new tweets are only created by the logged in user #MDM\n #@tweet = Tweet.new(tweet_params)\n @tweet = current_user.tweets.new(tweet_params)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group = nil\n @group = current_user.microgroups.find(params[:microgroup_id]).group unless params[:microgroup_id].nil?\n # @micropost = Micropost.new(params[:micropost])\n @micropost = current_user.microposts.build(params[:micropost])\n if @group\n @micropost.group = @group\n else\n @micropost.group_id = 0\n end\n\n respond_to do |format|\n if @micropost.save\n if @group\n format.html { redirect_to @group.microgroup, notice: 'Micropost was successfully created.' }\n format.js { @microposts = @group.microposts.paginate(page: params[:page], per_page: 10) }\n format.json { render json: @group.microgroup, status: :created, location: @microgroup }\n else\n format.html { redirect_to users_mine_path, notice: 'Micropost was successfully created.' }\n format.js { @microposts = current_user.feed.paginate(page: params[:page], per_page: 20) }\n format.json { render json: @micropost, status: :created, location: @micropost }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_micropost_toy\n @micropost_toy = MicropostToy.find(params[:id])\n end", "def create\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_provider_and_uid(auth[\"provider\"], auth[\"uid\"]) || User.create_with_omniauth(auth)\n session[:user_id] = user.id\n redirect_to app_path\n end", "def create\n REDIS.sadd REDIS_SET, @user.id\n self.class.broadcast\n end", "def wall\n Micropost.from_users_followed_by(self)\n end", "def create(tweet)\n # create a new tweet\n @tweet = Tweet.new(tweet)\n @tweet.made_by=session.user\n\n content = tweet[:content].strip #remove whitespace from front and back of the tweet's content\n\n # find out if the tweet is a private message or a group message or a reply\n is_pm = params[:for_users] || content.index('pm ') #from the form or command- 'dm yeban Holla!'\n is_gm = params[:for_group] || content.index('gm ') #from the form or command- 'gm Music Holla!'\n is_reply = content.index('@') #if the tweet contains '@', it is a reply\n\n if is_pm # if it is a private message\n\n # find the user it is intended for\n if params[:for_users] #from the form\n user = User.get params[:for_users].to_i\n else #from the command\n nick = content.split[1]\n user = User.all(:nick => nick)[0]\n end #finding user ends\n\n raise NotFound unless user # raise error if the user does not exist\n\n # if the user exists\n content = content.sub(/pm #{nick} /, '')\n @tweet.content = content\n @tweet.for_users << user #tweet has many to many relation with for_user\n @tweet.protected = true\n\n elsif is_gm # create a group message\n\n # find the group it is intended for\n if params[:for_group] #from the form\n group = Group.get params[:for_group].to_i\n else #from the command\n name = content.split[1]\n group = Group.all(:name => name)[0]\n end #finding user ends\n\n raise NotFound unless group # raise error if the group does not exist\n raise NotPriviliged unless session.user.is_member? group\n\n # if the group exists and the user is a member\n @tweet = Tweet.new\n content = content.sub(/gm #{name} /, '')\n @tweet.content = content\n @tweet.made_by=session.user\n @tweet.for_group = group\n @tweet.protected = true\n\n elsif is_reply # create a reply, it may be for more than one user\n \n #find the users it is intended for\n users = []\n content.split.each do |word|\n if word.match(/\\@\\w+/) #if the word is like '@yeban'\n nick = word.match(/\\w+/) #take yeban\n users << User.first(:nick => nick.to_s) #find the user\n end # if ends\n end # do ends\n\n @tweet.content = content\n @tweet.for_users = users\n\n else # a normal tweet\n @tweet.content = content\n end\n\n if @tweet.save\n redirect(url(:private_messages), :message => {:notice => \"Private Message sent successfully.\"}) if is_pm\n redirect(url(:group_messages), :message => {:notice => \"Group Message sent successfully.\"}) if is_gm\n redirect url(:tweets), :message => {:notice => \"Tweet was successfully created.\"}\n else\n message[:error] = \"Tweet failed to be created\"\n render :index\n end\n end", "def create\n omniauth = request.env['omniauth.auth']\n\n user = User.find_by_uid(omniauth['uid'])\n if not user\n # registruje novog usera\n user = User.new(:uid => omniauth['uid'])\n end\n user.email = omniauth['info']['email']\n user.save\n\n # sve info o useru u sesiji\n session[:user_id] = omniauth\n\n flash[:notice] = \"Successfully logged in\"\n redirect_to root_path\n end", "def make_microposts\n #this was above but upon merge I found my file & moved this here\n #10.23: Adding mp's to sample data, looping thru 6 users & adding 50 mp's\n users = User.all(limit: 6)\n 51.times do\n content = Faker::Lorem.sentence(5)\n users.each { |user| user.microposts.create!(content: content) }\n #to generate:\n #bundle exec rake db:reset\n # bundle exec rake db:populate\n\n end\nend", "def create\n user = User.from_omniauth(request.env['omniauth.auth'])\n if params[:remember_me]\n cookies[:auth_token] = { value: user.auth_token,\n expires: 1.weeks.from_now.utc }\n else\n # browser doesn't delete session cookies if session restore used\n cookies[:auth_token] = { value: user.auth_token,\n expires: 30.minutes.from_now.utc }\n end\n redirect_to user_path(user), notice: \"Welcome #{user.nickname}\"\n end", "def create\n tweet.user = current_user\n\n respond_to do |format|\n if tweet.save\n format.html { redirect_to tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: tweet }\n else\n format.html { render :new }\n format.json { render json: tweet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n if WatchedPost.where(user_id: params[:watched_post][:user_id], post_id: params[:watched_post][:post_id]).empty?\n @watched_post = WatchedPost.new(watched_post_params)\n\n respond_to do |format|\n if @watched_post.save\n format.html { redirect_to :back, notice: 'Watched post was successfully created.' }\n format.json { render :show, status: :created, location: @watched_post }\n else\n format.html { render :new }\n format.json { render json: @watched_post.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to watched_posts_user_path(current_user)\n end\n\n end", "def new \n\n begin\n if params[:oauth_token] != session['oauth_request_token_token']\n flash[:error] = 'Could not authorize your Twitter account'\n if current_user.nil?\n return redirect_to signup_path\n else\n return redirect_to edit_user_path(current_user)\n end\n end\n \n oauth_token = session['oauth_request_token_token']\n oauth_secret = session['oauth_request_token_secret']\n \n # if we're here, save the tokens to user\n access_token = @client.authorize(\n oauth_token,\n oauth_secret\n )\n\n if @client.authorized?\n \n client_info = @client.info\n \n if current_user.nil?\n newname = client_info['name']\n newtwittername = client_info['screen_name']\n newuserid = client_info['id_str']\n\n @user = User.find_by_twitter_id(newuserid)\n \n if @user.nil?\n @user = User.new(:name => newname, :twittername => newtwittername,\n :twitter_id => newuserid, :twitter_token => access_token.token,\n :twitter_secret => access_token.secret)\n @user.save! \n flash[:success] = \"User account created through Twitter\"\n else\n @user.name = newname\n @user.twittername = newtwittername\n @user.save!\n end\n \n sign_in @user\n session['oauth_request_token_token'] = nil\n session['oauth_request_token_secret'] = nil\n\n redirect_to current_user \n else\n \n twid = client_info['id_str']\n \n olduser = User.find_by_twitter_id(twid)\n if !olduser.nil?\n flash[:error] = 'Twitter account already linked to another account'\n else\n current_user.twitter_token = access_token.token\n current_user.twitter_secret = access_token.secret\n current_user.twitter_id = twid\n begin\n raise 'Could not save user' if !current_user.save\n rescue\n flash[:error] = \"bad\"\n end\n flash[:notice] = 'Your account has been authorized at Twitter'\n sign_in current_user\n end\n \n session['oauth_request_token_token'] = nil\n session['oauth_request_token_secret'] = nil\n return redirect_to edit_user_path(current_user)\n #rescue => e\n #flash[:error] = 'There was an error during processing the response from Twitter.'\n #flash[:error] = e.message\n end\n end \n end\n end", "def microposts \n @microposts = Micropost.where(user_id: current_user.followed_ids).order('created_at desc').all\n end", "def create\n # Get the other user\n other_user = User.find_by_id params[:user_id]\n\n # Determine instructor and student\n instructor = @auth_user.type == 'Instructor' ? @auth_user : other_user\n student = instructor == other_user ? @auth_user : other_user\n\n # Create the message\n message = Message.create do |m|\n m.subject = params[:subject]\n m.instructor = instructor\n m.student = student\n end\n\n # Create the post\n Post.create do |p|\n p.message = message\n p.user = @auth_user\n p.content = params[:content]\n end\n\n # Redirect to message\n redirect_to message_path(message)\n end", "def participate(micropost)\n\tif micropost.present? && friends?(micropost.user) && (!micropost.time || micropost.time.future? || (micropost.end_time && micropost.end_time.future?))\n\t\tparticipation = participations.build(micropost_id: micropost.id)\n\t\t\n\t\tparticipation.save\n\tend\n end", "def set_admin_micropost\n @admin_micropost = Admin::Micropost.find(params[:id])\n end", "def create\n logger.error \"=-=-=-=-=-=-=-=-=--=-=-=-=-==-=-=-=-=-=-=-\"\n logger.error params[:micropost_id]\n @post_like = PostLike.create(:micropost_id => params[:micropost_id])\n logger.error \"=-=-=-=-=-=-=-=-=--=-=-=-=-==-=-=-=-=-=-=-\"\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js\n end\n end", "def mymicropost_params\n params.require(:mymicropost).permit(:content, :user_id)\n end", "def create\n auth = request.env[\"omniauth.auth\"]\n user_info = auth[\"info\"] ? auth[\"info\"] : auth[\"user_info\"]\n authentication = Authorization.where(:provider => auth['provider'], :uid => auth['uid']).first\n authentication = Authorization.new(:provider => auth['provider'], :uid => auth['uid']) if !authentication\n session[:fb_token] = auth['credentials']['token'] if auth['credentials']['token'] != nil\n # if the user exists, but does not have a link with the social service\n if !authentication.user && current_user\n authentication.user = current_user\n authentication.save\n end\n # twitter only (gets no email)\n if !authentication.user && !user_info[\"email\"]\n flash[:notice] = \"No user linked to this account. Please sign in or create a new account\"\n redirect_to '/users/sign_up/'\n # if user doesnt exists, register user\n elsif !authentication.user\n user = User.where(email: user_info['email']).first\n if user\n authentication.user = user\n else\n new_user = User.new(email: user_info['email'], username: user_info['name'], first_name: user_info['first_name'], last_name: user_info['last_name'], role: \"registered\")\n new_user.save\n authentication.user = new_user\n end\n authentication.save\n end\n # if user exists, sign in. Gives a Mongoid glitch of not signing in after registration. So double sign in\n if authentication.user\n if !current_user\n sign_in authentication.user\n sign_out authentication.user\n sign_in authentication.user\n # raise \"user signed in? #{user_signed_in?.to_s}\".inspect\n flash[:notice] = \"Authorization successful.\"\n redirect_to root_path\n else\n flash[:notice] = \"Linked successfully.\"\n redirect_to '/users/'+current_user.id\n end\n end\n end", "def create\n if post_params[:url] != \"\" and post = Post.find_by(url: post_params[:url])\n redirect_to post_path(post)\n else\n @post = Post.new(post_params)\n @post.user = current_user\n\n\n respond_to do |format|\n if @post.save\n @user = User.find(current_user.id)\n @user.karma += 1\n @user.save\n callback = cookies.signed[:callback]\n cookies.delete(:callback)\n format.html { redirect_to newest_posts_path}\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @macropost = Macropost.new(params[:macropost])\n\n respond_to do |format|\n if @macropost.save\n format.html { redirect_to @macropost, notice: 'Macropost was successfully created.' }\n format.json { render json: @macropost, status: :created, location: @macropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @macropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n omniauth = request.env['omniauth.auth']\n # Check whether the Identity exists\n identity = Identity.from_omniauth(omniauth)\n if identity # If it does, sign the user in\n flash[:notice] = 'Welcome back!'\n sign_in_and_redirect(:user, identity.user)\n else\n handle_new_identity(omniauth)\n end\n end" ]
[ "0.69614714", "0.6949994", "0.69288254", "0.68862593", "0.68854606", "0.6883364", "0.687577", "0.6697888", "0.6637483", "0.6632141", "0.65898186", "0.6584668", "0.65834266", "0.6577411", "0.65374804", "0.6498302", "0.6496112", "0.6492521", "0.6359921", "0.6271584", "0.61633945", "0.60925204", "0.6048864", "0.5982845", "0.5956728", "0.5940458", "0.5931572", "0.5917823", "0.5903184", "0.58934134", "0.5891242", "0.5878599", "0.58418477", "0.58418477", "0.58417434", "0.58115816", "0.5776903", "0.57579756", "0.57350105", "0.57308674", "0.5716595", "0.570024", "0.5699901", "0.5696819", "0.5677082", "0.56505626", "0.56388414", "0.5638192", "0.5637083", "0.5621673", "0.560126", "0.5594818", "0.5583516", "0.5571321", "0.5570328", "0.55422616", "0.5529917", "0.5529337", "0.5528547", "0.5517859", "0.5517859", "0.5516434", "0.55163795", "0.55131227", "0.55131227", "0.55131227", "0.55131227", "0.55131227", "0.550781", "0.55050594", "0.5504099", "0.55016994", "0.5488559", "0.54776454", "0.54766273", "0.54745203", "0.5472288", "0.546893", "0.5456297", "0.5448203", "0.5447309", "0.54381293", "0.5426865", "0.54267025", "0.5425212", "0.5407109", "0.5396511", "0.5395236", "0.53897613", "0.53882945", "0.5387993", "0.53826827", "0.53791535", "0.5377592", "0.53718626", "0.53706497", "0.5369583", "0.53646266", "0.5362044", "0.53605527" ]
0.64683676
18
Define a method to return whether the current user is the micropost's user
def correct_user @post_to_go = current_user.microposts.find_by_id(params[:id]) redirect_to root_url if @post_to_go.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n check_owner_of(@micropost)\n end", "def correct_user; redirect_to root_url, flash: {success: \"Permission denied!\"} unless current_user? load_micropost.user end", "def twitter_user?\n return true if is_logged_in? && (session[:request_token] && session[:request_token_secret] && session[:twitter_id])\n end", "def is_my_post?(userid)\n #if someone is logged in\n if @current_user\n #if the user id of the post is the user id of the person logged in => it is my post\n if @current_user.id == userid\n return true\n # it isn't my post\n else\n return false\n end\n #It isn't my post because I'm not logged in\n else\n return false\n end\n end", "def current_user?\n \n end", "def current_user?(user)\r\n user == current_user\r\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def is_me?\n return self.user.email == session[:email]\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user) \n user == current_user\n end", "def participating?(micropost)\n\tif micropost.present?\n\t\treturn !participations.find_by_micropost_id(micropost.id).nil?\n\tend\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def lastfm_user?(user)\n lastfm_users.any? { |lastfm| lastfm.user_id == user.try(:id) }\n end", "def current_user?(user)\n\tuser == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend" ]
[ "0.77155155", "0.7076032", "0.70516586", "0.6958686", "0.681317", "0.6802739", "0.6785529", "0.6785529", "0.6785529", "0.6785529", "0.6785529", "0.6785529", "0.6785529", "0.67764467", "0.6767026", "0.6763558", "0.6763558", "0.6763558", "0.6763558", "0.6763558", "0.6763558", "0.6763558", "0.6763558", "0.6740874", "0.67377746", "0.6732728", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6732651", "0.6702509", "0.664986", "0.6648561", "0.6644745", "0.6644745" ]
0.0
-1
GET /schedules/1 GET /schedules/1.xml
def show @schedule = Schedule.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @schedule } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @schedules = Schedule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schedules }\n end\n end", "def schedules\n params = init_params\n request_url = UrlGenerator.url_for(\"schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schedule }\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @schedule }\n end\n end", "def index\n @schedules = get_all_schedules\n\n respond_to do |format|\n format.html\n end\n end", "def show\n @schedule = schedule\n respond_to do |format|\n format.html do\n @broadcasts = schedule.broadcasts_and_gaps(Time.now.utc, 1.day.from_now.utc) \n # renders show.html.erb\n end\n format.xml do \n except = [:id, :created_at, :updated_at]\n render :xml => @schedule.to_xml(:except => except)\n end\n end\n end", "def schedules\n @doc.at_xpath('/a:akomaNtoso/a:components/a:component/a:doc[@name=\"schedules\"]/a:mainBody', a: NS)\n end", "def show\n @class_schedule = ClassSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @class_schedule }\n end\n end", "def show\n @ptschedule = Ptschedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ptschedule }\n end\n end", "def show\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\n end", "def index\n @my_schedules = MySchedule.all\n end", "def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end", "def schedule\n @schedules = ReportSchedule.all\n\n respond_to do |format|\n format.html\n format.json { render json: @schedules }\n end\n end", "def get_schedule\n response = @client.full_game_schedule(@options[:season])\n parse_schedule_response(response)\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.all\n end", "def index\n @schedules = Schedule.paginate :page => params[:page], :order => \"created_at DESC\", :per_page => 10\n @apps = App.find(:all)\n \n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @schedules }\n end\n end", "def show\n @interview_session_schedule = InterviewSessionSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interview_session_schedule }\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end", "def schedulers(params = {})\n scope 'default'\n get('schedule/schedulers/', params)\n end", "def index\n log_request(\"Show All Schedules\")\n\n @schedules = Schedule.all\n\n @response = {\n \tevents: @schedules\n }\n\n respond_to do |format|\n format.html { @schedules }\n format.json { render :json => @response }\n end\n end", "def get_schedule\n Log.add_info(request, params.inspect)\n\n @date = Date.parse(params[:date])\n\n @schedules = Schedule.get_user_day(@login_user, @date)\n\n render(:partial => 'schedule', :layout => false)\n end", "def show\n @scheduled_class = ScheduledClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scheduled_class }\n end\n end", "def show\r\n @route_schedule = RouteSchedule.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @route_schedule }\r\n end\r\n end", "def show\n @event_schedule = EventSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_schedule }\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def reports_schedule\n \n @schedule = ReportSchedule.find(params[:schedule_id])\n \n respond_to do |format|\n format.html\n format.json { render json: @schedule }\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n render json: @schedule\n end", "def schedule_detail access_key\n params = init_params\n request_url = UrlGenerator.url_for(\"schedules\", access_key)\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end", "def schedules_for_assessment assessment_id\n params = init_params\n request_url = UrlGenerator.url_for(\"assessments\", \"#{assessment_id}/schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end", "def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end", "def schedule(uri); end", "def index\n @schedules = Schedule.where(start: params[:start]..params[:end])\n end", "def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end", "def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end", "def index\n @admin_schedules = Clapme::Schedule.all\n end", "def show\n @scheduler = Scheduler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheduler }\n end\n end", "def show\n @schedule = Schedule.find_by_id(params[:id])\n if @schedule\n #schedule_appointments = @schedule.appointments\n render json: @schedule,status: :ok\n else\n render json: {errorMessage:\"no schedule with id: #{params[:id]}\"}, status: :not_found\n end\n end", "def schedules\n\t\t@schedules = Schedule.all\n\tend", "def index\n schedules = Schedule.where(trip_id: params[:trip_id])\n respond_with schedules\n end", "def index\n @nfl_schedules = NflSchedule.all\n end", "def new\n @schedule = Schedule.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end", "def index\n @dates_schedules = DatesSchedule.all\n end", "def show\n @interviewer = Interviewer.find(params[:id])\n\n now = DateTime.now\n\n @next_sched = @interviewer.schedules.where([\"sched_start > ?\", now]) #.find(:conditions=>[\"sched_start < ?\", now])\n @prev_sched = @interviewer.schedules.where([\"sched_start < ?\", now]) #.find(:conditions=>[\"sched_start < ?\", now])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interviewer }\n end\n end", "def get_exam_schedules(course_id)\r\n relative_url = Path::COURSES_EXAMSCHEDULES % [course_id]\r\n get(relative_url)\r\n end", "def index\n @user_schedules = UserSchedule.all\n end", "def index\n show_unpublished = (person_signed_in? and can?(:edit, @context))\n if @context\n if show_unpublished\n @schedules = @context.schedules\n else\n @schedules = @context.schedules.find_all_by_published(true)\n end\n @schedule = Schedule.new :event => @context\n else\n if show_unpublished\n @schedules = Schedule.find(:all)\n else\n @schedules = Schedule.find_all_by_published(true)\n end\n @schedule = Schedule.new\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schedules }\n end\n end", "def index\n @mail_schedules = MailSchedule.all\n end", "def index\n @work_schedules = WorkSchedule.all\n end", "def index\n @schedules = Schedule.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schedules }\n end\n end", "def index\n @runschedules = Runschedule.all\n end", "def appointments(params = {})\n scope 'user_schedule'\n get('schedule/appointments/', params)\n end", "def show\n @schedules_history = SchedulesHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedules_history }\n end\n end", "def index\n @scheduled_tasks = ScheduledTask.paginate(\n :per_page => 20,\n :page => params[:page]\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scheduled_tasks }\n end\n end", "def list_schedules_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ScheduleApi.list_schedules ...\"\n end\n # resource path\n local_var_path = \"/v2/schedules\"\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :csv) if !opts[:'expand'].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 = ['GenieKey']\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 => 'ListSchedulesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScheduleApi#list_schedules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @dj_schedules = DjSchedule.all\n end", "def show\n @manage_schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manage_schedule }\n end\n end", "def show\n @weeklytimetable = Weeklytimetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weeklytimetable }\n end\n end", "def index\n @ptschedules = Ptschedule.search(params[:search]) \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ptschedules }\n end\n end", "def show\n @user_schedule = UserSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_schedule }\n end\n end", "def show\n @schedule_entry = ScheduleEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule_entry }\n end\n end", "def schedule(schedule)\n set_global_attributes\n upload_if_needed\n\n response = SimpleWorker.service.schedule(self.class.name, sw_get_data, schedule)\n# puts 'schedule response=' + response.inspect\n @schedule_id = response[\"schedule_id\"]\n response\n end", "def index\n @schedulers = Scheduler.all\n end", "def index\n @schedulers = Scheduler.all\n end", "def show\n @scheduled_task = ScheduledTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheduled_task }\n end\n end", "def schedules\n\t\t@schedules = Schedule.includes(:schedulable).all\n\tend", "def index\n @schedules = Schedule.all.per_page_kaminari(params[:page]).per(params[:per])\n end", "def schedule\n prepare_scan_group_tab_data\n prepare_schedule_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render 'schedule.js' }\n format.json { render json: @scans }\n end\n end", "def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end", "def index\n @scheduled_events = ScheduledEvent.all\n end", "def show\n @schedule_item_level = ScheduleItemLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schedule_item_level }\n end\n end", "def index\n @person_schedules = PersonSchedule.all\n end", "def index\n @schedules = Schedule.all.order(:sort).page(params[:page]).per(params[:per])\n end", "def index\n # @schedules = Schedule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@schedules, mode: :compat) }\n end\n end", "def get_report_schedule_list(params = {})\n response = get(\"/\", {\"Action\" => \"GetReportScheduleList\"}.merge(params))\n GetReportScheduleListResponse.format(response)\n end", "def index\n @bus_schedules = BusSchedule.all\n end", "def show\n @[email protected]_schedules\n end", "def pipeline_schedule(project, id)\n get(\"/projects/#{url_encode project}/pipeline_schedules/#{id}\")\n end", "def index\n @agent_schedules = AgentSchedule.all\n end", "def schedule_url_for(schedule)\n #{}\"#{schedules_url}?utf8=✓&q=#{schedule.day.to_s}\"\n \"#{schedules_url}?q=#{schedule.day.to_s}\"\n end", "def index\n @mailing_schedules = MailingSchedule.all\n end", "def get_broadcasts uri\n begin\n response = RestClient.get(uri)\n broadcasts = []\n JSON.parse(response)['schedule']['day']['broadcasts'].each do |json|\n broadcasts << Broadcast.new(json['programme']['display_titles']['title'],\n json['programme']['display_titles']['subtitle'],\n Time.parse(json['start']),\n json['pid'])\n end\n return broadcasts\n rescue => e\n logger.error e.response\n end\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def get_all_schedules_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ScheduleApi.get_all_schedules ...\"\n end\n # resource path\n local_var_path = \"/schedule/all\".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 = 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<Schedule>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScheduleApi#get_all_schedules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @crew_big_sonu_schedules = Crew::BigSonuSchedule.all\n end" ]
[ "0.73682785", "0.7360402", "0.7280713", "0.711103", "0.70666844", "0.7061428", "0.69146025", "0.6806414", "0.6804336", "0.67321527", "0.67246646", "0.6721426", "0.66539335", "0.66304797", "0.65861034", "0.65861034", "0.65861034", "0.65861034", "0.65861034", "0.65861034", "0.65861034", "0.65861034", "0.65861034", "0.65861034", "0.6554814", "0.650595", "0.6490154", "0.6490154", "0.6490154", "0.6490154", "0.64850646", "0.6440545", "0.6431751", "0.6411917", "0.638153", "0.63406277", "0.63335425", "0.6313087", "0.63100547", "0.63022965", "0.6286116", "0.6274207", "0.62609905", "0.62584317", "0.62514496", "0.62415683", "0.6223296", "0.621113", "0.6210411", "0.6203748", "0.6199906", "0.6197036", "0.6195095", "0.6167955", "0.6165762", "0.6163417", "0.6138287", "0.6129301", "0.61270773", "0.61111534", "0.61105204", "0.61093616", "0.61044204", "0.61037165", "0.60984504", "0.6097155", "0.608192", "0.60774326", "0.6069923", "0.60606647", "0.6058935", "0.60434467", "0.6023931", "0.60214466", "0.60214466", "0.60192555", "0.5997615", "0.59968185", "0.5981612", "0.59757775", "0.5970178", "0.5963747", "0.59595895", "0.5957338", "0.59493965", "0.5947965", "0.5945906", "0.5944534", "0.59444207", "0.59418976", "0.5921721", "0.5911674", "0.5908283", "0.5903878", "0.5903878", "0.5903878", "0.5903878", "0.5903878", "0.58980453", "0.5892821" ]
0.7230664
3
GET /schedules/new GET /schedules/new.xml
def new @schedule = Schedule.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @schedule } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end", "def new\n @schedule = Schedule.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end", "def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end", "def new\n @ptschedule = Ptschedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptschedule }\n end\n end", "def new\n @class_schedule = ClassSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @class_schedule }\n end\n end", "def new\n @schedule = Schedule.new\n @apps = App.find(:all)\n @tags = Contact.get_tags\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @schedule }\n end\n end", "def new\n @maintenance_schedule = MaintenanceSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\n end", "def create\n respond_to do |format|\n if @schedule.save\n flash[:notice] = 'Schedule was successfully created.'\n format.html { redirect_to(@schedule) }\n format.xml { render :xml => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to(@schedule, :notice => 'Schedule was successfully created.') }\n format.xml { render :xml => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end", "def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @schedule }\n end\n end", "def new\r\n @route_schedule = RouteSchedule.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @route_schedule }\r\n end\r\n end", "def new\n @event_schedule = EventSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event_schedule }\n end\n end", "def new\n @manage_schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_schedule }\n end\n end", "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, :notice => 'Schedule was successfully created.' }\n format.json { render :json => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule ha sido creado.' }\n format.json { render :index, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n authorize! :new, Schedule, :message => 'Not authorized as an administrator.'\n @schedule = Schedule.new(key: params[:key])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end", "def new\n\t\tlogger.debug(\"/routes/new params[:route] : #{params[:route].inspect}\")\n\t\t@route = Route.new(params[:route])\n\t\t@sports = Sport.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @route }\n\t\tend\n\tend", "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @scheduled_class = ScheduledClass.new\n @scheduled_class.instructor = \"TBD\"\n @scheduled_class.location = \"Live Anywhere\"\n @scheduled_class.start_date = Date.today\n @scheduled_class.end_date = Date.today + 7\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scheduled_class }\n end\n end", "def create\n @ptschedule = Ptschedule.new(params[:ptschedule])\n\n respond_to do |format|\n if @ptschedule.save\n flash[:notice] = t('ptschedule.title')+\" \"+t('created')\n format.html { redirect_to(@ptschedule) }\n format.xml { render :xml => @ptschedule, :status => :created, :location => @ptschedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ptschedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @maintenance_schedule = MaintenanceSchedule.new(params[:maintenance_schedule])\n\n respond_to do |format|\n if @maintenance_schedule.save\n format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully created.') }\n format.xml { render :xml => @maintenance_schedule, :status => :created, :location => @maintenance_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_new_schedule()\n wait_until_schedules_page_new_schedule_button_visible\n schedules_page_new_schedule_button.click\n self.wait_for_no_spinner\n wait_until_schedules_page_new_schedule_button_visible\n wait_until_schedules_page_active_schedule_title_visible\n self.wait_for_no_spinner\n MIST::AsyncHelper.wait_until{(schedules_page_active_schedule_title.text =~ /Schedule\\s*\\d+/i) == 0}\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @scheduler = Scheduler.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduler }\n end\n end", "def new\n @ptdo = Ptdo.new(:ptschedule_id => params[:ptschedule_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptdo }\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user_schedule = UserSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_schedule }\n end\n end", "def create\n @class_schedule = ClassSchedule.new(params[:class_schedule])\n\n respond_to do |format|\n if @class_schedule.save\n flash[:notice] = 'ClassSchedule was successfully created.'\n format.html { redirect_to(@class_schedule) }\n format.xml { render :xml => @class_schedule, :status => :created, :location => @class_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @class_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end", "def create\n if params[:schedule][\"start_time(1i)\"] > params[:schedule][\"end_time(1i)\"]\n redirect_to \"/find\"\n return\n end\n\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tournament = @resource_finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tournament }\n end\n end", "def new\n @collect_hour = range_format((0..23))\n @collect_minute = range_format((0..59))\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: \"Schedule was successfully created.\" }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @timeslot = current_event.timeslots.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeslot }\n end\n end", "def new\n @time_task = TimeTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_task }\n end\n end", "def create\n @schedule = Schedule.create(format(params))\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end", "def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end", "def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end", "def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end", "def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end", "def new\n @schedule_item_level = ScheduleItemLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule_item_level }\n end\n end", "def new\n @schedule = Schedule.new\n @schedule.code = \"S#{Time.now.strftime('%y%m%d%H%M%S')}\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end", "def create\n @schedule = Schedule.new(params[:schedule])\n\n if @schedule.save\n render json: @schedule, status: :created, location: @schedule\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end", "def create\n @manage_schedule = Schedule.new(params[:manage_schedule])\n\n respond_to do |format|\n if @manage_schedule.save\n format.html { redirect_to @manage_schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @manage_schedule, status: :created, location: @manage_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manage_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schedule }\n end\n end", "def index\n @schedules = Schedule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schedules }\n end\n end", "def create\n @nfl_schedule = NflSchedule.new(nfl_schedule_params)\n\n respond_to do |format|\n if @nfl_schedule.save\n format.html { redirect_to @nfl_schedule, notice: 'Nfl schedule was successfully created.' }\n format.json { render :show, status: :created, location: @nfl_schedule }\n else\n format.html { render :new }\n format.json { render json: @nfl_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @scheduled_task = ScheduledTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_task }\n end\n end", "def create\n @my_schedule = MySchedule.new(my_schedule_params)\n\n respond_to do |format|\n if @my_schedule.save\n format.html { redirect_to @my_schedule, notice: 'My schedule was successfully created.' }\n format.json { render :show, status: :created, location: @my_schedule }\n else\n format.html { render :new }\n format.json { render json: @my_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n # respond_to do |format|\n # if @schedule.save\n # format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @schedule }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @schedule.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schedule }\n end\n end", "def create\r\n @route_schedule = RouteSchedule.new(params[:route_schedule])\r\n\r\n respond_to do |format|\r\n if @route_schedule.save\r\n format.html { redirect_to @route_schedule, notice: 'Route schedule was successfully created.' }\r\n format.json { render json: @route_schedule, status: :created, location: @route_schedule }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @route_schedule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @track_calendar = TrackCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track_calendar }\n end\n end", "def new\n @the_day = TheDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @the_day }\n end\n end", "def new\n @schedule = Schedule.new(user_id: current_user.id, start_date: Date.today)\n\n respond_with(@schedule)\n end", "def create_one\n @laxid = params[:laxid]\n \tCreateScheduleService.new.scrape_team_schedule(@laxid)\n redirect_to \"/schedule/show?laxid=#{@laxid}\"\n end", "def new\n @task = Task.new\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "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", "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", "def new\n @timeline = Timeline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeline }\n end\n end", "def new\n @scheduled_service = ScheduledService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_service }\n end\n end", "def create\n @schedule = current_user.schedules.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html {redirect_to root_url, notice: 'スケジュールが作成されました'}\n format.json {render :show, status: :created, location: @schedule}\n else\n @action_type = @schedule.action_type\n format.html {render :new}\n format.json {render json: @schedule.errors, status: :unprocessable_entity}\n end\n end\n end", "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", "def create\n @admin_schedule = Clapme::Schedule.new(admin_schedule_params)\n\n respond_to do |format|\n if @admin_schedule.save\n format.html { redirect_to admin_schedule_url(@admin_schedule.id), notice: 'Schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @time_slot = TimeSlot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_slot }\n end\n end", "def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def new\n @flight_schedule = FlightSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight_schedule }\n end\n end", "def create\n @event_schedule = EventSchedule.new(params[:event_schedule])\n\n respond_to do |format|\n if @event_schedule.save\n format.html { redirect_to @event_schedule, notice: 'Event schedule was successfully created.' }\n format.json { render json: @event_schedule, status: :created, location: @event_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'スケジュールの登録が正常に行われました。' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @schedule = Schedule.new\n authorize! :create, @schedule\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @calendario = Calendario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario }\n end\n end", "def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def new\n @tournaments = Tournament.all\n @tournament_day = TournamentDay.new\n\n respond_to do |format|\n format.html # new.rb\n format.xml { render :xml => @tournament_day }\n end\n end", "def new\n @page_title = \"Task List New\"\n @task_list = TaskList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_list }\n end\n end", "def new\n @quartz = Quartz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quartz }\n end\n end", "def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end", "def new\n @route_rule = RouteRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_rule }\n end\n end", "def create\n @schedule = @applicant.schedules.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @location, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def create\n schedule = Schedule.new(schedule_params)\n\n if schedule.save\n # valid schedule\n render json: SchedulePresenter.new(schedule).as_json, status: 201\n else\n # invalid schedule\n render json: schedule.errors, status: 404\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @schedule }\n end\n end", "def new\n @task = Task.new(:expires => true, :time => -1, :start_date => Time.now.at_beginning_of_day, :end_date => Time.now.at_beginning_of_day)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @completed_route = CompletedRoute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @completed_route }\n end\n end", "def create\n @rssnew = Rssnews.new(params[:rssnew])\n\n respond_to do |format|\n if @rssnew.save\n flash[:notice] = 'Rssnew was successfully created.'\n format.html { redirect_to(@rssnew) }\n format.xml { render :xml => @rssnew, :status => :created, :location => @rssnew }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rssnew.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @availability_day = AvailabilityDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @availability_day }\n end\n end", "def new\n @event = Event.find(params[:event_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eventtime }\n end\n end", "def new\n @polling_station = PollingStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @polling_station }\n end\n end" ]
[ "0.80351675", "0.7788479", "0.778614", "0.7468082", "0.7426079", "0.72847664", "0.72740805", "0.7225677", "0.71897995", "0.7117595", "0.7099927", "0.6972721", "0.6843795", "0.67839086", "0.67081094", "0.66808784", "0.66796535", "0.66249573", "0.6609242", "0.6603368", "0.65847546", "0.6584392", "0.65609974", "0.65549105", "0.6547556", "0.6538081", "0.6507395", "0.6506979", "0.6491473", "0.6489355", "0.647185", "0.647185", "0.6462764", "0.6460983", "0.64310735", "0.6430408", "0.64253545", "0.6422557", "0.6416321", "0.6411688", "0.6405472", "0.6403883", "0.6403883", "0.6403883", "0.6403883", "0.6403883", "0.6401269", "0.6398593", "0.6394616", "0.63933766", "0.6384178", "0.6383263", "0.6372104", "0.63433653", "0.6337421", "0.6336435", "0.63322586", "0.6329751", "0.632633", "0.6319885", "0.631318", "0.63058096", "0.62981457", "0.62959564", "0.62959564", "0.6284082", "0.6266575", "0.6266017", "0.6261095", "0.6260384", "0.6251432", "0.6241813", "0.62414896", "0.62293535", "0.6228426", "0.62201333", "0.62194026", "0.62175316", "0.62133795", "0.62011886", "0.61945176", "0.61942923", "0.6191364", "0.617787", "0.61643267", "0.61643267", "0.61643267", "0.6161552", "0.6146412", "0.6138871", "0.61370164", "0.613627", "0.61242324", "0.6123532", "0.6123532", "0.6123532", "0.6123532", "0.6120406", "0.6120316", "0.6111977" ]
0.77597374
3
POST /schedules POST /schedules.xml
def create @schedule = Schedule.new(params[:schedule]) respond_to do |format| if @schedule.save format.html { redirect_to(@schedule, :notice => 'Schedule was successfully created.') } format.xml { render :xml => @schedule, :status => :created, :location => @schedule } else format.html { render :action => "new" } format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end", "def create\n @schedule = Schedule.new(params[:schedule])\n\n if @schedule.save\n render json: @schedule, status: :created, location: @schedule\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end", "def schedules\n params = init_params\n request_url = UrlGenerator.url_for(\"schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule ha sido creado.' }\n format.json { render :index, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedules\n @doc.at_xpath('/a:akomaNtoso/a:components/a:component/a:doc[@name=\"schedules\"]/a:mainBody', a: NS)\n end", "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, :notice => 'Schedule was successfully created.' }\n format.json { render :json => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @schedule.save\n flash[:notice] = 'Schedule was successfully created.'\n format.html { redirect_to(@schedule) }\n format.xml { render :xml => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: \"Schedule was successfully created.\" }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dates_schedule = DatesSchedule.new(dates_schedule_params)\n\n respond_to do |format|\n if @dates_schedule.save\n format.html { redirect_to @dates_schedule, notice: 'Dates schedule was successfully created.' }\n format.json { render :show, status: :created, location: @dates_schedule }\n else\n format.html { render :new }\n format.json { render json: @dates_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_play(params)\n path = @version + '/Call/Play/Schedule/'\n method = 'POST'\n return request(path, method, params)\n end", "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n @schedule.save\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'スケジュールの登録が正常に行われました。' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nfl_schedule = NflSchedule.new(nfl_schedule_params)\n\n respond_to do |format|\n if @nfl_schedule.save\n format.html { redirect_to @nfl_schedule, notice: 'Nfl schedule was successfully created.' }\n format.json { render :show, status: :created, location: @nfl_schedule }\n else\n format.html { render :new }\n format.json { render json: @nfl_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @my_schedule = MySchedule.new(my_schedule_params)\n\n respond_to do |format|\n if @my_schedule.save\n format.html { redirect_to @my_schedule, notice: 'My schedule was successfully created.' }\n format.json { render :show, status: :created, location: @my_schedule }\n else\n format.html { render :new }\n format.json { render json: @my_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:schedule][\"start_time(1i)\"] > params[:schedule][\"end_time(1i)\"]\n redirect_to \"/find\"\n return\n end\n\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = @applicant.schedules.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @location, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule\n @schedules = ReportSchedule.all\n\n respond_to do |format|\n format.html\n format.json { render json: @schedules }\n end\n end", "def create\n @event_schedule = EventSchedule.new(params[:event_schedule])\n\n respond_to do |format|\n if @event_schedule.save\n format.html { redirect_to @event_schedule, notice: 'Event schedule was successfully created.' }\n format.json { render json: @event_schedule, status: :created, location: @event_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_schedule\n team = Team.find(params[:id])\n authorize! :manage, team\n\n # used to send out the schedule.\n # now removed, as we send out weekly schedules instead/updates within 7 days\n\n render json: { schedule_sent: true }\n end", "def create\r\n @route_schedule = RouteSchedule.new(params[:route_schedule])\r\n\r\n respond_to do |format|\r\n if @route_schedule.save\r\n format.html { redirect_to @route_schedule, notice: 'Route schedule was successfully created.' }\r\n format.json { render json: @route_schedule, status: :created, location: @route_schedule }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @route_schedule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def schedule_slots(params = {})\n scope 'user_schedule'\n post('/schedule/slots/', params)\n end", "def create\n @maintenance_schedule = MaintenanceSchedule.new(params[:maintenance_schedule])\n\n respond_to do |format|\n if @maintenance_schedule.save\n format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully created.') }\n format.xml { render :xml => @maintenance_schedule, :status => :created, :location => @maintenance_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def conferences_schedule terms={}\n call_path = \"conferences/schedule\"\n data = build_post_data(terms.to_json)\n perform_post(build_url(call_path), data)\n end", "def createschedule(uid,rname,scparams,stparams)\r\n scrbslog(\"======Begin to create a new schedule======\")\r\n @user = User.find(uid)\r\n scrbslog(\"Author:\" + @user.name)\r\n @room = Room.find_by_room_name(rname) \r\n @schedule = Schedule.create(scparams)\r\n @user.schedules << @schedule\r\n @room.schedules << @schedule\r\n stparams[\"scheduleid\"][email protected]\r\n @status = Status.create(stparams)\r\n scrbslog(scparams)\r\n scrbslog(\"======End to create a new schedule======\")\r\n end", "def create\n @manage_schedule = Schedule.new(params[:manage_schedule])\n\n respond_to do |format|\n if @manage_schedule.save\n format.html { redirect_to @manage_schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @manage_schedule, status: :created, location: @manage_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manage_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mail_schedule = MailSchedule.new(mail_schedule_params)\n\n respond_to do |format|\n if @mail_schedule.save\n format.html { redirect_to @mail_schedule, notice: 'Mail schedule was successfully created.' }\n format.json { render :show, status: :created, location: @mail_schedule }\n else\n format.html { render :new }\n format.json { render json: @mail_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.create(format(params))\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n # respond_to do |format|\n # if @schedule.save\n # format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @schedule }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @schedule.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def pipeline_schedule(pipeline_name, options = {})\n options[:accept] = \"text/plain\" # Why is this not Json?\n post \"pipelines/#{pipeline_name}/schedule\", options\n end", "def create\n @schedule = current_user.schedules.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html {redirect_to root_url, notice: 'スケジュールが作成されました'}\n format.json {render :show, status: :created, location: @schedule}\n else\n @action_type = @schedule.action_type\n format.html {render :new}\n format.json {render json: @schedule.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\r\n\r\n @schedule = Schedule.new(params[:schedule])\r\n @schedule.event_id = params[:id]\r\n @schedule.date = params[:date]\r\n respond_to do |format|\r\n if @schedule.save\r\n # format.html { redirect_to new_schedule_path(params[:id],params[:date]), notice: 'Schedule was successfully created.' }\r\n format.html { redirect_to event_path(params[:id]), notice: 'Schedule was successfully created.' }\r\n\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def schedule_params\n params.require(:schedule).permit(:start_at, :end_at)\n end", "def create\n @agent_schedule = AgentSchedule.new(agent_schedule_params)\n\n respond_to do |format|\n if @agent_schedule.save\n format.html { redirect_to @agent_schedule, notice: 'Agent schedule was successfully created.' }\n format.json { render :show, status: :created, location: @agent_schedule }\n else\n format.html { render :new }\n format.json { render json: @agent_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ptschedule = Ptschedule.new(params[:ptschedule])\n\n respond_to do |format|\n if @ptschedule.save\n flash[:notice] = t('ptschedule.title')+\" \"+t('created')\n format.html { redirect_to(@ptschedule) }\n format.xml { render :xml => @ptschedule, :status => :created, :location => @ptschedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ptschedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n schedule = Schedule.new(schedule_params)\n\n if schedule.save\n # valid schedule\n render json: SchedulePresenter.new(schedule).as_json, status: 201\n else\n # invalid schedule\n render json: schedule.errors, status: 404\n end\n end", "def create\n @user_schedule = UserSchedule.new(params[:user_schedule])\n\n respond_to do |format|\n if @user_schedule.save\n format.html { redirect_to @user_schedule, notice: 'User schedule was successfully created.' }\n format.json { render json: @user_schedule, status: :created, location: @user_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def maintenance_schedule(statuspage_id, maintenance_name, maintenance_details, infrastructure_affected,\n date_planned_start, time_planned_start, date_planned_end, time_planned_end,\n automation = \"0\", all_infrastructure_affected = \"0\",\n maintenance_notify_now = \"0\", maintenance_notify_1_hr = \"0\",\n maintenance_notify_24_hr = \"0\", maintenance_notify_72_hr = \"0\", message_subject = \"Maintenance Notification\")\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_name'] = maintenance_name\n data['maintenance_details'] = maintenance_details\n data['infrastructure_affected'] = infrastructure_affected\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['date_planned_start'] = date_planned_start\n data['time_planned_start'] = time_planned_start\n data['date_planned_end'] = date_planned_end\n data['time_planned_end'] = time_planned_end\n data['automation'] = automation\n data['maintenance_notify_now'] = maintenance_notify_now\n data['maintenance_notify_1_hr'] = maintenance_notify_1_hr\n data['maintenance_notify_24_hr'] = maintenance_notify_24_hr\n data['maintenance_notify_72_hr'] = maintenance_notify_72_hr\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/schedule',\n :payload => data\n end", "def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end", "def create\n @admin_schedule = Clapme::Schedule.new(admin_schedule_params)\n\n respond_to do |format|\n if @admin_schedule.save\n format.html { redirect_to admin_schedule_url(@admin_schedule.id), notice: 'Schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:title, :description, :start, :end)\n end", "def create_schedule_for_assessment assessment_id, schedule_detail\n params = init_params\n params[:sc] = schedule_detail.to_json\n request_url = UrlGenerator.url_for(\"assessments\", \"#{assessment_id}/schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'POST', url: request_url, params: params)\n\n res = self.post(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end", "def create\n @dis_nfi_schedule = DisNfiSchedule.new(dis_nfi_schedule_params)\n\n respond_to do |format|\n if @dis_nfi_schedule.save\n format.html { redirect_to @dis_nfi_schedule, notice: 'Dis nfi schedule was successfully created.' }\n format.json { render :show, status: :created, location: @dis_nfi_schedule }\n else\n format.html { render :new }\n format.json { render json: @dis_nfi_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @runschedule = Runschedule.new(runschedule_params)\n\n respond_to do |format|\n if @runschedule.save\n format.html { redirect_to @runschedule, notice: 'Runschedule was successfully created.' }\n format.json { render :show, status: :created, location: @runschedule }\n else\n format.html { render :new }\n format.json { render json: @runschedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:bustrain, :routeid, :starttime, :endtime, :days)\n end", "def save_schedule\n\n #input_schedule = optimize_params[:events]\n\n output_schedule = input_schedule.map do |event_params|\n\n if not event_params[:repeat_type].blank? and event_params[:repeat_type] != \"once\"\n date_start = Time.at(event_params[:repeat_begin]).beginning_of_day()\n date_end = Time.at(event_params[:repeat_end]).end_of_day()\n s = Schedule.new(date_start)\n s.end_time = date_end\n \n if event_params[:repeat_type] == \"daily\"\n s.add_recurrence_rule(Rule.daily)\n elsif event_params[:repeat_type] == \"weekly\"\n days = []\n weekdays.each_with_index do |item, index| \n if params[:repeat_days].include?(index)\n days << item\n end\n end\n s.add_recurrence_rule(Rule.weekly(1).day(*days))\n end\n else\n s = nil\n end\n\n e = EventAssignment.new()\n e.assign_attributes(\n mandatory: true,\n name: event_params[:name],\n category: event_params[:category],\n description: event_params[:description],\n lat: event_params[:lat],\n lng: event_params[:lng],\n location: event_params[:location],\n is_private: event_params[:is_private],\n repeat_type: event_params[:repeat_type],\n start_unix: event_params[:start_unix],\n end_unix: event_params[:end_unix],\n schedule: s.to_yaml()\n )\n e\n end\n render json: {schedules: [output_schedule]}\n end", "def schedule(schedule)\n set_global_attributes\n upload_if_needed\n\n response = SimpleWorker.service.schedule(self.class.name, sw_get_data, schedule)\n# puts 'schedule response=' + response.inspect\n @schedule_id = response[\"schedule_id\"]\n response\n end", "def create\n @schedule = Schedule.new(schedule_params)\n @schedule.user = current_user\n \n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:title, :date_range, :start, :end)\n end", "def schedule_params\n params.require(:schedule).permit(:schedule_id, :state, :device_id, :date, :time, :repetition, :interval)\n end", "def create\n @weekly_schedule = WeeklySchedule.new(weekly_schedule_params)\n\n respond_to do |format|\n if @weekly_schedule.save\n format.html { redirect_to @weekly_schedule, notice: 'Weekly schedule was successfully created.' }\n format.json { render :show, status: :created, location: @weekly_schedule }\n else\n format.html { render :new }\n format.json { render json: @weekly_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:activity_id, :_id, :start, :end)\n end", "def create\n\t\tschedule = current_user.schedules.create(schedule_params)\n\t\t# updating the patient_id after scheduled created\n\t\tschedule.update_attributes(patient_id: params[:patient_id]) if !params[:patient_id].nil?\n\t\t# after schedule creation redirect to the schedules index page \n\t\tredirect_to schedules_path\n\tend", "def create\n @dj_schedule = DjSchedule.new(dj_schedule_params)\n\n respond_to do |format|\n if @dj_schedule.save\n format.html { redirect_to @dj_schedule, notice: 'Dj schedule was successfully created.' }\n format.json { render :show, status: :created, location: @dj_schedule }\n else\n format.html { render :new }\n format.json { render json: @dj_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @class_schedule = ClassSchedule.new(params[:class_schedule])\n\n respond_to do |format|\n if @class_schedule.save\n flash[:notice] = 'ClassSchedule was successfully created.'\n format.html { redirect_to(@class_schedule) }\n format.xml { render :xml => @class_schedule, :status => :created, :location => @class_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @class_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:name, :body, :sch_type)\n end", "def schedules_params\n params.require(:schedule).permit(:date, :price)\n end", "def schedule_params\n params.require(:schedule).permit(:content, :action_type, :start_time, :termination_time)\n end", "def create\n @interview_session_schedule = InterviewSessionSchedule.new(params[:interview_session_schedule])\n\n respond_to do |format|\n if @interview_session_schedule.save\n format.html { redirect_to(@interview_session_schedule, :notice => 'Interview session schedule was successfully created.') }\n format.xml { render :xml => @interview_session_schedule, :status => :created, :location => @interview_session_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interview_session_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:description, :start, :end)\n end", "def create\n @inspection_schedule = InspectionSchedule.new(inspection_schedule_savable_params)\n\n respond_to do |format|\n if @inspection_schedule.save\n format.html { redirect_to @inspection_schedule, notice: 'InspectionSchedule was successfully created.' }\n format.json { render :show, status: :created, location: @inspection_schedule }\n else\n format.html { render :new }\n format.json { render json: @inspection_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_schedules(id, options={})\n # schedules = options.fetch(:schedules) { raise ArgumentError }\n raise ArgumentError unless ENV['BUFFER_DEBUG']\n response = post(\"/profiles/#{id}/schedules/update.json\", options )\n Buff::Response.new(JSON.parse(response.body))\n end", "def create\n @schedule_action = ScheduleAction.new(schedule_action_params)\n\n respond_to do |format|\n if @schedule_action.save\n format.html { redirect_to @schedule_action, notice: 'Schedule action was successfully created.' }\n format.json { render :show, status: :created, location: @schedule_action }\n else\n format.html { render :new }\n format.json { render json: @schedule_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n @schedule.target ||= 0\n @schedule.achievement ||= 0\n if @schedule.save\n format.html { redirect_to @schedule,\n notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created,\n location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def schedule(subperiod,year,gs,expiry_date)\n #URL della servlet\n url = URI.parse(CONFIG['servlet']['address'])\n #impostazione del metodo POST\n req = Net::HTTP::Post.new(url.path)\n #parametri di autenticazione\n #req.basic_auth 'jack', 'pass'\n #dati da inviare op = ScheduleJob\n if expiry_date\n data = expiry_date.date\n day = data.day.to_i\n if day < 10\n day = \"0\" + day.to_s\n else\n day = day.to_s\n end\n month = data.mon.to_i\n if month < 10\n month = \"0\" + month.to_s\n else\n month = month.to_s\n end\n date = day + \"-\" + month + \"-\" + data.year.to_s\n req.set_form_data({'op'=>'sj', 'graduate_course' => gs.id.to_s,\n 'year' => year,\n 'subperiod' => subperiod.to_s,\n 'date'=> date\n }, '&')\n else\n req.set_form_data({'op'=>'sj', 'graduate_course' => gs.id.to_s,\n 'year' => year,\n 'subperiod' => subperiod.to_s\n }, '&')\n #connessione alla servlet\n end\n res = Net::HTTP.new(url.host, url.port).start {\n |http| http.request(req)\n }\n #controllo del codice di errore\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n return true\n when Net::HTTPNotAcceptable\n #parametri non corretti.. riportare alla form\n return false\n else\n #errore connessione.. riprovare\n return false\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n\n @schedule.project_id = 1;\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:week, :dayOfWeek, :beginHour, :endHour, :status)\n end", "def custom_schedule(schedule)\n schedules << schedule.create_custom\n save\n end", "def create\n authorize! :create, Schedule, :message => 'Not authorized as an administrator.'\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patient = Patient.find(params[:patient_id])\n @schedule = @patient.schedules.create(params[:schedule])\n\n # TODO can improve it to use nested attributes\n params[:pill_time].each do |pill_time|\n @schedule.pill_times.build(pill_time)\n end\n\n @pill_times = @schedule.pill_times\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to [@patient, @schedule],\n notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule,\n status: :created,\n location: [@patient, @schedule] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # Get schedule json object from parameters\n schedule_params = params[:schedule] ||= {}\n\n # Find if schedule has been created already\n # find by name and group\n @schedule = Schedule.find_by_name_and_group(schedule_params[:name], schedule_params[:group])\n\n if @schedule\n\n # Check to see if the schedule is registered with Quartz (after restart or removal, etc)\n key = JobKey.new(@schedule.name, @schedule.group)\n unless RemoteJobScheduler.instance.scheduler.check_exists(key)\n RemoteJobScheduler.instance.build_schedule(@schedule)\n end\n\n render :json => {:schedule_id => @schedule.id, :msg => 'schedule already exists'}\n else\n begin\n @schedule = Schedule.new(schedule_params)\n rescue => e\n Rails.logger.error \"Could not create schedule : #{e.message}\"\n render :json => {:error => e.message}\n return\n end\n\n if @schedule.save\n begin\n RemoteJobScheduler.instance.build_schedule(@schedule)\n render :json => {:schedule_id => @schedule.id}\n rescue => e\n Rails.logger.error \"Could not create schedule : #{e.message}\"\n render :json => {:error => e.message}\n end\n\n else\n # TODO : We need error codes for this\n render :json => {:error => \"Error : #{@schedule.errors.first[0]} #{@schedule.errors.first[1]}\",\n :content_type => 'text/plain',\n :status => :unprocessable_entity}\n\n end # end (if @schedule.save)\n\n end # end (if @schedule)\n\n end", "def create\n @bus_schedule = BusSchedule.new(bus_schedule_params)\n\n respond_to do |format|\n if @bus_schedule.save\n format.html { redirect_to @bus_schedule, notice: 'Bus schedule was successfully created.' }\n format.json { render :show, status: :created, location: @bus_schedule }\n else\n format.html { render :new }\n format.json { render json: @bus_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trip_schedule = TripSchedule.new(trip_schedule_params)\n\n respond_to do |format|\n if @trip_schedule.save\n format.html { redirect_to @trip_schedule, notice: 'Trip schedule was successfully created.' }\n format.json { render :show, status: :created, location: @trip_schedule }\n else\n format.html { render :new }\n format.json { render json: @trip_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @crew_big_sonu_schedule = Crew::BigSonuSchedule.new(crew_big_sonu_schedule_params)\n\n respond_to do |format|\n if @crew_big_sonu_schedule.save\n format.html { redirect_to @crew_big_sonu_schedule, notice: 'Big sonu schedule was successfully created.' }\n format.json { render :show, status: :created, location: @crew_big_sonu_schedule }\n else\n format.html { render :new }\n format.json { render json: @crew_big_sonu_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:shift_id, :employee, :date, :schedule_id, :start, :end)\n end", "def create\n @work_schedule = WorkSchedule.new(work_schedule_params)\n\n respond_to do |format|\n if @work_schedule.save\n format.html { redirect_to @work_schedule, notice: 'Work schedule was successfully created.' }\n format.json { render :show, status: :created, location: @work_schedule }\n else\n format.html { render :new }\n format.json { render json: @work_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to locations_path } \n #format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:name, :repeat, :hour, :minute, :repeat_days, :device_id)\n end", "def index\n @schedules = Schedule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schedules }\n end\n end", "def schedule_params\n params.require(:schedule).permit(:boat_id, :job_id, :start, :finish)\n end", "def create\n @class_schedule = ClassSchedule.new(class_schedule_params)\n\n respond_to do |format|\n if @class_schedule.save\n format.html { redirect_to class_schedules_path, notice: 'Розклад занять був успішно доданий.' }\n format.json { render :index, status: :created, location: @class_schedule }\n else\n format.html { render :new }\n format.json { render json: @class_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_params\n params.require(:schedule).permit(:start_date, :end_date, :category, :assignee_id)\n end", "def create_new_schedule()\n wait_until_schedules_page_new_schedule_button_visible\n schedules_page_new_schedule_button.click\n self.wait_for_no_spinner\n wait_until_schedules_page_new_schedule_button_visible\n wait_until_schedules_page_active_schedule_title_visible\n self.wait_for_no_spinner\n MIST::AsyncHelper.wait_until{(schedules_page_active_schedule_title.text =~ /Schedule\\s*\\d+/i) == 0}\n end", "def schedule_params\n params.require(:schedule).permit(:title, :date_from, :date_to, :place, :content, :user_id, schedule_users_attributes: [:id, :schedule_id, :user_id])\n end", "def schedule_params\n params.require(:schedule).permit(:title, :content, :place, :file, :schedule_type, :start_at, :end_at, :university)\n end", "def create\n @person_schedule = PersonSchedule.new(person_schedule_params)\n respond_to do |format|\n if @person_schedule.save\n format.json { render :show, status: :created, object: @person_schedule }\n else\n format.json { render json: @person_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def reports_schedule\n \n @schedule = ReportSchedule.find(params[:schedule_id])\n \n respond_to do |format|\n format.html\n format.json { render json: @schedule }\n end\n end", "def create\n @scheduler = Scheduler.new(scheduler_params)\n\n respond_to do |format|\n if @scheduler.save\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully created.' }\n format.json { render :show, status: :created, location: @scheduler }\n else\n format.html { render :new }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @scheduler = Scheduler.new(params[:scheduler])\n\n respond_to do |format|\n if @scheduler.save\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully created.' }\n format.json { render json: @scheduler, status: :created, location: @scheduler }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule = Schedule.new(schedule_params)\n auth! :action => :update, :object => @schedule.screen\n respond_to do |format|\n if @schedule.save\n process_notification(@schedule, {:screen_id => @schedule.screen_id, :screen_name => @schedule.screen.name,\n :template_id => @schedule.template.id, :template_name => @schedule.template.name }, \n :key => 'concerto_template_scheduling.schedule.create', :owner => current_user, :action => 'create')\n\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def scheduling_params\n params.require(:scheduling).permit(:group_id, :name, :description, :start_date, :end_date, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday)\n end", "def schedule_params\n params.require(:schedule).permit(:time, :date, :gym_id, :user_id)\n end", "def schedule(uri); end", "def create\n @schedule_entry = ScheduleEntry.new(params[:schedule_entry])\n\n respond_to do |format|\n if @schedule_entry.save\n format.html { redirect_to edit_schedule_entry_path(1), notice: 'Schedule entry was successfully created.' }\n format.json { render json: @schedule_entry, status: :created, location: @schedule_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_one\n @laxid = params[:laxid]\n \tCreateScheduleService.new.scrape_team_schedule(@laxid)\n redirect_to \"/schedule/show?laxid=#{@laxid}\"\n end", "def create\n @scheduled_task = ScheduledTask.new(params[:scheduled_task])\n p = params[:scheduled_task]\n d = DateTime.new(p[\"next_run(1i)\"].to_i, p[\"next_run(2i)\"].to_i, p[\"next_run(3i)\"].to_i, p[\"next_run(4i)\"].to_i, p[\"next_run(5i)\"].to_i)\n @scheduled_task.next_run = d\n\n respond_to do |format|\n if @scheduled_task.save\n format.html { redirect_to @scheduled_task, notice: 'Scheduled task was successfully created.' }\n format.json { render json: @scheduled_task, status: :created, location: @scheduled_task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheduled_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule_action_params\n params.require(:schedule_action).permit(:description, :start_date, :end_date, :schedule_id)\n end" ]
[ "0.7189827", "0.6615932", "0.6597347", "0.6574539", "0.6525362", "0.651203", "0.64997774", "0.6469093", "0.6468536", "0.6468107", "0.6458748", "0.6458", "0.6428549", "0.6393197", "0.63538903", "0.63437325", "0.63199866", "0.63099986", "0.6307639", "0.6297627", "0.62874734", "0.62704587", "0.62690914", "0.62538373", "0.6246043", "0.6217992", "0.6202645", "0.62013394", "0.61904716", "0.61860615", "0.61602736", "0.6159376", "0.6157559", "0.6145751", "0.61342573", "0.61275226", "0.6123986", "0.6123852", "0.611753", "0.61164415", "0.6101261", "0.60871583", "0.6079589", "0.6059857", "0.60586214", "0.60559314", "0.6038613", "0.6036242", "0.6036035", "0.60289097", "0.6012045", "0.60075504", "0.6004244", "0.6001609", "0.59988576", "0.5996406", "0.5989799", "0.59894115", "0.5986537", "0.5976507", "0.59559274", "0.59537727", "0.59500897", "0.59490556", "0.593821", "0.5933422", "0.5922599", "0.59110504", "0.59096014", "0.58874536", "0.5875816", "0.58610535", "0.58571", "0.5853174", "0.5849319", "0.5839206", "0.583881", "0.58353966", "0.5833897", "0.5830787", "0.5830095", "0.582506", "0.58239514", "0.5815942", "0.5815091", "0.58137", "0.57995266", "0.57931983", "0.5788712", "0.578548", "0.5784493", "0.5782117", "0.5781934", "0.57792234", "0.57740456", "0.57671505", "0.57632136", "0.5762714", "0.5762654", "0.57541174" ]
0.6714149
1
PUT /schedules/1 PUT /schedules/1.xml
def update @schedule = Schedule.find(params[:id]) respond_to do |format| if @schedule.update_attributes(params[:schedule]) format.html { redirect_to(@schedule, :notice => 'Schedule was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @schedule.update(schedule_params)\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n if @schedule.update(params[:schedule])\n head :no_content\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, :notice => 'Schedule was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n flash[:notice] = 'Schedule was successfully updated.'\n format.html { redirect_to(schedule_path(@schedule)) }\n format.xml { head :ok }\n else\n @apps = App.find(:all)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(format(params))\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n data = schedule_params\n data[:update_at] = Time.now\n if @schedule.update(data)\n format.html { redirect_to @schedule, notice: 'Schedule ha sido actualizado.' }\n format.json { render :index, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schedule.update(schedule_params)\n render text: \" \"\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule,\n notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok,\n location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @schedule = Schedule.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @schedule.update_attributes(params[:schedule])\r\n format.html { redirect_to event_path(@schedule.event_id), notice: 'Schedule 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: @schedule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to schedules_path, notice: 'Agendamento atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n \n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n\t expire_page :action => 'show', :id => params[:id]\n flash[:notice] = 'Schedule was successfully updated.'\n format.html { redirect_to(@schedule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n\n # First create jobkey with existing name,group\n key = JobKey.new(@schedule.name, @schedule.group)\n\n if @schedule.update_attributes(params[:schedule])\n\n # reload schedule to refresh attributes\n @schedule.reload\n\n # Also update schedule in Quartz, if it already exists\n if RemoteJobScheduler.instance.scheduler.check_exists(key)\n RemoteJobScheduler.instance.update_schedule_trigger(@schedule)\n end\n\n format.html { redirect_to(@schedule, :notice => 'Schedule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @event_schedule = EventSchedule.find(params[:id])\n\n respond_to do |format|\n if @event_schedule.update_attributes(params[:event_schedule])\n format.html { redirect_to @event_schedule, notice: 'Event schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @schedule.update(schedule_params)\n redirect_to schedules_path\n end\n end", "def update\r\n @route_schedule = RouteSchedule.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @route_schedule.update_attributes(params[:route_schedule])\r\n format.html { redirect_to @route_schedule, notice: 'Route schedule 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: @route_schedule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'スケジュールの更新が正常に行われました。' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ptschedule = Ptschedule.find(params[:id])\n\n respond_to do |format|\n if @ptschedule.update_attributes(params[:ptschedule])\n flash[:notice] = t('ptschedule.title')+\" \"+t('updated')\n format.html { redirect_to(@ptschedule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ptschedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: '스케쥴이 수정되었습니다' }\n format.json { render action: 'show', status: :ok, location: @schedule }\n else\n format.html { render action: 'edit' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @manage_schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @manage_schedule.update_attributes(params[:manage_schedule])\n format.html { redirect_to @manage_schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manage_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @location, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @my_schedule.update(my_schedule_params)\n format.html { redirect_to @my_schedule, notice: 'My schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_schedule }\n else\n format.html { render :edit }\n format.json { render json: @my_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def update\n @class_schedule = ClassSchedule.find(params[:id])\n\n respond_to do |format|\n if @class_schedule.update_attributes(params[:class_schedule])\n flash[:notice] = 'ClassSchedule was successfully updated.'\n format.html { redirect_to(@class_schedule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @class_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def update\n @user_schedule = UserSchedule.find(params[:id])\n\n respond_to do |format|\n if @user_schedule.update_attributes(params[:user_schedule])\n format.html { redirect_to @user_schedule, notice: 'User schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n\n respond_to do |format|\n if @maintenance_schedule.update_attributes(params[:maintenance_schedule])\n format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_schedules(id, options={})\n # schedules = options.fetch(:schedules) { raise ArgumentError }\n raise ArgumentError unless ENV['BUFFER_DEBUG']\n response = post(\"/profiles/#{id}/schedules/update.json\", options )\n Buff::Response.new(JSON.parse(response.body))\n end", "def updateschedule(scid,params)\r\n scrbslog(\"======Begin to update a schedule======\")\r\n @schedule = Schedule.find(scid)\r\n @user = User.find(@schedule.user_id)\r\n scrbslog(\"Author:\" + @user.name)\r\n room_id = Room.find_by_room_name(params[\"room_name\"]).id\r\n @schedule.update_attributes(:schedule_day=>params[\"schedule_day\"],:start_time=>params[\"start_time\"],:end_time=>params[\"end_time\"],:comment=>params[\"comment\"],:room_id => room_id,:title =>params[\"title\"] )\r\n Status.create(:room_name=>params[\"room_name\"],:schedule_day=>params[\"schedule_day\"],:start_time=>params[\"start_time\"],:end_time=>params[\"end_time\"],:scheduleid=>scid)\r\n scrbslog(params)\r\n scrbslog(\"======End to update a schedule======\")\r\n end", "def update\n respond_to do |format|\n if @agent_schedule.update(agent_schedule_params)\n format.html { redirect_to @agent_schedule, notice: 'Agent schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @agent_schedule }\n else\n format.html { render :edit }\n format.json { render json: @agent_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to session.delete(:return_to), notice: \"Schedule was successfully updated.\" }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dates_schedule.update(dates_schedule_params)\n format.html { redirect_to @dates_schedule, notice: 'Dates schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @dates_schedule }\n else\n format.html { render :edit }\n format.json { render json: @dates_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nfl_schedule.update(nfl_schedule_params)\n format.html { redirect_to @nfl_schedule, notice: 'Nfl schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @nfl_schedule }\n else\n format.html { render :edit }\n format.json { render json: @nfl_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule(schedule)\n set_global_attributes\n upload_if_needed\n\n response = SimpleWorker.service.schedule(self.class.name, sw_get_data, schedule)\n# puts 'schedule response=' + response.inspect\n @schedule_id = response[\"schedule_id\"]\n response\n end", "def update\n @interview_session_schedule = InterviewSessionSchedule.find(params[:id])\n\n respond_to do |format|\n if @interview_session_schedule.update_attributes(params[:interview_session_schedule])\n format.html { redirect_to(@interview_session_schedule, :notice => 'Interview session schedule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interview_session_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_schedule\n @schedule = Schedule.find(params[:id])\n end", "def update\n # respond_to do |format|\n # if @schedule.update(schedule_params)\n # format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @schedule.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n authorize! :update, Schedule, :message => 'Not authorized as an administrator.'\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_schedule.update(admin_schedule_params)\n format.html { redirect_to admin_schedule_url(@admin_schedule.id), notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scheduler = Scheduler.find(params[:id])\n\n respond_to do |format|\n if @scheduler.update_attributes(params[:scheduler])\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_schedule\n @schedule = Schedule.where(:schedule_id => params[:id])\n end", "def update\n respond_to do |format|\n if @scheduler.update(scheduler_params)\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully updated.' }\n format.json { render :show, status: :ok, location: @scheduler }\n else\n format.html { render :edit }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule_action.update(schedule_action_params)\n format.html { redirect_to @schedule_action, notice: 'Schedule action was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule_action }\n else\n format.html { render :edit }\n format.json { render json: @schedule_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_my_schedule\n @my_schedule = MySchedule.find(params[:id])\n end", "def update\n respond_to do |format|\n if @user_schedule.update(user_schedule_params)\n format.html { redirect_to @user_schedule, notice: 'User schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schedule = Schedule.find(params[:id])\n auth! :action => :update, :object => @schedule.screen\n\n respond_to do |format|\n if @schedule.update_attributes(schedule_params)\n process_notification(@schedule, {:screen_id => @schedule.screen_id, :screen_name => @schedule.screen.name,\n :template_id => @schedule.template.id, :template_name => @schedule.template.name }, \n :key => 'concerto_template_scheduling.schedule.update', :owner => current_user, :action => 'update')\n\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end", "def update\n @schedule_entry = ScheduleEntry.find(params[:id])\n\n respond_to do |format|\n if @schedule_entry.update_attributes(params[:schedule_entry])\n format.html { redirect_to @schedule_entry, notice: 'Schedule entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_schedule\n @schedule = Schedule.find(params[:id]) unless params[:id] == 'destroy_multiple' || params[:id].to_i.zero?\n end", "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to(@schedule, :notice => 'Schedule was successfully created.') }\n format.xml { render :xml => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @weekly_schedule.update(weekly_schedule_params)\n format.html { redirect_to @weekly_schedule, notice: 'Weekly schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @weekly_schedule }\n else\n format.html { render :edit }\n format.json { render json: @weekly_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trip_schedule.update(trip_schedule_params)\n format.html { redirect_to @trip_schedule, notice: 'Trip schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_schedule }\n else\n format.html { render :edit }\n format.json { render json: @trip_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @counter_schedule.update(counter_schedule_params)\n format.html { redirect_to @counter_schedule, notice: 'Counter schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @counter_schedule }\n else\n format.html { render :edit }\n format.json { render json: @counter_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @block && @schedule.update(schedule_params)\n format.html { redirect_to admins_backoffice_schedules_path, notice: @notice }\n format.json { render status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bus_schedule.update(bus_schedule_params)\n format.html { redirect_to @bus_schedule, notice: 'Bus schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus_schedule }\n else\n format.html { render :edit }\n format.json { render json: @bus_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scheduled_task = ScheduledTask.find(params[:id])\n\n respond_to do |format|\n if @scheduled_task.update_attributes(params.require(:scheduled_task).permit!)\n format.html { redirect_to @scheduled_task, notice: 'Scheduled task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduled_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def schedules\n @doc.at_xpath('/a:akomaNtoso/a:components/a:component/a:doc[@name=\"schedules\"]/a:mainBody', a: NS)\n end", "def update\n respond_to do |format|\n if @crew_big_sonu_schedule.update(crew_big_sonu_schedule_params)\n format.html { redirect_to @crew_big_sonu_schedule, notice: 'Big sonu schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @crew_big_sonu_schedule }\n else\n format.html { render :edit }\n format.json { render json: @crew_big_sonu_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @schedule = Schedule.find(params[:id])\n end", "def update\n respond_to do |format|\n if @person_schedule.update(person_schedule_params)\n format.json { render :show, status: :ok, object: @person_schedule }\n else\n format.json { render json: @person_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @runschedule.update(runschedule_params)\n format.html { redirect_to @runschedule, notice: 'Runschedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @runschedule }\n else\n format.html { render :edit }\n format.json { render json: @runschedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dis_nfi_schedule.update(dis_nfi_schedule_params)\n format.html { redirect_to @dis_nfi_schedule, notice: 'Dis nfi schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_nfi_schedule }\n else\n format.html { render :edit }\n format.json { render json: @dis_nfi_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scheduled_class = ScheduledClass.find(params[:id])\n\n respond_to do |format|\n if @scheduled_class.update_attributes(params[:scheduled_class])\n format.html { redirect_to(@scheduled_class, :notice => 'ScheduledClass was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scheduled_class.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_schedule access_key, edit_details\n params = init_params\n params[:sc] = edit_details.to_json\n request_url = UrlGenerator.url_for(\"schedules\", \"#{access_key}/edit\")\n asgn = SignatureGenerator.signature_for(http_verb: 'POST', url: request_url, params: params)\n\n res = self.post(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end" ]
[ "0.6889635", "0.6754661", "0.6754633", "0.6706276", "0.6698275", "0.6605363", "0.65974164", "0.65758055", "0.6571536", "0.6557505", "0.6557505", "0.6557505", "0.6557505", "0.6557505", "0.6557505", "0.6557505", "0.65455604", "0.65155226", "0.6475559", "0.6472355", "0.6464864", "0.6461399", "0.64485794", "0.64463645", "0.6425812", "0.6394227", "0.6387797", "0.6374747", "0.6347833", "0.63341194", "0.6331306", "0.6331306", "0.6331306", "0.6331306", "0.6331306", "0.6307273", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6296362", "0.6264908", "0.6257597", "0.6255576", "0.62469006", "0.62439007", "0.6201533", "0.6177679", "0.615438", "0.61535823", "0.61376125", "0.6116681", "0.61113054", "0.6079757", "0.607437", "0.60498315", "0.6040786", "0.60331744", "0.60234046", "0.6018738", "0.60180455", "0.6007075", "0.59829634", "0.597693", "0.59734", "0.593986", "0.59381825", "0.5931483", "0.590659", "0.5905697", "0.5886164", "0.5882481", "0.5874571", "0.5873107", "0.58639944", "0.5840553", "0.5840036", "0.5836876", "0.58198243", "0.58108705", "0.58052355" ]
0.698327
0
DELETE /schedules/1 DELETE /schedules/1.xml
def destroy @schedule = Schedule.find(params[:id]) @schedule.destroy respond_to do |format| format.html { redirect_to(schedules_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n\n @schedule.destroy\n\n key = JobKey.new(@schedule.name, @schedule.group)\n if RemoteJobScheduler.instance.scheduler.check_exists(key)\n RemoteJobScheduler.instance.remove_schedule(key)\n end\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n @maintenance_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(maintenance_schedules_url) }\n format.xml { head :ok }\n end\n end", "def deleteschedule(scid)\r\n scrbslog(\"======Begin to delete a schedule======\")\r\n @schedule = Schedule.find(scid)\r\n @user = User.find(@schedule.user_id)\r\n scrbslog(\"Author:\" + @user.name)\r\n @status = Status.find_by_scheduleid(@schedule.id)\r\n scrbslog(@schedule.title + \" \" + @schedule.schedule_day + \" \" + @schedule.start_time + \" \" + @schedule.end_time + \" \" + @schedule.comment + \" \" + @schedule.room_id.to_s)\r\n @status.delete\r\n @schedule.delete \r\n scrbslog(\"======Begin to delete a schedule======\")\r\n end", "def destroy\n @ptschedule = Ptschedule.find(params[:id])\n @ptschedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptschedules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n head :no_content\n end", "def destroy\r\n @route_schedule = RouteSchedule.find(params[:id])\r\n @route_schedule.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_schedules_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :ok }\n end\n end", "def destroy\n @class_schedule = ClassSchedule.find(params[:id])\n @class_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(class_schedules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @schedule = Schedule.find(params[:id])\r\n @schedule.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to schedules_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n end", "def destroy\n @schedule.destroy\n redirect_to schedules_url\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'スケジュールの削除が正常に行われました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @manage_schedule = Schedule.find(params[:id])\n @manage_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_schedules_url }\n format.json { head :ok }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_schedule = EventSchedule.find(params[:id])\n @event_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to event_schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interview_session_schedule = InterviewSessionSchedule.find(params[:id])\n @interview_session_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(interview_session_schedules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html {redirect_to root_url, notice: 'スケジュールが削除されました'}\n format.json {head :no_content}\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule ha sido eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_schedule.destroy\n respond_to do |format|\n format.html { redirect_to admin_schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nfl_schedule = NflSchedule.find(params[:id])\n @nfl_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to nfl_schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule = Schedule.find_by_id(params[:id])\n if @schedule\n @schedule.destroy\n @schedules = Schedule.all\n render json: @schedules\n else\n render json: {errorMessage:\"no schedule with id: #{params[:id]}\"}, status: :not_found\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url,\n notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to admins_backoffice_schedules_path, notice: 'Horário foi deletado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: \"Schedule was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: \"Schedule was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to admin_schedules_url, notice: '赛程删除成功' }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_schedule.destroy\n respond_to do |format|\n format.html { redirect_to my_schedules_url, notice: 'My schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dates_schedule.destroy\n respond_to do |format|\n format.html { redirect_to dates_schedules_url, notice: 'Dates schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @scheduler = Scheduler.find(params[:id])\n @scheduler.destroy\n\n respond_to do |format|\n format.html { redirect_to schedulers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dj_schedule.destroy\n respond_to do |format|\n format.html { redirect_to dj_schedules_url, notice: 'Dj schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @weekly_schedule.destroy\n respond_to do |format|\n format.html { redirect_to weekly_schedules_url, notice: 'Weekly schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mail_schedule.destroy\n respond_to do |format|\n format.html { redirect_to mail_schedules_url, notice: 'Mail schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @doctorsheduling = Doctorsheduling.find(params[:id])\n @doctorsheduling.destroy\n\n respond_to do |format|\n format.html { redirect_to(doctorshedulings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_schedule = UserSchedule.find(params[:id])\n @user_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to user_schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n auth! :action => :update, :object => @schedule.screen\n process_notification(@schedule, {:screen_id => @schedule.screen_id, :screen_name => @schedule.screen.name,\n :template_id => @schedule.template.id, :template_name => @schedule.template.name }, \n :key => 'concerto_template_scheduling.schedule.destroy', :owner => current_user, :action => 'destroy')\n @schedule.destroy\n \n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to @schedule.patient }\n format.json { head :no_content }\n end\n end", "def destroy\n @agent_schedule.destroy\n respond_to do |format|\n format.html { redirect_to agent_schedules_url, notice: 'Agent schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @scheduled_class = ScheduledClass.find(params[:id])\n @scheduled_class.destroy\n\n respond_to do |format|\n format.html { redirect_to(scheduled_classes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @schedule_entry = ScheduleEntry.find(params[:id])\n @schedule_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_schedule_entry_path(1) }\n format.json { head :no_content }\n end\n end", "def destroy\n @nfl_schedule.destroy\n respond_to do |format|\n format.html { redirect_to nfl_schedules_url, notice: 'Nfl schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n send_calendar_request(\"/#{@id}\", :delete)\n end", "def destroy\n @quartz = Quartz.find(params[:id])\n @quartz.destroy\n\n respond_to do |format|\n format.html { redirect_to(quartzs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @schedule_action.destroy\n respond_to do |format|\n format.html { redirect_to schedule_actions_url, notice: 'Schedule action was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dis_nfi_schedule.destroy\n respond_to do |format|\n format.html { redirect_to dis_nfi_schedules_url, notice: 'Dis nfi schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stop = Stop.find(params[:id])\n @stop.destroy\n \n respond_to do |format|\n format.html { format.html { redirect_to('/admin/schedule') } }\n format.xml { head :ok }\n end\n end", "def destroy\n @runschedule.destroy\n respond_to do |format|\n format.html { redirect_to runschedules_url, notice: 'Runschedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_grr = DailyGrr.find(params[:id])\n @daily_grr.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_daily_grrs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @scheduler.destroy\n respond_to do |format|\n format.html { redirect_to schedulers_url, notice: 'Scheduler was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, Schedule, :message => 'Not authorized as an administrator.'\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end", "def delete\n admin_only do\n \t# get the schedule object to be deleted.\n handle_recurring_schedule_failure 'remove', 'removed' do\n @test = get_test_with_rescue\n @test.destroy!\n flash[:success] = \"Recurring Test Run Removed\"\n end\n redirect_to action: \"index\"\n end\n end", "def destroy\n @mailing_schedule.destroy\n respond_to do |format|\n format.html { redirect_to mailing_schedules_url, notice: 'Mailing schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_task = TimeTask.find(params[:id])\n @time_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sheduled_message = SheduledMessage.find(params[:id])\n @sheduled_message.destroy\n\n respond_to do |format|\n format.html { redirect_to sheduled_messages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @eventtime = Eventtime.find(params[:id])\n @eventtime.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventtimes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to admin_schedule_url, notice: 'Schedule was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n unless @schedule.out_of_date\n @schedule.send_canceled_notify_applicant_email\n end\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to @location, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @counter_schedule.destroy\n respond_to do |format|\n format.html { redirect_to counter_schedules_url, notice: 'Counter schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_cron_request.destroy\n respond_to do |format|\n format.html { redirect_to admin_cron_requests_url, notice: I18n.t('admin.cron_requests.destroy.message.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule_block = ScheduleBlock.find(params[:id])\n @schedule_block.destroy\n\n respond_to do |format|\n format.html { redirect_to period_schedule_path(@period, @schedule) }\n format.json { head :ok }\n end\n end", "def destroy\n @flight_schedule = FlightSchedule.find(params[:id])\n @flight_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to flight_schedules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bus_schedule.destroy\n respond_to do |format|\n format.html { redirect_to bus_schedules_url, notice: 'Bus schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @crew_big_sonu_schedule.destroy\n respond_to do |format|\n format.html { redirect_to crew_big_sonu_schedules_url, notice: 'Big sonu schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @weeklytimetable = Weeklytimetable.find(params[:id])\n @weeklytimetable.destroy\n\n respond_to do |format|\n format.html { redirect_to(weeklytimetables_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @weeklytimetable = Weeklytimetable.find(params[:id])\n @weeklytimetable.destroy\n\n respond_to do |format|\n format.html { redirect_to(weeklytimetables_url) }\n format.xml { head :ok }\n end\n end", "def removecourse\n course = Course.find(params[:course][:id])\n schedule = course.schedules.find(params[:schedule][:id])\n if schedule\n course.schedule.delete(scedule)\n end\n redirect_to courselist_courses_path\n end", "def destroy\n @class_schedule.destroy\n respond_to do |format|\n format.html { redirect_to class_schedules_url, notice: 'Class schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n if !params[:room_id].nil?\n format.html { redirect_to room_url(params[:room_id]), notice: 'Schedule was successfully destroyed.' }\n else\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @schedule.destroy\n respond_to do |format|\n #format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n #format.json { head :no_content }\n\t format.html {redirect_to schedules_path( :construction_id => params[:construction_id], \n :move_flag => params[:move_flag])}\n end\n end", "def destroy\n @trip_schedule.destroy\n respond_to do |format|\n format.html { redirect_to trip_schedules_url, notice: 'Trip schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @scheduled_task = ScheduledTask.find(params[:id])\n @scheduled_task.destroy\n\n respond_to do |format|\n format.html { redirect_to scheduled_tasks_url, notice: 'Scheduled task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @scheduler.destroy\n respond_to do |format|\n format.html { redirect_to job_schedulers_path(@job), notice: 'Scheduler was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @interviewscheduler.destroy\n respond_to do |format|\n format.html { redirect_to interviewschedulers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work_schedule.destroy\n respond_to do |format|\n format.html { redirect_to work_schedules_url, notice: 'Work schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_daily = VehicleDaily.find(params[:id])\n @vehicle_daily.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_dailies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.xml { head :ok }\n end\n end", "def delete\n client_opts = {}\n client_opts[:scheduled_action_name] = name\n client_opts[:auto_scaling_group_name] = auto_scaling_group_name\n client.delete_scheduled_action(client_opts)\n nil\n end", "def destroy\n @schedule_item_level = ScheduleItemLevel.find(params[:id])\n @schedule_item_level.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedule_item_levels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @schedules_history = SchedulesHistory.find(params[:id])\n @schedules_history.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tournament_day = TournamentDay.find(params[:id])\n @tournament_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(tournament_days_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @attendance = Attendance.find(params[:id])\n @attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to(attendances_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.7514488", "0.7332302", "0.7264067", "0.7165445", "0.7112163", "0.7077493", "0.697315", "0.6967041", "0.6959388", "0.69550914", "0.69405305", "0.69405305", "0.69405305", "0.69405305", "0.69405305", "0.6926803", "0.69090253", "0.6869087", "0.6867715", "0.68624055", "0.68624055", "0.68624055", "0.68624055", "0.68624055", "0.68286365", "0.67904675", "0.6774258", "0.6771053", "0.6752473", "0.67329353", "0.6727509", "0.66880107", "0.66849405", "0.667412", "0.667412", "0.667412", "0.667412", "0.667412", "0.667412", "0.667412", "0.66632044", "0.66632044", "0.6656126", "0.6639421", "0.6620196", "0.66148883", "0.6580683", "0.6574686", "0.65661323", "0.6557293", "0.6537938", "0.6537391", "0.65262574", "0.6524131", "0.65160275", "0.65053225", "0.649971", "0.64866376", "0.6481454", "0.647574", "0.64618087", "0.6434932", "0.6434645", "0.6428057", "0.6412396", "0.6396141", "0.63741106", "0.6340262", "0.6335753", "0.63311553", "0.6320198", "0.63201475", "0.63176054", "0.6315063", "0.6312727", "0.63018566", "0.62828666", "0.62637424", "0.6256172", "0.6253308", "0.6253308", "0.6245583", "0.6233824", "0.62285274", "0.62157977", "0.619877", "0.61947817", "0.6173013", "0.61703753", "0.61502934", "0.61442995", "0.6142253", "0.61394334", "0.61329484", "0.6130914", "0.61269915", "0.6124991", "0.61233354" ]
0.7531215
2
as arguments. This method should return true if the search value is in the array, false if not. You may not use .include? in your solution.
def include?(array, search_element) array.each do |array_element| if array_element == search_element return true end false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include?(array, search)\n array.each do |value|\n return true if value == search\n end\n false\nend", "def include?(arr, search_value)\n arr.each do |num|\n if num == search_value\n return true\n end\n end\n false\nend", "def include? (array, search)\n array.each { |item| return true if search == item }\n return false\nend", "def include?(arr, search_value)\n new_arr = arr.select { |element| element == search_value}\n !new_arr.empty?\nend", "def include?(arr, search)\n result = false\n arr.each { |num| result = true if num == search }\n result\nend", "def include?(array, search_value)\n array.select { |value| value == search_value }.empty? ? false : true\nend", "def include?(arr, search)\n arr.each do |element|\n if element == search\n return true\n end\n end\n false\nend", "def include?(array,search_value)\n included = false\n array.each do |x|\n included = true if x == search_value\n break if x == search_value\n end\n \n included\nend", "def include?(array, search_value)\n array.any? { |element| element == search_value }\nend", "def include?(array, search_value)\n !array.select{|element| element == search_value}.empty?\nend", "def include?(array, search_value)\n if array.count(search_value) == 1\n return true\n else\n return false\n end\nend", "def include?(array, search_element)\n array.each do |array_element|\n if array_element == search_element\n return true\n end\n end\n false\nend", "def include?(arr, search)\n arr.any? { |i| i == search }\nend", "def is_item_in_array(array,item)\n return array.include?(item)\nend", "def include?(array, search_value)\n # array.each do |element|\n # return true if element == search_value\n # end\n # false\n array.count(search_value) > 0\nend", "def include?(array, search_value)\n array.count(search_value) > 0\nend", "def include?(arr, search_val)\n # arr.each { |e| return true if e == search_val }\n # false\n arr.count(search_val) > 0\n # or:\n # arr.any? { |i| i == val }\nend", "def include?(arr, search_term)\n arr.reduce(false) { |acc, current| current == search_term ? true : acc }\nend", "def include?(arr, search)\n arr.any? { |elem| elem == search }\nend", "def include?(array, value)\n array.each do |elem|\n return true if elem == value\n end\n false\nend", "def include?(arr, value)\n includes = false\n arr.each { |n| includes = true if n == value }\n includes\nend", "def include?(array, arg)\n boolean_return = false\n array.each {|value| return boolean_return = true if value == arg}\n boolean_return\nend", "def include?(array, value)\n array.each { |element| return true if value == element }\n false\nend", "def include?(array, query)\n array.each do |el|\n return true if el == query\n end\n false\nend", "def check_array(array,target)\n if array.include?(target)\n return true\n else\n return false\n end\nend", "def contains (array, string)\n# use select method to filter over array\n array.select do |value|\n# use include? to see if the array includes string\n value.include? string\n end\nend", "def include?(array, value)\n array.each do |integer|\n return true if integer == value\n end\n return false\nend", "def search(array, value)\n return false if array.length == 0\n\n return search_helper(array, value)\nend", "def includ?(array, value)\n\tarray.each do |element|\n\t\tif element == value\n\t\t\treturn true\n\t\tend\n\tend\n\tfalse\nend", "def include? array, item\n array.include?(item)\nend", "def include?(array, value)\n array.any?(value)\nend", "def include?(arr, val)\n arr.any? { |element| element == val }\nend", "def search(array, value)\n if array == []\n return false\n else\n return search_helper(array, value, i)\n end \nend", "def include?(arr, val)\n arr.each { |el| return el == val if el == val }\n false\nend", "def in_arr? (arr, text, exact)\n\tif exact\n\t\treturn arr.include? text\n\telse\n\t\treturn arr.any?{|s| s.include? text}\n\tend\nend", "def include?(array, value)\n !!array.find_index(value)\nend", "def include?(array, value)\n !!array.find_index(value)\nend", "def search_array(arr, value)\n arr.each do |i|\n if i == value\n puts \"#{value} is present within array\"\n else\n value = \"#{value} is not present within array\"\n end\n return value\n end\nend", "def include?(array, value)\n # https://ruby-doc.com/core-2.7.2/Array.html#method-i-find_index\n !!array.find_index(value)\nend", "def array_includes?(array, given_thing)\n answer = false\n\n array.each do |thing|\n if thing == given_thing\n answer = true\n end\n end\n\n return answer\nend", "def search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend", "def search(array, value)\n return false if array.length == 0\n if array.shift == value\n return true\n else\n search(array,value)\n end\nend", "def include?(array, target)\n matches = array.select { |element| element == target }\n !matches.empty?\nend", "def include?(list, search)\n return false if list.empty? && search == nil \n list.find { |elem| elem == search } == search ? true : false\nend", "def search(array, value)\n return false if array.empty?\n element = array.shift\n return element == value || search(array, value)\nend", "def include?(ary, value)\r\n ary.select{ |obj| obj == value } != []\r\nend", "def include?(array, value)\n # method A\n array.any? { |element| element == value }\n \n # method B\n # for item in array\n # return true if item == value\n # end\n \n # false\nend", "def include?(arr, value)\n !(arr.select { |element| element == value }).empty?\nend", "def search(array, value)\n if array.empty?\n return false\n elsif array.shift == value\n return true\n else\n return search(array, value)\n end\nend", "def search(array, value)\n return false if array.length == 0\n return true if value == array[0]\n return search(array[1..-1], value)\n end", "def search(array, value)\n return search_helper(array, value)\nend", "def innit?(array, item_to_look_for)\n\tresult = false\n\tarray.each do |list_item|\n\t\tif list_item == item_to_look_for\n\t\t\tresult = true\t\n\t\tend\n\tend\n\treturn result\nend", "def search_array(array_list, particular_string)\n array_list.each do |item|\n if item == particular_string\n return true\n end\n end\nend", "def include?(array, value)\r\n array.count(value) > 0\r\nend", "def search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend", "def search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend", "def is_it_in(array, string)\n array.include?(string) ? array.index(string) : nil\nend", "def include?(arr, target)\n arr.any?{ |ele| ele == target} ? true : false\nend", "def search(array, value)\n index = 0\n if array == []\n return false\n else search_helper(array,value,index)\n end\nend", "def contains(value)\n end", "def include?(arr, include_item)\n arr.each { |item| return true if item == include_item }\n false\nend", "def exists?(number, array)\n array.include?(number)\nend", "def search(array, value)\n\ti = 0\n\treturn search_helper(array, value, i)\nend", "def item_include?(array, string)\n match = false\n array.each do |el|\n if el == string\n match = true\n end\n end\n match\nend", "def search(array, length, value_to_find)\r\n # loop through array based on i which starts at 0\r\n i = 0;\r\n # have loop stop at array length\r\n while i < array.length\r\n # at each part in loop look to see if the element matches value_to_find\r\n if array[i] == value_to_find\r\n # if it does, then return true\r\n return true\r\n else\r\n # if it does not, increase i + 1\r\n i += 1;\r\n end\r\n end\r\n # if get through loop and has not returned true, return false\r\n return false\r\nend", "def search(array, value)\n return false if array.empty?\n if array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\nend", "def include_any?(arr, arr2)\n #good for large sets w/ few matches\n # Set.new(self).intersection(arr).empty?\n arr2.any? {|e| arr.include?(e) }\n end", "def true_for_ravenclaw(array, item)\n for i in array\n status= i.include?(item)\n end\n return status\nend", "def search(array, value)\n if array.empty?\n return false\n else\n if array[0] == value\n return true\n else\n array.shift\n return search(array, value)\n end\n end\nend", "def search(array, value)\n return false if array.empty?\n return true if array[0] == value\n return search(array[1..-1], value)\nend", "def search(array, value)\n return false if array.empty?\n return true if array[0] == value\n return search(array[1..-1], value)\nend", "def search_array(integers,search)\r\n\tintegers.each{|x|\r\n\t\tif x == search\r\n\t\t\treturn x\r\n\t\tend\r\n }\r\n\t return nil\r\nend", "def search(array, value)\n if array.empty?\n return false\n elsif array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\nend", "def search(array, value)\n # input validation\n return false if array.nil?\n # base case\n i = 0\n return search_helper(array, i, value)\nend", "def search(array, value)\n return false if array.empty?\n return true if array[0] == value\n return search(array[1..-1], value)\nend", "def belongs_in_array(arr, num)\n arr.each do |thing|\n if thing == num\n puts true\n return\n end\n end\n puts false\n # or puts arr.include?(num)\nend", "def search(array, value)\n return false if array.empty?\n return true if array[0] == value\n last = array.pop\n return true if last == value\n return search(array, value)\nend", "def search(array, value)\n new_array_minus_one = 0..-2\n\n if array.empty? \n return false \n elsif array[-1] == value\n return true \n else \n search(array[new_array_minus_one], value)\n end \nend", "def check_for (array, thing_to_find )\n array.select { |word| word.include? thing_to_find }\n end", "def includes?(array, target)\n return false if array.empty?\n \n return true if array[0] == target\n\n includes?(array[1..-1], target)\nend", "def using_include(array, element)\n\tarray.include?(element)\nend", "def search_for_result(array, value)\n result = array.select {|number| number == value}\n if result.empty?\n puts \"value not found in final array\"\n else\n puts \"#{value} found in final array\"\n end\n @found = true\nend", "def include_array?(array)\n array.any? { |member| array?(member) }\n end", "def includes?(array, target)\n return false if array.empty?\n return true if array[0] == target\n includes?(array.drop(1),target)\nend", "def include?(value)\n @values.include? value\n end", "def includes?(array, target)\n return false if array.empty?\n return true if array.first == target\n includes?(array[1..-1])\nend", "def is_value_in_array(string,array)\n found = false\n array_size = array.length\n array_index = 0\n\n while (found == false && array_index<array_size)\n if array[array_index]==string\n found = true\n end\n array_index =array_index+1 \n end\n return found\nend", "def array_search(array, value)\n array.find(value)\nend", "def includes?(array, target)\n if array.empty?\n false\n elsif array.first == target\n true\n else\n includes?(array.drop(1),target)\n end\nend", "def search(array, length, value_to_find)\n length.times do |i|\n if array[i] == value_to_find\n return true\n end\n end\n return false\nend", "def include?(key)\n value.include?(key)\n end", "def include?(o)\n @mut.synchronize{@array.include?(o)}\n end", "def search(array, value)\n if array == [] # base case\n return false\n elsif array[0] == value # base case\n return true\n else\n return search(array[1..-1], value)\n end\nend", "def search(array, value)\n if array.empty?\n return false\n elsif array[0] == value\n return true\n end\n \n return search(array[1..-1], value)\nend", "def includes?(array, target)\n array.each do |k, v|\n if k == key\n return true\n elsif v.class.to_s == \"Array\"\n v.each do |inner_array|\n return has_key(inner_array, key)\n end\n else\n return false\n end\n end\n\nend", "def search(array, value, current_index = 0 )\n # raise NotImplementedError, \"Method not implemented\"\n if current_index < array.length\n if array[current_index] == value\n return true\n else\n return search(array, value, current_index + 1)\n end\n end\n return false\nend", "def includes?(array, target)\n return false if array.empty?\n\n if array.pop == target\n return true\n else\n includes?(array, target)\n end\nend", "def search(array, value)\n if array.length == 0\n return false\n end\n if value == array[0]\n return true\n else\n return search(array[1..-1], value)\n end\nend", "def search(array, value)\n return false if array.empty?\n return true if value == array.first\n return search(array[1..-1], value)\nend", "def search(array, value)\n return false if array.empty?\n return true if value == array[0]\n return search(array[1..-1], value)\nend" ]
[ "0.8135656", "0.79325575", "0.79059553", "0.7866807", "0.7827858", "0.7816912", "0.7813352", "0.7780492", "0.776406", "0.77561796", "0.77016073", "0.76833194", "0.76818454", "0.7611247", "0.7604292", "0.7597185", "0.7595516", "0.7584448", "0.749761", "0.7324213", "0.7304917", "0.7303833", "0.7290835", "0.7279971", "0.7267937", "0.72513497", "0.7236829", "0.7229093", "0.7228369", "0.72160685", "0.71858317", "0.71439606", "0.7086721", "0.70744467", "0.70698094", "0.7066281", "0.7066281", "0.7016929", "0.7002034", "0.6995116", "0.69714904", "0.69640565", "0.69438547", "0.69436884", "0.692387", "0.6911205", "0.68983257", "0.68967193", "0.6892899", "0.6865985", "0.6851889", "0.68479276", "0.68409634", "0.6810933", "0.68077785", "0.68077785", "0.68017644", "0.67992014", "0.67885846", "0.6750959", "0.67495906", "0.67494726", "0.673525", "0.67349565", "0.6730772", "0.6725617", "0.6711124", "0.67092425", "0.6702442", "0.66971225", "0.66971225", "0.6672215", "0.666368", "0.6654429", "0.6643384", "0.66310155", "0.66235125", "0.66220415", "0.66161495", "0.6613866", "0.66126776", "0.66086924", "0.66053253", "0.6596732", "0.6594659", "0.65900373", "0.6584383", "0.6583904", "0.65811384", "0.6577861", "0.657686", "0.65754336", "0.6568391", "0.65673596", "0.6566138", "0.6562309", "0.65561384", "0.65549755", "0.655211", "0.6548151" ]
0.766524
13
puts include?(arr1, 5) true (breaks out of iteration and return true due to explicit return) puts include?(arr1, 1) list of elements see below with 'p' p include?(arr1, 1) [2, 3, 4, 5, 6, 7, 8, 9] Does not return false. Instead returns the the return value of the .each call (the original array) Not correct output! Move false return value out of loop iteration..
def include?(array, search_element) array.each do |array_element| if array_element == search_element return true end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include?(arr, num)\n arr.each{ |element| return true if element == num}\n return false\nend", "def include?(arr, value)\n includes = false\n arr.each { |n| includes = true if n == value }\n includes\nend", "def include?(array, integer)\r\n array.each do |element|\r\n return true if element == integer\r\n end\r\n\r\nfalse\r\nend", "def include?(arr, include_item)\n arr.each { |item| return true if item == include_item }\n false\nend", "def include?(array, value)\n array.each do |integer|\n return true if integer == value\n end\n return false\nend", "def include?(array, value)\n array.each do |elem|\n return true if elem == value\n end\n false\nend", "def include?(arr, search)\n result = false\n arr.each { |num| result = true if num == search }\n result\nend", "def include?(arr, search_value)\n arr.each do |num|\n if num == search_value\n return true\n end\n end\n false\nend", "def arr_includes(arr1, arr2)\n temp_arr2 = arr2.dup\n return false if arr2.length == 0\n arr1.each do |num|\n if temp_arr2.include? num\n index = temp_arr2.index(num)\n temp_arr2.delete_at(index)\n else\n return false\n end\n end\n return true\nend", "def include?(array, value)\n array.each { |element| return true if value == element }\n false\nend", "def using_include(array, element)\n\tarray.include?(element)\nend", "def include?(arr, val)\n arr.each { |el| return el == val if el == val }\n false\nend", "def include?(array, arg)\n boolean_return = false\n array.each {|value| return boolean_return = true if value == arg}\n boolean_return\nend", "def include?(arr, search)\n arr.each do |element|\n if element == search\n return true\n end\n end\n false\nend", "def arr_includes_all?(arr, *inc)\n inc.map { |i| arr.include? i }.reduce(&:&)\n end", "def include?(array,search_value)\n included = false\n array.each do |x|\n included = true if x == search_value\n break if x == search_value\n end\n \n included\nend", "def array_includes?(array, given_thing)\n answer = false\n\n array.each do |thing|\n if thing == given_thing\n answer = true\n end\n end\n\n return answer\nend", "def belongs_in_array(arr, num)\n arr.each do |thing|\n if thing == num\n puts true\n return\n end\n end\n puts false\n # or puts arr.include?(num)\nend", "def include?(array, search_element)\n array.each do |array_element|\n if array_element == search_element\n return true\n end\n false\n end\nend", "def number_included(number)\n arr = [1, 3, 5, 7, 9, 11]\n puts \"number\": number\n puts arr.include? number\nend", "def include?(array, search)\n array.each do |value|\n return true if value == search\n end\n false\nend", "def my_include?(array, target)\n return false if array.empty?\n return true if array.first == target\n my_include?(array.drop(1), target)\nend", "def include?(arr, number)\n arr.any? { |num| num == number }\nend", "def include?(array, value)\n # method A\n array.any? { |element| element == value }\n \n # method B\n # for item in array\n # return true if item == value\n # end\n \n # false\nend", "def include?(arr, value)\n !(arr.select { |element| element == value }).empty?\nend", "def include_any?(arr, arr2)\n #good for large sets w/ few matches\n # Set.new(self).intersection(arr).empty?\n arr2.any? {|e| arr.include?(e) }\n end", "def include?(array, value)\n array.any?(value)\nend", "def include?(arr, search_value)\n new_arr = arr.select { |element| element == search_value}\n !new_arr.empty?\nend", "def includes?(array, target)\n if array.empty?\n false\n elsif array.first == target\n true\n else\n includes?(array.drop(1),target)\n end\nend", "def include?(array, search_value)\n # array.each do |element|\n # return true if element == search_value\n # end\n # false\n array.count(search_value) > 0\nend", "def includes?(array, target)\n #empty array does not contain object\n return false if array == []\n\n #start with array[3]\n value = array.shift #pluck off\n if value == target\n true #the recursive call is not made\n else\n includes?(array, target)\n end\n\nend", "def include?(array, query)\n array.each do |el|\n return true if el == query\n end\n false\nend", "def include?(arr, target)\n arr.any?{ |ele| ele == target} ? true : false\nend", "def include?(array, target)\n matches = array.select { |element| element == target }\n !matches.empty?\nend", "def include?(arr, val)\n arr.any? { |element| element == val }\nend", "def include?(array, value)\r\n array.count(value) > 0\r\nend", "def include?(arr, search)\n arr.any? { |i| i == search }\nend", "def include?(ary, number)\n return false if ary.size == 0\n result = ary.detect do |item|\n item == number\n end\n !!(result == number)\nend", "def includ?(array, value)\n\tarray.each do |element|\n\t\tif element == value\n\t\t\treturn true\n\t\tend\n\tend\n\tfalse\nend", "def include?(arr, search_val)\n # arr.each { |e| return true if e == search_val }\n # false\n arr.count(search_val) > 0\n # or:\n # arr.any? { |i| i == val }\nend", "def include? (array, search)\n array.each { |item| return true if search == item }\n return false\nend", "def array_42(z)\n if z.include? 42\n return true\n else\n return false\n end\n\nend", "def include? array, item\n array.include?(item)\nend", "def include?(element)\n @ary.include? element\n end", "def includes?(array, target)\n return false if array.empty?\n return true if array[0] == target\n includes?(array.drop(1),target)\nend", "def include?(array, search_value)\n if array.count(search_value) == 1\n return true\n else\n return false\n end\nend", "def check_array(array,target)\n if array.include?(target)\n return true\n else\n return false\n end\nend", "def include?(arr, search)\n arr.any? { |elem| elem == search }\nend", "def includes?(array, target)\n return false if array.empty?\n return true if array.first == target\n includes?(array.drop(1), target)\nend", "def includes?(array, target)\n return true if array.first == target\n return false if array.empty?\n includes?(array.drop(1), target)\nend", "def includes?(array, target)\n return false if array.empty?\n return true if array.first == target\n includes?(array[1..-1])\nend", "def includes?(array, target)\n \n if array.empty?\n return false\n end\n \n if array[-1] == target\n return true\n else\n return includes?(array[0...-1], target)\n end\n\nend", "def includes?(array, target)\n return false if array.empty?\n \n return true if array[0] == target\n\n includes?(array[1..-1], target)\nend", "def includes?(array, target)\n return false if array.empty?\n return true if array.first == target\n includes?(array.drop(1), target)\nend", "def includes?(array, target)\n return true if array[0] == target\n return false if array[0] != target && array.length <= 1\n\n includes?(array.drop(1), target)\nend", "def include?(ary, value)\r\n ary.select{ |obj| obj == value } != []\r\nend", "def include_array?(array)\n array.any? { |member| array?(member) }\n end", "def include?(list,tst)\n list.each {|itm| return true if itm == tst}\n false\nend", "def array_include(a1, a2) \n return (a1 - a2).empty?\n end", "def include?(o)\n @mut.synchronize{@array.include?(o)}\n end", "def includes?(array, target)\n return false if array.empty?\n\n if array.pop == target\n return true\n else\n includes?(array, target)\n end\nend", "def include?(array, search_value)\n !array.select{|element| element == search_value}.empty?\nend", "def include?(array, search_value)\n array.select { |value| value == search_value }.empty? ? false : true\nend", "def includes?(array, target)\n return false if array.length <= 0\n return true if array[0] == target\n includes?(array[1..-1], target)\nend", "def includes?(array, target)\n return false if array.empty?\n dup = array.dup\n return true if dup.pop == target\n includes?(dup, target)\nend", "def include?(array, value)\n !!array.find_index(value)\nend", "def include?(array, value)\n !!array.find_index(value)\nend", "def include?(array, search_value)\n array.any? { |element| element == search_value }\nend", "def element(num)\n a = ['10', '2', '30', '5']\n if (a.include?(num) == true)\n puts \"#{num} is Present in the array\"\n else\n puts \"#{num} is not present in the array\"\n end\nend", "def include?(array, value)\n # https://ruby-doc.com/core-2.7.2/Array.html#method-i-find_index\n !!array.find_index(value)\nend", "def include?(array, search_value)\n array.count(search_value) > 0\nend", "def includes?(array, target)\n return false if array.empty?\n return true if array.pop == target\n includes?(array, target)\nend", "def is_item_in_array(array,item)\n return array.include?(item)\nend", "def true_for_ravenclaw(array, item)\n for i in array\n status= i.include?(item)\n end\n return status\nend", "def arrayAdditionI(arr)\n\tarrSum = 0\n\tlargestNum = arr.sort.pop\n\tarr.each{|x| arrSum += x if(x < largestNum) }\n\tif(arrSum >= largestNum || arr.include?(arrSum - largestNum))\n\t\treturn true\n\telse \n\t\treturn false\n\tend\nend", "def item_included?(str, arr)\n arr.each do |item|\n return true if item == str\n end\n false\nend", "def include?(ary, target)\n !ary.select { |value| value == target }.empty?\nend", "def in_array(array1, array2)\r\n \r\nend", "def does_list_include?(array, obj)\n array.count(obj) > 0\nend", "def not_included(arr) \n hash = Hash.new(0)\n arr.each { |el| hash[el] = 0 }\n i = 1\n # hash[5] == 0\n while true\n return i unless hash.has_key?(i)\n i += 1\n end\nend", "def include?(elem)\n @elements.include?(elem)\n end", "def includes?(data)\n list.includes?(data)\n end", "def includes?(array, target)\n array.each do |k, v|\n if k == key\n return true\n elsif v.class.to_s == \"Array\"\n v.each do |inner_array|\n return has_key(inner_array, key)\n end\n else\n return false\n end\n end\n\nend", "def includes?(array, target)\n \n return false if array.empty?\n\n middle_ele = array[array.length/2]\n\n if middle_ele == target\n return true\n elsif middle_ele > target\n includes?(array[0...array.length/2],target)\n elsif middle_ele < target\n includes?(array[array.length/2+1..-1],target)\n end\nend", "def compare(num1, num2, num3, num4, num5, num6)\n num_array = [num1, num2, num3, num4, num5]\n if num_array.include?(num6)\n p \"The number #{num6} appears in #{num_array}\"\n else\n p \"The number #{num6} does not appear in #{num_array}\"\n end\nend", "def include?(*args)\n args.inject(true) {|val, x| val = self.single_include?(x)}\n end", "def test_xyz_not_in_arr\n refute_includes(list, 'ttt')\n end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def include?(p0) end", "def they_here\n included = true\n new_animals = [\"Andean Cat\", \"Dodo\", \"Saiga Antelope\"]\n new_animals.each do |animal|\n @animal_array.each do |animal2|\n if animal == animal2\n included\n puts \"#{animal} is extinct\"\n else\n !included\n end\n end\n end\nend", "def include?(ary, value)\n !!ary.index(value)\nend", "def include?(el)\n list.include?(el)\n end", "def includes?(data)\n node = @head\n include_array = []\n until node.nil?\n include_array << node.data\n node = node.next_node\n end\n include_array.include?(data)\n end", "def include?(value)\n each do |index, list_value|\n return true if list_value == value\n end\n return false\n end", "def include?(element)\n @element_list.include? element\n end", "def exclude_all?(arr, arr2)\n ! include_any?(arr, arr2)\n end" ]
[ "0.7958506", "0.78739953", "0.7792143", "0.76820433", "0.7618613", "0.7591033", "0.7549037", "0.75187314", "0.74890625", "0.7472271", "0.74661076", "0.7425164", "0.73944294", "0.73934376", "0.73853475", "0.7352196", "0.7331383", "0.72701406", "0.7265875", "0.72497183", "0.7216824", "0.72077405", "0.71786904", "0.7162809", "0.71526974", "0.7132787", "0.7101517", "0.7100473", "0.7070405", "0.7038446", "0.7034349", "0.70129514", "0.70113474", "0.69831467", "0.69819283", "0.697439", "0.69585216", "0.6912014", "0.6900662", "0.69002444", "0.689133", "0.688096", "0.687461", "0.68715453", "0.68597764", "0.6856937", "0.6833273", "0.68097717", "0.67902625", "0.678765", "0.677828", "0.6773755", "0.67734796", "0.6735324", "0.6726455", "0.6711196", "0.66782004", "0.6674597", "0.6640601", "0.6630266", "0.66185373", "0.66071916", "0.6594632", "0.65725297", "0.65573174", "0.6545895", "0.6545895", "0.65331525", "0.65126884", "0.64901876", "0.64689445", "0.64476025", "0.6437076", "0.64310527", "0.63870776", "0.63609374", "0.6356545", "0.6278166", "0.6267425", "0.6261959", "0.6256596", "0.62435746", "0.6240277", "0.6232102", "0.62246907", "0.618012", "0.6172123", "0.6167152", "0.6166796", "0.6166796", "0.6166796", "0.6166796", "0.6166796", "0.61538017", "0.61447567", "0.61141974", "0.61048996", "0.60953826", "0.6092986", "0.6063707" ]
0.7301507
17
true works.. LS >
def include?(array, value) !!array.find_index(value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stand\r\n return true\r\n end", "def ls_trivial?\n\t\t!@ls || @ls.clear?\n\tend", "def check ; true ; end", "def semact?; false; end", "def pass\n checked_print ?.\n end", "def scm_char?; SCM_FALSE; end", "def truth\n\t\t\t\"You can't handle the truth\" ; true\n\t\tend", "def success?() end", "def flag; end", "def p2sh?\n false\n end", "def displ(res, l_n, inb)\n if res.is_a? String\n if check_flag(res)\n puts \"Line #{l_n.get}: #{res}\"\n return false\n end\n end\n\n puts_res(res) unless inb.casecmp('LET').zero?\n\n true\n end", "def slop!; end", "def slop!; end", "def test_ls\n cmd=ShellCommand.new(:cmd=>\"ls\")\n assert(!cmd.run?)\n assert(!cmd.success?)\n assert(cmd.run)\n assert(cmd.run?)\n if cmd.success?\n refute_equal(\"\", cmd.output)\n else\n refute_equal(\"\", cmd.error)\n end\n end", "def test; true; end", "def shell?\n false\n end", "def issn; end", "def output? ; !!@output ; end", "def working?\n true\n end", "def working?\n true\n end", "def scm_vector?; SCM_FALSE; end", "def lit?\n @lit\n end", "def working?\n false\n end", "def working?\n \t@working\n end", "def true \n \"true\" \n end", "def lsi; end", "def pipe?() end", "def success?; terminal_flag == :success end", "def success?; terminal_flag == :success end", "def show(msg)\n puts msg\n false\n end", "def qwerty\n\t\tfalse\n\tend", "def placebo?; false end", "def delicious?\n\t\treturn true\n\tend", "def pass; end", "def pass; end", "def shexit(shell)\n return true if shell == 0\n return false if shell == 1\nend", "def trux\n true\nend", "def true(_argvs)\n return nil\n end", "def broken?\n @broken == :broken \n\tend", "def print_success_message\n puts \"You have that!\"\n true #why should this return true also? #see my comment on line 53, and look at how it's called on line 96.\n end", "def nd?\n true\n end", "def full?\n end", "def test?\n false\n end", "def normal?\n @code == 1000\n end", "def scm_string?; SCM_FALSE; end", "def poopy?\n\t\t@stuff_in_intestine >= 8\n\tend", "def check!\n true\n end", "def open_root(base_revision)\n # Nothing has been printed out yet, so return 'true'.\n [true, '']\n end", "def revealed? ; false ; end", "def success?\n @_st_stat == 0\n end", "def delicious?\n #its automattically true\n true\n end", "def alto?\n @cr[0xb][7] == 1\n end", "def full?\n false\n end", "def executable_real?() end", "def falsx\n false\nend", "def list?\n false\n end", "def sld; end", "def expanded?(r)\n false\n end", "def command_found; end", "def passed?; end", "def passed?; end", "def passed?; end", "def cmd; end", "def success?(*) end", "def open_status?\n return @ajar == true\n end", "def cuts_opening?\n end", "def _true\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"true\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = apply(:_utfw)\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_true unless _tmp\n return _tmp\n end", "def dumb?\n false\n end", "def verdi; end", "def soprano?\n @cr[0xc][7] == 1\n end", "def current?\n\t return current_r == \"N\" ? false : true \n\tend", "def scm_symbol?; SCM_FALSE; end", "def isFull\n\[email protected] do |i| \n\t\tif i == '-' then \n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\n end", "def running? ; @running end", "def hello\r\n true\r\n end", "def tst_result\n passed? ? \"p\" : \"f\"\n end", "def left?; end", "def full?\n par? && trio?\n end", "def check_starting(_lang_result)\n end", "def scm_pair?; SCM_FALSE; end", "def teleportable?\n !grabbed?\n end", "def run\n false\n end", "def test_false_when_history_prevents_en_passant\n # TODO\n end", "def scholarly?\n false\n end", "def checked_puts object = ''\n real_puts object\n @prev_printed = false\n end", "def passed?\n\t\t\t@passed\n\t\tend", "def used?\n true\n end", "def splayed?\n splayed\n end", "def isWalking _args\n \"isWalking _args;\" \n end", "def delicious?()\n\t\treturn TRUE\n\tend", "def ai?\n\ttrue\n end", "def check_ending(_result)\n end", "def test?\n true\n end", "def stderrs; end", "def hpricot? ; false end", "def redirected?\r\n self.Mode > 31\r\n end", "def fin; false; end", "def positive?; end", "def process_true(exp)\n \"Qtrue\"\n end", "def complete?\n end", "def simple?\n true\n end" ]
[ "0.6583405", "0.63511115", "0.6176009", "0.6108918", "0.59303313", "0.59110874", "0.5868739", "0.5740535", "0.57060695", "0.56924134", "0.5673562", "0.56699187", "0.56699187", "0.5660929", "0.56531256", "0.56525314", "0.5647522", "0.5606071", "0.5585114", "0.5585114", "0.55831033", "0.5561047", "0.55570906", "0.5549842", "0.5544234", "0.5530673", "0.5508889", "0.55056524", "0.55056524", "0.55002934", "0.54978037", "0.5487057", "0.5481985", "0.5468086", "0.5468086", "0.545538", "0.54542655", "0.54397994", "0.54391056", "0.5422154", "0.54130965", "0.54050976", "0.54038095", "0.53984106", "0.5392933", "0.5391694", "0.53863245", "0.5369123", "0.536866", "0.53653145", "0.53653127", "0.53609776", "0.534719", "0.5344802", "0.5343823", "0.5332465", "0.53276277", "0.53256917", "0.5317072", "0.53139424", "0.53139424", "0.53139424", "0.5307173", "0.5303069", "0.52948076", "0.5294065", "0.5282769", "0.5267686", "0.5265144", "0.5263896", "0.52612036", "0.52593243", "0.52576995", "0.5257064", "0.5249288", "0.5247928", "0.52441555", "0.52385896", "0.5237856", "0.5227063", "0.52259123", "0.5224862", "0.52248013", "0.5208078", "0.52030283", "0.5201647", "0.5198509", "0.5196388", "0.5196376", "0.51962745", "0.51962143", "0.51951706", "0.51788026", "0.51749563", "0.51741993", "0.5173247", "0.51703084", "0.51696134", "0.51598704", "0.51571167", "0.51534134" ]
0.0
-1
Cantidad total del producto
def total_quantity total = 0.0 self.quantities.each do |quantity| total = total + quantity.number end total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preco_total\n produto.preco * quantidade\n end", "def total\n if @products.empty?\n return 0\n else\n total = (@products.values.sum * 1.075).round(2)\n end\n return total\n end", "def total\n # TODO: implement total\n if products.length == 0\n return 0\n end\n ((@products.values.sum)*1.075).round(2)\n end", "def total\n if @products == {}\n return 0 \n else\n m = 0\n @products.values.each do |v|\n m += v\n end\n\n sum = (m + (m * 0.075)).round(2)\n return sum\n end\n end", "def precio_total_compras\n compras.sum(:precio_total)\n #p = 0\n #compras.each do |compra|\n #p += (compra.precio_total || 0)\n #end\n #return p\n end", "def total\n if @products.length == 0\n return 0\n else\n total = @products.values.reduce(:+)\n total*= 1.075 #Tax\n total = total.round(2)\n return total\n end\n end", "def total\n (@products.values.sum * 1.075).round(2)\n end", "def total_products\n self.carts.sum(:quantity)\n end", "def total\n # Calculo el total sin descuentos\n self.total_prize = @products.map {|p| p.prize }.inject :+\n\n # Aplico todos los descuentos dinamicamente\n @discounts.each do |discount|\n discount.call self\n end\n\n self.total_prize # Retorno el precio final\n end", "def products_total\n @cart.cart_products.inject(0) do |total, cart_product|\n total += (cart_product.qty * cart_product.price)\n end\n end", "def product_total\n\t\ttotal = 0\n\t\tself.items.each do |item|\n\t\t\ttotal += item.amount\n\t\tend\n\t\ttotal\n\tend", "def total\n return 0 if @products.empty?\n total = (@products.sum { |name, price| price } * 1.075).round(2)\n return total\n end", "def total\n\t\tif @products == {}\n\t\t\treturn 0\n\t\telse\n\t\t\treturn (@products.sum {|product, cost| cost} * 1.075).round(2)\n\t\tend\n\tend", "def total\n add_products = 0\n @products.each_value do |cost|\n add_products += cost\n end\n total = (add_products + (add_products * 0.075)).round(2)\n return total\n end", "def total\n @sum = @products.values.inject(0, :+)\n @total = @sum + (@sum * 0.075).round(2)\n return @total\n end", "def total_products_count\n products.inject(0) { |count, product| count + product.count.to_i }\n end", "def total\n\t\tProduct.find(self.product_id).price * quantity.to_i\n\tend", "def total\n array = @products.values\n if array != []\n tally = array.reduce(:+)\n tally += (0.075 * tally)\n return tally.round(2)\n else\n return 0\n end\n end", "def total_quantity\n category_quantity = 0 \n self.products.each do |product|\n category_quantity += product.quantity\n end\n category_quantity\n end", "def subtotal\n precio * cantidad\n end", "def total\n total = (@products.values.sum) * 1.075\n return total.round(2)\n end", "def total\n total = 0\n @products.values.each do |price|\n total += price\n end\n total += (0.075 * total).round(2)\n end", "def total\n total = @products.map do |product, price|\n price\n end\n\n return (total.sum * 1.074).round(2)\n end", "def total_price\n res = product.price * count\n if product_options.any?\n res = res + product_options.map { |po| po.price }.sum * count\n end\n res\n end", "def calcula_pago_total\n \t \tmonto = self.monto\n \t\ttipo_cliente = self.tipo\n \t\tif tipo_cliente == \"colocadora\"\n \t\t\tmonto = ((monto* 0.00)+monto).to_i\n \t\telse\n \t\t\tmonto = ((monto* 0.50)+monto).to_i\n \t\tend\n \tend", "def total\n product_total = 0\n tax = 1.075\n @products.each do |product, price|\n product_total += price\n end\n order_total = (product_total * tax).round(2)\n return order_total\n end", "def calculo_valor_calorico_total\n recorrido = lista_alimentos.head\n cantidad = lista_cantidades.head\n acumulador = 0\n\n while (recorrido != nil && cantidad != nil)\n acumulador = acumulador + (((recorrido.value.proteinas * cantidad.value)/1000) * 4) + (((recorrido.value.lipidos * cantidad.value)/1000) * 9) + (((recorrido.value.carbohidratos * cantidad.value)/1000) * 4)\n\n recorrido = recorrido.next\n cantidad = cantidad.next\n end\n\n acumulador.round(2)\n end", "def totalSimplificado\n @biblioteca.livrosComoLista.map(&:preco).inject(0){|total, preco| total += preco}\n end", "def total\n total_amount = 0\n @order.each do |product, quantity|\n prod_price = PRODUCTS[product]\n if @pricing_rules.key?(product)\n rule = @pricing_rules[product]\n n = rule[1]\n type = rule[0]\n case type\n when \"Nx1\"\n total_amount += prod_price*( quantity/n + quantity%n )\n when \"BULK\"\n disccount_price = rule[2]\n total_amount += quantity * (quantity < n ? prod_price : disccount_price) #disccount price\n end\n else\n total_amount += prod_price * quantity\n end\n end\n total_amount\n end", "def get_total_products_number_in_cart\n if self.cart.line_items.length == 0\n total_products_number_in_cart = 0\n else\n total_products_number_in_cart = self.cart.line_items.sum{|li| li.quantity}\n end\n end", "def total_value\n category_value = 0 \n self.products.each do |product|\n category_value += (product.price * product.quantity)\n end\n category_value\n end", "def sum_totals\n @total = Lote.where(:programacion_id => @programacion.first).sum(:precio_t)\n @total = Money.new(\"#{@total}00\", \"USD\").format\n @cantidades = Lote.where(:programacion_id => @programacion.first).sum(:cantidad)\n end", "def total\n sum = 0\n subtotal = @products.values\n subtotal.each do |price|\n sum += price.to_f\n end\n\n total = (sum * 1.075).round(2)\n return total\n end", "def total\n product_total = 0\n subtotal = 0\n @products.each_value do |prices|\n subtotal += prices\n end\n product_total = (subtotal * 0.075).round(2)+ subtotal\n return product_total\n\n end", "def calcular_total\n\t\treturn calcular_seguro*calcular_incremento\n\tend", "def cart_total\r\n\t\ttotal = 0\r\n\t\tfor item in @cart_items\r\n\t\t\ttotal = total + @products[item].to_f\r\n\t\tend\r\n\t\ttotal\r\n\tend", "def cantidad_casas_hoteles\n aux = 0\n \n @propiedades.each do |i|\n aux += i.cantidad_casas_hoteles\n end\n \n return aux\n end", "def cart_total\n total = 0\n cart.each do |pId, info|\n if (prod = Product.find_by(id: pId))\n total += prod.price * info[\"Num\"].to_i\n end\n end\n total\n end", "def total_items\r\n\t\[email protected](0) { |sum, i| sum + i.quantity }\r\n\tend", "def total_price\n puts \"O PRECO TOTAL DE ORDER FOI CHAMADO\"\n self.line_items.to_a.sum{ |item| item.total_price}\n end", "def total_item_number\n @quantity * product.result_n\n end", "def product_count\n self.items.inject(0) {|sum, item| sum + item.quantity}\n end", "def total_items\n @cart_items.sum{|k,v| v}\n end", "def valor_total(estado)\n\t\t@valor = 0\n\t\tself.parts.each do |p|\n\t\t\tif(p.confirmacao == estado)\n\t\t\t\t@valor += p.valor\n\t\t\tend\n\t\tend\n\t\t@valor\n\tend", "def items_cesta()\n @total_cesta_cables = 0\n @items_cesta = 0\n CestaCable.all.each{|c| t=TipoMaterial.find_by_id(c.tipo_material_id);c.cantidad =1 unless !c.cantidad.blank?; suma= t.costo * c.cantidad unless t.nil?; @total_cesta_cables += suma unless t.nil?; @items_cesta += 1 unless t.nil?}\n\n return @items_cesta\nend", "def cart_total\n total = 0\n cart.each do |product_id, details|\n if p = Product.find_by(id: product_id)\n total += p.price_cents * details['quantity'].to_i\n end\n end\n total\n end", "def cart_total\n total = 0\n cart.each do |product_id, details|\n if p = Product.find_by(id: product_id)\n total += p.price_cents * details['quantity'].to_i\n end\n end\n total\n end", "def total_items\n order_items.inject(0) { |t,i| t + i.quantity }\n end", "def total_items\n order_items.inject(0) { |t, i| t + i.quantity }\n end", "def total_items\n order_items.inject(0) { |t, i| t + i.quantity }\n end", "def total\n cart_value = 0\n self.line_items.each do |line_item|\n cart_value += line_item.value\n end\n cart_value\n end", "def totalValueProducts(quantity)\n total = self.products.map {|product| product.getValue(quantity)}.reduce(:+)\n return total\n end", "def total_product_price\n total_price = @products.map{|product| product.price}\n total_price.reduce(:+) \n end", "def total_nutrientes\n\t\ti = 0\n\t\tproteinas = carbohidratos = lipidos = 0.0\n\t\twhile i < @lista_alimentos.size do\n\t\t\tproteinas += (@lista_alimentos[i].proteinas)*(@lista_cantidades[i])\n\t\t\tcarbohidratos += (@lista_alimentos[i].carbohidratos)*(@lista_cantidades[i])\n\t\t\tlipidos += (@lista_alimentos[i].lipidos)*(@lista_cantidades[i])\n\t\t i+= 1\n\t\tend\n\t\treturn proteinas + lipidos + carbohidratos\n\tend", "def total_price\n total = 0\n self.carts.each do |item|\n total += item.quantity * item.product.price\n end\n return total\n end", "def total_num_items\n line_items.reduce(0) { |sum, item| sum + item.quantity }\n end", "def total\n count\n end", "def total_items\n line_items.sum(:quantity)\n end", "def total_items\n line_items.sum(:quantity)\n end", "def totalLipidos\n\t\tlip = 0\n\t\ttotal = 0\n\t\[email protected] do |alimento|\n\t\t\tlip += alimento.lipidos\n\t\tend\n\t\treturn lip.round(2)\n\t\n\tend", "def total\n @total\n end", "def total\n super\n if @products.empty?\n return super\n else\n return super + 10\n end\n end", "def total_price\n\t\tproduct.price * quantity\n\tend", "def totalProteina \n\t\tprot = 0\n\t\ttotal = 0\n\t\[email protected] do |alimento|\n\t\t\tprot += alimento.proteinas\n\t\tend\n\t\treturn prot.round(2)\n\tend", "def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end", "def total_items\n\t\tline_items.sum(:quantity)\n\tend", "def sub_total(product)\n number_of_products(product.code) * product.price\n end", "def saldo_total\n ias = object\n .inventory_articles\n .select { |ia| ia.inventory_id == current_inventory.id }\n\n return 0 unless ias.length > 0\n\n ias.first.count\n end", "def total\n total = 0\n line_items.each do |line_item|\n total += line_item.item.price * line_item.quantity\n end\n total\n end", "def total\n @items_total = []\n self.line_items.each do |item|\n @item = Item.find_by_id(item.item_id)\n @items_total << @item.price.to_f\n end\n cart_total = @items_total.inject(0){|sum, x| sum + x }\n @cart_total = cart_total.round(2)\n @cart_total\n end", "def order_total\n order_sum = 0\n Order.all.each do |order|\n order_sum += order.order_quantity.to_i\n end \n order_sum\n end", "def precio_total_comprar\n precio_compra = @coste + ((@num_casas + @num_hoteles) * @titulo.precio_edificar).to_i\n \n return precio_compra\n end", "def total\n order_pots.sum(&:total)\n end", "def total\n self.quantity * self.product.price\n end", "def total\n total = 0\n self.menu_items.each do |item|\n total += item.price\n end\n \"$#{total}\"\n end", "def total\n sum(:total)\n end", "def sum_produits_used\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * (p.quantite - p.stock) }\n sum\n end", "def total_amount\n if order_products.any?\n order_products.collect { |order_product| order_product.price }.sum\n else\n Money.new(0, 'EUR')\n end\n end", "def total; end", "def total_price\r\n\t\[email protected](0.0) { |sum, i| sum + i.total_unit_price * i.quantity }\r\n\tend", "def total_quantity\n line_items.sum(:quantity)\n end", "def total\n sum = 0\n order_items.each do |order_item|\n if order_item.item.price.present? && order_item.quantity.present?\n sum += order_item.item.price * order_item.quantity\n end\n end\n return sum\n end", "def totalPrazo(cp,quant)\n\t\treg = cp.size - 1\n\t\tret = 0\n\t\tfor ct in (0..reg)\n\t\t\tret = ret + (desconto(Produt.find(cp[ct]).prazo, Produt.find(cp[ct]).id) * quant[ct])\n\t\tend\n\t\treturn ret\n\tend", "def totalHidratos\n\t\thidr = 0\n\t\ttotal = 0\n\t\[email protected] do |alimento|\n\t\t\thidr += alimento.carbohidratos\n\t\tend\n\t\treturn hidr.round(2)\n\tend", "def total_price\n total = 0\n if self.nil? || self.order_items.empty?\n else\n items = Order.find(self.id).order_items\n if items.length > 0\n items.each do |item|\n total += Product.find(item.product_id).price * item.quantity\n end\n end\n end\n\n\n return total\n end", "def total\n total_cost = 0\n \n # Summing up the product cost\n @products.each do |item, cost|\n total_cost += cost\n end\n \n # Calculate a 7.5% tax\n total_order_cost = total_cost * 1.075\n \n # Rounding the result to two decimal places\n return total_order_cost.round(2)\n end", "def total_price\n # convert to array so it doesn't try to do sum on database directly\n @total = 0\n line_items.each do |item|\n @total = item.price\n end\n line_items.to_a.sum {|item| (item.quantity * item.price) }\n end", "def set_importe_total\n self.importe_total = 0\n self.detalles.each do |detalle|\n self.importe_total += detalle.precio_unitario * detalle.cantidad unless detalle.marked_for_destruction?\n end\n end", "def total\n conv_price_single * conv_quantity\n end", "def total\n self.inject(0) { |t, calculator| t + (calculator.active? ? calculator.price(@cart) : 0) }\n end", "def totalImpuestosTrasladados valor\n @totalImpuestosTrasladados = valor.to_f\n end", "def total\n total_invoice_items_price(invoice_items)\n end", "def total_price\n \t\tsale_items.sum { |item| (item.product.price * item.quantity) }\n\tend", "def total_price\n \tresult = 0;\n \titems = self.order_items\n\n \titems.each do |item|\n \t\tresult += item.price\n \tend\n \treturn result\n end", "def total_price(cart)\n cart.sum {|item| item.price} \n end", "def total\n total = with_product_discounts\n total = with_basket_discounts(total)\n return \"£#{total}\"\n end", "def total\n return (@listOfItem.inject(0){|sum,e| sum += e.total}).round_to(2)\n end", "def total\n\t\tprices = line_items.map {|li| li.price}\n\t\tprices.reduce(0) {|it0, it1| it0+it1}\n\tend", "def total\n self.quantity * self.amount\n end", "def total\n total = order_items.inject(0) { |sum, p| sum + p.subtotal }\n end" ]
[ "0.791601", "0.7825717", "0.78182995", "0.7726436", "0.77129453", "0.77054805", "0.7623513", "0.76198786", "0.7590958", "0.75740606", "0.75225776", "0.7522329", "0.7519567", "0.7510527", "0.74856323", "0.7482087", "0.74432284", "0.74300873", "0.73599863", "0.735101", "0.7346239", "0.734073", "0.72962177", "0.727113", "0.7261566", "0.725677", "0.7256633", "0.72564024", "0.7219748", "0.71969366", "0.7187265", "0.718331", "0.7169588", "0.71618253", "0.7153307", "0.7152405", "0.7140279", "0.712055", "0.71153516", "0.7108957", "0.7096487", "0.70851034", "0.7084682", "0.70818675", "0.7072276", "0.7060355", "0.7060355", "0.7043312", "0.702859", "0.702859", "0.70070136", "0.69978774", "0.6972883", "0.6955837", "0.6942706", "0.69413453", "0.69266963", "0.69190234", "0.69190234", "0.6909756", "0.6897502", "0.6894032", "0.6877136", "0.6872131", "0.6865348", "0.685834", "0.6855356", "0.6852714", "0.68524784", "0.6851722", "0.6838566", "0.68328226", "0.6826939", "0.6825284", "0.6816706", "0.68147874", "0.68119836", "0.6807789", "0.6800153", "0.67986834", "0.6784772", "0.67796534", "0.6773059", "0.6763889", "0.6758977", "0.67574525", "0.67384136", "0.6728506", "0.6725485", "0.6714466", "0.6712532", "0.67118347", "0.67069244", "0.6703978", "0.66983604", "0.66925615", "0.6684874", "0.6671884", "0.66583806", "0.6657933" ]
0.68471897
70
Use callbacks to share common setup or constraints between actions.
def set_syllabus_language @syllabus_language = SyllabusLanguage.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def syllabus_language_params params.require(:syllabus_language).permit(:language_id, :syllabus_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def permitted_params\n @wfd_edit_parameters\n end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.71207976", "0.705222", "0.69488335", "0.69021654", "0.67362636", "0.6717561", "0.6689192", "0.6678948", "0.66622657", "0.6555007", "0.6527569", "0.64588845", "0.64522904", "0.6450812", "0.6448551", "0.6434285", "0.6412147", "0.6412147", "0.6393719", "0.6381976", "0.6381976", "0.6375729", "0.63612986", "0.6355188", "0.6285782", "0.6281054", "0.62458795", "0.62301606", "0.6224915", "0.622486", "0.6210121", "0.62075305", "0.61789036", "0.6172226", "0.6168105", "0.6160074", "0.61448", "0.61348766", "0.61225486", "0.6110136", "0.60996324", "0.6078064", "0.6052116", "0.6041118", "0.6035623", "0.60318893", "0.602124", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6020888", "0.6016033", "0.60159355", "0.6007089", "0.6005682", "0.60034984", "0.59973234", "0.59967214", "0.5996135", "0.5985281", "0.59851986", "0.59779865", "0.5973843", "0.59714854", "0.5966646", "0.59659743", "0.59659743", "0.5957345", "0.5952455", "0.59514904", "0.59479517", "0.59451497", "0.5932892", "0.59316385", "0.5929465", "0.59269744", "0.5920278", "0.5917984", "0.59153455", "0.5913883", "0.5908388", "0.5907796", "0.590644", "0.5900998", "0.5898838", "0.5898161", "0.58975124", "0.5895988" ]
0.0
-1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ App side methods (you can overwrite them) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def manage @comments = current_user.comcoms.with_users.active.max2min(:id).page(params[:page]) render template: 'the_comments/manage/manage' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app; @app; end", "def initialize(app); end", "def initialize!(app); end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def app; end", "def appraisals; end", "def appraisals; end", "def app\n @app\n end", "def main\n super\n return self\n end", "def app\n self\n end", "def app\n self\n end", "def parent_api; end", "def parent_api; end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def handle(app)\n app\n end", "def method_missing(method_name, *args, &block)\n app && app.respond_to?(method_name) ? app.send(method_name, *args, &block) : super\n end", "def initialize( app )\n\t\t@app = app\n\tend", "def apis; end", "def app_configured?; end", "def before_dispatch(_env)\n end", "def api; end", "def api; end", "def call\n raise NotImplementedError,\n \"Override #call and implement your application logic.\"\n end", "def app\n @app\n end", "def app=(_arg0); end", "def private; end", "def run\n super\n end", "def run\n super\n end", "def app\n parent.app\n end", "def app\n App\nend", "def application\n self\n end", "def app\n @app || make_app\nend", "def app_landing\n end", "def app_name ; self.class.rootname.snake_case.to_sym ; end", "def main\n @app.main\n end", "def app_root; end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def server\n super\n end", "def server\n super\n end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def initialize(app)\n @app = app\n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def show\n currentapp_initialize\n end", "def onStart\r\n end", "def exceptions_app; end", "def exceptions_app; end", "def main_app\n @main_app\n end", "def appFX\n appEM.app\nend", "def before_run; end", "def before_dispatch(env); end", "def after_view_setup\n end", "def appindex\n\n end", "def on_pre_request( request )\n end", "def app_id; end", "def app_id; end", "def after_created\n super.tap do |val|\n app_state_python(self)\n end\n end", "def method_missing(method, *args, &block)\n if (method.to_s.end_with?('_path') || method.to_s.end_with?('_url')) && main_app.respond_to?(method)\n main_app.send(method, *args, &block)\n else\n super\n end\n end", "def start_app\nend", "def app_about\n end", "def app\n @app ||= LiuLunch\n end", "def handler; end", "def handler; end", "def on_before_load\n end", "def initialize(app)\n super()\n\n @app = app\n @local_data = {}\n end", "def call\n # implement in subclasses\n end" ]
[ "0.674727", "0.653247", "0.63677347", "0.6346448", "0.6346448", "0.6346448", "0.6346448", "0.6346448", "0.6346448", "0.6346448", "0.6346448", "0.6346448", "0.6346448", "0.6322179", "0.6322179", "0.61396915", "0.6121104", "0.6111894", "0.6111894", "0.60461473", "0.60461473", "0.60450923", "0.60450923", "0.60450923", "0.60450816", "0.60053724", "0.60048145", "0.5960866", "0.59430003", "0.5898264", "0.5891846", "0.58644384", "0.58644384", "0.5847243", "0.58375895", "0.58347476", "0.58330876", "0.5820868", "0.5820868", "0.5809191", "0.58074504", "0.5799854", "0.5778831", "0.5777535", "0.5768795", "0.5758139", "0.5748083", "0.5719104", "0.5719104", "0.5719104", "0.5719104", "0.5717286", "0.5717286", "0.5710777", "0.5710777", "0.5710777", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.57026196", "0.5695751", "0.56902736", "0.5686417", "0.5686417", "0.5684613", "0.56785995", "0.5667647", "0.56672037", "0.56651515", "0.56439614", "0.56418353", "0.56357086", "0.56357086", "0.5630175", "0.56210065", "0.56172", "0.55854756", "0.55805814", "0.5579247", "0.5579247", "0.5577357", "0.5560427", "0.5549412" ]
0.0
-1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Restricted area ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def edit @comments = current_user.comcoms.where(id: params[:id]).page(params[:page]) render template: 'the_comments/manage/manage' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area\n appellation.region.area\n end", "def set_area\n @area = current_user.area || '-1'\n end", "def area_wrt_ground ()\n \n end", "def percent_protected\n protected_area / total_area * 100\n end", "def current_area\n PoliticalArea.nyc\n end", "def area\n return @area || Area.inactive_area\n end", "def valor_administracion\n\t\tarea * 2300\n\tend", "def get_area()\n @space.get_area()\n end", "def restriction\n end", "def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend", "def admin_area &block\n capture(&block) if current_user && current_user.admin?\n end", "def restriction \n end", "def area\n respond_to?(:constituencyGroupHasConstituencyArea) ? constituencyGroupHasConstituencyArea.first : nil\n end", "def area\n\t\t@side_length * @side_length\n\tend", "def area\n popolo.areas.find_by(id: area_id)\n end", "def has_permission?(location)\n if @logged_in_user.is_admin?\n return true\n end\n if not @logged_in_user.nil?\n groups = @logged_in_user.groups\n groups.each do |g|\n g.rights.detect {|right| \n if right.area == location\n return true\n end\n }\n end\n flash[:notice] = \"You do not have permission to access that area.\"\n redirect_to :controller => 'main', :action => 'index' and return false\n else\n return false\n end\n end", "def area(x=$game_player.x, y=$game_player.y)\n new_area = @areas.reverse.detect {|area| x >= area.x && y >= area.y }\n @area = new_area if @area != new_area\n @area\n end", "def area\n\n return @side_len * @side_len\n\n\n end", "def area_params\n permitted = ProductionArea.globalize_attribute_names + [:edrpou_code, :site, :railway_track, :railway_distance,\n :trucks_road, :state_road_distance, :airport_distance,\n :total_area, :building_year, :free_floors_count,\n :free_floors, :production_area, :additional, :phone,\n :email, :rent_year, :sale, :date_info, :main_image,\n :gis_type_name, :status, :map_layer_id, :ownership_id,\n questionnaire_images_attributes: %i[id imgable_type\n imgable_id _destroy],\n questionnaire_file_attributes: %i[id fileable_type file\n fileable_id _destroy],\n geo_json_attributes: %i[id geo_type position],\n balancer_ids: [], infrastructure_type_ids: []]\n params.require(:production_area).permit(permitted)\n end", "def index\n areas = if current_user.moderator?\n ProductionArea.where.not(state: 0).eager_load(:map_layer)\n else\n current_user.production_areas.eager_load(:map_layer).with_translations(I18n.locale)\n end\n @cabinet_production_areas = areas\n end", "def area\n respond_to?(:constituencyGroupHasConstituencyArea) ? constituencyGroupHasConstituencyArea.first : nil\n end", "def set_area_of_expertise\n @area_of_expertise = AreaOfExpertise.find(params[:id])\n end", "def get_area\n openstudio::getArea(@points_list)\n end", "def has_permission(location)\n if @logged_in_user.is_admin?\n return true\n end\n if not @logged_in_user.nil?\n groups = @logged_in_user.groups\n groups.each do |g|\n g.rights.detect {|right| \n if right.area == location\n return true\n end\n }\n end\n #flash[:notice] = \"You do not have permission to access that area.\"\n return false\n else\n return false\n end\n end", "def printArea #----> this is protected class\n @area=getheight * getwidth\n puts \"the area of inside is :#@area\"\n end", "def volunteer_portal\n authorize! :volunteer_portal, :Reservation\n end", "def restriction_level\n return 0 # only user itself is allowed\n end", "def plan_only\n unless current_user\n redirect_to \"/\", :alert => \"Access denied. You must be a member to suggest a charity. Explore with us as a member now for free.\"\n end\n end", "def rating_area\n @rating_area ||= plan_year.rating_area\n end", "def area\n return @side_length * @side_length\n end", "def valid?\n\t\tarea != 0\n\tend", "def entering_unauthorized_area?(path)\n return false if path == self.class.safe_zone\n\n self.class.authorization_triggers.any? do |trigger, paths|\n if authorization_triggered? trigger\n\n # Now that we know an authorization should be performed, let's do it!\n\n if path.match(combined_paths(paths[:restricted]))\n true\n elsif path.match(combined_paths(paths[:unrestricted]))\n false\n else\n trigger.default_access == :restricted\n end\n end\n end\n end", "def percent_land\n land_area / total_area if land_area\n end", "def calculate_area\n\n \tarea = 3.14*@radius*@radius\n\n end", "def get_area()\n # Finds the floor and space parents and assigns them to @floor and @space \n # variables to be used later\n begin\n floor = get_floor()\n space = get_space()\n # Get the keyword value for location\n location = get_keyword_value(\"LOCATION\")\n # Get the keyword value for polygon\n polygon_id = get_keyword_value(\"POLYGON\")\n rescue\n end\n \n \n # if the polygon_id keyword value was nil and the location value was nil, then \n # the height and width are directly defined within the \"exteriorWall\" command\n \n if ( location == \"BOTTOM\" || location == \"TOP\") && (space.get_shape != \"BOX\")\n return space.polygon.get_area \n \n elsif ( location == nil && polygon_id == nil )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n #puts \"Direct:\" + height + \" times \" + width\n height = height.to_f\n width = width.to_f\n \n return height * width\n elsif ( location == nil && polygon_id != nil)\n return space.polygon.get_area\n \n \n # if the location was defined as \"SPACE...\", it is immediately followed by a\n # vertex, upon which lies the width of the exteriorwall\n elsif location.match(/SPACE.*/)\n location = location.sub( /^(.{6})/, \"\")\n width = space.polygon.get_length(location)\n if space.check_keyword?(\"HEIGHT\")\n height = space.get_height\n else\n height = floor.get_space_height\n end\n #puts floor.utype\n #puts \"Space:\" + height.to_s + \" times \" + width.to_s\n return width * height\n # if the shape was a box, the width and height would be taken from the\n # \"SPACE\" object\n elsif ( space.get_shape == \"BOX\" ) \n width = space.get_width\n height = space.get_height\n return width * height\n \n \n else\n raise \"The area could not be evaluated\"\n end\n end", "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend", "def find_area\n\t\t@area = 0.5 * ((@point1.x - @point3.x)*(@point2.y - @point1.y) - (@point1.x - @point2.x)*(@point3.y - @point1.y)).abs\n\tend", "def area\n info[:area].to_sym\n end", "def allowCuratorLogicIgnoreAreas _obj, _args\n \"_obj allowCuratorLogicIgnoreAreas _args;\" \n end", "def set_administrative\n authorize current_admin, policy_class: Admin::AdministrativePolicy\n @administrative = Admin.where(id: params[:id], admin_role: \"administrative\").first\n end", "def area\n\t\tMath::PI * (self.radius ^ 2)\n\tend", "def get_door_area()\n get_children_area(\"DOOR\")\n end", "def area\n (@p1.x * @p2.y + @p2.x * @p3.y + @p3.x * @p1.y - @p1.y * @p2.x - @p2.y * @p3.x - @p3.y * @p1.x).abs / 2.0\n end", "def mountain_area_capabilities\n query('txt/wxfcs/mountainarea/json/capabilities')\n end", "def area; rect size; end", "def show\n authorize @fuel_supply\n end", "def get_door_area()\n get_children_area(\"DOOR\")\n end", "def show\n authorize @place\n end", "def area\n ( @width*@top) * ( 1.0 - ( ( 1.0 - @alpha.value) ** 2))\n end", "def area\n return format(\"%.2f\", model.land.area)\n end", "def area\n @area ||= @areas.detect {|c| c.matches_path? path }\n end", "def inherit_restricted_status\n self.restricted = parent.restricted?\n end", "def show\n authorize RoleCutoff\n end", "def get_area()\n OpenStudio::getArea(self.get_3d_polygon())\n end", "def admin_area(&block)\n if admin?\n yield\n end\n end", "def area\r\n return (( (@p1.x*(@p2.y - @p3.y)) + (@p2.x*(@p3.y - @p1.y)) + (@p3.x*(@p1.y - @p2.y)) )/2.0).abs\r\n end", "def index\n require_user()\n @area_of_expertises = AreaOfExpertise.all\n end", "def coordinate_area\n (@x_max.to_f - @x_min.to_f) * (@y_max.to_f - @y_min.to_f)\n end", "def area\n width() * height\n end", "def getArea\n\t\tgetWidth() * getHeight\n\tend", "def getArea\n\t\tgetWidth() * getHeight\n\tend", "def area\n\t\treturn @PI * @radius ** 2\n\tend", "def activate\n RestrictedPage\n # admin.tabs.add \"Restricted Page\", \"/admin/restricted_page\", :after => \"Layouts\", :visibility => [:all]\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def area\n \t@width * @height\n end", "def platinum\n authorize! :view, :platinum, :message => 'Access limited to teachers only.'\n end", "def area\n w * h\n end", "def restrict_fields\n allowed_fields=Location.new.attributes.keys+[\"top_left_coordinate_str\", \"bottom_right_coordinate_str\"]-[\"top_left_coordinate_id\", \"bottom_right_coordinate_id\"]\n @fields=allowed_fields & (params[:fields] || \"\").split(\",\")\n \n if @fields.present?\n @[email protected](@fields) \n else\n @fields=allowed_fields\n end \n\n end", "def area_or_perimeter(l , w)\n if l === w\n (l * w)\n else \n 2*(l+w)\n end\nend", "def restricted?\n page.restricted?\n end", "def index\n @floor_plans = FloorPlan.all\n authorize @floor_plans\n end", "def area_params\n params.require(:area).permit(:name)\n end", "def land_area_km\n land_area * SQUARE_MILES_TO_KILOMETERS if land_area\n end", "def area\n parts[0]\n end", "def authorize_warehouse_allocation\n authorize WarehouseAllocation\n end", "def set_cabinet_production_area\n @cabinet_production_area = if current_user.moderator?\n ProductionArea.find(params[:id])\n else\n current_user.production_areas.find(params[:id])\n end\n end", "def area_clicked(leftX, topY, rightX, bottomY)\n # complete this code\n if ((mouse_x > leftX and mouse_x < rightX) and (mouse_y > topY and mouse_y < bottomY))\n true\n else\n false\n end\nend", "def set_and_authorize_floor_plan\n @floor_plan = FloorPlan.find_by_id(params[:id])\n authorize @floor_plan\n true\n end", "def area_clicked(leftX, topY, rightX, bottomY)\r\n# complete this code\r\nend", "def area\r\n is_open ? width * length_opened : width * length\r\n end", "def show\n authorize @airport\n end", "def area\n GeographicItem.where(id:).select(\"ST_Area(#{GeographicItem::GEOGRAPHY_SQL}, false) as area_in_meters\").first['area_in_meters']\n end", "def set_area\n @area = Area.find(params[:area_id])\n end", "def show \n authorize! :read, Carpool \n @expected_passengers = @carpool.late_passengers.active if params[:lpax]\n end", "def supervisor?(area)\n self.student? and return false\n self.area_ids.include?(area.id) \n end", "def is_expert?(area)\n expertises.each do |e|\n if e.area == area\n return true\n end\n end\n false\n end", "def adjust_restricted\n\t\tunless self.restricted == !self.works.collect(&:restricted).include?(false)\n\t\t self.toggle!(:restricted)\n\t\tend\n\tend", "def area(index)\n get_field_from_relationship(workspace_id(index), @fields_extra[:area])\n end", "def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end", "def create\n require_user()\n @area_of_expertise = AreaOfExpertise.new(area_of_expertise_params)\n\n respond_to do |format|\n if @area_of_expertise.save\n format.html { redirect_to @area_of_expertise, notice: 'Area of expertise was successfully created.' }\n format.json { render :show, status: :created, location: @area_of_expertise }\n else\n format.html { render :new }\n format.json { render json: @area_of_expertise.errors, status: :unprocessable_entity }\n end\n end\n end", "def define_area \n\t\tif params[:kind] == 'model' || (!params[:id].nil? && params[:id][0] == 'M') \n\t\t\t@area = 'model'\n\t\telsif params[:kind] == 'creation' || (!params[:id].nil? && params[:id][0] == 'C') \n\t\t\t@area = 'creation'\n\t\telsif params[:kind] == 'accessory' || (!params[:id].nil? && params[:id][0] == 'A') \n\t\t\t@area = 'accessory'\n\t\telsif params[:kind] == 'fabric' || (!params[:id].nil? && params[:id][0] == 'F')\n\t\t\t@area = 'fabric'\n\t\telsif request.original_url.include?('workshop')\n\t\t\t@area = 'workshop'\n\t\telsif request.original_url.include?('cart')\n\t\t\t@area = 'workshop'\n\t\telsif request.original_url.include?('users')\t\n\t\t\t@area = 'users'\n\t\tend\n\t\t@area\n\tend", "def find_area_beneath\n detect_in(@areas, :area) { |area| area.piles.include?(@pile_beneath) }\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def area(* args)\r\n raise \"not implemented for Selenium\"\r\n end", "def deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end", "def getArea()\n getWidth() * getHeight()\n end", "def area\n is_open ? width * length_opened : width * length\n end", "def show\n authorize @shooting_velocity\n end" ]
[ "0.68615115", "0.67622304", "0.6628989", "0.6493552", "0.6417966", "0.63284135", "0.6318681", "0.63021207", "0.61447865", "0.61250067", "0.610394", "0.6103917", "0.60800433", "0.6063386", "0.60493636", "0.5987441", "0.597351", "0.5949657", "0.59042996", "0.58825976", "0.5881225", "0.5869007", "0.58675355", "0.5859513", "0.58438265", "0.5837171", "0.5833869", "0.5824672", "0.5823498", "0.5786906", "0.57766414", "0.57689786", "0.57410467", "0.57284033", "0.57263976", "0.5720731", "0.57117116", "0.56816334", "0.56815714", "0.5681509", "0.5656689", "0.564172", "0.5636978", "0.56285894", "0.5626177", "0.56248707", "0.56207633", "0.56149787", "0.56121385", "0.5610968", "0.56068414", "0.56064343", "0.55940425", "0.5592926", "0.5588896", "0.5575554", "0.5561968", "0.55547017", "0.55386275", "0.5519822", "0.551956", "0.55117005", "0.5499979", "0.5495015", "0.5495015", "0.5495015", "0.5494199", "0.5487442", "0.54836303", "0.54806477", "0.5478427", "0.5472206", "0.5470399", "0.5468517", "0.54681927", "0.5467893", "0.54609495", "0.5455996", "0.5450509", "0.54494154", "0.5448816", "0.5444896", "0.54421365", "0.54395133", "0.54364836", "0.5435543", "0.54310334", "0.54291695", "0.54287267", "0.5428437", "0.54270434", "0.542417", "0.5419458", "0.54192364", "0.5418554", "0.5417451", "0.54130316", "0.5409065", "0.5393036", "0.53881776", "0.5364053" ]
0.0
-1
Sanitize a HTML file
def sanitize(input, options={}) return "" if input.nil? or input.empty? # Only take elements inside of <body> @doc = Hpricot(input) @doc = Hpricot(@doc.at("body").inner_html) if @doc.at("body") sanitized = Aqueduct::RailsSanitizer.white_list_sanitizer.sanitize(@doc.to_html) # Start parsing sanitized doc @doc = Hpricot(sanitized) # Rewrite all id's to appened network_key append_id(@options[:append]) unless @options[:append].nil? @options[:formatted] == false ? @doc.to_html.gsub(/\r|\n/i,'') : @doc.to_html end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize(html)\n doc = Nokogiri::HTML::DocumentFragment.parse(html)\n if Mako.config.sanitize_images\n doc.css('img').each do |n|\n begin\n n.name = 'a'\n n.content = n['alt'] ? \"📷 #{n['alt']}\" : '📷 Image'\n n['href'] = URI.parse(n['src']).absolutize!(uri)\n rescue URI::InvalidURIError\n # if there's a problem, just ignore it\n next\n end\n end\n end\n doc.css('h1,h2,h3,h4,h5,h6').each { |n| n.name = 'p'; n.set_attribute('class', 'bold') }\n doc.to_s\n end", "def sanitize!(html, options = {})\n msclean!(html, options)\n end", "def sanitize!\n\t\t\[email protected]!\n\t\t\[email protected]!(/<style.*?\\/style>/m, '')\n\t\t\[email protected]!(/<script.*?\\/script>/m, '')\n\t\t\[email protected]!(/<.*?>/m, ' ')\n\t\t\[email protected]!(/\\s+/, ' ')\n\t\tend", "def sanitize(html, options = {})\n msclean(html, options)\n end", "def sanitize_html\n self.data = self.class.clean_html(self.data) unless self.data.nil?\n end", "def clean_html\n cleaned = ConverterMachine.clean_html(self) # => {html: clean html, css: Nokogiri extracted <style>...</style>}\n self.update_attributes!(file_content_html: cleaned[:html], file_content_css: cleaned[:css])\n end", "def sanitize_as_html!\n Engine.clean!(self)\n end", "def sanitize_as_html!\n Engine.clean!(self)\n end", "def sanitize_html(content)\n require 'cgi'\n CGI.escapeHTML(content)\n end", "def clean_html(html)\n Sanitize.clean(html) rescue html\n end", "def clean_html\n HTML::WhiteListSanitizer.allowed_protocols << 'data'\n self.content = ActionController::Base.helpers.sanitize(self.body, :tags => ALLOWED_TAGS, :attributes => ALLOWED_ATTRIBUTES)\n end", "def app_sanitize(html)\n sanitize(html, attributes: %w[style])\n end", "def sanitize(html)\n HTML5::HTMLParser.\n parse_fragment(html, :tokenizer => HTML5::HTMLSanitizer, :encoding => 'utf-8').\n to_s\n end", "def sanitize(html)\n HTML5::HTMLParser.\n parse_fragment(html, :tokenizer => HTML5::HTMLSanitizer, :encoding => 'utf-8').\n to_s\n end", "def clean(html)\n return unless html\n\n # Make a whitelist of acceptable elements and attributes.\n sanitize_options = {\n elements: %w{div span p a ul ol li h1 h2 h3 h4\n pre em sup table tbody thead tr td img code strong\n blockquote small br section aside},\n remove_contents: %w{script},\n attributes: {\n 'div' => %w{id class data-tralics-id data-number data-chapter},\n 'a' => %w{id class href target rel},\n 'span' => %w{id class style},\n 'ol' => %w{id class},\n 'ul' => %w{id class},\n 'li' => %w{id class},\n 'sup' => %w{id class},\n 'h1' => %w{id class},\n 'h2' => %w{id class},\n 'h3' => %w{id class},\n 'h4' => %w{id class},\n 'img' => %w{id class src alt},\n 'em' => %w{id class},\n 'code' => %w{id class},\n 'section' => %w{id class},\n 'aside' => %w{id class},\n 'blockquote' => %w{id class},\n 'br' => %w{id class},\n 'strong' => %w{id class},\n 'table' => %w{id class},\n 'tbody' => %w{id class},\n 'tr' => %w{id class},\n 'td' => %w{id class colspan}\n },\n css: {\n properties: %w{color height width}\n },\n protocols: {\n 'a' => {'href' => [:relative, 'http', 'https', 'mailto']},\n 'img' => {'src' => [:relative, 'http', 'https']}\n },\n output: :xhtml\n }\n\n Sanitize.clean(html.force_encoding(\"UTF-8\"), sanitize_options)\n end", "def htmlClean(html)\n html\nend", "def sanitize_feed_content(html, sanitize_tables = false)\n options = sanitize_tables ? {} : { tags: %w[table thead tfoot tbody td tr th] }\n sanitized = html.strip do |html|\n html.gsub! /&amp;(#\\d+);/ do |_s|\n \"&#{Regexp.last_match(1)};\"\n end\n end\n sanitized\n end", "def edited_html\n begin\n File.open(self.edited_html_file_name, 'r:utf-8') { |f| f.read }\n rescue Errno::ENOENT\n begin\n File.open(self.scrubbed_html_file_name, 'r:utf-8') { |f| f.read }\n rescue Errno::ENOENT\n \"\"\n end\n end\n end", "def clean_up_contents()\n # very minimal\n # elements = ['p', 'b', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes={})\n\n if self.contents?\n html = self.contents\n email_regex = /<p>Email:\\s+((\\w|\\-|\\_|\\.)+\\@((\\w|\\-|\\_)+\\.)+[a-zA-Z]{2,})/i\n\n html.gsub! /\\[endif\\]--/ , ''\n html.gsub! /[\\n|\\r]/ , ' '\n html.gsub! /&nbsp;/ , ' '\n\n # this will convert UNICODE into ASCII. \n #It will also strip any possiblity of using a foreign language!\n #converter = Iconv.new('ASCII//IGNORE//TRANSLIT', 'UTF-8') \n #html = converter.iconv(html).unpack('U*').select{ |cp| cp < 127 }.pack('U*')\n # keep only the things we want.\n unless (Sanitize::Config::RELAXED[:attributes][\"table\"].include?(\"align\"))\n Sanitize::Config::RELAXED[:attributes][\"table\"] << \"align\"\n end\n\n config = Sanitize::Config::RELAXED\n if (html.encoding.name == 'ASCII-8BIT')\n config[:output_encoding] = 'ASCII'\n end\n html = Sanitize.clean( html, config)\n\n # butt up any tags\n html.gsub! />\\s+</ , '><'\n\n #remove email address lines\n html.gsub! email_regex , '<p>'\n\n # post sanitize cleanup of empty blocks\n # the order of removal is import - this is the way word stacks these elements\n html.gsub! /<i><\\/i>/ , ''\n html.gsub! /<b><\\/b>/ , ''\n html.gsub! /<\\/b><b>/ , ''\n html.gsub! /<p><\\/p>/ , ''\n html.gsub! /<p><b><\\/b><\\/p>/ , ''\n\n # misc - fix butted times\n html.gsub! /(\\d)am / , '\\1 am '\n html.gsub! /(\\d)pm / , '\\1 pm '\n # misc - remove multiple space that may cause doc specific regexs to fail (in dates for example)\n html.gsub! /\\s+/ , ' '\n\n # add new lines at the end of lines\n html.gsub! /<\\/(p|h\\d|dt|dd|dl)>/, '</\\1>' + \"\\n\"\n html.gsub! /<dl>/ , '<dl>' + \"\\n\"\n\n self.contents = html\n end\n end", "def sanitized_html\n @sanitized_html ||= begin\n return nil if html_part.nil?\n Envelope::MessageTools.sanitize(html_part)\n end\n end", "def sanitize_text(text)\n doc = Nokogiri::HTML.fragment(text)\n UNSUPPORTED_HTML_TAGS.each do |tag|\n doc.search(tag).each(&:remove)\n end\n doc.inner_html\n end", "def clean()\n #strip all illegal content here. (scripts, shit that will break layout, etc.)\n end", "def pre_sanitize(html)\n html = Nokogiri::HTML.fragment(html)\n HTML_TRANSFORMS.each do |orig, new|\n html.xpath(\".//#{orig}\").each { |node| node.name = new }\n end\n html.to_html\n end", "def sanitize(tainted)\n untainted = tainted\n \n untainted = rule1_sanitize(tainted)\n \n # Start - RULE #2 - Attribute Escape Before Inserting Untrusted Data into HTML Common Attributes\n # End - RULE #2 - Attribute Escape Before Inserting Untrusted Data into HTML Common Attributes\n \n # Start - RULE #3 - JavaScript Escape Before Inserting Untrusted Data into HTML JavaScript Data Values\n # End - RULE #3 - JavaScript Escape Before Inserting Untrusted Data into HTML JavaScript Data Values\n \n # Start - RULE #4 - CSS Escape Before Inserting Untrusted Data into HTML Style Property Values\n # End - RULE #4 - CSS Escape Before Inserting Untrusted Data into HTML Style Property Values\n \n untainted\n end", "def unescaped_html_without_soft_hyphens\n str = CGI.unescapeHTML IO.read(path)\n str.gsub! /&shy;/, ''\n str\n end", "def sanitize(text)\n text.gsub('<', '&lt;').gsub('>', '&gt;')\n end", "def sanitize_data(value)\n HtmlSanitizer.sanitize(value)\n end", "def strip_dangerous_html_tags(allowed_tags = 'a|span|strong|b|img|i|s|p|br|h1|h2|h3|h4|h5|h6|blockquote|footer', attributes = {'img' => ['src', 'alt'], 'a' => ['href', 'title', 'target']})\n if allowed_tags.present?\n Sanitize.fragment(self, {elements: allowed_tags.split('|'), attributes: attributes})\n else\n self.gsub('<', \"&lt;\").gsub('>', \"&gt;\")\n end\n end", "def strip_html(text)\n @name =\n # Remove HTML from the text\n Sanitize.clean(text).\n # Replace newlines with a space\n gsub(/\\n|\\r/, ' ').\n # Replaces runs of spaces by a single space\n squeeze(' ').\n # Remove leading and trailing whitespace\n strip\nend", "def sanitize_from_db(text, allowed_tags = NB.allowed_html_tags)\n text = sanitize_from_evernote(text)\n text = text.gsub(/#{ NB.truncate_after_regexp }.*\\Z/m, '')\n .gsub(/<br[^>]*?>/, \"\\n\")\n .gsub(/<b>|<h\\d>/, '<strong>')\n .gsub(%r{</b>|</h\\d>}, '</strong>')\n # OPTIMIZE: Here we need to allow a few more tags than we do on output\n # e.g. image tags for inline image.\n text = sanitize_by_settings(text, allowed_tags)\n text = format_blockquotes(text)\n text = format_code(text)\n text = remove_instructions(text)\n end", "def xhtml_sanitize(html)\n return html unless sanitizeable?(html)\n tokenizer = HTML::Tokenizer.new(html.to_utf8)\n results = []\n\n while token = tokenizer.next\n node = XHTML::Node.parse(nil, 0, 0, token, false)\n results << case node.tag?\n when true\n if ALLOWED_ELEMENTS.include?(node.name)\n process_attributes_for node\n node.to_s\n else\n node.to_s.gsub(/</, \"&lt;\").gsub(/>/, \"&gt;\")\n end\n else\n node.to_s.unescapeHTML.escapeHTML\n end\n end\n\n results.join\n end", "def sanitize_upload dom\n # Basic security check\n dom.css(\"script\").remove();\n dom\n end", "def strip_tags(html); end", "def strip_tags(html); end", "def strip_tags(html); end", "def safe_sanitize(html_fragment)\n html_fragment = \"\" if (html_fragment.nil?)\n Sanitize.fragment(html_fragment, Sanitize::Config::BASIC)\n end", "def sanitize!; end", "def sanitize_html( html, okTags='' )\n\n return if html.blank?\n\n # no closing tag necessary for these\n soloTags = [\"br\",\"hr\"]\n\n # Build hash of allowed tags with allowed attributes\n tags = okTags.downcase().split(',').collect!{ |s| s.split(' ') }\n allowed = Hash.new\n tags.each do |s|\n key = s.shift\n allowed[key] = s\n end\n\n # Analyze all <> elements\n stack = Array.new\n result = html.gsub( /(<.*?>)/m ) do | element |\n if element =~ /\\A<\\/(\\w+)/ then\n # </tag>\n tag = $1.downcase\n if allowed.include?(tag) && stack.include?(tag) then\n # If allowed and on the stack\n # Then pop down the stack\n top = stack.pop\n out = \"</#{top}>\"\n until top == tag do\n top = stack.pop\n out << \"</#{top}>\"\n end\n out\n end\n\n elsif element =~ /\\A<(\\w+)\\s*\\/>/\n # <tag />\n tag = $1.downcase\n if allowed.include?(tag) then\n \"<#{tag} />\"\n end\n\n elsif element =~ /\\A<(\\w+)/ then\n # <tag ...>\n tag = $1.downcase\n if allowed.include?(tag) then\n if ! soloTags.include?(tag) then\n stack.push(tag)\n end\n if allowed[tag].length == 0 then\n # no allowed attributes\n \"<#{tag}>\"\n else\n # allowed attributes?\n out = \"<#{tag}\"\n while ( $' =~ /(\\w+)=(\"[^\"]+\")/ )\n attr = $1.downcase\n valu = $2\n if allowed[tag].include?(attr) then\n out << \" #{attr}=#{valu}\"\n end\n end\n out << \">\"\n end\n end\n end\n end\n\n # eat up unmatched leading >\n while result.sub!(/\\A([^<]*)>/m) { $1 } do end\n\n # eat up unmatched trailing <\n while result.sub!(/<([^>]*)\\Z/m) { $1 } do end\n\n # clean up the stack\n if stack.length > 0 then\n result << \"</#{stack.reverse.join('></')}>\"\n end\n\n result\n end", "def strip_html(str,allow=['dm','dl'])\n str = str.strip || ''\n allow_arr = allow.join('|') << '|\\/'\n str.gsub(/<(\\/|\\s)*[^(#{allow_arr})][^>]*>/,'').strip\n end", "def presentable_html(html)\n # sanitize edited, tags: %w(body p span a h1 h2 h3 h4 h5 h6 ul ol li) if work.file_content_html %> -->\n # doc = Nokogiri::HTML(html_junk)\n # body = doc.at_xpath(\"//body\")\n # body.css('*').remove_attr('class')\n # edited = body.to_html\n return raw html\n end", "def sanitize!\n return self if @sanitized\n replace(HTMLEntities.new.encode(self))\n @sanitized = true\n return self\n end", "def strip_html(allow)\n str = self.strip || ''\n allow_arr = allow.join('|')\n str = str.gsub(/<\\s*/,'<')\n str = str.gsub(/<\\/\\s*/,'</')\n # First part of | prevents matches of </allowed. Second case prevents matches of <allowed\n # and keeps the / chacter from matching the ?! allowed.\n str.gsub(/<(\\/(?!(#{allow_arr}))|(?!(\\/|#{allow_arr})))[^>]*?>/mi,'')\n end", "def clean_html(options={:url => nil})\n use_http_get = true\n call_api('clean-html', options, use_http_get)\n end", "def safe_output(input)\n sanitize Nokogiri::HTML.fragment(CGI.unescapeHTML(input)).to_s\n end", "def sanitize(text)\n return nil if text.nil? || text.empty?\n string = text.to_s # ensure we have a string\n\n doc = Nokogiri::HTML.parse(text)\n\n doc.xpath('//@style').remove\n doc.xpath('//@class').remove\n doc.xpath('//@id').remove\n doc.xpath('//@font-size').remove\n doc.xpath('//@color').remove\n doc.xpath('//@size').remove\n doc.xpath('//@face').remove\n doc.xpath('//@bgcolor').remove\n doc.xpath('//comment()').remove\n\n # remove \"bad\" elements\n doc.css('script, link, img, style').each { |node| node.remove }\n\n # convert all <div>s to <p>s\n doc.css('div').each do |div|\n node = doc.create_element 'p'\n node.inner_html = div.inner_html\n div.replace(node)\n end\n\n # remove <font> and <span> tags, but preserve their content\n doc.css('font, span').each do |node|\n node.swap(node.children)\n end\n\n # removing tags leaves dangling text nodes that should really be merged, so let's\n # re-build the document\n doc = Nokogiri::HTML.parse(doc.to_s)\n\n # wrap orphaned text nodes in <p> tags\n doc.css('html body').children.each do |orphan|\n if orphan.class == Nokogiri::XML::Text && !orphan.text.strip.gsub(Envelope::Message::ALL_SPACES, '').empty?\n node = doc.create_element 'p'\n node.inner_html = orphan.text\n orphan.replace(node)\n end\n end\n\n # remove all <p><br><p>\n doc.css('p br').each do |node|\n node.remove\n end\n\n # convert all new lines to br and trim content\n doc.css('p').each do |node|\n node.inner_html = node.inner_html.gsub(\"\\n\", '<br>').strip\n end\n\n # remove empty tags\n doc.css('html body > *').each do |node|\n unless %w(br p).include?(node.name)\n node.remove if node.inner_html.gsub(Envelope::Message::ALL_SPACES, '').empty?\n end\n end\n\n doc.css('html body > *').to_s.gsub(/[\\n\\t]+?/, '')\n end", "def parse_text(text)\n ## Strip html\n Sanitize::clean!(text, :remove_contents => ['script','style'])\n text.gsub!(/[\\n\\t]+/, ' ')\n text\n end", "def preprocess!\n input_html\n nil\n end", "def fixup_page\r\n html = content\r\n if html.gsub!(/(href|src)=(['\"])..\\/..\\//, '\\1=\\2/')\r\n content = html\r\n save!\r\n end\r\n end", "def html_markup_textile_strict(text); end", "def h(str)\n sanitize_html(str)\n end", "def html_sanitizer(string, set=:basic)\n if set == :basic\n $htmlmap = MAPPINGS[:base]\n else\n $htmlmap = MAPPINGS[:base].merge!(MAPPINGS[:title])\n end\n\n string = string.split(\"\")\n string.map! { |char|\n ( $htmlmap.has_key?(char.unpack('U')[0]) ) ? $htmlmap[char.unpack('U')[0]] : char\n }\n\n\n return string.join\nend", "def strip_tags(html)\n Sanitize.clean(html.strip).strip\n end", "def strip_tags(html)\n Sanitize.clean(html.strip).strip\n end", "def clean(html)\n dupe = html.dup\n clean!(dupe) || dupe\n end", "def process_markdown\n self.data = self.class.convert_markdown(self.data)\n sanitize_html\n end", "def normalize!\n data = read\n html = Nokogiri::XML.parse(data)\n html.encoding = 'utf-8'\n\n # Process the @DOM\n standardize_dom(html)\n remove_scripts(html)\n change_hrefs(html)\n\n write(html.to_s)\n end", "def strip_html_tags!\n @raw.gsub!(/<[^>]+?>/, ' ')\n end", "def sanitize_bio(bio)\n permit_scrubber = Rails::Html::PermitScrubber.new\n permit_scrubber.tags = %w(h3 h4 p ul li ol strong em span sup sub)\n sanitize bio, tags: %w(h3 h4 p ul li ol strong em span sup sub), scrubber: permit_scrubber\n end", "def clean!(html)\n @whitelist_nodes = []\n fragment = Nokogiri::HTML::DocumentFragment.parse(html)\n clean_node!(fragment)\n @whitelist_nodes = []\n\n output_method_params = {:encoding => 'utf-8', :indent => 0}\n\n if @config[:output] == :xhtml\n output_method = fragment.method(:to_xhtml)\n output_method_params[:save_with] = Nokogiri::XML::Node::SaveOptions::AS_XHTML\n elsif @config[:output] == :html\n output_method = fragment.method(:to_html)\n else\n raise Error, \"unsupported output format: #{@config[:output]}\"\n end\n\n result = output_method.call(output_method_params)\n\n # Ensure that the result is always a UTF-8 string in Ruby 1.9, no matter\n # what. Nokogiri seems to return empty strings as ASCII for some reason.\n result.force_encoding('utf-8') if RUBY_VERSION >= '1.9'\n\n return result == html ? nil : html[0, html.length] = result\n end", "def safe_xhtml_sanitize(html, options = {})\n sanitized = xhtml_sanitize(html.purify)\n doc = Nokogiri::XML::Document.parse(\"<div xmlns='http://www.w3.org/1999/xhtml'>#{sanitized}</div>\", nil, (options[:encoding] || 'UTF-8'), 0)\n sanitized = doc.root.children.to_xml(:indent => (options[:indent] || 2), :save_with => 2 )\n rescue Nokogiri::XML::SyntaxError\n sanitized = sanitized.escapeHTML\n end", "def scrubbed_html_file_name\n self.mydirectory + \"scrubbed.html\"\n end", "def clean_html(str)\n\t str = str.gsub(/<script(.*)>(.*)<\\/script>/i, \"\")\n\t str = str.gsub(/<frame(.*)>(.*)<\\/frame>/i, \"\")\n\t str = str.gsub(/<iframe(.*)>(.*)<\\/iframe>/i, \"\")\n\t\n\t return str\n end", "def sanitize_content\n self.title = helpers.sanitize(self.title)\n self.user_name = helpers.sanitize(self.user_name)\n end", "def rewrite_html (html_file)\n\t\tdoc = Nokogiri::HTML(open(html_file))\n\t\tUNNECESARY_HTML_NODES.each do |node_path|\n \tnode = doc.xpath(node_path)\n \tnode.remove\n \t\tend\n \t\tFile.open(html_file,'w') { |file| doc.write_html_to file }\n\tend", "def fix_docbook_xhtml(xhtml)\r\n sf=File.new(xhtml, 'r')\r\n\t nf=File.new(xhtml+'~', 'w')\r\n\t sf.each_line do |l|\r\n r=l.gsub(/ =\"\"/, ' class=\"\"')\r\n\t\t nf << r\r\n\t end\r\n\t sf.close\r\n\t nf.close\r\n\t cp nf.path, sf.path\r\n\t rm nf.path\r\n end", "def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s.gsub(\"\\n\", \"\")\n end", "def strip_tags(html)\n # First we need to get rid of any embedded code.\n html = strip_embedded(html)\n\n # Remove comments\n html = html.gsub(/<!--.*?--\\s*>/m, \"\\xEF\\xBF\\xBC\")\n\n # SGML Declarations\n html = html.gsub(/<!.*?>/m, \"\\xEF\\xBF\\xBC\")\n\n # Remove script and css blocks\n html = html.gsub(/<script.*?>.*?<\\/script>/m, \"\\xEF\\xBF\\xBC\")\n html = html.gsub(/<style.*?>.*?<\\/style>/m, \"\\xEF\\xBF\\xBC\")\n\n # Strip html tags\n html = html.gsub(/<\\/? # opening tag with optional slash\n (\n [^<>\"'] | # match anything unquoted\n \".*?\" | # match double quotes…\n '.*?' # and single ones\n )* # any combination of the three\n > # close tag\n /xm, \"\\xEF\\xBF\\xBC\") # placeholder\n\n # Handle placeholders\n html = html.gsub(/^[ \\t]*\\xEF\\xBF\\xBC[ \\t]*(\\n|\\r|\\r\\n)/xm, '') # Remove lines with only tags\n html = html.gsub(/\\xEF\\xBF\\xBC/xm, '') # Remove other placeholders\n return html\nend", "def sanitize_css(style); end", "def sanitize_css(style); end", "def sanitize_css(style); end", "def sanitize_excerpt(html, okTags)\n # no closing tag necessary for these\n soloTags = [\"br\",\"hr\"]\n\n # Build hash of allowed tags with allowed attributes\n tags = okTags.downcase().split(',').collect!{ |s| s.split(' ') }\n allowed = Hash.new\n tags.each do |s|\n key = s.shift\n allowed[key] = s\n end\n\n # Analyze all <> elements\n stack = Array.new\n result = html.gsub( /(<.*?>)/m ) do | element |\n if element =~ /\\A<\\/(\\w+)/ then\n # </tag>\n tag = $1.downcase\n if allowed.include?(tag) && stack.include?(tag) then\n # If allowed and on the stack\n # Then pop down the stack\n top = stack.pop\n out = \"</#{top}>\"\n until top == tag do\n top = stack.pop\n out << \"</#{top}>\"\n end\n out\n end\n elsif element =~ /\\A<(\\w+)\\s*\\/>/\n # <tag />\n tag = $1.downcase\n if allowed.include?(tag) then\n \"<#{tag} />\"\n end\n elsif element =~ /\\A<(\\w+)/ then\n # <tag ...>\n tag = $1.downcase\n if allowed.include?(tag) then\n if ! soloTags.include?(tag) then\n stack.push(tag)\n end\n if allowed[tag].length == 0 then\n # no allowed attributes\n \"<#{tag}>\"\n else\n # allowed attributes?\n out = \"<#{tag}\"\n while ( $' =~ /(\\w+)=(\"[^\"]+\")/ )\n attr = $1.downcase\n valu = $2\n if allowed[tag].include?(attr) then\n out << \" #{attr}=#{valu}\"\n end\n end\n out << \">\"\n end\n end\n end\n end\n\n # eat up unmatched leading >\n while result.sub!(/\\A([^<]*)>/m) { $1 } do end\n\n # eat up unmatched trailing <\n while result.sub!(/<([^>]*)\\Z/m) { $1 } do end\n\n # clean up the stack\n if stack.length > 0 then\n result << \"</#{stack.reverse.join('></')}>\"\n end\n\n result\n end", "def sanitize(text)\n sanitized_text = text.dup\n\n # Strip URLs\n sanitized_text.gsub!(URL_REGEX, '')\n\n # Strip @mention style tokens\n sanitized_text.gsub!(MENTION_REGEX, '')\n\n sanitized_text\n end", "def strip_html\n gsub(HTML_TAG_PATTERN, \"\")\n end", "def sanitize_mail(mail)\n if mail.content_type.start_with? 'text/html'\n html = mail.body.decoded.encode('utf-8', mail.charset)\n Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::RELAXED,\n remove_contents: ['style']\n ))\n else\n Rack::Utils.escape_html(mail.body.decoded)\n end\n end", "def sanitize_attributes\n # Summary, content are sanitized with an HTML sanitizer, we want imgs etc to be present.\n # Other attributes are sanitized by stripping tags, they should be plain text.\n self.content = Sanitizer.sanitize_html self.content\n self.summary = Sanitizer.sanitize_html self.summary\n\n self.title = Sanitizer.sanitize_plaintext self.title\n self.author = Sanitizer.sanitize_plaintext self.author\n self.guid = Sanitizer.sanitize_plaintext self.guid\n self.url = Sanitizer.sanitize_plaintext self.url\n end", "def sanitize_data\n sanitize_permalink\n sanitize_name\n end", "def strip_tags(html)\n strip(Sanitize.clean(html, :elements => [], :attributes => []))\n end", "def sanitize(string_or_io)\n loofah_fragment = Loofah.html4_fragment(string_or_io)\n loofah_fragment.scrub!(:strip)\n loofah_fragment.xpath(\"./form\").each(&:remove)\n loofah_fragment.to_s\n end", "def sanitize_and_remove_lines(text)\n remove_lines(sanitize(text))\n end", "def sanitize_and_remove_lines(text)\n remove_lines(sanitize(text))\n end", "def normalize(filename)\n str_strip(filename) + \".html\"\n end", "def normalise(html)\n doc = Nokogiri::HTML(html)\n body = doc.xpath('//body')\n\n body.xpath('//script').each {|s| s.remove}\n body.xpath('//comment()').each {|c| c.remove}\n body.xpath('//text()').find_all {|t| t.to_s.strip == ''}.map(&:remove)\n body.xpath('//header').remove\n body.xpath('//footer').remove\n body.xpath('//div[@id = \"global-cookie-message\"]').remove\n body.xpath('//div[@id = \"global-header-bar\"]').remove\n body.xpath('//div[@class = \"phase-banner-alpha\"]').remove\n body.xpath('//@class').remove\n body.xpath('//@id').remove\n body.xpath('//a').xpath('//@href').remove\n body.xpath('//label').xpath('//@for').remove\n body.xpath('//input').xpath('//@name').remove\n body.xpath('//input').xpath('//@value').remove\n\n remove_attributes(body, 'data')\n remove_attributes(body, 'aria')\n\n body.to_s\n .gsub(/>\\s+/, '>')\n .gsub(/\\s+</, '<')\n .gsub('><', \">\\n<\")\n end", "def searchable_content(file)\n content = File.read file\n content = CommonMarker.render_html content\n content.remove(/<\\/?[^>]*>/).gsub(\"\\n\", \" \")\n end", "def cleaned s, whitelist=%w[ref]\r\n\ts ||= ''\r\n\twhitelist << '---' # prevent empty (?!) in regexes\r\n\t\r\n\ts.gsub(/'{2,3}/, '').gsub(/<(?!#{whitelist.join '|'})(?!\\/(?:#{whitelist.join '|'}))[^>]+>/, '')\r\nend", "def strip_links(html); end", "def strip_links(html); end", "def strip_links(html); end", "def initialize\n @html_sanitizer = HTML::FullSanitizer.new\n end", "def sanitize\n self.summary = sanitize_string(summary)\n self.description = sanitize_string(description)\n self.post_install_message = sanitize_string(post_install_message)\n self.authors = authors.collect {|a| sanitize_string(a) }\n end", "def protect_html html\n raise \"Must override Filter#protect_html\"\n end", "def strip_html(string=\"\")\n begin\n string = strip_tags(string)\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace &nbsp; with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end", "def strip_html(string=\"\")\n begin\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace &nbsp; with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end", "def strip_html(string=\"\")\n begin\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace &nbsp; with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end", "def validate_file(file)\n status =\n POpen4::popen4(\"java -cp '#{@validator_path}' nu.validator.htmlparser.tools.HTML2HTML #{file.path}\") do |stdout, stderr|\n stdout.read\n @errors, @warnings = parse_error_output(stderr.read)\n end\n @errors = [\"Cannot run Java HTML5 validator #{@validator_path}: #{status.inspect}\"] unless status.exitstatus == 0\n end", "def cleanText(txt)\r\n clean = txt.gsub(\"<\", \"&lt;\")\r\n clean.gsub!(\">\", \"&gt;\")\r\n\r\n puts \"cleaned text: #{txt} -> #{clean}\" if $DEBUG\r\n clean\r\n\r\n end", "def file_sanitizer(file)\n\t file = File.open(file, mode=\"r+\")\n\t content = File.read(file)\n\t\tcontent.force_encoding(Encoding::Windows_1252)\n\t\tcontent = content.encode!(Encoding::UTF_8, :universal_newline => true)\n\t content.gsub!(\"\\r\\n\",\"\\n\")\n\t\tcontent\n\tend", "def html(text)\n scan(text, HTML, :html)\n end", "def clean_up_text\n text.gsub!(/<br/, \"\\n<br\")\n text.gsub!(/<p/, \"\\n<p\")\n text.gsub!(/<\\/?span(.*?)?>/, '')\n text.gsub!(/<\\/?div(.*?)?>/, '')\n end", "def sanitize(review)\n xss_filter(review)\n end", "def sanitize_data\n data + \"datacite: #{create_xml.to_xml.gsub(\"%\", \"%25\").gsub(\":\", \"%3A\").gsub(\"\\n\", \"%0D%0A\").gsub(\"\\r\", \"\")}\\n\"\n end" ]
[ "0.7414484", "0.7242845", "0.7204977", "0.7202476", "0.7168088", "0.7095999", "0.7079836", "0.7079836", "0.7066949", "0.7064357", "0.7033279", "0.7023007", "0.70115083", "0.70115083", "0.69995487", "0.6831037", "0.67975205", "0.6716664", "0.66873735", "0.66757107", "0.6672944", "0.6593231", "0.6585103", "0.6560697", "0.6545402", "0.6437628", "0.6397002", "0.63321877", "0.63074136", "0.6302382", "0.62944967", "0.62843126", "0.6280059", "0.6280059", "0.6280059", "0.6274628", "0.62575436", "0.62433994", "0.62222415", "0.6213545", "0.6203779", "0.6187427", "0.61569875", "0.61217445", "0.61116904", "0.60896856", "0.60727483", "0.6057873", "0.60509276", "0.6047937", "0.60378104", "0.60354936", "0.60354936", "0.60248643", "0.6018987", "0.60186684", "0.6018421", "0.601324", "0.6010569", "0.59737897", "0.5973236", "0.5972913", "0.5972764", "0.5972141", "0.5966958", "0.59550047", "0.5923643", "0.5903069", "0.5903069", "0.5903069", "0.58879656", "0.58828497", "0.5877596", "0.58694565", "0.5865145", "0.58640724", "0.5848805", "0.5847949", "0.58427626", "0.58427626", "0.58326656", "0.58278465", "0.58258796", "0.5820563", "0.5809095", "0.5809095", "0.5809095", "0.5788946", "0.57885224", "0.57862353", "0.5784411", "0.57772654", "0.57772654", "0.57755476", "0.5760382", "0.5736875", "0.5733723", "0.5717447", "0.5704517", "0.5696866" ]
0.6349797
27
== Local variable section in emacs
def rb2f90_emacs_readonly mess = "!Local Variables:\n" mess << <<-"__EOF__" !mode: f90 !buffer-read-only: t !End: __EOF__ return mess end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_variables() end", "def put_var_scope\nend", "def global_variables() end", "def k_var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n\n\n\n type = K_VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 357:4: 'var'\n match( \"var\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 26 )\n\n\n end", "def get_local_var\n p $local_var #this is different than...\n local_var = \"Local Var\"\n p local_var #...this.\nend", "def put_var_scope\n\tinvisible_var = 4\n\tputs \"The argument variable is: #{invisible_var}\"\nend", "def cvars; end", "def global_var\n $global_var \n end", "def scope=(_); end", "def locals; list_all :local_variables; end", "def amethod\n localvar = 10\n puts( localvar )\n puts( $globalvar )\nend", "def main_variable ; end", "def active_locals; end", "def local_vars(bnd, vars = {})\n vars.each_pair do |name, val|\n bnd.local_variable_set(name, val)\n end\n bnd\n end", "def rename_local_variable\n # Start on either 'asdf', and do viw<leader>rrlv\n asdf = 10\n p asdf\n # TODO: make this work without 'v'\nend", "def global_var=(var)\n $global_var = var\nend", "def global_var\n $global_var \nend", "def definir_var_local\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n\n return_value = DefinirVarLocalReturnValue.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 __LPAR121__ = nil\n __RPAR123__ = nil\n __EOL124__ = nil\n var_local120 = nil\n body_var_local122 = nil\n\n\n tree_for_LPAR121 = nil\n tree_for_RPAR123 = nil\n tree_for_EOL124 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 131:4: var_local LPAR body_var_local RPAR EOL\n @state.following.push( TOKENS_FOLLOWING_var_local_IN_definir_var_local_577 )\n var_local120 = var_local\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, var_local120.tree )\n end\n\n __LPAR121__ = match( LPAR, TOKENS_FOLLOWING_LPAR_IN_definir_var_local_579 )\n if @state.backtracking == 0\n tree_for_LPAR121 = @adaptor.create_with_payload( __LPAR121__ )\n @adaptor.add_child( root_0, tree_for_LPAR121 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_body_var_local_IN_definir_var_local_581 )\n body_var_local122 = body_var_local\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, body_var_local122.tree )\n end\n\n __RPAR123__ = match( RPAR, TOKENS_FOLLOWING_RPAR_IN_definir_var_local_583 )\n if @state.backtracking == 0\n tree_for_RPAR123 = @adaptor.create_with_payload( __RPAR123__ )\n @adaptor.add_child( root_0, tree_for_RPAR123 )\n\n end\n\n __EOL124__ = match( EOL, TOKENS_FOLLOWING_EOL_IN_definir_var_local_585 )\n if @state.backtracking == 0\n tree_for_EOL124 = @adaptor.create_with_payload( __EOL124__ )\n @adaptor.add_child( root_0, tree_for_EOL124 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\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__, 25 )\n\n\n end\n\n return return_value\n end", "def env(variable_name, variable_value, &block); end", "def scope1(var)\r\n\ta = \"monkey\"\r\nend", "def settt_global_var(value)\n\t# puts \"This is the val:#{value}\"\n\t$global_var = value\nend", "def foo\n local_variables = 10\n puts \"local variables: #{local_variables}\"\n puts defined?(local_variables)\nend", "def local_scope; @scope = :local end", "def blah()\n my_var = \"my var has been defined\"\nend", "def getlocal() end", "def intro_to_variables\n expression = \"Ruby is Elegant.\" #Local Varible\n puts expression\nend", "def external_vars(opts={})\n if opts\n opts.each do |k,v|\n if v.include? \",\"\n if v.split(\",\")[0] == \"char\"\n ## default is 40 characters\n if v.split(\",\")[2]\n $external_vars << \"#{v.split(\",\")[0]}* #{k}[#{v.split(\",\")[2].lstrip}];\"\n else\n $external_vars << \"#{v.split(\",\")[0]} #{k}[40] = \\\"#{v.split(\",\")[1].lstrip}\\\";\"\n end\n else\n $external_vars << \"#{v.split(\",\")[0]} #{k} =#{v.split(\",\")[1]};\"\n end\n else\n if v.split(\",\")[0] == \"char\"\n $external_vars << \"#{v.split(\",\")[0]} #{k}[40];\"\n else\n\n $external_vars << \"#{v.split(\",\")[0]} #{k};\"\n end\n end\n # check chars work here\n $external_var_identifiers << k\n end\n end\n end", "def var_decl(keys)\n puts \"Entering var_decl '#{@sy}'\" if DEBUG\n var_list = nil\n \n if @sy.type == TokenType::VAR_TOKEN\n next_token\n var_list = var_list(keys | VariableDeclaration.follow)\n if @sy.type == TokenType::SEMI_COL_TOKEN\n next_token\n else\n error(\"Line #{@sy.line_number}: expected ';' but saw '#{@sy.text}'\",keys | VariableDeclaration.follow)\n end\n end\n \n puts \"Leaving var_decl '#{@sy.text}\" if DEBUG\n VariableDeclarationNode.new var_list if var_list\n end", "def global_var=(var)\n $global_var = var\n end", "def a\r\n test = 123\r\nend", "def local_global\n\t\t\they = \"hey there\" # Local - only accessible from certain methods\n\t\t\tputs hey\n\t\tend", "def forward_local_env(env_variable_patterns); end", "def globals; end", "def globals; end", "def strict_variables=(_arg0); end", "def process_cvar(exp)\n # TODO: we should treat these as globals and have them in the top scope\n name = exp.shift\n return name.to_s\n end", "def setup(key, var)\n @vars[key] = var\n end", "def locals; end", "def locals; end", "def locals; end", "def var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 75 )\n\n type = VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 196:7: 'var'\n match( \"var\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 75 )\n\n end", "def local_var(aparam)\n # +2 instead of +1 because %ecx is pushed onto the stack in main,\n # In any variadic function we push :numargs from %ebx into -4(%ebp)\n \"-#{PTR_SIZE*(aparam+2)}(%ebp)\"\n end", "def globals; list_all :global_variables; end", "def local_variable_reads(node); end", "def lex_en_expr_variable=(_arg0); end", "def lex_en_expr_variable=(_arg0); end", "def lex_en_expr_variable=(_arg0); end", "def local_variable_declaration(method)\n\n\n\n \t dummy_variable = LocalVariableDefinition.new\n \t local_variables = []\n\n\n # 149:7: variable_modifier type[dummy_variable] local_variable_list[dummy_variable, local_variables, method] ';'\n variable_modifier()\n\n type(dummy_variable)\n\n local_variable_list(dummy_variable, local_variables, method)\n\n match(:SEMICOLON)\n\n local_variables.each do |local_variable|\n method.add_local_variable(local_variable)\n end\n local_variables.each do |local_variable|\n method.add_use_of(local_variable.name, local_variable.line) if local_variable.was_initialized?\n end\n \n\n\n\n end", "def vars\n @vars ||= soln.keys\n @vars\n end", "def variable; end", "def variable; end", "def var_names\n @var_names ||= eval \"local_variables\", get_binding\n end", "def global_decls; end", "def add_sticky_local(name, &block)\n config.extra_sticky_locals[name] = block\n end", "def ext_local\n @frame.ext_local\n @cobj.get('set').def_proc do |ent|\n key, val = ent.par\n @stat.repl(key, val)\n @stat.flush\n verbose { \"Set [#{key}] = #{val}\" }\n end\n super\n end", "def lex_en_expr_variable; end", "def lex_en_expr_variable; end", "def lex_en_expr_variable; end", "def method\n local_variable = \"Hi, I'm local only to this method\"\nend", "def my_method\n v3 = 3\n puts local_variables\n log local_variables\n end", "def change\n $global = 99\nend", "def variables; end", "def variables; end", "def inspect_variables_in_scope(scope_node); end", "def scope=(_arg0); end", "def scope=(_arg0); end", "def scope=(_arg0); end", "def test_local_basic\n lst = compile( \"foo = 1 ; foo\")\n assert_equal ScopeStatement , lst.class\n assert_equal LocalVariable , lst.statements[1].class\n end", "def variable_name_expr; end", "def var(name, value)\n @locals[name] = value\n end", "def strict_variables; end", "def inject_var(name, value, b)\n Thread.current[:__pry_local__] = value\n b.eval(\"#{name} = Thread.current[:__pry_local__]\")\nensure\n Thread.current[:__pry_local__] = nil\nend", "def set_variables(activity, line_num, file_read)\n val = activity[0].upcase.ord\n return could_not_eval(line_num) unless check_variables([activity[0]])\n if activity[1].nil?\n puts \"Line #{line_num}: operator LET applied to empty stack\"\n error_eval(2, line_num, nil, file_read)\n else\n activity.shift\n store = evaluate_expression(activity, line_num, file_read)\n $user_variables[val - 65] = store unless store.nil?\n end\n end", "def encode_global_variable(name)\n raise if name.to_s[0,1] != '$'\n \"$\" + @global_name_generator.get(name.to_s)\n end", "def define_variable(name)\n emit_section :data\n emit \"#{name}: .long 0x0\\n\"\n emit_section :text\nend", "def define_variable(name)\n emit_section :data\n emit \"#{name}: .long 0x0\\n\"\n emit_section :text\nend", "def scope=(v); end", "def scope=(v); end", "def var_file(path:)\n add option: \"-var-file=#{path}\"\n end", "def declare_global_init(variable,name, options = {})\r\n v = (name.include?(\"[\") ? \"\" : \"var \")\r\n unless options[:local_construction]\r\n @global_init << \"#{v}#{variable.assign_to(name)}\"\r\n else\r\n @global_init << \"#{v}#{name};\"\r\n @init << variable.assign_to(name)\r\n end\r\n end", "def inject_sticky_locals!\n sticky_locals.each_pair do |name, value|\n inject_local(name, value, current_binding)\n end\n end", "def enable_check_variables\n add option: \"-check-variables=true\"\n end", "def get_local(locals: {}, key: \"\", alt: false ) \n\t\t_local = alt\n\t\tif locals.has_key?(key.to_sym)\n\t\t\t_local = locals[key.to_sym]\n\t\telsif locals.has_key?(key.to_s)\n\t\t\t_local = locals[key.to_s]\n\t\tend\n\n\t\treturn _local \n\tend", "def local(name)\n @locals[name.to_s.to_sym]\n end", "def var(key:, value:)\n add option: \"-var='#{key}=#{value}'\"\n end", "def process_lvar(exp)\n lvar = exp.shift\n\n lvar_name = @model.encode_local_variable(lvar)\n raise \"variable not available\" unless @local_variables.include?(lvar_name)\n\n resultify(\"#{lvar_name}\")\n end", "def default_scope=(_arg0); end", "def definir_variable\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 46 )\n\n\n return_value = DefinirVariableReturnValue.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 __K_DEF241__ = nil\n __K_VAR242__ = nil\n __Identificador243__ = nil\n __LPAR244__ = nil\n __EOL246__ = nil\n var_exp245 = nil\n\n\n tree_for_K_DEF241 = nil\n tree_for_K_VAR242 = nil\n tree_for_Identificador243 = nil\n tree_for_LPAR244 = nil\n tree_for_EOL246 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 216:4: K_DEF K_VAR Identificador LPAR var_exp EOL\n __K_DEF241__ = match( K_DEF, TOKENS_FOLLOWING_K_DEF_IN_definir_variable_1046 )\n if @state.backtracking == 0\n tree_for_K_DEF241 = @adaptor.create_with_payload( __K_DEF241__ )\n @adaptor.add_child( root_0, tree_for_K_DEF241 )\n\n end\n\n __K_VAR242__ = match( K_VAR, TOKENS_FOLLOWING_K_VAR_IN_definir_variable_1048 )\n if @state.backtracking == 0\n tree_for_K_VAR242 = @adaptor.create_with_payload( __K_VAR242__ )\n @adaptor.add_child( root_0, tree_for_K_VAR242 )\n\n end\n\n __Identificador243__ = match( Identificador, TOKENS_FOLLOWING_Identificador_IN_definir_variable_1050 )\n if @state.backtracking == 0\n tree_for_Identificador243 = @adaptor.create_with_payload( __Identificador243__ )\n @adaptor.add_child( root_0, tree_for_Identificador243 )\n\n end\n\n __LPAR244__ = match( LPAR, TOKENS_FOLLOWING_LPAR_IN_definir_variable_1052 )\n if @state.backtracking == 0\n tree_for_LPAR244 = @adaptor.create_with_payload( __LPAR244__ )\n @adaptor.add_child( root_0, tree_for_LPAR244 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_var_exp_IN_definir_variable_1054 )\n var_exp245 = var_exp\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, var_exp245.tree )\n end\n\n __EOL246__ = match( EOL, TOKENS_FOLLOWING_EOL_IN_definir_variable_1056 )\n if @state.backtracking == 0\n tree_for_EOL246 = @adaptor.create_with_payload( __EOL246__ )\n @adaptor.add_child( root_0, tree_for_EOL246 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\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__, 46 )\n\n\n end\n\n return return_value\n end", "def lookup_variable(key)\n\n fexp.lookup_variable(key)\n end", "def var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n\n\n type = VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 24:6: 'ingrediente'\n match( \"ingrediente\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 3 )\n\n\n end", "def _load_env\n require 'yaml'\n r_var = _open_sefile('env3.yml') { |f| YAML.load(f) }\n @var.delete :file_open_raised\n r_var.each { |k,v| @var[k] = v } if r_var\nend", "def compile_argument(ctx, stream, void)\n ctx.declare_var(name, \"local\")\n stream.dup_top if (!void)\n stream.local_set(name)\n end", "def some_method # Scope gate\n v2 = 2\n p local_variables\n end", "def local?; !!@local end", "def local_variable_defined_for_node?(node, name); end", "def vardecl \n\t\n\t$cst.add_branch(\"VarDecl\")\n\t\n\ttype\n\tid\n\t\n\t$cst.ascend\n\nend", "def introduce_myself\n # Local variable\n expression = \"I am a genious\"\n puts expression\nend", "def definir_variables\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n\n return_value = DefinirVariablesReturnValue.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 definir_variable239 = nil\n definir_var_local240 = nil\n\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 212:4: ( definir_variable | definir_var_local )\n # at line 212:4: ( definir_variable | definir_var_local )\n alt_33 = 2\n look_33_0 = @input.peek( 1 )\n\n if ( look_33_0 == K_DEF )\n alt_33 = 1\n elsif ( look_33_0 == DOUBLEDOT )\n alt_33 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 33, 0 )\n\n end\n case alt_33\n when 1\n # at line 212:5: definir_variable\n @state.following.push( TOKENS_FOLLOWING_definir_variable_IN_definir_variables_1032 )\n definir_variable239 = definir_variable\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, definir_variable239.tree )\n end\n\n\n when 2\n # at line 212:22: definir_var_local\n @state.following.push( TOKENS_FOLLOWING_definir_var_local_IN_definir_variables_1034 )\n definir_var_local240 = definir_var_local\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, definir_var_local240.tree )\n end\n\n\n end\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\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__, 45 )\n\n\n end\n\n return return_value\n end", "def local_env(body)\n env = ''\n vtmp = @var.dup\n vtmp[:pub_rsa] = '[PUBLIC RSA KEY]'\n vtmp[:prv_rsa] = '[PRIVATE RSA KEY]'\n vtmp[:user_keys] = @var[:user_keys].collect { |k,_| k }\n vtmp.each { |k,v| env << \"#{(k.to_s + ' '*20)[0,20]} => #{v.inspect}\\n\" }\n _notice \" -- Current Environment Variables --\\n#{env}\"\nend", "def _get_var(name)\n\t\treturn @replace_vars[name]\n\tend" ]
[ "0.68682605", "0.6309533", "0.6301486", "0.6167567", "0.60794634", "0.6078201", "0.60412484", "0.59860516", "0.5967931", "0.5958772", "0.5948803", "0.5931514", "0.58843285", "0.5855342", "0.5853259", "0.58524746", "0.58410513", "0.5830527", "0.58228785", "0.5813567", "0.58058417", "0.5762738", "0.575488", "0.568963", "0.56782794", "0.56748724", "0.5655481", "0.5650178", "0.56240726", "0.55896264", "0.5573041", "0.5561205", "0.5557406", "0.5557406", "0.55472183", "0.55470824", "0.55433327", "0.5535704", "0.5535704", "0.5535704", "0.55354035", "0.553259", "0.5530302", "0.5523791", "0.5521119", "0.5521119", "0.5521119", "0.55180866", "0.5510489", "0.55033654", "0.55033654", "0.5480918", "0.5480142", "0.5465287", "0.5463354", "0.54552126", "0.54552126", "0.54552126", "0.5452296", "0.54485226", "0.5432568", "0.54062635", "0.54062635", "0.5397586", "0.5397148", "0.5397148", "0.5397148", "0.53851384", "0.5385004", "0.5382058", "0.5373102", "0.53641915", "0.5363447", "0.53603125", "0.5341915", "0.5341915", "0.5336003", "0.5336003", "0.5332544", "0.53291684", "0.5329113", "0.5326816", "0.5323723", "0.5320586", "0.53172827", "0.5317122", "0.53155684", "0.531325", "0.53095895", "0.53032935", "0.5298508", "0.5297209", "0.5284211", "0.52739", "0.5272195", "0.527193", "0.5271324", "0.52564085", "0.52512145", "0.5247702" ]
0.6369953
1
Only allow a trusted parameter "white list" through.
def user_params params.require(:user).permit(:username, :password, :password_confirmation) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @inativa = Matinativa.new @inativa.aluno_id = @matricula.aluno_id @inativa.curso_id = @matricula.curso_id @inativa.data_matricula = @matricula.data_matricula @inativa.termino_matricula = Date.today @inativa.ano = @matricula.ano @inativa.teoria_ano = @matricula.teoria_ano @inativa.valor_mensal = @matricula.valor_mensal @inativa.id_ativa = @matricula.id if @matricula.horarios.size > 1 @inativa.professor_id = @matricula.horarios.first.professor_id @inativa.dia_pratica = @matricula.horarios.first.dia[0] @inativa.professor_teoria_id = @matricula.horarios.last.professor_id @inativa.dia_teoria = @matricula.horarios.last.dia[0] elsif [email protected]? @inativa.professor_id = @matricula.horarios.first.professor_id @inativa.dia_pratica = @matricula.horarios.first.dia[0] elsif [email protected]? @inativa.professor_teoria_id = @matricula.horarios.last.professor_id @inativa.dia_teoria = @matricula.horarios.last.dia[0] end if @inativa.save #gera_notificacao("admin",@matricula, action_name) @matricula.destroy respond_to do |format| format.html { redirect_to matriculas_path } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7245172", "0.7242216", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_matricula @matricula = Matricula.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def matricula_params params.require(:matricula).permit(:aluno_id, :curso_id, :data_matricula, :ano, :valor_mensal, :termino_matricula, :teoria_ano) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62909746", "0.62904227", "0.62837297", "0.6240993", "0.6239739", "0.6217764", "0.6214983", "0.62112504", "0.6194765", "0.6178", "0.61755055", "0.61729854", "0.61636627", "0.6153461", "0.6151674", "0.61478525", "0.6122671", "0.61188513", "0.61075556", "0.6105721", "0.6092412", "0.6081011", "0.6071054", "0.6064436", "0.6022111", "0.6018135", "0.60151577", "0.60108894", "0.60070235", "0.60070235", "0.6000806", "0.6000464", "0.5998811", "0.59926987", "0.5992257", "0.5991173", "0.5980311", "0.59660876", "0.59596545", "0.5959415", "0.59589994", "0.5957478", "0.5953214", "0.5952233", "0.5944033", "0.59396756", "0.59396756", "0.59386414", "0.59345603", "0.5931261", "0.5926345", "0.5925795", "0.59174526", "0.59108645", "0.5909469", "0.5908263", "0.59053195", "0.58980685", "0.5897738", "0.589657", "0.5895971", "0.58942044", "0.5892847", "0.588742", "0.58834344", "0.5880024", "0.58739793", "0.5868253", "0.5867907", "0.58670515", "0.58668053", "0.5865756", "0.5863549", "0.5863236", "0.5862728", "0.5861283", "0.58591247", "0.5855159", "0.5854291", "0.58512247", "0.58498096" ]
0.0
-1
GET /items/1 GET /items/1.xml
def show @item = Item.find(params[:id]) @feature = Feature.new respond_to do |format| format.html # show.html.erb format.xml { render :xml => @item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end", "def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end", "def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end", "def xml(item)\n presenter.xml(item)\n end", "def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end", "def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end", "def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end", "def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end", "def index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end", "def index\n @front_page = true\n @items_count = Item.count\n @items = Item.all.paginate :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def index\n @news_items = do_index(NewsItem, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def items\n # Since we're parsing xml, this will raise an error\n # if the response isn't xml.\n self.response = self.class.get(\"#{record_url}/items?view=full\")\n raise_error_if(\"Error getting items from Aleph REST APIs.\") {\n (response.parsed_response[\"get_item_list\"].nil? or response.parsed_response[\"get_item_list\"][\"items\"].nil?)\n }\n [response.parsed_response[\"get_item_list\"][\"items\"][\"item\"]].flatten\n end", "def show\n @actionitem = Actionitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actionitem }\n end\n end", "def items\n @document.xpath('//results/page/items/*')\n end", "def show\n @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_item }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end", "def index\n @stream_items = StreamItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stream_items }\n end\n end", "def show\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @item }\n end\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def index\n @items = @category.blank? ? Item.roots : @category.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end", "def item\n @item = Item.find(params[:id])\n end", "def show\n @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end", "def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end", "def index\n @current_item = \"my_account\"\n \n respond_to do |format|\n format.html \n format.xml { render :xml => @accounts.to_xml }\n end\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def get(item)\n self.send(\"GET #{item}\")\n\n # Check for errors\n case @retcode\n when 0 then @retmesg # OK\n when 10 then nil # item doesn't exist\n else\n fail(\"Debconf: debconf-communicate returned #{@retcode}: #{@retmesg}\")\n end\n end", "def show\n @receiving_item = ReceivingItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end", "def index\n @league_items = LeagueItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @league_items }\n end\n end", "def show\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def show\n @auction_item = AuctionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction_item }\n end\n end", "def show_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def show\n @item_alias = ItemAlias.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_alias }\n end\n end", "def output_xml(items)\n puts \"<?xml version=\\\"1.0\\\"?><items>\"\n items.each do |item|\n puts \"<item uid=\\\"#{item[\"uid\"]}\\\" arg=\\\"#{item[\"arg\"]}\\\">\n <title>#{item[\"title\"]}</title>\n <icon>icon.png</icon>\n <subtitle>#{item[\"subtitle\"]}</subtitle>\n </item>\"\n end\n puts \"</items>\" \n end", "def show\n @instancia_item = InstanciaItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @news_item.to_xml }\n end\n end", "def get(item)\n run(\"show #{ item }\")\n end", "def show\n @shop_item = ShopItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shop_item }\n end\n end", "def show\n @account = Account.find(params[:account_id])\n @account_item = @account.account_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_item }\n end\n end", "def show\n @stream_item = StreamItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stream_item }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def show\n @news_item = NewsItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @news_items = NewsItem.find(:all, :order => 'updated_at desc')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @news_items.to_xml }\n end\n end", "def index\n @apiv1_items = Item.all.order(:name)\n end", "def show\n @item = ItemTemplate.find(params[:id])\n @title = @item.name.titleize\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end", "def index\n @expense_items = ExpenseItem.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @expense_items }\n end\n end", "def get(pAuthToken, p_item_id, p_args)\r\n service_uri = \"#{@@m_service_url.path}#{@@m_service_get}#{p_item_id}.#{@@m_content_format}?authToken=#{pAuthToken}\"\r\n\r\n # verify user intention about related items, if :related_items flag is set\r\n # load all related items\r\n if p_args.nil? == false and p_args[:related_items] == true\r\n service_uri += \"&#{PARAM_LOAD_RELATED_ITEMS}=true\"\r\n\r\n # verify whether user has set any offset\r\n offset = p_args[:offset]\r\n unless offset.nil?\r\n service_uri += \"&offset=#{offset.to_s}\"\r\n end\r\n\r\n # verify whether user has set any maximum number of related items\r\n max = p_args[:max]\r\n unless max.nil?\r\n service_uri += \"&max=#{max}\"\r\n end\r\n\r\n # verify whether user has set the accepted relation types\r\n relation_types_array = p_args[:relation_types]\r\n unless relation_types_array.nil? and relation_types_array.empty?\r\n relation_types = \"\"\r\n relation_types_array.each do |relation_type|\r\n if relation_types.size > 0\r\n relation_types += \",\" + relation_type\r\n else\r\n relation_types += relation_type\r\n end\r\n end\r\n service_uri += \"&relation_types=#{relation_types}\"\r\n end\r\n end\r\n debug service_uri\r\n response = Net::HTTP.start(@@m_service_url.host,\r\n @@m_service_url.port) {|http|\r\n http.get(service_uri, {HEADER_COOKIE => @@m_cookies})\r\n }\r\n xml_content = response.body\r\n built_item = build_item(xml_content)\r\n debug(\"built item - #{built_item}\")\r\n return built_item\r\n end", "def show\n @nav_item = NavItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @nav_item }\n end\n end", "def show\n @asset_item = AssetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset_item }\n end\n end", "def show\r\n @item_type = ItemType.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end", "def show\n @mail_item = MailItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mail_item }\n end\n end", "def show\n @item_photos = ItemPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_photos }\n end\n end", "def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def new\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", "def new\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", "def new\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", "def new\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", "def new\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", "def new\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", "def new\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", "def new\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", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end" ]
[ "0.67883086", "0.67824584", "0.67824584", "0.67824584", "0.67824584", "0.67824584", "0.67824584", "0.6725632", "0.671724", "0.66035503", "0.65945554", "0.6577324", "0.65549666", "0.647732", "0.6476387", "0.6447388", "0.64292353", "0.63994366", "0.636686", "0.6338798", "0.63165414", "0.6298263", "0.62632203", "0.62601656", "0.6239026", "0.623873", "0.62011945", "0.6199706", "0.61959916", "0.6194133", "0.61774075", "0.6176978", "0.6176305", "0.616367", "0.6154313", "0.6154313", "0.6152154", "0.6151408", "0.61482036", "0.61401194", "0.61355865", "0.6129329", "0.61048645", "0.6098971", "0.60888124", "0.6062392", "0.605675", "0.6054347", "0.60539645", "0.6053387", "0.60531044", "0.604103", "0.6039239", "0.6013435", "0.60076755", "0.59996665", "0.5996147", "0.59941393", "0.5992188", "0.5980887", "0.5980137", "0.59765226", "0.59761995", "0.5973315", "0.5973315", "0.5962681", "0.5962681", "0.5962681", "0.5962681", "0.5961207", "0.5951778", "0.59360486", "0.5932361", "0.59245753", "0.592405", "0.5919943", "0.5916206", "0.5913215", "0.5912309", "0.59068704", "0.5899329", "0.5898835", "0.5898835", "0.5898835", "0.5898835", "0.5898835", "0.5898835", "0.5898835", "0.5898835", "0.5895703", "0.58872175", "0.58872175", "0.58872175", "0.58872175", "0.58872175", "0.58872175", "0.58872175", "0.58872175", "0.58872175", "0.58872175", "0.58872175" ]
0.0
-1
GET /items/new GET /items/new.xml
def new @item = Item.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end", "def new\r\n @item = Item.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item }\r\n end\r\n end", "def new\n @title = \"New item\"\n @item = ItemTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end", "def new\n @action_item = ActionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_item }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def item\n @new = New.find(params[:id])\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def new\n @ordered_item = OrderedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end", "def new\n @item = BudgetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def new\n @clone_item_request = CloneItemRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clone_item_request }\n end\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def new\n @item = Item.new\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.rjs\n format.xml { render :xml => @item }\n end\n end", "def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end", "def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_item }\n end\n end", "def new\n @receiving_item = ReceivingItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end", "def new\r\n @item_type = ItemType.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\n end", "def new\n @goods_item = Goods::Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goods_item }\n end\n end", "def new\n @miscellaneous_item = MiscellaneousItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @item = Item.new\n @items = Item.all\n @tags = Tag.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @inventory_item = InventoryItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inventory_item }\n end\n end", "def new\n @item = Item.new(:list_id => params[:list_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item}\n end\n end", "def new\n @to_do_item = ToDoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @to_do_item }\n end\n end", "def new\n @nav_item = NavItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nav_item }\n end\n end", "def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @mail_item = MailItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mail_item }\n end\n end", "def new\n @auction_item = AuctionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auction_item }\n end\n end", "def new\n @item_alias = ItemAlias.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_alias }\n end\n end", "def new\n @item_info = ItemInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_info }\n end\n end", "def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end", "def new\n @requisicion = Requisicion.new\n @[email protected]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requisicion }\n end\n end", "def new\n @item = current_user.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @instancia_item = InstanciaItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @order = Order.new\n @items = OrderItem.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @question_item = QuestionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_item }\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { redirect_to(items_path)}\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @menu_item = MenuItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_item }\n end\n end", "def new\n @menu_item = uhook_new_menu_item\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_item }\n end\n end", "def new\n @shop_item = ShopItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shop_item }\n end\n end", "def new\n @item_class = ItemClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_class }\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |wants|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n wants.html { redirect_to(admin_items_url) }\n wants.xml { render :xml => @item, :status => :created, :location => @item }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @stock_item = StockItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_item }\n end\n end", "def new\n @collection = Collection.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to \"/new/\" + Base58.encode(@item.id) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n end", "def new\n @item = Item.new\n end", "def new\n @item = Item.new\n end", "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.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "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.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @material_item = MaterialItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @material_item }\n end\n end", "def new\n @item_catalog = ItemCatalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_catalog }\n end\n end", "def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mylist }\n end\n end", "def set_new_item\n @new_item = NewItem.find(params[:id])\n end", "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", "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", "def new\n @stream_item = StreamItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stream_item }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @itemstable = Itemstable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstable }\n end\n end", "def new\n @portfolio_item = PortfolioItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @portfolio_item }\n end\n end", "def new\n @item_option = ItemOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_option }\n end\n end" ]
[ "0.7750405", "0.7674057", "0.7650397", "0.7624482", "0.7310945", "0.7224427", "0.7214633", "0.71571666", "0.7152413", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.71524066", "0.7129221", "0.7129221", "0.7113735", "0.71053255", "0.709452", "0.70915234", "0.7070292", "0.7010604", "0.6997517", "0.6997517", "0.699483", "0.6989647", "0.6962315", "0.6950287", "0.6925482", "0.6925428", "0.6923494", "0.6923494", "0.69189775", "0.6915415", "0.6907549", "0.6894268", "0.6874881", "0.687417", "0.683855", "0.6833972", "0.6811353", "0.6807025", "0.6802822", "0.67999506", "0.6787933", "0.6779471", "0.67490417", "0.67291135", "0.6727892", "0.6718457", "0.67161024", "0.67145824", "0.67142606", "0.67023045", "0.66967815", "0.66915214", "0.6689704", "0.66760546", "0.66760546", "0.6667374", "0.6664618", "0.6662776", "0.66508657", "0.66508657", "0.66508657", "0.6641776", "0.6641776", "0.6610741", "0.66070956", "0.65938926", "0.65922964", "0.65917206", "0.65917206", "0.6586411", "0.6586276", "0.6584741", "0.6573925", "0.6571739" ]
0.7721567
5
POST /items POST /items.xml
def create @item = Item.new(params[:item]) respond_to do |format| if @item.save flash[:notice] = 'Item was successfully created.' format.html { redirect_to(@item) } format.xml { render :xml => @item, :status => :created, :location => @item } else format.html { render :action => "new" } format.xml { render :xml => @item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { redirect_to(items_path)}\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end", "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", "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", "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.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "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.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item(data, question_ids)\n xml = xml_root(\"items\")\n\n questions = question_ids.inject(XML::Node.new(\"questions\")) do |doc, id|\n question = XML::Node.new(\"question\")\n question[\"id\"] = id.to_s\n doc << question\n end\n\n arrayed(data).each do |name|\n xml.root << (XML::Node.new(\"item\") << (XML::Node.new(\"data\") << name) << questions.copy(true))\n end\n\n send_and_process('items/add', 'items/item', xml)\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |wants|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n wants.html { redirect_to(admin_items_url) }\n wants.xml { render :xml => @item, :status => :created, :location => @item }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = @list.items.create(item_params)\n redirect_to @list\n end", "def item_params\n params.require(:item).permit(:item, :body)\n end", "def create\n \n #debug\n write_log(\n Const::SL::LOG_PATH_SL,\n \"items_controller#create(params[:item] => #{params[:item]})\",\n # __FILE__,\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n \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", "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", "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", "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", "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", "def post(payload, request_opts={})\n if payload.is_a?(Hash)\n payload = self.class.item_class.new(payload) # apply data type conversion\n end\n qs = payload.query_string_params\n payload = payload.as_hash\n response = http(request_opts).post(resolved_path + qs, payload)\n new_item = self.class.item_class.new\n new_item.store_result(response)\n new_item\n end", "def api_post(method: nil, item: [], params: {})\n raise ArgumentError, 'Missing method in API request' unless method\n\n login(@host) if Time.new.to_i > @session_timeout\n\n request = {}\n request[:method] = method\n request[:params] = [[item || []], params.to_h]\n # This is how we create request params once all methods use structs\n # request[:params] = [[item || []], params.to_h]\n # We use a StandardError since it is based on the HTTP response code with a JSON payload definition\n begin\n resp = @http.post(@uri, request.to_json, @headers)\n JSON.parse(resp.body)['result']['result']\n rescue StandardError\n puts \"The following error has occurred #{JSON.parse(resp.body)['error']['message']}\"\n end\n end", "def create\n @item = current_user.items.build(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to home_path }\n format.xml { head :created, :location => item_url(@item) }\n else\n format.html { render :action=>:new }\n format.xml { render :xml=>@item.errors.to_xml }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n @item.save\n redirect_to @item\n end", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "def create\n @item = Item.new(params[:item])\n\n get_relations_from_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 json: @item, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "def create\n @item = Item.new(item_save_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", "def item_params\n params.require(:item).permit(:name, :value)\n end", "def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "def create(item_attrs = {})\n body = { value: item_attrs }\n Iterable.request(conf, base_path).put(body)\n end", "def item_params\n params.require(:item).permit(:name, :tag_list, :type_list, :description)\n end", "def item_params\n params.require(:item).permit(:title, :body)\n end", "def create\r\n @item = Item.new(params[:item])\r\n\r\n respond_to do |format|\r\n if @item.save\r\n format.html { render :action => \"initauction\"}\r\n format.xml { render :xml => @item, :status => :created, :location => @item }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n\r\n end", "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", "def writeItem(app, repo_url, item)\n headers = defaultHeaders(app[\"token\"])\n data = item.to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response\nend", "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", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to lists_path, :notice => 'Item was successfully created.' }\n format.json { render :json => lists_path, :status => :created, :location => lists_path }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "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 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", "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 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", "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 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", "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 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", "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 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", "def create\n @items_mob = ItemsMob.new(params[:items_mob])\n\n respond_to do |format|\n if @items_mob.save\n flash[:notice] = 'ItemsMob was successfully created.'\n format.html { redirect_to items_mob_url(@items_mob) }\n format.xml { head :created, :location => items_mob_url(@items_mob) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @items_mob.errors.to_xml }\n end\n end\n end", "def save_items_data\n @parsed[\"order_items\"].each do |i| \n external_code = i['item']['id']\n item = Item.find_or_create_by(external_code: external_code)\n item.order_id = @order.id\n item.external_code = i['item']['id']\n item.name = i['item']['title']\n item.price = i['unit_price']\n item.quantity = i['quantity']\n item.total = i['full_unit_price']\n @subItems = []\n item.save\n end\n end", "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", "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", "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 @item.save_info\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end \n end", "def create\n @user = User.find(current_user.id)\n @item = @user.items.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 :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", "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", "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", "def create_rest\n @entry_item = EntryItem.new(params[:entry_item])\n\n respond_to do |format|\n if @entry_item.save\n flash[:notice] = 'EntryItem was successfully created.'\n #format.html { redirect_to(@entry_item) }\n format.xml { render :xml => @entry_item, :status => :created, :location => @entry_item }\n else\n #format.html { render :action => \"new\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "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", "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", "def item_params\n params.require(:item).permit(:name)\n end", "def item_params\n params.require(:item).permit(:name)\n end", "def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to \"/new/\" + Base58.encode(@item.id) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ordered_item = OrderedItem.new(params[:ordered_item])\n\n respond_to do |format|\n if @ordered_item.save\n format.html { redirect_to(@ordered_item, :notice => 'Ordered item was successfully created.') }\n format.xml { render :xml => @ordered_item, :status => :created, :location => @ordered_item }\n format.json { render :json => @ordered_item, :status => :created, :location => @ordered_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ordered_item.errors, :status => :unprocessable_entity }\n format.json { render :json => @ordered_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_item\n #params[item_id]\n end", "def item_params\n params.require(:item).permit!\n end", "def create\r\n @item = Item.new(params[:item])\r\n if @item.save\r\n redirect_to @item, notice: 'Item was successfully created.'\r\n else\r\n render action: \"new\"\r\n end\r\n end", "def create\n @question_item = QuestionItem.new(params[:question_item])\n\n respond_to do |format|\n if @question_item.save\n format.html { redirect_to(@question_item, :notice => 'Question item was successfully created.') }\n format.xml { render :xml => @question_item, :status => :created, :location => @question_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n # @item.build_note\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 respond_with(@items)\n end\n end\n end", "def create\n @item = current_user.items.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", "def create\n puts params\n item_data = {\n :title => params[:title],\n :description => params[:description]\n }\n @item = current_user.items.build(item_data)\n if params[:attachments]\n params[:attachments].each do |att_id|\n @att = Attachment.find(att_id)\n @item.attachments.push(@att)\n if @att.att_type == 'photo'\n @item.photos.build(\n photo_url: @att.url\n )\n end\n end\n end\n if @item.save\n respond_to do |format|\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create item\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end", "def item_params\n params.require(:item).permit(:name, :type_id, :user_id)\n end", "def create\n @item = Item.new(params[:item])\n @item.user = current_user\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", "def item_params\n params.require(:item).permit(:name, :url, :price, :container)\n end", "def create\n @item = BudgetItem.new(params[:budget_item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(attributes)\n response = JSON.parse(@client.post('items', attributes).body)\n Promisepay::Item.new(@client, response['items'])\n end", "def create\n @item = @list.items.build(item_params)\n @item.user = current_user\n\n if @item.save\n return success_item_create\n else\n return error_item_save\n end\n end", "def create\n @instancia_item = InstanciaItem.new(params[:instancia_item])\n\n respond_to do |format|\n if @instancia_item.save\n format.html { redirect_to(@instancia_item, :notice => 'Instancia item was successfully created.') }\n format.xml { render :xml => @instancia_item, :status => :created, :location => @instancia_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @instancia_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "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", "def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end", "def item_params\n params.require(:item).permit(:name, :price, :date, :user_id, :group_id, :item_type, { tag_ids: [] })\n end", "def create\n @item = Item.new(params[:item])\n respond_to do |format|\n if @item.save\n flash[:notice] = 'O item foi criado com sucesso.'\n format.html { redirect_to(@item) }\n format.js\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n error_respond(format, \"new\");\n end\n end\n end", "def create\n @order_item = OrderItem.new(order_items_params)\n\n respond_to do |format|\n if @order_item.save\n format.html { redirect_to @order_item, notice: \"Order item was successfully created.\" }\n format.json { render json: @order_item, status: :created, location: @order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entry }\n end\n end\n end" ]
[ "0.6878987", "0.68121386", "0.6461912", "0.6385658", "0.63709396", "0.63393664", "0.63393664", "0.6333269", "0.62712324", "0.6207085", "0.617964", "0.61328024", "0.6087989", "0.60817254", "0.60677546", "0.60674924", "0.6064618", "0.6062312", "0.6056173", "0.60460603", "0.603753", "0.60354125", "0.60354125", "0.60354125", "0.60354125", "0.60354125", "0.60354125", "0.60354125", "0.60352844", "0.6033661", "0.6028079", "0.6024467", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.6015514", "0.60130453", "0.5970512", "0.5967576", "0.5961362", "0.5958295", "0.59548736", "0.5951618", "0.5948807", "0.5929945", "0.5928832", "0.59223294", "0.59093016", "0.5907063", "0.5907063", "0.5907063", "0.5907063", "0.5907063", "0.59040564", "0.59016395", "0.58971214", "0.5890969", "0.5888336", "0.5856993", "0.58496875", "0.5843399", "0.5830667", "0.581636", "0.580811", "0.5797268", "0.5797105", "0.5794647", "0.5789113", "0.57856816", "0.5777197", "0.5767775", "0.5766641", "0.57632524", "0.574645", "0.5746136", "0.5745855", "0.5727223", "0.57190925", "0.5713327", "0.57126015", "0.5712485", "0.57120353", "0.57078344", "0.5705289", "0.5700787", "0.5696946", "0.5687106" ]
0.6326739
9
PUT /items/1 PUT /items/1.xml
def update @item = Item.find(params[:id]) respond_to do |format| if @item.update_attributes(params[:item]) flash[:notice] = 'Item was successfully updated.' format.html { redirect_to(@item) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n @item ||= Item.find_by_id_or_name(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item }\n format.xml { head :ok }\n else\n \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_item\n @item = Item.find(params[:id])\n @item.update(params[:item])\n redirect \"/items/#{@item.id}\"\n end", "def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = \"Item has been updated\"\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { render :action => :edit }\n else\n format.json { render :text => \"Could not update item\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to(@item, :notice => 'Item Successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[@item.class.to_s.downcase.to_sym])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item.update!(item_params)\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_apiv1_item\n @apiv1_item = Item.find(params[:id])\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update \n respond_to do |wants|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n wants.html { redirect_to(admin_items_path) }\n wants.xml { head :ok }\n else\n \n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end", "def set_api_v1_item\n @api_v1_item = Item.find(params[:id])\n end", "def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response \nend", "def update\n @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Artikel is succesvol ge-update.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "def update\n item = Item.find(params[:item_id])\n\n item.name = params[:name]\n item.details = params[:details]\n item.save\n end", "def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @item.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ordered_item = OrderedItem.find(params[:id])\n\n respond_to do |format|\n if @ordered_item.update_attributes(params[:ordered_item])\n format.html { redirect_to(@ordered_item, :notice => 'Ordered item was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ordered_item.errors, :status => :unprocessable_entity }\n format.json { render :json => @ordered_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update\n @item = Item.find(params[:id])\n\n logger.info \"Item: #{@item}\\nw/ param attr: #{params[:item].inspect}\"\n respond_to do |format|\n @item.attributes = params[:item].select{|k,v| ![:item_photos, :item_photos_attributes, :location].include?(k.to_sym) }\n\n @item.load_item_photos_with_params(params[:item] )\n\n if @item.save\n\n @item.set_by_user(auth_user)\n\n logger.info \" C) after save: attr: #{@item.attributes}\"\n\n if manage_item_photos(@item).present? || @item.changed?\n @item.save\n logger.info \" D) attr: #{@item.attributes}\"\n end\n\n format.html {\n redirect_to inventory_approve_item_path(:user_id => \"#{@item.owner.id}\")\n }\n format.json { render json:{ item: @item, success: true} }\n else\n set_flash_messages_from_errors(@item)\n format.html { render action: \"edit\" }\n format.json { render json: { error: @item.errors.first.join(' ') }, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to item_show_path(@item), notice: 'O item foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def put_item(table_name, item)\n params = {\n table_name: table_name,\n item: item,\n return_values: \"NONE\",\n }\n $client.put_item(params)\n return item\nend", "def update\n @swap_item = SwapItem.find(params[:id])\n\n respond_to do |format|\n if @swap_item.update_attributes(params[:swap_item])\n format.html { redirect_to :back }\n format.xml { head :ok }\n else\n format.html { redirect_to :back }\n format.xml { render :xml => @swap_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(retrospective_path(@item.section.retrospective), :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(list, item, qty)\n add_item(list, item, qty)\nend", "def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, notice: 'Item was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n if @goods_item.update_attributes(params[:goods_item])\n format.html { redirect_to(@goods_item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goods_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item ' + @item.name + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end", "def updated(item)\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n @item.save_info\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @action_item = ActionItem.find(params[:id])\n\n respond_to do |format|\n if @action_item.update_attributes(params[:action_item])\n format.html { redirect_to(@action_item, :notice => 'Action item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @action_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(item_attrs = {})\n body = { update: item_attrs }\n Iterable.request(conf, base_path).patch(body)\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6630569", "0.6627824", "0.6621275", "0.6534779", "0.64609754", "0.6442224", "0.64367634", "0.64367634", "0.6424991", "0.63892907", "0.63527155", "0.63239944", "0.63216454", "0.6300074", "0.6266376", "0.6246194", "0.6228602", "0.62218153", "0.62161434", "0.6210292", "0.61932355", "0.61638486", "0.6158045", "0.61483026", "0.6127812", "0.6124251", "0.6124218", "0.6123124", "0.6107452", "0.61040443", "0.60982674", "0.60623866", "0.6053807", "0.6042889", "0.6042889", "0.6026645", "0.6023631", "0.60216236", "0.60216236", "0.60216236", "0.60216236", "0.60216236", "0.60216236", "0.60216236", "0.60216236", "0.60216236", "0.60216236", "0.60216236", "0.6003085", "0.59707874", "0.5969619", "0.59654075", "0.59295064", "0.5916392", "0.5916392", "0.5912531", "0.5911191", "0.5891543", "0.5885153", "0.587794", "0.5877905", "0.5871189", "0.5864498", "0.5857929", "0.58530253", "0.5850848", "0.5847117", "0.5847117", "0.5847117", "0.5847117", "0.58469903", "0.58454955", "0.5839977", "0.58393145", "0.582793", "0.5825796", "0.5824281", "0.5819485", "0.5817598", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568", "0.5817568" ]
0.6492852
4
DELETE /items/1 DELETE /items/1.xml
def destroy @item = Item.find(params[:id]) @item.destroy respond_to do |format| format.html { redirect_to(items_url) } format.xml { head :ok } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @item = Item.find(params[:id])\r\n\r\n @item.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(items_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_items_url, :notice => 'Item was deleted.') }\n format.xml { head :ok }\n end\n end", "def delete_item(item)\n @get_items.delete(item)\n end", "def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(manage_items_url, :notice => 'Item was successfully deleted.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @actionitem = Actionitem.find(params[:id])\n @actionitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(actionitems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = @course.items.find(:first, :conditions => ['lower(name) = ?', params[:id].downcase.gsub('_', ' ')])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_items_url(@course)) }\n format.xml { head :ok }\n end\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(admin_items_url) }\n wants.xml { head :ok }\n end\n end", "def delete_item\n\nend", "def destroy\n @item = @project.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_items_path(@project, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @action_item = ActionItem.find(params[:id])\n @action_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(current_user) }\n format.xml { head :ok }\n end\n end", "def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end", "def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_item = ContentItem.find(params[:id])\n @content_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @instancia_item = InstanciaItem.find(params[:id])\n @instancia_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(instancia_items_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(item_ids = [])\n body = { itemIds: item_ids }\n Iterable.request(conf, base_path).delete(body)\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\r\n @item = Item.find(params[:id])\r\n @item.destroy\r\n redirect_to items_url\r\n end", "def destroy\n @ordered_item = OrderedItem.find(params[:id])\n @ordered_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(ordered_items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n head :no_content\n end", "def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def delete(id)\n @item = Item.find_by_id(id)\n \n begin\n item.destroy!\n say 'Item Deleted'\n rescue StandardError => e\n say e.message\n end\n end", "def deleted(item)\n end", "def destroy\n @goods_item = Goods::Item.find(params[:id])\n @goods_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_items_url) }\n format.xml { head :ok }\n end\n end", "def deleteItems\n self.items.each do |item|\n item.delete\n end\n end", "def delete\n @@all_items.delete(@id)\n end", "def destroy\n\t\[email protected]\n\t\thead :no_content\n\tend", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end", "def destroy\n @mail_item = MailItem.find(params[:id])\n @mail_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(mail_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @question_item = QuestionItem.find(params[:id])\n @question_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_items_url) }\n format.xml { head :ok }\n end\n end", "def delete\n \t@item = Item.find(params[:id])\n \[email protected]\n \tredirect_to :action => 'index'\n\tend", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy(item)\n raise StandardError unless @mode == :update\n @attached.delete(item)\n @remove_file.puts(XML.generate({ :id => item.is_a?(String) ? item : item.id }, false))\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end", "def destroy\n @item = ItemTemplate.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request_items = @request.request_items\n @request_items.each do |ri|\n ri.destroy\n end\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end", "def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: '削除に成功しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @auction_item = AuctionItem.find(params[:id])\n @auction_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(auction_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @items_mob = ItemsMob.find(params[:id])\n @items_mob.destroy\n\n respond_to do |format|\n format.html { redirect_to items_mobs_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @item_alias = ItemAlias.find(params[:id])\n @item_alias.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_aliases_url) }\n format.xml { head :ok }\n end\n end", "def delete_item(item)\r\n @list.delete(item)\r\n end", "def destroy\n @receiving_item = ReceivingItem.find(params[:id])\n @receiving_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(receiving_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy!\n end", "def destroy\n @inventory_item = InventoryItem.find(params[:id])\n @inventory_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventory_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n @miscellaneous_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_items_url) }\n format.xml { head :ok }\n end\n end", "def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_with @item\n end", "def destroy\n @news_items = NewsItem.find(params[:id])\n @news_items.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_items_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.70777845", "0.70777845", "0.70777845", "0.70777845", "0.70777845", "0.70777845", "0.7069073", "0.7031392", "0.6894484", "0.6870741", "0.683775", "0.68257034", "0.6819741", "0.6802184", "0.67975116", "0.6779638", "0.6778703", "0.6772744", "0.67490864", "0.6748912", "0.67385924", "0.6709272", "0.6708908", "0.6686428", "0.66788584", "0.66660637", "0.6587583", "0.6585115", "0.6569109", "0.6563634", "0.6556639", "0.65491194", "0.65321046", "0.65177727", "0.65060335", "0.6505881", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65057", "0.65050447", "0.6502434", "0.6501662", "0.64888376", "0.6487612", "0.6482682", "0.6474402", "0.6469712", "0.6445492", "0.64441115", "0.6443347", "0.64339226", "0.6428482", "0.64220333", "0.641575", "0.64129984", "0.6407609", "0.6399077", "0.6394702", "0.6391295", "0.63912743", "0.63762283", "0.637527", "0.6359976", "0.6359976", "0.6359976", "0.6359976", "0.6359976", "0.6359976", "0.6359976", "0.6359976", "0.6359976", "0.6359976", "0.63564324", "0.6350352", "0.6350158", "0.6346782", "0.63304806", "0.6329805", "0.6328838", "0.6325342", "0.6322343", "0.63201576", "0.6318394", "0.63078", "0.63021415", "0.62983096", "0.62944394", "0.629212", "0.6287357" ]
0.0
-1
Passing the required "name" parameter creates a folder with this name. Optionally, passing an "overwrite" parameter as true/false, will overwrite an existing folder if true.
def create(name) url = prefix + "create" + "&name=#{name}" return response(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_folder(name)\n Dir.mkdir(\"#{name}\")\nend", "def create_folder(name)\n folder = ROSRS::Folder.create(self, name)\n load unless loaded?\n @folders[folder.uri] = folder\n folder\n end", "def create_folder(name, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_post_call('/files/create-folder?name=%s&parent_id=%i' % [name, folder])\n end", "def mkdir(name=newname)\n dir = path(name)\n Dir.mkdir(dir)\n return dir\n end", "def create_folder(folder_name)\n IITPlaylist.new(@ole.CreateFolder(folder_name))\n end", "def createIfMissing(folder_name)\n\tunless Dir.exists?(folder_name)\n\t\tputs \"Creating directory \" + folder_name\n\t\tDir.mkdir folder_name\n\tend\nend", "def mkdir(name)\n return self if name == '.'\n name = name[1..-1] if name[0] == '/'\n newdir, *remainder = name.split('/')\n subdir = get(newdir)\n unless subdir.dir?\n result = @od.request(\"#{api_path}/children\",\n name: newdir,\n folder: {},\n '@microsoft.graph.conflictBehavior': 'rename'\n )\n subdir = OneDriveDir.new(@od, result)\n end\n remainder.any? ? subdir.mkdir(remainder.join('/')) : subdir\n end", "def create_folder (folder_path, params = \"-p\")\n \"mkdir #{params} '#{folder_path}'\"\n end", "def create_folder(name, description=nil)\n body = {}\n body['name'] = name\n post(\"/projects\", body: body, code: 201 )\n end", "def mkdir path\n parent = lookup_single! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend", "def create_directory\n remove_dir(@name) if Dir.exist?(@name)\n Dir.mkdir(@name)\n end", "def create_folder(path, opts = {})\r\n create_folder_with_http_info(path, opts)\r\n nil\r\n end", "def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end", "def add_folder(teamsiteId:, name:, parentFolderId: \"root\", **args)\n request.post(\n \"#{teamsites_url}/#{teamsiteId}/folders\",\n body: { name: name, parentFolderId: parentFolderId, **args }\n )\n end", "def folder(name)\n Kamelopard::Folder.new(name)\n end", "def creatFolder(path)\n Dir.mkdir(path) unless File.exists?(path)\n end", "def create_if_missing \n if File.exists?(@folder)\n return\n else\n Dir.mkdir(@folder) unless \n $LOG.info(\"#{@name} : #{@folder} created\")\n end\n end", "def create_gallery_folder(foldername)\n params = {}\n params['folder'] = foldername unless foldername.nil?\n perform(DeviantArt::Gallery::Folders::Create, :post, '/api/v1/oauth2/gallery/folders/create', params)\n end", "def add_directory(name)\n full_path = File.join(path, name)\n\n Dir.mkdir(full_path) unless File.directory?(full_path)\n\n self.class.new(full_path)\n end", "def create_folder(folder_path, name, root=\"auto\")\n to_path = File.join(folder_path, name)\n payload = {\n path: to_path,\n root: root\n }\n\n connexion = Dropbox.start(:create_folder, access_token)\n response = connexion.post do |req|\n req.url \"fileops/create_folder\"\n req.body = payload\n end\n\n response = format_response(response)\n tree_cache(response)\n end", "def name_folder(name)\n Kamelopard::DocumentHolder.instance.current_document.folder.name = name\n return Kamelopard::DocumentHolder.instance.current_document.folder\n end", "def folder(name)\n Check_MK::Folder.new(self, name)\n end", "def add_folder(folder_name)\n dir = File.dirname(folder_name).gsub(\"#{@dest}\",\".\").gsub(\"./\",\"\")\n fn = File.basename(folder_name) + \"/\"\n folder = @folders[dir] || @folders[dir]=[]\n folder << fn\n end", "def add_folder(folder_name)\n dir = File.dirname(folder_name).gsub(\"#{@dest}\",\".\").gsub(\"./\",\"\")\n fn = File.basename(folder_name) + \"/\"\n folder = @folders[dir] || @folders[dir]=[]\n folder << fn\n end", "def create(folder)\n # Ensure API availability\n api.call(\"system\", \"greet\")\n\n api.call(files_project, \"newFolder\", { parents: true, folder: folder })\n end", "def create_file_and_folder\n begin\n Dir::mkdir(@directory)\n rescue Errno::EEXIST\n end\n FileUtils.touch \"#{@directory}/#{@store}.yml\"\n end", "def create_folder()\n\n directory_name = \"./public/swap/imageuploader\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n\nend", "def add_folder name\n elem = ElemFolder.new(name)\n add_element(elem)\n end", "def create\n location.mkdir\n end", "def make_folder(path:, mode: \"644\", owner: nil, group: nil )\n @output.item @i18n.t('setup.mkdir', path: path)\n FileUtils::mkdir_p path unless File::exist? path\n FileUtils.chmod mode.to_i(8), path\n FileUtils.chown owner, group, path if owner and group\n end", "def team_folder_create(folder:, trace: false)\n dropbox_query(query: '2/team/team_folder/create', query_data: \"{\\\"name\\\":\\\"#{folder}\\\"}\", trace: trace)\n end", "def create_dir_in_audio(folder_name)\n `mkdir audio/#{folder_name}`\n end", "def mkdir(*args) Dir.mkdir(path, *args) end", "def folder_create(path, opts = {})\n input_json = {\n path: path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/folder_create\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def create_app_folder_structure\n puts \"Create #{name} folder structure\"\n end", "def mkdir\n !!meta_or('mkdir', true)\n end", "def test_create_folder\n request = CreateFolderRequest.new(path: remote_data_folder + '/TestCreateFolder')\n\n @words_api.create_folder(request)\n end", "def create_folder(folder_name, recipient, sender)\n\tputs \"Creating folder: \" + folder_name\n\tfolder = {:name => folder_name, :to => recipient, :from => sender}\n\tdata = JSON.generate(folder)\n\tresponse = request_post('/api/partner/folder', data)\n\tputs response.body\nend", "def bootstrap_folder\n FileUtils.mkdir_p folder_path\n end", "def file_create_folder(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/create_folder\", params)\n\n parse_response(response)\n end", "def create_folder(path)\n notify \"Path:#{path}\"\n full_path = @dst_full_path + path\n r = path_transform(full_path,false)\n url = sprintf(NAS_FOLDER_CREATE_URL,CGI.escape(r[:path]),CGI.escape(r[:share]))\n notify \"create folder with #{url}\"\n result = RestClient.get(url, {:cookies => @nas_cookies})\n notify \"create result#{result.inspect}\"\n return result == \"{\\\"errmsg0\\\": \\\"OK\\\"}\"\n end", "def mkdir(option={})\n @generator.mkdir(option)\n end", "def createFolder(folderName,parentFolder)\n\tthesame = lambda { |key| hostName }\t\n client = Savon.client(wsdl: @@wsdl, ssl_verify_mode: :none, ssl_version: :TLSv1, convert_request_keys_to: :none)\n parentId = getFolder(parentFolder)\n if parentId.nil?\n print \"Parent Folder \" + parentFolder + \" doesn't exist\"\n return nil\n else\n response = client.call(:folder_create, message: {\n token: @@token,\n folderName: folderName,\n parentFolderId: parentId,\n folderTypeId: 1\n })\n doc = Nokogiri::XML.parse(response.to_xml)\n puts doc\n end\n end", "def create_folder(directory)\n\tputs 'Creating directory \\'' + directory + '\\'...'\n\tFileUtils.mkdir_p directory\n\tputs 'done'\nend", "def mkdir(path)\n Dir.mkdir path unless exists? path\n end", "def mkdir(path)\n @client.file_create_folder(path)\n rescue\n puts $! if @@verbose\n nil\n end", "def find_or_create_folder(folder_root, name)\n folder_root.childEntity.each do |child|\n if child.instance_of?(RbVmomi::VIM::Folder) &&\n child.name == name\n return child\n end\n end\n\n folder_root.CreateFolder(:name => name)\n end", "def mkdir_p(*arg)\n FileUtils.mkdir_p(*arg)\n end", "def create\n FileUtils.mkdir_p(directory) unless exist?\n end", "def mkdir(dir_name)\n dir_name = ::File.expand_path(dir_name)\n\n ::FileUtils.mkdir_p(dir_name) unless ::File.directory?(dir_name)\n end", "def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend", "def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend", "def mkdir(path)\n FileUtils.mkdir_p(path)\n end", "def create_folder_in_source(folder_name, i_source)\n IITPlaylist.new(@ole.CreateFolderInSource(folder_name, i_source))\n end", "def mkdir(path, metadata=false)\n # FIXME: does metadata mkdir even make sense?\n metadata ? @metadata_tree.mkdir(path) : @content_tree.mkdir(path)\n end", "def mkdir(*args)\n args[0] = 0700 unless args[0]\n orig_mkdir(*args)\n end", "def ensure_subfolder(folder_name)\n subfolder = subfolders.find { |each| each.name == folder_name }\n subfolder || VSphere::Folder.new(@folder.CreateFolder(name: folder_name))\n end", "def create_folder\n unless File.directory?(client.config.tmp_folder)\n FileUtils.mkdir_p(client.config.tmp_folder)\n end\n end", "def create_favorite_folder\n favorite_folders.create(name: 'Favorites', is_permanent: true)\n end", "def mkdir(path)\n @dirs_to_create.push(path) unless @dirs_to_create.include?(path)\n end", "def ensure_subfolder(folder_name)\n subfolder = subfolders.find { |each| each.name == folder_name }\n subfolder || VSphere::Folder.new(@folder.CreateFolder(name: folder_name), parent: self, name: folder_name)\n end", "def create_directory(dir_name)\n Dir.mkdir(dir_name) unless File.exists?(dir_name)\nend", "def create(project_name)\n project = read_config_file()\n FileUtils.mkdir(project_name)\n \n if project['project']['files']\n project['project']['files'].each do |file|\n FileUtils.touch(\"#{project_name}/#{file}.#{@language}\")\n end\n end\n \n project['project']['folders'].each do |folder|\n FileUtils.mkdir_p(\"#{project_name}/#{folder['name']}\")\n \n if folder['files']\n folder['files'].each do |file|\n FileUtils.touch(\"#{project_name}/#{folder['name']}/#{file}\")\n end\n end\n \n end\n \n end", "def create\n create_directories\n end", "def folder_create(command)\n pp @client.files.folder_create(clean_up(command[1]))\n end", "def mkdir(option={})\n mode = option[:mode] || 0700\n path = create(option)\n path.mkdir(mode)\n return path\n end", "def default_folder\n self.folders.create(:name => \"LNKS!\")\n end", "def google_create_folder(client)\n path = CGI::unescape(@fields[:path].to_s)\n result = client.create_folder_by_path(path)\n end", "def mkdir_p path\n bkt,key = split_path(path)\n @s3.interface.create_bucket(bkt) unless exists? path\n end", "def create\n FileUtils.mkdir_p path\n end", "def add_folder(title)\n perform_post_with_object('/api/1.1/folders/add', {title: title}, Instapaper::Folder)\n end", "def mkdir( *args ) Dir.mkdir( expand_tilde, *args ) end", "def upload_folder(folder_name, location: 'root')\n begin\n update_refresh_token if refresh_due?\n upload = @drive_manager.post(\n { 'name' => folder_name,\n 'mimeType' => 'application/vnd.google-apps.folder' }.to_json\n )\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{folder_name}\"\n retry\n end\n\n folder_id = JSON.parse(upload)['id']\n\n if location != 'root'\n begin\n update_refresh_token if refresh_due?\n @drive_manager[folder_id + '?addParents=' + location +\n '&removeParents=root&alt=json'].patch(\n { 'uploadType' => 'resumable' }.to_json\n )\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{folder_name}\"\n retry\n end\n end\n\n folder_id\n end", "def create_directories(*args)\n args.each do |argument|\n FileUtils.mkdir_p(argument) unless File.directory?(argument)\n end\n end", "def create_application(name)\n store_dir = File.join(@path, name)\n FileUtils.mkdir_p store_dir\n \n ApplicationConfiguration.new name, store_dir\n end", "def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\n \n #Create book zip folder\n @book_prod_final_zip_folder=@book_zip_generated_folder+\"book/\"\n if (File.exists?(@book_prod_final_zip_folder) && File.directory?(@book_prod_final_zip_folder))\n puts \"Book Prod Zip folder exists\"\n else\n Dir.mkdir(@book_prod_final_zip_folder)\n end\nend", "def create_team_folder\n\n folder = Folder.new\n folder.name = self.name\n folder.parent_id = 0\n folder.owner_id = self.id\n folder.xtype = Folder::XTYPE_TEAM\n folder.read_teams = '|'+self.id.to_s+'|'\n folder.write_teams = '|'+self.id.to_s+'|'\n folder.save!\n\n return folder\n end", "def make_dirs(*args)\n FileUtils.mkdir_p(args)\nend", "def create_directory(path)\n FileUtils.mkdir_p(path)\n path\n end", "def create_directory(branch, destination, name, author)\n destination ||= ''\n repo = satelliterepo\n repo.checkout(branch) unless repo.empty?\n file = File.join(name, '.gitignore')\n file = File.join(destination, file) unless destination.empty?\n absolute = File.join(satellitedir, file)\n FileUtils.mkdir_p File.dirname(absolute)\n FileUtils.touch(absolute)\n repo.index.add file\n message = \"Add directory #{name}\"\n commit_id = satellite_commit(repo, message, author, branch)\n fake_thumbnail commit_id\n repo.checkout('master')\n File.dirname(file)\n end", "def create_directory(branch, destination, name, author)\n destination ||= ''\n repo = satelliterepo\n repo.checkout(branch) unless repo.empty?\n file = File.join(name, '.gitignore')\n file = File.join(destination, file) unless destination.empty?\n absolute = File.join(satellitedir, file)\n FileUtils.mkdir_p File.dirname(absolute)\n FileUtils.touch(absolute)\n repo.index.add file\n message = \"Add directory #{name}\"\n commit_id = satellite_commit(repo, message, author, branch)\n fake_thumbnail commit_id\n repo.checkout('master')\n File.dirname(file)\n end", "def create_directory!\n return if Dir.exist?(output_directory)\n\n FileUtils.mkdir_p(output_directory)\n end", "def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\nend", "def mkdir!(path, attrs={}, &callback)\n wait_for(mkdir(path, attrs, &callback))\n end", "def new_folder\n\n puts \"create new folder\"\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"New Folder\")\n\n # get \"My Files\" and \"Shared Files\" folder objects\n @currentFolder = params[:parent_id]\n\n # create new subfolder\n begin\n newFolder = client.create_folder(params[:folderName], @currentFolder)\n rescue\n puts \"could not create new folder\"\n flash[:error] = \"Error: could not create folder\"\n end\n\n redirect_to dashboard_id_path(@currentFolder)\n end", "def create_directory(file)\n end", "def create_dir(dir_name) \n Dir.exist?(dir_name) ? nil : Dir.mkdir(dir_name)\n return true\n end", "def create_user_ingest_folder(user_name, parent = '0BxnZXCons72AYXZOTVVrdGk0bTg')\n metadata = @drive.files.insert.request_schema.new({\n 'title' => user_name,\n 'mimeType' => \"application/vnd.google-apps.folder\",\n 'parents' => [{'id' => parent}]\n })\n result = @client.execute( :api_method => @drive.files.insert, :body_object => metadata )\n result.data[\"id\"]\n end", "def move_folder\n if ENV['RACK_ENV'] == 'production'\n if File.directory?(get_folder(name_change.last))\n error!('A folder with this name already exists.', 400)\n else\n FileUtils.mv get_folder(name_change.first), get_folder(name_change.last)\n end\n end\n end", "def make_directory\n FileUtils.mkdir_p output_directory unless File.exist? output_directory\n end", "def mk_dir(path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n end", "def create_directory(name_slide, counter)\n puts 'Creating Nested Slide(s) Directory...'\n # NEW: Create a nested file with the name given\n Dir.mkdir \"./slides_archive/#{name_slide}/\" unless File.exist? \"./slides_archive/#{name_slide}/\"\n puts \"DONE ✓ (Created No. #{counter} nested directory)\"\n end", "def mkdir(path)\n Utils.traverse(path) do |dir, name|\n params = make_params :is_dir => true,\n :dir_id => dir.try(:id),\n :name => name\n\n scope.find_or_create_by(params)\n end\n end", "def mkdir(dir)\n Dir.mkdir dir unless File.exists?(dir)\nend", "def mkdirs\n if (not exists?)\n parent.mkdirs\n factory.system.mkdir @path\n end\n end", "def write(name, value)\n FileUtils.mkdir_p(File.dirname(path(name)))\n File.open(path(name), 'w') do |f|\n f.write(value)\n end\n end", "def generate_install_folder\n folder='./EdenApps'\n unless File.exist?(folder)\n Console.show \"Creating folder #{folder}\", 'info'\n FileUtils.mkdir_p(folder)\n FileUtils.chown_R('EdenManager','EdenManager',folder)\n FileUtils.chmod_R(0775, folder)\n end\n installFolder = \"./EdenApps/#{self.type}/#{self.name}\"\n unless File.exist?(installFolder)\n Console.show \"Creating folder #{installFolder}\", 'info'\n FileUtils.mkdir_p(installFolder)\n FileUtils.chown_R('EdenManager','EdenManager',installFolder)\n end\n installFolder\n end", "def create_if_missing(path)\n FileUtils.mkdir(path) unless File.exists?(path)\n end", "def create_if_missing(path)\n FileUtils.mkdir(path) unless File.exists?(path)\n end", "def create_if_missing(path)\n FileUtils.mkdir(path) unless File.exists?(path)\n end", "def mkdir_p(path)\n FileUtils.mkdir_p(path)\n end" ]
[ "0.7132006", "0.7082928", "0.6863603", "0.6840631", "0.67737246", "0.67631376", "0.6699661", "0.6692752", "0.6558048", "0.64649916", "0.63744944", "0.6359679", "0.6349082", "0.63409466", "0.6327305", "0.63105977", "0.6305249", "0.6240773", "0.6234909", "0.6221404", "0.62029326", "0.61888075", "0.61821127", "0.61821127", "0.61406434", "0.6088309", "0.6086074", "0.6069865", "0.605273", "0.6038738", "0.6036737", "0.5996186", "0.59930277", "0.5950906", "0.5946322", "0.59398663", "0.5926482", "0.5903935", "0.5898104", "0.58811325", "0.5870717", "0.5842011", "0.5828199", "0.58281034", "0.5825312", "0.5813744", "0.580356", "0.57834345", "0.57823014", "0.5780733", "0.5771753", "0.5771753", "0.5737307", "0.5727094", "0.57123184", "0.56923336", "0.56810135", "0.5660803", "0.56551135", "0.56419665", "0.5631266", "0.5598738", "0.5585822", "0.55817044", "0.55732393", "0.5556292", "0.5555079", "0.5527381", "0.5523353", "0.55190295", "0.5483596", "0.54832786", "0.54822713", "0.5477063", "0.5472667", "0.5470529", "0.54670113", "0.5462205", "0.5457972", "0.54499364", "0.54499364", "0.5436221", "0.5433043", "0.54139876", "0.5408781", "0.5408278", "0.5402925", "0.5390951", "0.53840095", "0.5379062", "0.5378712", "0.5375386", "0.53677344", "0.5366721", "0.53664756", "0.5360276", "0.5353992", "0.5353459", "0.5353459", "0.5353459", "0.5343828" ]
0.0
-1
Deletes a folder given the passed in "id" parameter and all children of this folder.
def delete url = prefix + "delete" return response(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_folder(folder_id)\n perform_post_with_unparsed_response('/api/1.1/folders/delete', folder_id: folder_id)\n true\n end", "def delete_folder folder_id\n delete(\"/projects/#{folder_id}\", code: 204)\n end", "def delete_user_folder(id)\n @client.raw('delete', \"/helpers/folders/#{id}\")\n end", "def delete(conn_id, path, *args)\n options = args.extract_options!\n options.assert_valid_keys(VALID_DELETE_OPTIONS)\n \n timeout = resolve_timeout_option(options[:timeout], 10.seconds)\n path = resolve_folderpath_option(conn_id, path)\n \n with_connection(conn_id, timeout) { |conn|\n conn.folder_delete(path, options[:recursive])\n }\n end", "def delete_folder(request)\n data, _status_code, _headers = delete_folder_with_http_info(request)\n data\n end", "def delete(id)\n path(id).delete\n clean(id) if clean?\n end", "def clean(id)\n path(id).dirname.ascend do |pathname|\n if pathname.children.empty? && pathname != directory\n pathname.rmdir\n else\n break\n end\n end\n end", "def delete(id)\n path = path(id)\n path.delete\n clean(path) if clean?\n rescue Errno::ENOENT\n end", "def delete(id)\n FileUtils.rm_r File.join(DOTDIR, id)\n end", "def destroy\n @folder.destroy\n end", "def destroy\n @folder = Folder.find(params[:id])\n @folder.destroy\n\n respond_to do |format|\n format.html { redirect_to folders_url }\n format.json { head :ok }\n end\n end", "def destroy\n @task_folder = TaskFolder.find(params[:id])\n parent_id = @task_folder.parent_id\n project = @task_folder.project\n @task_folder.destroy\n\n\tif parent_id == nil\n\t\trespond_to do |format|\n\t\t format.html { redirect_to folders_project_url(project) }\n\t\t format.json { head :ok }\n\t\tend\n\telse\n\t\trespond_to do |format|\n\t\t format.html { redirect_to task_folder_url(parent_id) }\n\t\t format.json { head :ok }\n\t\tend\n\tend\n end", "def delete\n if (exists?)\n list.each do |children|\n children.delete\n end\n factory.system.delete_dir(@path)\n end\n end", "def destroy\n @folder = Folder.find(params[:id])\n @folder.destroy\n\n respond_to do |format|\n format.html { redirect_to(folders_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @folder = Folder.find(params[:id])\n @folder.destroy\n\n respond_to do |format|\n format.html { redirect_to(folders_url) }\n format.xml { head :ok }\n end\n end", "def delete_folder(folder_id)\n $db.execute(\"DELETE FROM folders WHERE folder_id = ?\", folder_id)\nend", "def delete(id)\n call(:delete, path(id))\n end", "def delete_id(id)\n ids_in_doc = root.fetch(full_path, :single => true)\n raise TypeError, \"Expecting array\" unless ids_in_doc.kind_of? Array\n ids_in_doc.delete id\n root.save!\n ids.delete id\n save!\n end", "def delete(id:)\n path = file_path(id)\n storage_object_id, file_category = id_from_path(path)\n\n delete_from_moab(storage_object_id, path, file_category)\n end", "def folder(id)\n Box::Folder.new(@api, nil, :id => id)\n end", "def destroy\n @pm_folder = PmFolder.find(params[:id])\n @pm_folder.destroy\n\n respond_to do |format|\n format.html { redirect_to(pm_folder_url(@pm_folder.parent)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @folder.destroy\n respond_to do |format|\n format.html { redirect_to folder_url(@folder.parent) }\n format.json { head :no_content }\n end\n end", "def delete(id)\n file = get_file(id)\n delete_file(file) unless file.nil?\n end", "def get_folder_by_id(folder, grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'Folder deletion was successful.'\n grafana_options[:unknown_code_msg] = 'FolderApi::get_folder_by_id unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/folders/id/' + get_folder_id(folder)\n\n folder_obj = do_request(grafana_options)\n\n return if folder_obj[:message] == 'Folder not found'\n folder_obj\n end", "def destroy\n authorize! :destory, params[:id]\n respond_to do |format|\n if @folder.destroy\n format.html { redirect_to lae_folders_path, notice: 'Folder was successfully deleted.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @folder.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete(id)\n self.find(id).delete_\n end", "def remove_folder\n space = Space.accessible_by(@context).find(params[:id])\n ids = Node.sin_comparison_inputs(unsafe_params[:ids])\n\n if space.contributor_permission(@context)\n nodes = Node.accessible_by(@context).where(id: ids)\n\n UserFile.transaction do\n nodes.update(state: UserFile::STATE_REMOVING)\n\n nodes.where(sti_type: \"Folder\").find_each do |folder|\n folder.all_children.each { |node| node.update!(state: UserFile::STATE_REMOVING) }\n end\n\n Array(nodes.pluck(:id)).in_groups_of(1000, false) do |ids|\n job_args = ids.map do |node_id|\n [node_id, session_auth_params]\n end\n\n Sidekiq::Client.push_bulk(\"class\" => RemoveNodeWorker, \"args\" => job_args)\n end\n end\n\n flash[:success] = \"Object(s) are being removed. This could take a while.\"\n else\n flash[:warning] = \"You have no permission to remove object(s).\"\n end\n\n redirect_to files_space_path(space)\n end", "def delete_folder_children_request(folder_id)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/children\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Delete.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n response = http.request(request)\n\n if response.code == 304.to_s\n puts \"Folder is empty. Status: #{response.code}\"\n elsif response.code == 504.to_s\n puts \"Gateway Time-out. Status: #{response.code}\"\n puts response.body\n end\n\n response.code\nend", "def delete!\n if new_record?\n raise Errors::FolderNotFound.new(@id, \"Folder does only exist locally\")\n else\n self.class.delete(@conn_id, @location.path)\n @id = nil\n end\n end", "def remove_video_from_folder folder_id, video_id\n delete(\"/projects/#{folder_id}/videos/#{video_id}\", code: 204)\n end", "def authorize_deleting\r\n folder = Folder.find_by_id(folder_id)\r\n unless @logged_in_user.can_delete(folder.id)\r\n flash.now[:folder_error] = \"You don't have delete permissions for this folder.\"\r\n redirect_to :controller => 'folder', :action => 'list', :id => folder_id and return false\r\n else\r\n authorize_deleting_for_children(folder)\r\n end\r\n end", "def delete_folder request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_folder_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def delete_children(id, flowcell)\n @session.flowcell_lane.dataset.filter(:flowcell_id => id).delete\n end", "def delete_children(id, flowcell)\n Lane::dataset(@session).filter(:flowcell_id => id).delete\n end", "def destroy\n @folder.destroy\n respond_to do |format|\n format.html { redirect_to folders_url, notice: 'Folder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @folder.destroy\n respond_to do |format|\n format.html { redirect_to folders_url, notice: 'Folder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @folder.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def test_delete_folder\n test_delete_folder = remote_data_folder + '/TestDeleteFolder'\n\n upload_file File.join(local_test_folder, local_file), test_delete_folder + '/TestDeleteFolder.docx'\n\n request = DeleteFolderRequest.new(path: test_delete_folder)\n\n @words_api.delete_folder(request)\n end", "def destroy\n @folder.destroy\n\n respond_to do |format|\n format.html { redirect_to library_url, :notice => 'Folder was successfully removed.' }\n format.json { head :ok }\n end\n end", "def move(id, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n # This provides support for an Array of ids.\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/move?file_ids=%s&parent_id=%i' % [id, folder]).status == \"OK\"\n end", "def recursively_delete_dir(dir)\n FileUtils.rm_rf(dir) # or use FileUtils.rm_r(dir, :force => true)\n # system(\"rm -rf #{dir}\")\n end", "def delete(id)\n @lock.synchronize do\n @items.delete id\n end\n end", "def destroy\n temp = @folder_client.destroy(get_id, force)\n if temp[:status]\n flash_message(:notice,\"#{t('folder.folder')} #{t('succesfully_destroyed')}\")\n redirect_to folders_path\n else\n if temp[:code] == 403\n @id = get_id\n @message = temp[:response]['message']\n else\n flash_message(:error, temp[:response]['message'])\n redirect_to root_path\n end\n\n end\n @success = temp[:status]\n end", "def destroy\n # @folder.destroy\n respond_to do |format|\n format.html { redirect_to folders_url }\n format.json { head :no_content }\n end\n end", "def delete_group(id)\n delete(\"groups/#{id}\")\n end", "def remove_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\tremove_file(id)\n\tend", "def delete(id)\n @chunks.delete(id).delete if @chunks.has_key? id\n end", "def delete(class_name, id)\n @data = get_all()\n for item in @data[class_name]\n if item[\"id\"] == id\n @data[class_name].delete(item)\n end\n end\n save()\n end", "def files_id_delete(id, opts = {})\n files_id_delete_with_http_info(id, opts)\n end", "def delete_id(id)\n existed = exist?(id)\n @items[id] = nil\n existed\n end", "def destroy\n @media_folder = MediaFolder.find(params[:id])\n @media_folder.destroy\n\n respond_to do |format|\n format.html { redirect_to(media_folders_url) }\n format.xml { head :ok }\n end\n end", "def delete_children(id, gel)\n element_dataset.filter(container_id_sym => id).delete\n end", "def destroy\n\t\tparent = @fallacyfolder.parent\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { }\n\t\t\tformat.json { render :json => {:parent => parent.id}.to_json }\n\t\tend\n\tend", "def authorize_deleting_for_children(folder)\r\n folder.children.each do |child_folder|\r\n unless @logged_in_user.can_delete(child_folder.id)\r\n error_msg = \"Sorry, you don't have delete permissions for one of the subfolders.\"\r\n if child_folder.parent.id == folder_id\r\n flash.now[:folder_error] = error_msg\r\n else\r\n flash[:folder_error] = error_msg\r\n end\r\n redirect_to :controller => 'folder', :action => 'list', :id => folder_id and return false\r\n else\r\n authorize_deleting_for_children(child_folder) # Checks the permissions of a child's children\r\n end\r\n end\r\n end", "def delete_folder_request(folder_id)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Delete.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n response = http.request(request)\n\n if response.code == 200.to_s\n $deleted_count = $deleted_count + 1\n elsif response.code == 304.to_s\n puts \"Folder is empty. Status: #{response.code}\"\n elsif response.code == 504.to_s\n puts \"Gateway Time-out. Status: #{response.code}\"\n puts response.body\n end\n\n response.code\nend", "def delete_by_id(id)\n delete_product_by_id(id)\n end", "def rm_dir(dir)\n @dirs.delete(dir.path)\n end", "def delete(project_id, id)\n @_client.delete(\"#{resource_root(project_id)}/#{id}\")\n end", "def delete(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/delete?file_ids=%s' % [id]).status == \"OK\"\n end", "def destroy\n @folder.destroy\n respond_to do |format|\n format.html { redirect_to '/folders/1' }\n format.json { head :no_content }\n end\n\n\n end", "def deleteDirectory(dirPath, dryRun)\n #N Without this, the required ssh command to recursive remove a directory won't be (optionally) executed. Without the '-r', the attempt to delete the directory won't be successful.\n ssh(\"rm -r #{dirPath}\", dryRun)\n end", "def destroy\n @file_folder.destroy\n respond_to do |format|\n format.html { redirect_to file_folders_url }\n format.json { head :no_content }\n end\n end", "def rm_dir(dir)\n @dirs.delete(dir.path)\n end", "def files_id_delete(api_key, id, opts = {})\n files_id_delete_with_http_info(api_key, id, opts)\n return nil\n end", "def destroy\n @jpeg_folder = JpegFolder.find(params[:id])\n @jpeg_folder.destroy\n\n respond_to do |format|\n format.html { redirect_to(jpeg_folders_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n path = normalize_path(path)\n if path.empty?\n raise 'Empty path'\n elsif path.size == 1\n child = @children.delete(path.first)\n @modified = true if child\n child\n else\n tree = @children[path.first]\n raise 'Not a tree' if tree.type != :tree\n tree.delete(path[1..-1])\n end\n end", "def delete(id)\n emsg = \"The %s argument cannot be nil, empty, or a zero length string\"\n raise(ArgumentError, emsg % ['id']) if !id.kind_of?(Integer)\n\n # remove the account\n @accounts.delete_if{|a| a.id == id}\n end", "def destroy\n @catogory = Catogory.find(params[:id])\n @catogory.destroy\n flash[:info] = \"成功删除目录\"\n redirect_to catogories_url\n end", "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @folder.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => 'documents', :action => 'index',\n :project_id => @folder.project) }\n format.xml { head :ok }\n end\n end", "def delete!(id:)\n client.delete_list(id: id)\n end", "def test_delete_folder\n\n path = 'folder4'\n storage = 'First Storage'\n recursive = true\n request = DeleteFolderRequest.new(path, storage, recursive)\n\n result = @storage_api.delete_folder(request)\n assert result.code == 200, 'Error while deleting folder'\n\n end", "def delete_features_from_hiptest\n puts \"\\nStart deleting...\"\n children_folders_of_root = get_children_folders $root_folder_id\n\n # Delete features from root subfolders\n children_folders_of_root.each do |folder|\n status = delete_folder_children_request folder['id']\n\n if status == 200.to_s\n puts \"Features from '#{folder['attributes']['name']}' folder deleted.\"\n end\n end\n\n # Delete folders from root subfolder\n status = delete_folder_children_request $root_folder_id\n\n if status == 200.to_s\n puts \"Folders from root folder deleted.\"\n end\nend", "def delete(id)\n @conn.execute(*@builder.delete(id))\n end", "def remove_group(id)\n delete(\"/groups/#{id}\")\n end", "def destroy(id)\n Ribs.with_handle(self.database) do |h|\n h.delete(get(id))\n end\n end", "def delete(id)\n id = id.id if id.is_a?(Parse::Pointer)\n if id.present? && permissions.has_key?(id)\n will_change!\n permissions.delete(id)\n end\n end", "def delete_tree_recursion(tree, node_group_id)\n tree[node_group_id].each do |childid|\n delete_tree_recursion(tree, childid)\n end\n #protect against trying to delete the Rootuuid\n delete_node_group(node_group_id) if node_group_id != Rootuuid\n end", "def del(id, which=:groups)\n resp = self.class.delete(\"/#{which}/#{id}\")\n check_errors resp\n end", "def delete_folder\n @sub_shared_folders,@sub_shared_folders_collection,@sub_shared_docs,@sub_shared_docs_collection,sub_shared_docs = [],[],[],[],[]\n action_type = \"deleted\"\n find_portfolio_and_folder\n cur_folder_parent_id = @folder.parent_id\n files_and_docs_of_folder(@folder.id,true,false)\n find_sub_shared_docs\n send_mail_while_deleting_document(action_type)\n send_mail_while_deleting_folder(action_type)\n delete_files_and_docs_of_folder(@folder.id,true)\n Event.create_new_event(\"permanent_delete\",current_user.id,nil,[@folder],current_user.user_role(current_user.id),@folder.name,nil)\n @folder.real_estate_property.destroy if @folder.real_estate_property_id !=nil && @folder.parent_id ==0\n @folder.destroy\n assign_params(\"asset_data_and_documents\",\"show_asset_files\" )\n @msg = \"#{@folder.name} successfully deleted\"\n update_page_after_deletion\n @folder = Folder.find(@folder.parent_id) if @folder.parent_id !=0 && @folder.parent_id != -2\n end", "def destroy\n @directory = Directory.find(params[:id])\n @directory.destroy\n\n respond_to do |format|\n format.html { redirect_to directories_url }\n format.json { head :ok }\n end\n end", "def delete(id)\n @storage.delete(id)\n purge(id)\n end", "def delete(id)\n item = Item.find(id)\n item.class == Item ? item.delete : item\n end", "def delete_dir!(path)\n # do nothing, because there's no such things as 'empty directory'\n end", "def delete\n File.delete fullpath\n dirname = File.dirname(fullpath)\n while dirname != root\n Dir.rmdir(dirname)\n dirname = File.dirname(dirname)\n end\n rescue Errno::ENOTEMPTY\n end", "def delete(id)\n read_or_die(id)\n\n sql, vals = sql_delete(id_fld => id)\n execute sql_subst(sql, *vals.map{|v| quote v})\n\n self\n\n rescue => e\n handle_error(e)\n end", "def destroy\n respond_to do |format|\n format.js {\n begin\n @folder = Folder.find(params[:id])\n # Khi xóa 1 folder:\n # - xóa hết các file trong cây con đó (directedshare == true).\n UpFile.joins(:up_file_shortcuts).where(up_file_shortcuts: {shortcut: false, folder_id: @folder.subtree_ids}).destroy_all\n # - xóa hết các file shortcut tới cây con của folder (các direct shorcut tự động bị xóa khi xóa file trong câu trên) .\n UpFileShortcut.un_directed.where(folder_id: @folder.subtree_ids).destroy_all\n # - các folder của cây con tự động bị xóa -> các shortcut của folder cũng tự động bị xóa.\n # - xóa folder\n deleted_folders = @folder.subtree_ids\n @folder.destroy\n # => load lại cây thư mục\n set_children_folders\n set_children_shortcuts\n FoldersDestroyBroadcastJob.perform_later deleted_folders\n rescue ActiveRecord::RecordNotFound\n set_children_folders\n set_children_shortcuts\n @remote_error = {error: 'RecordNotFound'}\n rescue\n @remote_error = {error: 'generic'}\n end\n }\n end\n\n end", "def rmdir() Dir.rmdir(path) end", "def remove_content(id)\n delete(\"/#{id}\")\n end", "def destroy_folder\n folder_id = params[:id]\n @folder = Folder.find_by_id(folder_id)\n \n uploader = @folder.bucket.uploader\n\n if uploader == current_user\n @folder.destroy\n uploader.uploaded_data_size = uploader.uploaded_data_size - @folder.size\n uploader.save\n end\n # redirect_to :back\n respond_to do |format|\n format.js\n end\n\n end", "def delete_item(id, opts = {})\n data, _status_code, _headers = delete_item_with_http_info(id, opts)\n data\n end", "def delete(id)\n @item = Item.find_by_id(id)\n \n begin\n item.destroy!\n say 'Item Deleted'\n rescue StandardError => e\n say e.message\n end\n end", "def destroy(id)\n if id.is_a?(Array)\n id.map {|one_id| destroy(one_id)}\n else\n find(id).destroy\n end\n end", "def delete_by_id(id)\n item = self[id]\n if item\n @tasks.delete_at(index(id))\n end\n end", "def recursive_delete(path: nil)\n raise ArgumentError, \"path is a required argument\" if path.nil?\n\n result = zk.get_children(path: path)\n raise Kazoo::Error, \"Failed to list children of #{path} to delete them. Result code: #{result.fetch(:rc)}\" if result.fetch(:rc) != Zookeeper::Constants::ZOK\n\n threads = result.fetch(:children).map do |name|\n Thread.new do\n Thread.abort_on_exception = true\n recursive_delete(path: File.join(path, name))\n end\n end\n threads.each(&:join)\n\n result = zk.delete(path: path)\n raise Kazoo::Error, \"Failed to delete node #{path}. Result code: #{result.fetch(:rc)}\" if result.fetch(:rc) != Zookeeper::Constants::ZOK\n end", "def rmdir\n util.rmdir(path)\n end", "def destroy\n back_url = @ficheiro.folder_id\n @ficheiro.destroy\n respond_to do |format|\n format.html { redirect_to Folder.find(back_url) }\n format.json { head :no_content }\n end\n end", "def delete_field_rel(id)\n delete(\"fieldRels/#{id}\")\n end", "def delete(id)\n raise RuntimeError, \"File datastore does not support document deletion\"\n end", "def delete(id)\n collection.remove(id)\n end", "def delete_children(id, tube_rack)\n @session.tube_rack_slot.dataset.filter(:tube_rack_id => id).delete\n end" ]
[ "0.7575797", "0.73996645", "0.69512916", "0.6664926", "0.64769596", "0.64564824", "0.63483113", "0.63026357", "0.6298884", "0.6243065", "0.61222774", "0.61151075", "0.6058769", "0.6047256", "0.6047256", "0.60314673", "0.59556323", "0.5888522", "0.5857324", "0.5840239", "0.5818591", "0.5805032", "0.5777355", "0.5763721", "0.5759385", "0.57365274", "0.5691753", "0.5685545", "0.5622054", "0.5588573", "0.5558108", "0.55349743", "0.5534079", "0.55315024", "0.55179816", "0.55179816", "0.55072504", "0.54823095", "0.54670185", "0.54623204", "0.5456833", "0.54355675", "0.5425398", "0.54193956", "0.5336796", "0.5336304", "0.53235024", "0.5320936", "0.53180254", "0.5316425", "0.5306876", "0.53021365", "0.53010523", "0.5290671", "0.52657336", "0.5260464", "0.52526647", "0.52472526", "0.5244786", "0.5243868", "0.52302617", "0.5214452", "0.5212873", "0.5196698", "0.5191627", "0.5175029", "0.5170404", "0.5163678", "0.5150429", "0.51462245", "0.51407754", "0.5139477", "0.512352", "0.5113099", "0.5102156", "0.509851", "0.5093722", "0.50809735", "0.5071002", "0.5070704", "0.5061302", "0.5058689", "0.50574356", "0.5036291", "0.5021795", "0.50217557", "0.5019265", "0.50137794", "0.5005555", "0.5004472", "0.4986799", "0.49802977", "0.49801016", "0.49762762", "0.49756485", "0.49751168", "0.4969693", "0.49625042", "0.4958994", "0.49521145", "0.4950567" ]
0.0
-1
Passing the required "name" parameter will change a folders name to what is passed.
def rename(name) url = prefix + "rename&name=#{name}" return response(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_folder(name)\n Kamelopard::DocumentHolder.instance.current_document.folder.name = name\n return Kamelopard::DocumentHolder.instance.current_document.folder\n end", "def rename(new_name)\n\n self.update_attribute(:name, new_name)\n\n folder = self.get_team_folder\n\n unless folder.nil?\n folder.update_attribute(:name, new_name)\n end\n end", "def folder(name)\n Kamelopard::Folder.new(name)\n end", "def rename_folder\n result = folder_service.rename(@folder, params[:name])\n\n raise ApiError, result.value[:message] if result.failure?\n\n render json: result.value, adapter: :json\n end", "def folder(name)\n Check_MK::Folder.new(self, name)\n end", "def edit_folder_name\n\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Rename Item\")\n # folder = client.folder_from_id(params[:folder_id])\n session[:current_folder] = params[:folder_id]\n\n # make Box API call to update folder name\n begin\n client.update_folder(params[:folderId], name: params[:folderName])\n Rails.cache.delete(\"/folder/#{session[:box_id]}/my_folder/#{params[:folderId]}\")\n flash[:notice] = \"Folder name changed to \\\"#{params[:folderName]}\\\"\"\n rescue\n flash[:error] = \"Error: Could not change folder name\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end", "def directory_name=(name)\n clear!\n @directory_name = name\n end", "def add_folder name\n elem = ElemFolder.new(name)\n add_element(elem)\n end", "def set_folder_name\n media_regexp = Regexp.new(\"^#{media_path.filesystem_path}[/]?\")\n write_attribute(:folder_name, File.dirname(file_name).gsub(media_regexp, ''))\n end", "def mkdir(name)\n return self if name == '.'\n name = name[1..-1] if name[0] == '/'\n newdir, *remainder = name.split('/')\n subdir = get(newdir)\n unless subdir.dir?\n result = @od.request(\"#{api_path}/children\",\n name: newdir,\n folder: {},\n '@microsoft.graph.conflictBehavior': 'rename'\n )\n subdir = OneDriveDir.new(@od, result)\n end\n remainder.any? ? subdir.mkdir(remainder.join('/')) : subdir\n end", "def create_folder(name)\n folder = ROSRS::Folder.create(self, name)\n load unless loaded?\n @folders[folder.uri] = folder\n folder\n end", "def rename!(name)\n @name = name\n @path = make_path\n end", "def name\n\t\t\tself.nice_folder_name\n\t\tend", "def update\r\n if request.post?\r\n if @folder.update_attributes(:name => params[:folder][:name], :date_modified => Time.now)\r\n redirect_to :action => 'list', :id => folder_id\r\n else\r\n render_action 'rename'\r\n end\r\n end\r\n end", "def create_folder(name)\n Dir.mkdir(\"#{name}\")\nend", "def rename\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @mail_folder = MailFolder.find(params[:id])\n\n unless params[:thetisBoxEdit].blank?\n @mail_folder.name = params[:thetisBoxEdit]\n @mail_folder.save\n end\n render(:partial => 'ajax_folder_name', :layout => false)\n end", "def addNameToPath(name)\n @root = name if @currentPath.empty?\n @currentPath.addName(name)\n end", "def add_folder(folder_name)\n dir = File.dirname(folder_name).gsub(\"#{@dest}\",\".\").gsub(\"./\",\"\")\n fn = File.basename(folder_name) + \"/\"\n folder = @folders[dir] || @folders[dir]=[]\n folder << fn\n end", "def add_folder(folder_name)\n dir = File.dirname(folder_name).gsub(\"#{@dest}\",\".\").gsub(\"./\",\"\")\n fn = File.basename(folder_name) + \"/\"\n folder = @folders[dir] || @folders[dir]=[]\n folder << fn\n end", "def set_dir_name(dir_name)\n @builder['dir_label'].label = dir_name\n end", "def move_folder\n if ENV['RACK_ENV'] == 'production'\n if File.directory?(get_folder(name_change.last))\n error!('A folder with this name already exists.', 400)\n else\n FileUtils.mv get_folder(name_change.first), get_folder(name_change.last)\n end\n end\n end", "def folder_name\n @folder_name\n end", "def add_folder(teamsiteId:, name:, parentFolderId: \"root\", **args)\n request.post(\n \"#{teamsites_url}/#{teamsiteId}/folders\",\n body: { name: name, parentFolderId: parentFolderId, **args }\n )\n end", "def folder(name)\n Folder.bind(service, FolderId.new(name, Mailbox.new(self.config['mailbox'])))\n end", "def name_to_dir(name)\n name.gsub(/[^-A-Za-z0-9_|\\[\\]]/, \"_\")\n end", "def file_or_folder_name=(value)\n @file_or_folder_name = value\n end", "def folder_changed(choo_dir, choo_file)\n dir = choo_dir.filename\n choo_file.current_folder = dir\nend", "def dir_alias= name\n #This is a stub, used for indexing\n end", "def renamenx(old_name, new_name); end", "def renamenx(old_name, new_name); end", "def rename(name)\n url = prefix + \"rename&name=#{name}\" \n return response(url)\n end", "def default_folder\n self.folders.create(:name => \"LNKS!\")\n end", "def mkdir(name=newname)\n dir = path(name)\n Dir.mkdir(dir)\n return dir\n end", "def project_folder(name)\n File.join(projects_folder, name)\n end", "def set_name(a_name)\n @name = a_name\n end", "def create_folder(name, description=nil)\n body = {}\n body['name'] = name\n post(\"/projects\", body: body, code: 201 )\n end", "def create_folder(folder_name)\n IITPlaylist.new(@ole.CreateFolder(folder_name))\n end", "def change_name(name)\n self.change_all_attribute(name, 'name')\n end", "def rename(name)\n url = prefix + \"rename&name=#{name}\"\n return response(url)\n end", "def change_name=(name)\n @name = name\n end", "def change_folder(folder=nil, base=nil, dir=nil)\n \n # Set defaults if parameters not given\n base=PROFILE_BASE unless base\n\n FOLDER_DEFAULTS.each do |key|\n if key[:name] == folder\n puts \"Found key: #{key[:name]}\" if @debug\n # Ok key found\n dir=key[:dir] unless dir\n # Add it to stage\n @folders.push({ :name => folder, :value => base+'\\\\'+dir })\n end\n end\n @folders\n end", "def subdirs(*name)\n\t\treturn File.join(name, \"*/\")\n\tend", "def changeName\r\n\t\tcheckSpace\r\n\tend", "def set_name(name)\n @name = name\n end", "def create_gallery_folder(foldername)\n params = {}\n params['folder'] = foldername unless foldername.nil?\n perform(DeviantArt::Gallery::Folders::Create, :post, '/api/v1/oauth2/gallery/folders/create', params)\n end", "def create_folder(name, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_post_call('/files/create-folder?name=%s&parent_id=%i' % [name, folder])\n end", "def folder_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s + '/'\n\tend", "def new_name(new_name)\n @name = new_name\n end", "def directory_name=(d)\n @directory_name = d\n end", "def name=(name)\n\t\t@new_name = name\n\tend", "def groups_rename(params = {})\n fail ArgumentError, \"Required arguments 'channel' missing\" if params['channel'].nil?\n fail ArgumentError, \"Required arguments 'name' missing\" if params['name'].nil?\n response = @session.do_post \"#{SCOPE}.rename\", params\n Slack.parse_response(response)\n end", "def set_name(name_in)\n @name = name_in.clone();\n end", "def set_Folder(value)\n set_input(\"Folder\", value)\n end", "def rename(new_name)\n json_body = { :name => new_name }.to_json\n HTTParty.put(base_request_uri, :body => json_body)\n @name = new_name\n end", "def rename_this_name(name)\n name\n end", "def set_root() = self.destination_root = name", "def rename(new_name)\n raise 'to be implemented in subclass'\n end", "def rename(old_name, new_name); end", "def rename(old_name, new_name); end", "def change_name(repo_id, name)\n response = HTTParty.put(\n GIT_BASE_URL + 'projects/' + repo_id.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n },\n :body => {\n :name => name\n }\n )\n Rails.logger.info \"Git server response (change name): #{response}\"\n end", "def dir=(value)\n @data['info']['name'] = value if @data['info'].key?('files')\n end", "def add_directory(name)\n full_path = File.join(path, name)\n\n Dir.mkdir(full_path) unless File.directory?(full_path)\n\n self.class.new(full_path)\n end", "def update_name(new_name)\n ensure_uri\n response = @client.rest_put(@data['uri'], 'body' => { 'name' => new_name, 'type' => 'ArtifactsBundle' })\n @client.response_handler(response)\n @data['name'] = new_name\n true\n end", "def upload_folder(folder_name, location: 'root')\n begin\n update_refresh_token if refresh_due?\n upload = @drive_manager.post(\n { 'name' => folder_name,\n 'mimeType' => 'application/vnd.google-apps.folder' }.to_json\n )\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{folder_name}\"\n retry\n end\n\n folder_id = JSON.parse(upload)['id']\n\n if location != 'root'\n begin\n update_refresh_token if refresh_due?\n @drive_manager[folder_id + '?addParents=' + location +\n '&removeParents=root&alt=json'].patch(\n { 'uploadType' => 'resumable' }.to_json\n )\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{folder_name}\"\n retry\n end\n end\n\n folder_id\n end", "def dir_name(name)\n name = name.dup\n name.gsub!(\":\", VAGRANT_COLON) if Util::Platform.windows?\n name.gsub!(\"/\", VAGRANT_SLASH)\n name\n end", "def post_rename(old_name,repo,data)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{old_name}\",data).body_str\n end", "def rename_this_name(name)\n name\n end", "def change_project(name)\n update!(name: name)\n end", "def change_item_name(new_name:, **)\n self.name = new_name # This will generate the event!\n end", "def create_subfolders_in(folder_name)\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Start Add Menu\").fire_event(\"onfocus\")\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Create Folders\").click\n instantiate_class(:create_folders)\n end", "def update!(**args)\n @folder = args[:folder] if args.key?(:folder)\n end", "def update!(**args)\n @folders = args[:folders] if args.key?(:folders)\n end", "def update!(**args)\n @folders = args[:folders] if args.key?(:folders)\n end", "def change_name(new_name)\n Dropio::Resource.client.change_drop_name(self,new_name)\n end", "def name= (new_name)\n @name = new_name\n end", "def name_setter(new_name)\n @name = new_name\n end", "def move_to_folder=(value)\n @move_to_folder = value\n end", "def ftp_name=(new_name)\n return if new_name == @resource.should(:share_name)\n @share_edit_args += [ \"-F\", new_name ]\n end", "def replace_names!(former,nname)\n # By default: try to replace the name recursively.\n self.each_node_deep do |node|\n if node.respond_to?(:name) && node.name == former then\n node.set_name!(nname)\n end\n end\n end", "def find_folder(name)\n @storage.nodes.find { |f| f.type == :folder && f.name == name }\n end", "def setName(name)\n @name = name\n end", "def move_dirs\n \n end", "def renameBrick(oldName, newName)\n # Raise an error if the new name is already taken\n raise \"Brick node: #{newName} is already in the tree.\" if @tree.has_key?(newName)\n \n # Make sure the child exists\n raise \"Brick node: #{oldName} does not exist.\" unless @tree.has_key?(oldName)\n\n # Remove link to the old brick name from old parent\n parentName = self.getParent(oldName)['brick']\n self.removeChildLink(parentName, oldName)\n \n # Add link to the parent for the new brick name\n self.addChildLink(parentName ,newName)\n \n #--\n # Update the brick's name\n #--\n # Add hash element to tree under new name\n @tree[newName] = @tree[oldName]\n @tree[newName]['brick'] = newName\n @tree[newName]['parent'] = parentName\n\n # Erase old hash element\n @tree.delete(oldName)\n end", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def name=(new_name)\n @name = new_name\n end", "def name=(new_name)\n @name = new_name\n end", "def set_name=(name)\n @name = name\n end", "def name= new_name\n @gapi.update! name: String(new_name)\n end", "def name=(new_name)\n\t\t@name = new_name\n\tend", "def path\n folder.path + name\n end", "def addName(name)\n @path << name\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(new_name)\n @name = new_name\n end", "def name\n rename_workspace(params[:workspace_object], params)\n\n head :ok\n end" ]
[ "0.74881196", "0.70607036", "0.70495236", "0.70100117", "0.6783836", "0.6705728", "0.6571921", "0.64381593", "0.63509005", "0.6318723", "0.62641656", "0.62009376", "0.61694974", "0.61659306", "0.615026", "0.6138195", "0.61344975", "0.60982823", "0.60982823", "0.60720223", "0.6050125", "0.6048856", "0.59225947", "0.59188324", "0.5911803", "0.58801365", "0.5861428", "0.5853922", "0.5852502", "0.5852502", "0.584578", "0.5838402", "0.5833484", "0.5819282", "0.5773161", "0.57702667", "0.57637006", "0.5756383", "0.5752908", "0.5724864", "0.571688", "0.5693141", "0.5685929", "0.56831086", "0.5667662", "0.56337905", "0.563291", "0.56127846", "0.56067806", "0.55911124", "0.5583003", "0.5559806", "0.5555184", "0.55515707", "0.55464894", "0.5539302", "0.55357915", "0.55318576", "0.55318576", "0.5530191", "0.5529025", "0.55256516", "0.55228704", "0.5522216", "0.55208266", "0.5516995", "0.5508316", "0.5480611", "0.5480389", "0.5473941", "0.546743", "0.5464705", "0.5464705", "0.5456082", "0.5449474", "0.54437345", "0.5441183", "0.5440862", "0.5440454", "0.54327327", "0.5427772", "0.54244554", "0.54227245", "0.54225117", "0.54225117", "0.54225117", "0.54225117", "0.54225117", "0.54044205", "0.54044205", "0.540403", "0.5396365", "0.5387919", "0.53866565", "0.53819114", "0.53816366", "0.5381194", "0.5381194", "0.53808916" ]
0.5614569
48
(not implemented) Calling this function will return a link directly to a specified folder given the "id" parameter of a folder.
def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drive_folder_link\n\t\t\"https://drive.google.com/#folders/#{self.folder_id}\"\n\tend", "def get_folder(folder_id)\n @folders[folder_id]\n end", "def get_folder(folder_id)\n @folders[folder_id]\n end", "def folder(id)\n Box::Folder.new(@api, nil, :id => id)\n end", "def get_folder folder_id\n get(\"/projects/#{folder_id}\")\n end", "def folder_id\n self.folder.id\n end", "def get_folder_by_id(folder, grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'Folder deletion was successful.'\n grafana_options[:unknown_code_msg] = 'FolderApi::get_folder_by_id unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/folders/id/' + get_folder_id(folder)\n\n folder_obj = do_request(grafana_options)\n\n return if folder_obj[:message] == 'Folder not found'\n folder_obj\n end", "def get_folder(folder_id)\n\tputs \"Getting folder: \" + folder_id\n\tresponse = request_get('/api/partner/folder/' + folder_id)\n\tputs response.body\nend", "def rip_folder(folder_id)\n \n query_string = \"SELECT ZICCLOUDSYNCINGOBJECT.ZTITLE2, ZICCLOUDSYNCINGOBJECT.ZOWNER, \" + \n \"ZICCLOUDSYNCINGOBJECT.Z_PK \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZICCLOUDSYNCINGOBJECT.Z_PK=?\"\n\n #Change things up for the legacy version\n if @version == IOS_LEGACY_VERSION\n query_string = \"SELECT ZSTORE.Z_PK, ZSTORE.ZNAME as ZTITLE2, \" +\n \"ZSTORE.ZACCOUNT as ZOWNER \" + \n \"FROM ZSTORE \" +\n \"WHERE ZSTORE.Z_PK=?\"\n end\n\n @database.execute(query_string, folder_id) do |row|\n tmp_folder = AppleNotesFolder.new(row[\"Z_PK\"],\n row[\"ZTITLE2\"],\n get_account(row[\"ZOWNER\"]))\n @folders[folder_id] = tmp_folder\n end \n end", "def getFolderId\r\n\t\t\t\t\treturn @folderId\r\n\t\t\t\tend", "def set_folder\n @folder = PulStore::Lae::Folder.find(params[:id])\n end", "def toodle_folder_to_tw(folderid)\n @remote_folders.find{|f| f[:id] == folderid}[:name]\n end", "def build_href(folder, folder_set, base)\n parent_id = folder[:folder_id]\n\n if parent_id.present?\n parent = folder_set.detect { |folder| folder[:id] == parent_id }\n\n if parent\n base = build_href(parent, folder_set, base)\n end\n\n folder.href = [ base, folder[:pretty_title] ].join('/')\n else\n folder.href = base\n end\n end", "def show\n @folder = current_user.folders.find(params[:id])\n end", "def show\n @folder = Folder.find(params[:id])\n end", "def go_to_folder(foldername)\n frm.link(:text=>foldername).click\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def folder_id\n current.folder.id\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def path(controller,folder, link_to_self,matter=nil)\n # the base url for a path is always the same:\n unless folder==nil\n url = url_for(:controller => controller, :action => 'folder_list', :id => nil)\n # start with the deepest folder and work your way up\n if link_to_self\n path = h(folder.name)\n id = folder.id.to_s\n # get the folders until folder doesn't have a parent anymore\n # (you're working your way up now)\n until folder.parent == nil\n folder = folder.parent\n path = truncate_hover(folder.name,18,true) + \"/\" + path + '&#187;'\n end\n\n # Finally, make it a link...\n path = ' <a href=\"#\" onclick= \"GetFoldersList('+ id + ',true);return false;\">' + h(path) + '&#187; </a> '\n else\n path = truncate_hover(folder.name,30,false)\n # get the folders until folder doesn't have a parent anymore\n # (you're working your way up now)\n until folder.parent == nil\n folder = folder.parent\n if controller=='workspaces'\n path =' <a href=\"#\" onclick= \"GetFoldersList('+ folder.id.to_s + ',true);return false;\">' + truncate_hover(folder.name,18,true) + '&#187; </a> '+ path\n elsif controller=='repositories'\n path =' <a href=\"#\" onclick= \"GetFoldersListRepository('+ folder.id.to_s + ',true);return false;\">' + truncate_hover(folder.name,18,true) + '&#187; </a> '+ path\n elsif controller=='document_homes'\n path =' <a href=\"#\" onclick= \"GetFoldersListMatter('+ folder.id.to_s + ',true,this,' + matter.id.to_s + ');return false;\">' + truncate_hover(folder.name,18,true) + '&#187; </a> '+ path\n end\n end\n if controller=='document_homes'\n linkto = \"/matters/#{+ matter.id }/#{controller}\"\n path = '<a href=\"'+\"#{linkto }\"+'\">' +\" Root Folder\" + ' &#187; </a> ' + path\n else\n path = '<a href=\"/' + \"#{controller}\" + '\">' +\" Root Folder\" + ' &#187; </a> ' + path\n end\n end\n else\n path = 'Root Folder'\n end\n return path.html_safe!\n end", "def folder\n query = Builder::XmlMarkup.new.Query do |xml|\n xml.Where do |xml|\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FileRef\")\n xml.Value(::File.dirname(url).sub(/\\A\\//, \"\"), :Type => \"Text\")\n end\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FSObjType\")\n xml.Value(1, :Type => \"Text\")\n end\n end\n end\n @list.items(:folder => :all, :query => query).first\n end", "def get_folder(folder, grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'Folder deletion was successful.'\n grafana_options[:unknown_code_msg] = 'FolderApi::get_folder_by_uid unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/folders/' + get_folder_uid(folder)\n\n folder_obj = do_request(grafana_options)\n\n return if folder_obj[:message] == 'Folder not found'\n folder_obj\n end", "def set_folder\n begin\n @folder = Folder.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render json: {\n error: e.to_s\n }, status: :not_found\n end\n end", "def pathify_folder(folder)\n if folder.private?\n \"/home/files?folderId=#{folder.id}\"\n elsif folder.public?\n \"/home/files/everybody?folderId=#{folder.id}\"\n elsif folder.in_space?\n \"/home/files/spaces?folderId=#{folder.id}\"\n else\n raise \"Unable to build folder's path\"\n end\n end", "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", "def folder\n connection.directories.get(folder_name)\n end", "def path(id)\n directory.join(relative(id))\n end", "def require_existing_folder\n @folder = get_folder_or_redirect(params[:id])\n end", "def show\n @folder = current_user.folders.find_by_name(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @folder }\n end\n end", "def set_folder\n @folder = Folder.find_by!(id: params[:id], user_id: current_user.id)\n end", "def sitemapFolderLink(page, title)\n return '' if page.level == 1\n css_class = page.folded?(current_user.id) ? 'folded' : 'collapsed'\n link_to_remote(\n '',\n :url => {\n :controller => 'admin/pages',\n :action => :fold,\n :id => page.id\n },\n :complete => %(\n foldPage(#{page.id})\n ),\n :html => {\n :class => \"page_folder #{css_class}\",\n :title => title,\n :id => \"fold_button_#{page.id}\"\n }\n )\n end", "def folder\n @folders[@folder_name]\n end", "def sitemapFolderLink(page)\n return '' if page.level == 1\n if page.folded?(current_user.id)\n css_class = 'folded'\n title = _t('Show childpages')\n else\n css_class = 'collapsed'\n title = _t('Hide childpages')\n end\n link_to(\n '',\n alchemy.fold_admin_page_path(page),\n :remote => true,\n :method => :post,\n :class => \"page_folder #{css_class}\",\n :title => title,\n :id => \"fold_button_#{page.id}\"\n )\n end", "def setFolderId(folderId)\r\n\t\t\t\t\t@folderId = folderId\r\n\t\t\t\tend", "def folder(name)\n Kamelopard::Folder.new(name)\n end", "def folder\n File.join self.class::FOLDER, model_id.to_s\n end", "def path(id)\n directory.join(id.gsub(\"/\", File::SEPARATOR))\n end", "def root_folder_id\n self.root_folder\n end", "def folder_path\n File.join(location.path, folder_name)\n end", "def folder_id\n case params[:controller] + '/' + params[:action]\n when 'folder/index', 'folder/list', 'folder/new', 'folder/create', 'folder/update_permissions', 'folder/feed', 'file/upload', 'file/validate_filename'\n current_folder_id = 1 unless current_folder_id = params[:id]\n when 'file/do_the_upload'\n # This prevents a URL like 0.0.0.0/file/do_the_upload/12,\n # which breaks the upload progress. The URL now looks like this:\n # 0.0.0.0/file/do_the_upload/?folder_id=12\n current_folder_id = 1 unless current_folder_id = params[:folder_id]\n when 'folder/rename', 'folder/update', 'folder/destroy'\n current_folder_id = @folder.parent_id if @folder\n when 'file/download', 'file/rename', 'file/update', 'file/destroy', 'file/preview'\n current_folder_id = @myfile.folder.id\n when 'inbox/do_the_upload', 'inbox/index'\n unless params[:user_id].nil?\n current_folder_id = Folder.fetch_user_inbox(params[:user_id]).id \n else\n current_folder_id = Folder.fetch_user_inbox(@logged_in_user.id).id \n end\n end\n\n case params[:controller]\n when 'claims'\n current_folder_id = 2\n end\n\n return current_folder_id\n end", "def folder_path\n File.expand_path @folder_path\n end", "def url(id, **options)\n if subdirectory\n File.join(host || \"\", subdirectory, id)\n else\n if host\n File.join(host, path(id))\n else\n path(id).to_s\n end\n end\n end", "def getFolder\r\n\t\t\t\t\treturn @folder\r\n\t\t\t\tend", "def jsonToFolder(jsonObject)\r\n\t\t\t\tfolder = Folder.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\tfolder.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"name\")\r\n\t\t\t\t\tfolder.setName(jsonObject[\"name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"is_discussion\")\r\n\t\t\t\t\tfolder.setIsDicussion(jsonObject[\"is_discussion\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"link\")\r\n\t\t\t\t\tlink = jsonObject[\"link\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"self\")\r\n\t\t\t\t\t\tfolder.setURL(link[\"self\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn folder\r\n\t\t\tend", "def get_team_folder\n\n Team.get_team_folder(self.id)\n end", "def id; dir end", "def open_folder(foldername)\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(foldername)}/).link(:title=>\"Open this folder\").click\n end", "def default_folder\n self.folders.create(:name => \"LNKS!\")\n end", "def path\n '/c/document_library/get_file?folderId=%i&name=%s' % [self.folderid, self.name]\n end", "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folder }\n end\n end", "def set_file_folder\n @file_folder = FileFolder.find(params[:id])\n end", "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @folder }\n end\n end", "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @folder }\n end\n end", "def rip_folder(folder_id)\n\n @logger.debug(\"Rip Folder: Calling rip_folder on Folder ID #{folder_id}\")\n\n # Set the ZSERVERRECORD column to look at\n server_record_column = \"ZSERVERRECORD\"\n server_record_column = server_record_column + \"DATA\" if @version >= IOS_VERSION_12 # In iOS 11 this was ZSERVERRECORD, in 12 and later it became ZSERVERRECORDDATA\n\n # Set the ZSERVERSHARE column to look at\n server_share_column = \"ZSERVERSHARE\"\n server_share_column = server_share_column + \"DATA\" if @version >= IOS_VERSION_12 # In iOS 11 this was ZSERVERRECORD, in 12 and later it became ZSERVERRECORDDATA\n \n smart_folder_query = \"'' as ZSMARTFOLDERQUERYJSON\"\n smart_folder_query = \"ZICCLOUDSYNCINGOBJECT.ZSMARTFOLDERQUERYJSON\" if @version >= IOS_VERSION_15\n \n query_string = \"SELECT ZICCLOUDSYNCINGOBJECT.ZTITLE2, ZICCLOUDSYNCINGOBJECT.ZOWNER, \" + \n \"ZICCLOUDSYNCINGOBJECT.#{server_record_column}, ZICCLOUDSYNCINGOBJECT.#{server_share_column}, \" +\n \"ZICCLOUDSYNCINGOBJECT.Z_PK, ZICCLOUDSYNCINGOBJECT.ZIDENTIFIER, \" +\n \"ZICCLOUDSYNCINGOBJECT.ZPARENT, #{smart_folder_query} \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZICCLOUDSYNCINGOBJECT.Z_PK=?\"\n\n #Change things up for the legacy version\n if @version == IOS_LEGACY_VERSION\n query_string = \"SELECT ZSTORE.Z_PK, ZSTORE.ZNAME as ZTITLE2, \" +\n \"ZSTORE.ZACCOUNT as ZOWNER, '' as ZIDENTIFIER \" +\n \"FROM ZSTORE \" +\n \"WHERE ZSTORE.Z_PK=?\"\n end\n\n @database.execute(query_string, folder_id) do |row|\n\n tmp_folder = AppleNotesFolder.new(row[\"Z_PK\"],\n row[\"ZTITLE2\"],\n get_account(row[\"ZOWNER\"]))\n\n # If this is a smart folder, instead build an AppleNotesSmartFolder\n if row[\"ZSMARTFOLDERQUERYJSON\"] and row[\"ZSMARTFOLDERQUERYJSON\"].length > 0\n tmp_folder = AppleNotesSmartFolder.new(row[\"Z_PK\"],\n row[\"ZTITLE2\"],\n get_account(row[\"ZOWNER\"]),\n row[\"ZSMARTFOLDERQUERYJSON\"])\n end\n\n if row[\"ZIDENTIFIER\"]\n tmp_folder.uuid = row[\"ZIDENTIFIER\"]\n end\n\n # Set whether the folder displays notes in numeric order, or by modification date\n tmp_folder.retain_order = @retain_order\n tmp_folder.sort_order = @folder_order[row[\"ZIDENTIFIER\"]] if @folder_order[row[\"ZIDENTIFIER\"]]\n\n # Add server-side data, if relevant\n tmp_folder.add_cloudkit_server_record_data(row[server_record_column]) if row[server_record_column]\n\n if(row[server_share_column]) \n tmp_folder.add_cloudkit_sharing_data(row[server_share_column])\n\n # Add any share participants to our overall list\n tmp_folder.share_participants.each do |participant|\n @cloud_kit_participants[participant.record_id] = participant\n end\n end\n\n @logger.debug(\"Rip Folder: Created folder #{tmp_folder.name}\")\n\n # Remember folder heirarchy\n if row[\"ZPARENT\"]\n tmp_parent_folder_id = row[\"ZPARENT\"]\n tmp_folder.parent_id = tmp_parent_folder_id\n end\n \n # Whether child or not, we add it to the overall tracker so we can look up by folder ID.\n # We'll clean up on output by testing to see if a folder has a parent.\n @folders[folder_id] = tmp_folder\n\n end\n end", "def folder\n model.folder\n end", "def folder_name\n @folder_name\n end", "def link\n \"/events/#{id}\"\n end", "def delete_user_folder(id)\n @client.raw('delete', \"/helpers/folders/#{id}\")\n end", "def index_folder\n @folder = current_user.folders.find params[:folder_id]\n if @folder.present?\n # If feed subscriptions in the folder have not changed, return a 304\n if stale? EtagCalculator.etag(@folder.subscriptions_updated_at),\n last_modified: @folder.subscriptions_updated_at\n @feeds = current_user.folder_feeds @folder, include_read: @include_read\n index_feeds\n end\n else\n Rails.logger.info \"User #{current_user.id} - #{current_user.email} tried to index feeds in folder #{params[:folder_id]} which does not exist or he does not own\"\n head 404\n end\n\n end", "def path\n folder.path + name\n end", "def getFolder(response)\r\n\t\t\t\tfolder_json = JSON.parse response\r\n\t\t\t\tfolder_array = folder_json[\"folders\"]\r\n\t\t\t\treturn jsonToFolder(folder_array[0])\r\n\t\t\tend", "def folder(name)\n Check_MK::Folder.new(self, name)\n end", "def folder\n @attributes[:folder]\n end", "def new_folder_request(dir_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"name\": dir_name,\n \"parent-id\": $root_folder_id\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n id = ''\n\n if response.code == 422.to_s\n id = JSON.parse(response.read_body)['existing_folder_id']\n puts \"Folder already exist. id: #{id}\"\n elsif response.code == 201.to_s\n id = JSON.parse(response.read_body)['data']['id']\n puts \"Folder created. id: #{id}\"\n end\n\n id\nend", "def get_all_folderdata_for_folder_id(folder_id)\n return $db.execute(\"SELECT * FROM folders WHERE folder_id = ?\", folder_id)\nend", "def show\n begin\n @folder = Folder.find(params[:id])\n set_current_folder params[:id]\n set_current_children\n set_new_items\n @chat_room = current_folder.chat_room\n rescue ActiveRecord::RecordNotFound\n flash[:warning] = 'Không tìm thấy folder. Quay về home.'\n redirect_to folders_path\n end\n end", "def set_sharedfolder\n @sharedfolder = Sharedfolder.find(params[:id])\n end", "def show\n @media_folder = MediaFolder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @media_folder }\n end\n end", "def show\n @media_folder = MediaFolder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @media_folder }\n end\n end", "def navigate_to_folder(folder_name)\n folder = menu_folders.detect { |item| item.text == folder_name }\n if folder\n folder.click\n sleep 1\n else\n raise \"Folder: #{folder_name} is not available on the page.\"\n end\n end", "def set_folder\n @folder_id = params[:folder_id] ? params[:folder_id] : params[:id]\n unless @folder_id==\"#\"\n @folder = current_user.is_support? ? Folder.where(id: @folder_id).first : Folder.where(user_id: current_user.id, id: @folder_id).first\n\n params[:project_id] = @project_id = @folder.project_id\n @project = current_user.is_support? ? Project.where(id: @project_id).first : Project.where(user_id: current_user.id, id: @project_id).first unless @project\n end\n end", "def root_folder\n folders.first({ title: Folder::DefaultFolder, folder_id: nil })\n end", "def create_team_folder\n\n folder = Folder.new\n folder.name = self.name\n folder.parent_id = 0\n folder.owner_id = self.id\n folder.xtype = Folder::XTYPE_TEAM\n folder.read_teams = '|'+self.id.to_s+'|'\n folder.write_teams = '|'+self.id.to_s+'|'\n folder.save!\n\n return folder\n end", "def find(conn_id, *args)\n options = args.extract_options!\n \n folders = case args.first\n when :all\n options.assert_valid_keys(VALID_FIND_OPTIONS)\n options[:subfolders] = :all\n find_every(conn_id, options)\n when :some\n options.assert_valid_keys(VALID_FIND_OPTIONS)\n options[:subfolders] = :direct\n find_every(conn_id, options)\n else\n options.assert_valid_keys(VALID_FIND_BY_IDS_OPTIONS)\n \n ids = args.first\n ids = (ids.is_a?(Array)) ? ids.flatten.compact.uniq : [ids]\n \n raise(ArgumentError, \"Couldn't find folder without an ID\") if ids.empty?\n \n find_from_ids(conn_id, ids, options)\n end\n \n folders.compact!\n raise Errors::FolderNotFound if folders.empty?\n \n (folders.length > 1) ? folders : folders.first\n end", "def get_parent_id_folder(id)\n if id.to_s.length > 4\n id.to_s[0..id.to_s.length-2]\n else\n id.to_s\n end\nend", "def find_object_from_link(parent_object, id)\n find_object(parent_object, id)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def userfolder\n # \"public/upload/user_id_\" + self.user_id.to_s\n User.find_by_id( self.user_id ).userfolder\n end", "def target_folder(param = 'null')\n \"targetFolder=#{param}\"\n end", "def find_url(id:, language:)\n base_url + find_path(id: id, language: language)\n end", "def link\n\t\tpage_id.present? ? short_page_path(Page.find(page_id)) : href\n\tend", "def url(id)\n entry(id).url(@user)\n rescue exception_block\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end", "def set_FolderID(value)\n set_input(\"FolderID\", value)\n end" ]
[ "0.7450053", "0.72249484", "0.72249484", "0.7170387", "0.70170796", "0.69332033", "0.6892542", "0.68248606", "0.66044796", "0.6596108", "0.65366524", "0.6534565", "0.6506531", "0.6438451", "0.6435177", "0.6396507", "0.6387204", "0.6387204", "0.63646686", "0.63481534", "0.6341996", "0.6341996", "0.6341996", "0.6341996", "0.6341996", "0.62972695", "0.629425", "0.62577873", "0.62502146", "0.62428033", "0.6192415", "0.61607784", "0.6131927", "0.6073965", "0.6063051", "0.60602784", "0.60403997", "0.60173255", "0.6013513", "0.60099095", "0.5993207", "0.5988054", "0.59718883", "0.59531754", "0.59266907", "0.59255606", "0.59182346", "0.591446", "0.5893861", "0.58786416", "0.58740383", "0.58640057", "0.5839545", "0.5833931", "0.58239865", "0.57625043", "0.57513356", "0.57429814", "0.57429814", "0.57238436", "0.56909966", "0.5676439", "0.5672954", "0.56644255", "0.5640932", "0.5637638", "0.5616389", "0.5584199", "0.5564772", "0.555849", "0.5558301", "0.55539525", "0.55228376", "0.551693", "0.551693", "0.5514078", "0.5494575", "0.54755884", "0.5471542", "0.5470668", "0.5468346", "0.54613435", "0.5456025", "0.5456025", "0.5456025", "0.5456025", "0.5456025", "0.5449402", "0.54391736", "0.54296076", "0.5415458", "0.5409653", "0.5407568", "0.5407568", "0.5407568", "0.5407568", "0.5407568", "0.5407568", "0.5407568", "0.5407568", "0.5407568" ]
0.0
-1
(not implemented) Grants folder privileges to the given user.
def grant(userid=nil, email=nil, download=true, upload=false, view=true, admin=false, delete=false, notifyupload=false, notifydownload=false) #(userid OR email) required end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_rights_for_user(usr)\n return unless usr\n return :all if administrator?(usr)\n\n rights = standard_authorized_user_rights\n \n user_groups = usr.send(Lockdown.user_groups_hbtm_reference)\n user_groups.each do |grp|\n permissions_for_user_group(grp).each do |perm|\n rights += access_rights_for_permission(perm) \n end\n end\n rights\n end", "def grant_system_admin_privileges(user)\n can :manage, AccountPlan\n end", "def add_user_permission(u)\n\t\t\n\tend", "def setPermission( other_user, perm )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if not self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"creating special users group\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n self.special_users = {}\n end\n self.special_users[other_user.id.to_s] = perm\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"new permission:\"\n # d self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end", "def access_rights_for_user(usr)\n return unless usr\n return :all if administrator?(usr)\n\n rights = standard_authorized_user_rights\n \n usr.user_groups.each do |grp|\n permissions_for_user_group(grp) do |perm|\n rights += access_rights_for_permission(perm) \n end\n end\n rights\n end", "def has_access_to_folder(folder_id, user_id)\n if get_all_user_data(user_id).first[\"rank\"] >= 1\n return true\n end\n owner_id = $db.execute(\"SELECT owner_id FROM folders WHERE folder_id = ?\", folder_id).first[\"owner_id\"]\n if owner_id == user_id\n return true\n else\n return false\n end\nend", "def allowed?(user)\n allowed = (@permissions[user] || []).include?(@jid)\n allowed && exists?(user) && (root? || current?(user))\n end", "def service_user(_user)\n can :access, :stats\n can :access, :export unless RuntimeConfig.elections_active?\n can :access, :voters if RuntimeConfig.elections_started? && RuntimeConfig.elections_active?\n end", "def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end", "def define_user_privileges(user)\n # Projects\n can :create, Project\n can [:read, :save, :activate], Project, owner: user\n can :read, Project do |project|\n project.confirmation_approver? user\n end\n\n can :destroy, Project, owner: user, state: :active\n can :destroy, Project, owner: user, state: :inactive\n can :destroy, Project, owner: user, state: :unconfirmed\n\n # Note: this 'update' refers to the Update and Edit actions of ProjectsController,\n # not the ability to create Update objects associated with a project\n can :update, Project, owner: user, can_edit?: true\n\n can :create, Update do |update|\n update.project.can_update? and\n update.project.owner == user\n end\n\n can :destroy, Video do |video|\n video.project.owner = user\n end\n\n can :create, Comment if user.id\n can :destroy, Comment do |comment|\n comment.user == user and comment.body != \"comment deleted\"\n end\n\n can :create, Contribution do |contribution|\n contribution.project.owner != user and\n contribution.project.contributions.find_by_user_id(user.id).nil? and\n contribution.project.end_date >= Time.zone.today\n end\n # If the user is logged in, doesn't own the project, and has a contribution on this project,\n # they can edit\n can :update, Contribution do |contribution|\n !contribution.project.contributions.find_by_user_id(user.id).nil?\n end\n\n # Groups\n can [:create], Group\n can :remove_project, Group # had to move check for admin or project owner to controller\n\n can [:update, :admin, :destroy], Group, owner: user\n\n #Aprovals\n can :create, Approval\n can [:approve, :reject], Approval do |approval|\n approval.group.owner == user\n end\n\n can :read, User, id: user.id\n end", "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end", "def setPermissionView( other_user )\n return setPermission( other_user, Dfile::PP_MAYVIEW )\n end", "def can_traverse?(user, path)\n return true if user == 'root'\n byme = File.stat(path).uid == -> { Etc.getpwnam(user).uid } && File.stat(path).mode & 64 == 64 # owner has x\n byus = File.stat(path).gid == -> { Etc.getpwnam(user).gid } && File.stat(path).mode & 8 == 8 # group has x\n byall = File.stat(path).mode & 1 == 1 # other has x\n byme || byus || byall\n end", "def accessible_user\n @user = User.find(params[:id])\n\n user_accessible = (@user.id == current_user.id) # can edit self\n unless user_accessible\n # check if user is in accessible group\n groups = Group.accessible_by(current_ability)\n @user.groups_users.each do |groups_user|\n if groups.include?(groups_user.group)\n user_accessible = true\n break\n end\n end\n end\n unless user_accessible\n raise CanCan::AccessDenied.new(\"Permission error\")\n end\n end", "def initialize(user)\n define_global_privileges\n define_user_privileges(user) if user\n define_admin_privileges(user) if user and user.admin?\n end", "def user_access_control_all\n @user = User.find(params[:user_id])\n\n unless [email protected]? && current_user.admin? || current_user?(@user)\n response_access_denied\n end\n\n rescue\n response_access_denied\n end", "def permissions_assignable_for_user(usr)\n return [] if usr.nil?\n if administrator?(usr)\n get_permissions.collect do |k| \n ::Permission.find_by_name(Lockdown.get_string(k))\n end.compact\n else\n user_groups_assignable_for_user(usr).collect do |g| \n g.permissions\n end.flatten.compact\n end\n end", "def change_privilege(user, group=user)\n Merb.logger.info \"Changing privileges to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n \n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n Merb.logger.error \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end", "def permissions_assignable_for_user(usr)\n return [] if usr.nil?\n if administrator?(usr)\n get_permissions.collect{|k| Permission.find_by_name(Lockdown.get_string(k)) }.compact\n else\n user_groups_assignable_for_user(usr).collect{|g| g.permissions}.flatten.compact\n end\n end", "def permissions(username,path)\n # walk the path from the most specific to the least specific scanning the\n # rules at each way point, capturing any explicit user name match and merging\n # any matching group permissios. The first such match is the result\n #\n repo , dir = path.split(':')\n @path_routes.each do |point|\n next if !(path =~ /^#{point}/) && !(dir =~ /^#{point}/)\n gperms = []\n uperms = nil\n @paths[point].each do |selector,rule|\n fail \"Syntax error #{selector}='#{rule}'\" if rule.tr('^rw','')!=rule\n p = (rule=='rw')? ['r', 'w'] : [rule]\n if username==selector || @aliases[username]==selector\n uperms = p # user permssion\n elsif user_included?(username,selector)\n gperms |= p # group permission\n end\n end\n gperms |= [uperms] if !uperms.nil? # user perms extend group perms\n return gperms.sort.join('') if !gperms.empty?\n end\n '' # no matching rule\n end", "def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend", "def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend", "def permissions_for_deploy(aUser=nil,aGroup=nil,aPath=nil)\n\t\taUser ||= user\n\t\taGroup ||= apache_user\n\t\taPath ||= deploy_to\n\t\trun \"#{sudo} chown -R #{aUser}:#{aGroup} #{MiscUtils.append_slash(aPath)}\"\n\t\trun \"#{sudo} chmod u+rw #{MiscUtils.append_slash(aPath)}\"\n\t\trun_for_all(\"chmod u+x\",aPath,:dirs)\t\t\n\tend", "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end", "def asuser\n if self.should(:owner) and ! self.should(:owner).is_a?(Symbol)\n writeable = Puppet::Util::SUIDManager.asuser(self.should(:owner)) {\n FileTest.writable?(::File.dirname(self[:path]))\n }\n\n # If the parent directory is writeable, then we execute\n # as the user in question. Otherwise we'll rely on\n # the 'owner' property to do things.\n asuser = self.should(:owner) if writeable\n end\n\n asuser\n end", "def fixup_homedir_ownership(user)\n\t\t# Determine whether current ownership is right\n\t\thomedir_stat = File.stat(\"/home/#{user}/\")\n\n\t\tuid_correct =\n\t\t\t\tbegin\n\t\t\t\t\tEtc.getpwuid(homedir_stat.uid).name == user\n\t\t\t\trescue ArgumentError\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\tgid_correct =\n\t\t\t\tbegin\n\t\t\t\t\tEtc.getgrgid(homedir_stat.gid).name == user\n\t\t\t\trescue ArgumentError\n\t\t\t\t\tfalse\n\t\t\t\tend\n\n\t\tlogger.debug \"[CPB:restore] Attemping homedir permission fix.\" unless uid_correct and gid_correct\n\n\t\tunless uid_correct\n\t\t\tinvoke_and_log_cmd(\"/usr/bin/find -P /home/#{user}/ -user #{homedir_stat.uid} -exec /bin/chown -P --no-dereference #{user} '{}' \\\\;\", 'chown')\n\t\tend\n\n\t\tunless gid_correct\n\t\t\tinvoke_and_log_cmd(\"/usr/bin/find -P /home/#{user}/ -group #{homedir_stat.gid} -exec /bin/chgrp -P --no-dereference #{user} '{}' \\\\;\", 'chgrp')\n\t\tend\n\n\tend", "def super_admin(user)\n can :manage, :all\n end", "def process_global_role(user)\n # Grant management access to most things through the\n # GlobalRole.can_edit_system_configuration? permission.\n #\n # TODO: This permission does too much. We probably want to separate\n # out things like ActivityLog, SystemConfiguration, User, and the roles\n # from Organization, for example.\n if user.global_role.can_edit_system_configuration?\n can :manage, [\n CourseRole,\n GlobalRole,\n Organization,\n Term,\n User,\n Course,\n CourseOffering,\n CourseEnrollment,\n ]\n end\n\n # Grant broad course management access through the\n # GlobalRole.can_manage_all_courses? permission.\n if user.global_role.can_manage_all_courses?\n can :manage, [Course, CourseOffering, CourseEnrollment]\n end\n end", "def define_global_privileges\n can :read, Project, public_can_view?: true\n can :index, Project\n can :read, Group\n end", "def initialize(user)\n if user.role == \"site_admin\"\n # can [:create, :update, :destroy], User\n can :manage, User\n # can [:create, :update, :destroy], Document\n can :manage, Document\n # can [:create, :update, :destroy], Folder\n can :manage, Folder\n can :manage, Project\n can :manage, [Stage, Factor]\n cannot :destroy, [Stage, Factor]\n elsif user.role == \"project_manager\"\n # can only manage projects which he is a part of\n can :manage, Project do |project|\n (project.membership_ids & user.membership_ids).present?\n end\n # TODO: promote / demote?\n \n # can manage his own account; *cannot change his own role -> set in view\n can :manage, User, :id => user.id\n \n # can edit other users (except site admins) in the same project; limitation to change role set in view\n can :update, User do |other_user|\n (other_user.project_ids & user.project_ids).present? # This is working =].\n end\n elsif user.role == \"normal_user\"\n # can only view projects with he is a part of\n can :read, Project do |project|\n (project.membership_ids & user.membership_ids).present?\n end\n # can create, edit, delete docs in projects he belongs to\n can :manage, Document do |doc|\n (doc.project.membership_ids & user.membership_ids).present?\n end\n # can edit his own account only; *cannot change his own role -> set in view\n cannot :manage, User\n can :manage, User, :id => user.id\n can :create, User\n cannot :destroy, User # can't destroy own account\n end\n end", "def extra_perms_for_all_users\n can :create, User\n can :create, PaperTrail::Version\n can :read, Team, :private => false\n can :read, Team, :private => true, :team_users => { :user_id => @user.id, :status => 'member' }\n\n # A @user can read a user if:\n # 1) @user is the same as target user\n # 2) target user is a member of at least one public team\n # 3) @user is a member of at least one same team as the target user\n can :read, User do |obj|\n @user.id == obj.id || obj.teams.where('teams.private' => false).exists? || @user.is_a_colleague_of?(obj)\n end\n\n # A @user can read contact, project or team user if:\n # 1) team is private and @user is a member of that team\n # 2) team user is not private\n can :read, [Contact, Project, TeamUser] do |obj|\n team = obj.team\n !team.private || @user.is_member_of?(team)\n end\n\n # A @user can read any of those objects if:\n # 1) it's a source related to him/her or not related to any user\n # 2) it's related to at least one public team\n # 3) it's related to a private team which the @user has access to\n can :read, [Account, Source, Media, ProjectMedia, ProjectSource, Comment, Flag, Status, Tag, Embed, Link, Claim] do |obj|\n if obj.is_a?(Source) && obj.respond_to?(:user_id)\n obj.user_id == @user.id || obj.user_id.nil?\n else\n team_ids = obj.get_team\n teams = obj.respond_to?(:get_team_objects) ? obj.get_team_objects.reject{ |t| t.private } : Team.where(id: team_ids, private: false)\n if teams.empty?\n TeamUser.where(user_id: @user.id, team_id: team_ids, status: 'member').exists?\n else\n teams.any?\n end\n end\n end\n end", "def permits_write_access_for(user)\n end", "def standard_authorized_user_rights\n Lockdown::System.public_access + Lockdown::System.protected_access \n end", "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "def can_create?(folder_id)\n administrator? or\n permissions.for_create.exists? :folder_id => folder_id\n end", "def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "def direct_share( user, privileges )\n @acl ||= Acl.new\n @acl << { :user => user, :privileges => privileges }\n end", "def create_user_permissions\n group.users.each do |user|\n create_permission_for(user)\n end\n end", "def can_read?(folder_id)\n administrator? or\n permissions.for_read.exists? :folder_id => folder_id\n end", "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n# if current_user.contentadmin?\n# can [:create, :destroy], GwWork\n# can [:create, :destroy], GwEtd\n# end\n end", "def set_perms\n self.perms = Access.for_user(self)\n end", "def allow_user(user_id)\n create_entry(user_id, USER, true)\n end", "def any_logged_in(user)\n can :export_calendar, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check)\n end\n\n # only matters if read in any_one() is false (ie. user_check is junior)\n can :read, User do |user_check| \n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || user.friends.include?(user_check) || admin_of_users_league?(user, user_check)\n end\n\n # contact details and shit\n can :read_private_details, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || admin_of_users_team?(user, user_check) || admin_of_users_league?(user, user_check)\n end\n\n # ie parent\n can :act_on_behalf_of, User do |user_check|\n user_check.junior? && user_check.parent_ids.include?(user.id)\n end\n\n # TEAM\n can :read, Team do |team|\n team.has_member?(user) || team.primary_league.has_organiser?(user) || can?(:manage_teams, team.tenant)\n end\n\n # currently only used for mobile app, prob should use on web too. TS\n can :read_private_details, Team do |team|\n team.has_member?(user) || (!team.primary_league.nil? && team.primary_league.has_organiser?(user))\n end\n\n can :export_calendar, Team do |team|\n team.has_member?(user)\n end\n\n # Not sure these should be here... Can be inferred from other info (eg. are they in the team)\n # also, they're more about whether it is feasible, rather than whether they're allowed\n # Plus, this is checking the team, and the setting belong to the user. We should just be\n # looking for the settings (if has perms to edit user), and raise invalid id not there. TS\n can :read_notification_settings, Team do |team|\n team.has_associate?(user)\n end\n can :update_notification_settings, Team do |team|\n team.has_associate?(user) \n end\n\n # EVENT\n # only matters is read in any_one gives false\n can :read, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n can :read_messages, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # TODO: remove in favour of :read_private_details\n can :read_all_details, Event do |event|\n can? :read_private_details, Event\n end\n\n # TODO: remove in favour of :read_private_details\n can :view_private_details, Event do |event|\n can? :read_private_details, Event\n end\n\n can :read_private_details, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # SR: Added to mimic\n can :view_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # SR: Added to mimic\n can :read_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # DEPRECATED: this is only used for view code, not actual authorisation, so should be removed from here. TS.\n can :respond_to_invite, Event do |event|\n event.teamsheet_entries.map{|tse| tse.user_id}.include?(user.id) && event.user_id != user.id\n end\n\n can :respond, TeamsheetEntry do |tse|\n # player, event organiser (legacy), parent, or team organiser\n #tse.event.team.has_associate?(user) &&\n (user.id == tse.user_id || tse.event.user_id == user.id || can?(:act_on_behalf_of, tse.user) || can?(:manage, tse.event.team))\n end\n\n can :check_in, TeamsheetEntry do |tse|\n can? :manage_roster, tse.event.team\n end\n\n # ACTIVITY ITEMS\n can :view, ActivityItem\n\n can :create_message_via_email, Event do |event|\n # organiser, or registered player\n # TODO: generalise this set of perms (and refactor to check user has role on team)\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # ACTIVITY ITEM COMMENTS AND LIKES\n can :comment_via_email, EventMessage do |message| \n # if this implementation changes then a test is required\n if message.messageable.is_a? Team \n message.messageable.has_active_member?(user)\n elsif message.messageable.is_a? Event\n can? :create_message_via_email, message.messageable\n end \n end\n\n can :comment_via_email, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message_via_email, event_result.event \n end\n\n can :comment_via_email, User\n can :comment_via_email, Event \n can :comment_via_email, TeamsheetEntry \n can :comment_via_email, InviteResponse\n can :comment_via_email, InviteReminder\n end", "def custom_permissions\n can [:file_status, :stage, :unstage], FileSet\n\n if current_user.ingest_from_external_sources?\n end\n\n if current_user.manage_users?\n can [:show, :add_user, :remove_user, :index], Role\n end\n\n if current_user.manage_roles?\n can [:create, :show, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.run_fixity_checks?\n can [:fixity], FileSet\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end", "def check_access_control_all\n @user = User.find(params[:user_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @user.id\n rescue\n response_access_denied\n end", "def permissions_for_web(aPath=nil,aUser=nil,aApacheUser=nil,aHideScm=nil)\n\t\taPath ||= deploy_to\n\t\taUser ||= user\n\t\taApacheUser ||= apache_user\n\t\n\t\trun \"#{sudo} chown -R #{aUser}:#{aApacheUser} #{MiscUtils.append_slash(aPath)}\"\n\t\trun \"#{sudo} chmod -R 644 #{MiscUtils.append_slash(aPath)}\"\n\t\trun_for_all(\"chmod +x\",aPath,:dirs)\n\t\trun_for_all(\"chmod g+s\",aPath,:dirs)\n\t\tcase aHideScm\n\t\t\twhen :svn then run_for_all(\"chown -R #{aUser}:#{aUser}\",aPath,:dirs,\"*/.svn\")\n\t\tend\n\tend", "def change_privilege(user, group)\n begin\n if group\n log \"Changing group to #{group}.\"\n Process::GID.change_privilege(Etc.getgrnam(group).gid)\n end\n\n if user\n log \"Changing user to #{user}.\" \n Process::UID.change_privilege(Etc.getpwnam(user).uid)\n end\n rescue Errno::EPERM\n log \"FAILED to change user:group #{user}:#{group}: #$!\"\n exit 1\n end\n end", "def read_allowed?(user)\n return true unless self.group_restrictions.any? || (user.nil? && self.categories.detect { |c| !c.public })\n return false unless user\n group_restrictions.each do |r|\n unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil? \n logger.info(\"\\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}\")\n return true\n end\n end\n return false\n end", "def check_user_access(user, file, flag)\n if inspec.os.linux? == true\n # use sh on linux\n perm_cmd = \"su -s /bin/sh -c \\\"test -#{flag} #{file}\\\" #{user}\"\n elsif inspec.os[:family] == 'freebsd'\n # use sudo on freebsd\n perm_cmd = \"sudo -u #{user} test -#{flag} #{file}\"\n end\n\n if !perm_cmd.nil?\n cmd = inspec.command(perm_cmd)\n cmd.exit_status == 0 ? true : false\n else\n return skip_resource 'The `file` resource does not support `by_user` on your OS.'\n end\n end", "def authorize_creating\n unless @logged_in_user.can_create(folder_id)\n flash.now[:folder_error] = \"You don't have create permissions for this folder.\"\n redirect_to :controller => 'folder', :action => 'list', :id => folder_id and return false\n end\n end", "def can_access?(user)\n user == self.user\n end", "def setUserFileAccess(adminSettingPerms, userName, filePath, grantAccess)\n\n #filePath = GlobalSettings.changeFilePathToMatchSystem(filePath)\n fAccess = filePath.concat \".access\"\n access = Hash.new {}\n if !File.exist?(fAccess)\n if grantAccess\n access[\"users\"] = \";#{userName};\"\n else\n access[\"users\"] = \"\"\n end\n access[\"groups\"] = \"\"\n if(adminSettingPerms == \"root\")\n access[\"adminUsers\"] = \";root(rwp);\"\n else\n access[\"adminUsers\"] = \";root(rwp);\"+adminSettingPerms+\"(rw);\"\n end\n access[\"adminGroups\"] = \"\"\n else\n access = YAML.load_file(fAccess)\n users = access[\"users\"]\n if users.index(userName) == nil && grantAccess\n users.concat( userName+\";\")\n elsif users.index(userName) != nil && !grantAccess\n\n beginning = users[0..users.index(userName)]\n gend = users[users.index(\";\", users.index(userName)+userName.size)]\n users = beginning.concat gend\n end\n access[\"users\"] = users\n end\n File.write(fAccess, access.to_yaml)\n\n end", "def give_permissions_to_folders(group, permission_to_everything)\n Folder.find(:all).each do |folder|\n add_to_group_permissions(group, folder, permission_to_everything)\n end\n end", "def authorize_creating\n unless current.user.can_create? folder_id\n flash[:folder_error] = 'You don\\'t have create permissions for this folder.'\n redirect_to folder_path(folder_id)\n end\n end", "def chown(user_and_group)\n return unless user_and_group\n user, group = user_and_group.split(':').map {|s| s == '' ? nil : s}\n FileUtils.chown user, group, selected_items.map(&:path)\n ls\n end", "def set_user\n @user = User.find(params[:id])\n \tauthorize [:admin, @user]\n end", "def create_and_permissions_on_path(log_path, user = nil, group = nil)\n user = Capistrano::BaseHelper.get_capistrano_instance.fetch(:user) if user.nil?\n group = \"syslog\" if group.nil?\n c = Capistrano::BaseHelper.get_capistrano_instance\n # will use sudo\n commands = []\n commands << \"#{c.sudo} mkdir -p #{log_path}\"\n commands << \"#{c.sudo} chown -R #{user}:#{group} #{log_path}\"\n commands << \"#{c.sudo} chmod u+w #{log_path}\"\n commands << \"#{c.sudo} chmod g+w #{log_path}\"\n Capistrano::BaseHelper.get_capistrano_instance.run commands.join(\" && \")\n end", "def read_allowed?(user)\n return false if self.draft && self.user != user\n all_categories_public = (self.categories.detect { |c| !c.public }).nil?\n return true unless self.group_restrictions.any? || (user.nil? && !all_categories_public)\n return true if self.group_restrictions.empty? && user && all_categories_public\n return false unless user\n group_restrictions.each do |r|\n unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil?\n logger.info(\"\\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}\")\n return true\n end\n end\n return false \n end", "def add_group_permission(g)\n\t\t\n\tend", "def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end", "def make_user_administrator(usr)\n user_groups = usr.send(Lockdown.user_groups_hbtm_reference)\n user_groups << Lockdown.user_group_class.\n find_or_create_by_name(Lockdown.administrator_group_string)\n end", "def can_user_access?(user)\n if user.is_account_holder_or_administrator? || self.is_user_tagged_to_team?(user)\n true\n else\n false\n end\n end", "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n # Admin user can create works of all work types\n can :create, curation_concerns_models\n end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end", "def browsable_by?(user)\n return true if space.member?(user)\n\n browsable && folder.browsable_by?(user)\n end", "def change_privilege(user, group=user)\n puts \">> Changing process privilege to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\nrescue Errno::EPERM => e\n puts \"Couldn't change user and group to #{user}:#{group}: #{e}\"\nend", "def default(user)\n puts \"Rights: default\"\n # can :read, :all # doesn't do that ! We will authorize each actions\n can :read, [Doc, Gallery, Image, Place]\n can :manage, User, :id => user.id\n cannot :destroy, User, :id => user.id\n\n can :read, ForumCategory, [\"role <= ?\", user.role] do |forum_category|\n forum_category.role <= user.role\n end\n\n can :read, Forum, [\"role <= ?\", user.role] do |forum|\n if (forum.role <= user.role)\n can :read, Topic\n can :read, Message\n true\n else\n false\n end\n end\n\n # can read users profiles\n can :read, User\n\n # special actions\n can :mark_all_read, Forum\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def directoryadminify\n without_access_control do\n User.module_eval do\n def role_symbols\n @role_symbols = [ :directoryadmin ]\n end\n end\n\n request.session[:auth_via] = 'cas'\n request.session[:user_id] = users(:one)\n end\n end", "def administerable_by(user_id)\n\t\tuser = project_groups.find_by_user_id(user_id)\n\t\tif (! user.nil?) && user.project_administrator then\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end", "def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end", "def admin_grant_permissions\n user = User.find(params[:id])\n authorize user\n\n # Super admin can grant any Perm, org admins can only grant Perms they\n # themselves have access to\n perms = if current_user.can_super_admin?\n Perm.all\n else\n current_user.perms\n end\n\n render json: {\n 'user' => {\n 'id' => user.id,\n 'html' => render_to_string(partial: 'users/admin_grant_permissions',\n locals: { user: user, perms: perms },\n formats: [:html])\n }\n }.to_json\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def can_access user\n return self.users.include? user\n end", "def _change_privilege(user, group=user)\n Merb.logger.warn! \"Changing privileges to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n\n begin\n target_uid = Etc.getpwnam(user).uid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to user #{user}, does the user exist?\", e)\n return false\n end\n\n begin\n target_gid = Etc.getgrnam(group).gid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to group #{group}, does the group exist?\", e)\n return false\n end\n\n if (uid != target_uid) || (gid != target_gid)\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n true\n rescue Errno::EPERM => e\n Merb.fatal! \"Permission denied for changing user:group to #{user}:#{group}.\", e\n false\n end", "def setPermissionEdit( other_user )\n return setPermission( other_user, Dfile::PP_MAYEDIT )\n end", "def set_user\n\t\t@user = current_user\n\t\tif !current_user.is_admin?\n\t\t\t# redirects to the denied path if not\n\t\t\tredirect_to denied_path\n\t\tend\n\tend", "def user_access\n @bot = current_user.admin? ? Bot.find(params[:id]) : current_user.bots.find(params[:id])\n\n check_user_access(@bot.account.user_id)\n\n rescue\n flash_access_denied\n end", "def has_access?(user)\n return false if user.nil?\n self.user == user || user.is_admin?\n end", "def extra_perms_for_all_users\n can :create, [User, AccountSource]\n can :create, Version\n can :read, Team, :private => false\n can :read, Team, :private => true, id: @user.cached_teams\n can_list Team, { inactive: false }\n can_list Project, { 'joins' => :team, 'teams.inactive' => false }\n cannot :manage, BotUser\n\n # A @user can read a user if:\n # 1) @user is the same as target user\n # 2) target user is a member of at least one public team\n # 3) @user is a member of at least one same team as the target user\n can :read, User, id: @user.id\n can :read, [User, BotUser], teams: { private: false }\n can :read, [User, BotUser], team_users: { status: ['member', 'requested'], team_id: @user.cached_teams }\n\n # A @user can read project or team user if:\n # 1) team is private and @user is a member of that team\n # 2) team user is not private\n can :read, [Project, TeamUser, ProjectGroup, SavedSearch], team_id: @user.cached_teams\n can :read, [Project, TeamUser, ProjectGroup, SavedSearch], team: { private: false }\n\n # A @user can read any of those objects if:\n # 1) it's a source related to him/her or not related to any user\n # 2) it's related to at least one public team\n # 3) it's related to a private team which the @user has access to\n can :read, [Account, ProjectMedia, Source], user_id: [@user.id, nil]\n can :read, [Media, Link, Claim], project_medias: { team: { private: false } }\n can :read, [Media, Link, Claim], project_medias: { team_id: @user.cached_teams }\n\n can :read, Account, source: { user_id: [@user.id, nil] }\n can :read, Relationship, { source: { team_id: @user.cached_teams }, target: { team_id: @user.cached_teams } }\n can :read, ProjectMedia do |obj|\n (!obj.team.private || @user.cached_teams.include?(obj.team.id)) && obj.user_can_see_project?(@user)\n end\n\n can :read, Cluster do |obj|\n shared_team_ids = @context_team.shared_teams.map(&:id)\n team_ids = (shared_team_ids & @user.cached_teams)\n ProjectMedia.where(cluster_id: obj.id, team_id: shared_team_ids).exists? && !team_ids.empty?\n end\n\n can :read, BotUser do |obj|\n obj.get_approved || @user.cached_teams.include?(obj.team_author_id)\n end\n\n can [:read, :create, :update, :destroy], ProjectMediaUser do |obj|\n obj.user_id == @user.id\n end\n\n can [:read, :create], TiplineMessage do |obj|\n @user.cached_teams.include?(obj.team_id)\n end\n\n annotation_perms_for_all_users\n\n cannot :manage, ApiKey\n\n can [:create, :update], LoginActivity\n\n cannot :find_by_json_fields, DynamicAnnotation::Field\n\n can [:read, :create], Shortener::ShortenedUrl\n\n can :read, Feed do |obj|\n !(@user.cached_teams & obj.team_ids).empty?\n end\n\n can :read, FeedTeam do |obj|\n @user.cached_teams.include?(obj.team_id)\n end\n\n can :read, Request do |obj|\n !(@user.cached_teams & obj.feed.team_ids).empty?\n end\n end", "def canBeWrittenBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n if user.isAdmin == 1\n return true\n elsif user.name == @user\n if @userRights == 2 or @userRights >= 6\n return true\n else\n return false\n end\n elsif isIncludedIn? user.groups, @group\n if @groupRights == 2 or @groupRights >= 6\n return true\n else\n return false\n end\n else\n if @othersRights == 2 or @othersRights >= 6\n return true\n else\n return false\n end\n end\n end", "def standard_authorized_user_rights\n public_access + protected_access \n end", "def mkdir_run_user( dir, opts = {} )\n mode = opts[:mode] || 0775\n sudo \"mkdir -p #{dir}\"\n chown_run_user dir\n sudo( \"chmod %o %s\" % [ mode, dir ] )\n end", "def authorize_user\n redirect_to restrooms_path, flash: {message: \"You don't have permission to make changes to another user's profile.\"} unless current_user.admin? || @user == current_user\n end", "def privileges(user)\n\n\t\t# create a new privileges object with no rights\n\t\tp = TinyPrivileges.new\n\n\t\t# user must be specified\n\t\treturn p if user.nil?\n\n\t\t# an admin has full privileges\n\t\treturn p.grant_all if user.admin?\n\t\treturn p.grant_all if user == contract.facilitator\n\n\t\t##########################################\n\t\t# see if the user has an enrollment role on the contract here\n\t\tuser_role = contract.role_of(user)\n\n\t\t##########################################\n\t\t# USER IS NOT ENROLLED\n\t\t# if no role, then check for staff privileges\n\t\tif user_role.nil?\n\n\t\t\t# staff members can view and do notes\n\t\t\t# non-staff, non-enrolled user has no privileges\n\t\t\tp[:browse] = \n\t\t\tp[:view] = \n\t\t\tp[:create_note] = \n\t\t\tp[:view_students] = \n\t\t\tp[:view_note] = (user.privilege == User::PRIVILEGE_STAFF)\n\n\t\t\treturn p\n\t\tend\n\n\t\t##########################################\n\t\t# USER IS ENROLLED\n\t\t# FOR EDIT PRIVILEGES,\n\t\t# user must be instructor\n\t\tp[:edit] = (user_role >= Enrollment::ROLE_INSTRUCTOR)\n\t\t\n\t\t# FOR VIEW, NOTE PRIVILEGES,\n\t\t# user must be an instructor or a supervisor or the enrolled student\n\t\tp[:view] = \n\t\tp[:create_note] = \n\t\tp[:view_note] =\n\t\tp[:browse] = ((user_role >= Enrollment::ROLE_INSTRUCTOR) or\n\t\t\t\t\t\t\t\t\t(user.id == participant.id))\n\n\t\t# an instructor or supervisor can edit a note\n\t\tp[:view_students] = # bogus since an enrollment only deals with one student\n\t\tp[:edit_note] = user_role >= Enrollment::ROLE_INSTRUCTOR\n\t\treturn p\n\tend", "def auto_elevate!\n add_role :superuser\n end", "def is_workspace_admin(user, project)\n is_admin = false\n user_permissions = user[\"UserPermissions\"]\n\n this_workspace = project[\"Workspace\"]\n this_workspace_oid = this_workspace[\"ObjectID\"].to_s\n\n if !user_permissions.nil? then\n user_permissions.each do | this_permission |\n if this_permission._type == \"WorkspacePermission\" then\n if this_permission.Workspace.ObjectID.to_s == this_workspace_oid then\n permission_level = this_permission.Role\n if permission_level == $ADMIN then\n is_admin = true\n break\n end\n end\n end\n end\n end\n return is_admin\nend", "def user_permission\n has_controller_permission?('user')\n end", "def change_privilege(user, group=user)\n log \">> Changing process privilege to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n log \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end", "def userfolder\n # \"public/upload/user_id_\" + self.user_id.to_s\n User.find_by_id( self.user_id ).userfolder\n end", "def grants?( path, access, roles )\n roles = [*roles]\n self.match?( path ) && ( self.access == WRITE || self.access == access ) && roles.include?( role )\n end", "def set_perms(data)\n permission = data[:permission] || 2 \n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end", "def authorize_reading\n unless @logged_in_user.can_read(folder_id)\n flash.now[:folder_error] = \"You don't have read permissions for this folder.\"\n redirect_to :controller => 'folder', :action => 'list', :id => nil and return false\n end\n end", "def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end", "def authorize_for_user(user, group=nil, actions=Permissions::View)\n # Must save content authorization association 1st\n get_privacy_setting.save\n auth = authorizations.find_or_initialize_by_user_id_and_circle_id(\n :user_id => user ? user.id : 0, \n :circle_id => group ? group.id : 0)\n auth.permissions = Permissions.new(actions)\n if auth.save\n update_privacy_level(ContentAuthorization::AuthPartial)\n end\n end", "def __set_synchromesh_permission_granted(old_rel, new_rel, obj, acting_user, args = [], &block)\n saved_acting_user = obj.acting_user\n obj.acting_user = acting_user\n new_rel.__synchromesh_permission_granted =\n obj.instance_exec(*args, &block) || (old_rel && old_rel.try(:__synchromesh_permission_granted))\n new_rel\n ensure\n obj.acting_user = saved_acting_user\n end", "def share( user, privileges )\n if (user.is_a?(Ecore::User) or user.is_a?(Ecore::Group)) and can_share?\n acl << { :user => user, :privileges => privileges }\n Ecore::AuditLog.create(:action => \"shared\", :tmpnode => self, :tmpuser => @session.user, :summary => \"#{user.name} (#{user.class.name}) #{privileges}\")\n nodes.each{ |n| n.share!( user, privileges ) if n.can_share? }\n return true\n end\n false\n end" ]
[ "0.6458626", "0.64164406", "0.63195044", "0.6302407", "0.62864375", "0.6193603", "0.6145888", "0.61149967", "0.61095226", "0.60716057", "0.6060547", "0.6048689", "0.6034951", "0.60318506", "0.60236", "0.6004368", "0.600217", "0.59809643", "0.5973481", "0.59724665", "0.59607404", "0.59607404", "0.5952989", "0.59526473", "0.595143", "0.5947341", "0.59389675", "0.5937646", "0.59338737", "0.59232146", "0.59005934", "0.5887495", "0.5887359", "0.5885844", "0.58799547", "0.586622", "0.58614856", "0.5860287", "0.5859004", "0.58554614", "0.58464223", "0.5838766", "0.58211046", "0.5821037", "0.58161986", "0.58138585", "0.5811026", "0.58092874", "0.5803553", "0.5797593", "0.57935524", "0.5758767", "0.5755271", "0.575406", "0.57502806", "0.57381666", "0.57245934", "0.5715421", "0.5708021", "0.5706384", "0.57007617", "0.56891394", "0.56885606", "0.56836027", "0.5680836", "0.56808066", "0.5672482", "0.5669965", "0.5669593", "0.5669431", "0.56687", "0.5668479", "0.56650764", "0.5660928", "0.5660928", "0.5660928", "0.5660928", "0.5657618", "0.5655175", "0.56473446", "0.5645286", "0.5644192", "0.56416225", "0.5638016", "0.5636183", "0.5634865", "0.56345755", "0.56332767", "0.56273645", "0.56212586", "0.5616601", "0.5614101", "0.5613798", "0.56097656", "0.5608827", "0.5604438", "0.5602923", "0.5589158", "0.5583776", "0.5578048", "0.5577251" ]
0.0
-1
(not implemented) Revokes folder privileges from the given user
def revoke(userid=nil, email=nil) #(userid OR email) required end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_privileges(user, group)\n uid, gid = user_id(user) if user\n gid = group_id(group) if group\n\n Process::Sys.setgid(gid) if gid\n Process::Sys.setuid(uid) if uid\n rescue Errno::EPERM => e\n raise ServiceError, \"unable to drop privileges (#{e})\"\n end", "def delete current_user\n raise RequestError.new(:internal_error, \"Delete: no user specified\") if current_user.nil?\n\n # remove all its files\n self.files.each { |item| item.delete current_user }\n # remove all its children, meaning all its subdirectories. (all sub-sub-directories and sub-files will me removed as well)\n self.childrens.each { |children| children.delete current_user }\n\n if current_user.id != self.user_id then # if random owner \n # remove all links between this folder and the current user only\n FileUserAssociation.all(x_file_id: self.id, user_id: current_user.id).destroy!\n # remove all associations where this folder is a children of a folder belonging to the current user only\n FolderFolderAssociation.all(children_id: self.id).each do |asso|\n asso.destroy! if current_user.x_files.get(asso.parent_id)\n end\n # No sharing for folders: no SharedToMeAssociations\n\n else # if true owner \n # remove all links between this folder and ALL users\n FileUserAssociation.all(x_file_id: self.id).destroy!\n # remove all associations where this folder is a children of a folder belonging ALL users\n FolderFolderAssociation.all(children_id: self.id).destroy!\n # No sharing for folders: no SharedByMeAssociations\n\n # No need to remove the association where this folder is a parent (of a file or folder)\n # because the children have already been removed and all theirs associations\n #\n # FolderFolderAssociation.all(parent_id: self.id).destroy!\n # FileFolderAssociation.all(parent_id: self.id).destroy!\n \n # now remove the entity\n self.destroy!\n end\n end", "def drop_root_privileges\n if Process::Sys.getuid==0\n Dir.chdir($app[:path]) if not $app[:path].nil?\n Process::GID.change_privilege($app[:ginfo].gid)\n Process::UID.change_privilege($app[:uinfo].uid)\n end\n end", "def revoke_admin\n authorize! @user\n @user.roles = @user.roles - ['admin']\n @user.save\n redirect_to @user, notice: t('user.revoked_admin', name: @user.username)\n end", "def delete_permissions_for_user(user)\n remove_filtered_policy(0, user)\n end", "def revoke_all_permissions\n update_column(:admin, nil)\n UserPermission.where(user_id: id).each(&:destroy)\n end", "def restore_admin5\n if File.exist?('/Library/Receipts/com.company.removedadmins') then\n users=read_admins\n users.each do |u|\n puts \"Restoring admin rights for #{u}\" \n %x(/usr/sbin/dseditgroup -o edit -a #{u} -t user admin)\n end\n else\n users=get_users\n users.each do |u|\n puts \"Restoring admin rights for #{u}\"\n %x(/usr/sbin/dseditgroup -o edit -a #{u} -t user admin)\n end\n end\nend", "def revoke_access(user_identifier)\n Scribd::Security.revoke_access user_identifier, self\n end", "def delete_user_folder(id)\n @client.raw('delete', \"/helpers/folders/#{id}\")\n end", "def revoke_superuser(user, opts={})\n return false unless self.superuser?(user, opts)\n unh = self._user_and_host(user, opts[:host])\n self.interpreter.log.info(PNOTE+\"Revoked superuser rights from MySQL user: #{unh}\")\n self.fetch(\"revoke all on *.* from #{unh}\") if self.interpreter.writing?\n return true\n end", "def change_privilege(user, group=user)\n Merb.logger.info \"Changing privileges to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n \n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n Merb.logger.error \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end", "def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end", "def change_privilege(user, group=user)\n puts \">> Changing process privilege to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\nrescue Errno::EPERM => e\n puts \"Couldn't change user and group to #{user}:#{group}: #{e}\"\nend", "def change_privilege(user, group)\n begin\n if group\n log \"Changing group to #{group}.\"\n Process::GID.change_privilege(Etc.getgrnam(group).gid)\n end\n\n if user\n log \"Changing user to #{user}.\" \n Process::UID.change_privilege(Etc.getpwnam(user).uid)\n end\n rescue Errno::EPERM\n log \"FAILED to change user:group #{user}:#{group}: #$!\"\n exit 1\n end\n end", "def restore_permissions; end", "def restore_permissions; end", "def change_privilege(user, group=user)\n log \">> Changing process privilege to #{user}:#{group}\"\n \n uid, gid = Process.euid, Process.egid\n target_uid = Etc.getpwnam(user).uid\n target_gid = Etc.getgrnam(group).gid\n\n if uid != target_uid || gid != target_gid\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n rescue Errno::EPERM => e\n log \"Couldn't change user and group to #{user}:#{group}: #{e}\"\n end", "def deop(nick)\n change_permissions(:deop, nick)\n end", "def removePermission( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = self.getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n if self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"group before\"\n # d self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n self.special_users.delete( other_user.id.to_s )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"group after\"\n # d self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"The file has no special group\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end", "def delete_workspace_permission(user, workspace)\n\n if @upgrade_only_mode then\n @logger.info \" #{user[\"UserName\"]} #{workspace[\"Name\"]} - upgrade_only_mode == true.\"\n @logger.warn \" Proposed Permission: #{NOACCESS}\"\n @logger.info \" Proposed Permission change would downgrade permissions. No permission updates applied.\"\n return\n end\n\n # queries on permissions are a bit limited - to only one filter parameter\n workspace_permission_query = RallyAPI::RallyQuery.new()\n workspace_permission_query.type = :workspacepermission\n workspace_permission_query.fetch = \"Workspace,Name,ObjectID,Role,User,UserName\"\n workspace_permission_query.page_size = 200 #optional - default is 200\n workspace_permission_query.order = \"Name Asc\"\n workspace_permission_query.query_string = \"(User.UserName = \\\"\" + user.UserName + \"\\\")\"\n\n query_results = @rally.find(workspace_permission_query)\n\n query_results.each do | this_workspace_permission |\n\n this_workspace = this_workspace_permission.Workspace\n this_workspace_oid = this_workspace[\"ObjectID\"].to_s\n\n if this_workspace_permission != nil && this_workspace_oid == workspace[\"ObjectID\"].to_s\n begin\n @rally.delete(this_workspace_permission[\"_ref\"])\n rescue Exception => ex\n this_user = this_workspace_permission.User\n this_user_name = this_user.Name\n\n @logger.warn \"Cannot remove WorkspacePermission: #{this_workspace_permission.Name}.\"\n @logger.warn \"WorkspacePermission either already NoAccess, or would remove the only WorkspacePermission in Subscription.\"\n @logger.warn \"User #{this_user_name} must have access to at least one Workspace within the Subscription.\"\n end\n end\n end\n end", "def delete_user_route(user)\n self.client.delete(\"gh.storage.user.#{user}\")\n end", "def untrash(user)\n return false unless trashed?(user)\n trash(user, nil)\n end", "def delete_user(user)\n res1 = remove_filtered_grouping_policy(0, user)\n res2 = remove_filtered_policy(0, user)\n res1 || res2\n end", "def disallow_edit(user)\n self.content_permissions.by_user(user).destroy_all\n end", "def revoke_firecloud_acl\n\t\tbegin\n\t\t\tunless self.permission == 'Reviewer'\n\t\t\t\tacl = Study.firecloud_client.create_workspace_acl(self.email, 'NO ACCESS')\n\t\t\t\tStudy.firecloud_client.update_workspace_acl(self.firecloud_project, self.firecloud_workspace, acl)\n\t\t\tend\n\t\trescue RuntimeError => e\n\t\t\tRails.logger.error \"#{Time.now}: Could not remove share for #{self.email} to workspace #{self.firecloud_workspace} due to: #{e.message}\"\n\t\t\tSingleCellMailer.share_delete_fail(self.study, self.email).deliver_now\n\t\tend\n\tend", "def restore_admin4\n if File.exist?('/Library/Receipts/com.company.removedadmins') then\n users=read_admins\n users.each do |u|\n puts \"Restoring admin rights for #{u}\"\n %x(nicl -raw /var/db/netinfo/local.nidb -append /groups/admin users #{u})\n end\n else\n users=get_users\n users.each do |u|\n puts \"Restoring admin rights for #{u}\"\n %x(nicl -raw /var/db/netinfo/local.nidb -append /groups/admin users #{u})\n end\n end\nend", "def revoke(user, session)\n\t\trevoke_session user if authorize(user, session)\n\tend", "def curator_access_revoke\n unless user_signed_in? && current_user.user_type == \"curator\"\n redirect_to root_path\n end\n end", "def fixup_homedir_ownership(user)\n\t\t# Determine whether current ownership is right\n\t\thomedir_stat = File.stat(\"/home/#{user}/\")\n\n\t\tuid_correct =\n\t\t\t\tbegin\n\t\t\t\t\tEtc.getpwuid(homedir_stat.uid).name == user\n\t\t\t\trescue ArgumentError\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\tgid_correct =\n\t\t\t\tbegin\n\t\t\t\t\tEtc.getgrgid(homedir_stat.gid).name == user\n\t\t\t\trescue ArgumentError\n\t\t\t\t\tfalse\n\t\t\t\tend\n\n\t\tlogger.debug \"[CPB:restore] Attemping homedir permission fix.\" unless uid_correct and gid_correct\n\n\t\tunless uid_correct\n\t\t\tinvoke_and_log_cmd(\"/usr/bin/find -P /home/#{user}/ -user #{homedir_stat.uid} -exec /bin/chown -P --no-dereference #{user} '{}' \\\\;\", 'chown')\n\t\tend\n\n\t\tunless gid_correct\n\t\t\tinvoke_and_log_cmd(\"/usr/bin/find -P /home/#{user}/ -group #{homedir_stat.gid} -exec /bin/chgrp -P --no-dereference #{user} '{}' \\\\;\", 'chgrp')\n\t\tend\n\n\tend", "def revoke_admin\n self.update_attributes(:admin => false)\n end", "def owner\n guest_list = GuestList.find(params[:id])\n guest_list.remove_user_permissions(params[:user_id])\n redirect_to wedding_list_managers_path(guest_list.wedding)\n end", "def admin_deny_user\n @user.destroy\n redirect_to admin_path, notice: \"User Denied and Account Deleted\"\n end", "def delete_workspace_permission(user, workspace)\n # queries on permissions are a bit limited - to only one filter parameter\n query_result = @rally.find(:workspace_permission, :fetch => true, :pagesize => 100) {\n equal :\"user.login_name\", user.login_name\n }\n \n # So now we need to find the exact workspace for all the users workspace_permissions\n workspace_permission = nil\n workspace_permission = query_result.find { |wp| wp.workspace == workspace }\n # delete it if it exists\n if workspace_permission != nil\n workspace_permission.delete\n end\n end", "def drop_privileges(uid, gid, supplementary_groups)\n if ::Process::Sys.geteuid == 0\n uid_num = Etc.getpwnam(uid).uid if uid\n gid_num = Etc.getgrnam(gid).gid if gid\n\n supplementary_groups ||= []\n\n group_nums = supplementary_groups.map do |group|\n Etc.getgrnam(group).gid\n end\n\n ::Process.groups = [gid_num] if gid\n ::Process.groups |= group_nums unless group_nums.empty?\n ::Process::Sys.setgid(gid_num) if gid\n ::Process::Sys.setuid(uid_num) if uid\n ENV['HOME'] = Etc.getpwuid(uid_num).try(:dir) || ENV['HOME'] if uid\n end\n end", "def clear_current_user; end", "def remove_project_admin_auth(project_id_or_key, user_id)\n delete(\"projects/#{project_id_or_key}/administrators\", user_id: user_id)\n end", "def revive\n\t\t@user = User.find(params[:user_id])\n authorize @user\n @user.revive\n\n redirect_to users_path\n\tend", "def setPermissionEdit( other_user )\n return setPermission( other_user, Dfile::PP_MAYEDIT )\n end", "def authorize_deleting\r\n folder = Folder.find_by_id(folder_id)\r\n unless @logged_in_user.can_delete(folder.id)\r\n flash.now[:folder_error] = \"You don't have delete permissions for this folder.\"\r\n redirect_to :controller => 'folder', :action => 'list', :id => folder_id and return false\r\n else\r\n authorize_deleting_for_children(folder)\r\n end\r\n end", "def delete_permission_for_user(user, *permission)\n remove_policy(Util.join_slice(user, *permission))\n end", "def delete_user\n end", "def delete_all_user_permissions\n self.permissions.each do |p|\n if p.contributor_type == 'User'\n p.destroy\n end\n end\n end", "def clean_up_packages!(path, user = 'user')\n send(\"execute_as_#{user}\", \"cd #{path}; rm -rf gitpusshuten-packages\")\n end", "def revoke_session(user)\n\t\[email protected] user\n\tend", "def delete(name)\n handle = system.run!(:search, \"user\", name, nil, @keyring)\n system.run!(:unlink, handle, @keyring)\n end", "def modify_image_launch_perm_remove_users(image_id, user_id=[])\n modify_image_attribute(image_id, 'launchPermission', 'remove', :user_id => user_id.to_a)\n end", "def chown(user_and_group)\n return unless user_and_group\n user, group = user_and_group.split(':').map {|s| s == '' ? nil : s}\n FileUtils.chown user, group, selected_items.map(&:path)\n ls\n end", "def _change_privilege(user, group=user)\n Merb.logger.warn! \"Changing privileges to #{user}:#{group}\"\n\n uid, gid = Process.euid, Process.egid\n\n begin\n target_uid = Etc.getpwnam(user).uid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to user #{user}, does the user exist?\", e)\n return false\n end\n\n begin\n target_gid = Etc.getgrnam(group).gid\n rescue ArgumentError => e\n Merb.fatal!(\"Failed to change to group #{group}, does the group exist?\", e)\n return false\n end\n\n if (uid != target_uid) || (gid != target_gid)\n # Change process ownership\n Process.initgroups(user, target_gid)\n Process::GID.change_privilege(target_gid)\n Process::UID.change_privilege(target_uid)\n end\n true\n rescue Errno::EPERM => e\n Merb.fatal! \"Permission denied for changing user:group to #{user}:#{group}.\", e\n false\n end", "def reset_permissions_for(item)\n item.edit_groups = []\n item.edit_users = []\n item.read_groups = []\n item.read_users = []\n end", "def destroy\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n @user = User.find(params[:id])\n if (@user)\n @user.destroy\n end\n redirect_to :action => 'index'\n else\n redirect_to '/'\n end \n end", "def delete_roles_for_user(user)\n remove_filtered_grouping_policy(0, user)\n end", "def destroy_user\n self.own_children.each do |child|\n unless child.admins.where([\"relations.user_id != ?\", self.id]).any?\n child.destroy_child\n end\n end\n self.destroy\n end", "def require_delete_permission\n unless @folder.is_root? || current_user.can_delete(@folder)\n redirect_to @folder.parent, :alert => t(:no_permissions_for_this_type, :method => t(:delete), :type =>t(:this_folder))\n else\n require_delete_permissions_for(@folder.children)\n end\n end", "def delete_user(username, removehome=false)\n\t\t\tend", "def revoke_user_impersonation_token(user_id, impersonation_token_id)\n delete(\"/users/#{user_id}/impersonation_tokens/#{impersonation_token_id}\")\n end", "def delete_user(user)\n delete user_path(user)\n end", "def remove_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end", "def handle_revoke_permission\n raise ArgumentError, \"Error: trying to revoke permission #{privilege_set_name} for #{pristine_role.name}, but this permission does not exist\" unless cbac_permission_exists?\n\n if pristine_role.role_type == PristineRole.ROLE_TYPES[:context]\n permission = Cbac::Permission.joins(:privilege_set).where(\"cbac_privilege_set.name = ?\", privilege_set_name).where(context_role: pristine_role.name).first\n else\n permission = Cbac::Permission.joins(:generic_role, :privilege_set).where(\"cbac_privilege_set.name = ?\", privilege_set_name).where(\"cbac_generic_roles.name = ?\", pristine_role.name).first\n end\n\n register_change if Cbac::Permission.find(permission.id).destroy\n end", "def deprotect(nick)\n change_permissions(:deprotect, nick)\n end", "def restore_permissions=(_arg0); end", "def restore_permissions=(_arg0); end", "def delete\n # no need to delete all the associations because root_folder.delete does it\n self.root_folder.delete self\n # remove all friendships where the user is the source\n Friendship.all(source_id: self.id).destroy!\n # remove all friendships where the user is the target\n Friendship.all(target_id: self.id).destroy!\n\n # remove all associations where this user receives a file >BY< another user\n SharedToMeAssociation.all(user_id: self.id).destroy!\n # remove all associations where this user shared a file >TO< another user\n SharedByMeAssociation.all(user_id: self.id).destroy!\n\n self.destroy!\n end", "def process_menu_authorization user, items\n to_delete = []\n if items\n for item in items\n if not item.allow_all_access and not user.authorized?(item.controller, item.action)\n to_delete << item\n end\n item.items = process_menu_authorization user, item.items\n end\n items -= to_delete\n end\n items\n end", "def delete\n appctrl_delete( 'User' )\n end", "def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown -R%s %s %s',\n (force ? 'f' : ''),\n (group ? \"#{user}:#{group}\" : user || ':'),\n list.join(' ')) if verbose\n return if noop\n uid = fu_get_uid(user)\n gid = fu_get_gid(group)\n list.each do |root|\n Entry_.new(root).traverse do |ent|\n begin\n ent.chown uid, gid\n rescue\n raise unless force\n end\n end\n end\n end", "def removerole(userrole)\n userrole.delete if userroles.count > 1\n end", "def remove_folder\n space = Space.accessible_by(@context).find(params[:id])\n ids = Node.sin_comparison_inputs(unsafe_params[:ids])\n\n if space.contributor_permission(@context)\n nodes = Node.accessible_by(@context).where(id: ids)\n\n UserFile.transaction do\n nodes.update(state: UserFile::STATE_REMOVING)\n\n nodes.where(sti_type: \"Folder\").find_each do |folder|\n folder.all_children.each { |node| node.update!(state: UserFile::STATE_REMOVING) }\n end\n\n Array(nodes.pluck(:id)).in_groups_of(1000, false) do |ids|\n job_args = ids.map do |node_id|\n [node_id, session_auth_params]\n end\n\n Sidekiq::Client.push_bulk(\"class\" => RemoveNodeWorker, \"args\" => job_args)\n end\n end\n\n flash[:success] = \"Object(s) are being removed. This could take a while.\"\n else\n flash[:warning] = \"You have no permission to remove object(s).\"\n end\n\n redirect_to files_space_path(space)\n end", "def delete\n\t\tcurrent_user\n\t\tcurrent_user.regexpressions.destroy_all\n\t\tcurrent_user.tasks.destroy_all\n\t\tcurrent_user.clouds.destroy_all\n\t\tcurrent_user.platforms.destroy_all\n\t\tcurrent_user.demos.destroy_all\n\t\tcurrent_user.favorites.destroy_all\n\tend", "def remove_admin(arg)\n chg_permission(admins, arg, :remove)\n end", "def authorize_deleting\n unless @logged_in_user.can_delete(folder_id)\n flash.now[:folder_error] = \"You don't have delete permissions for this folder.\"\n redirect_to :controller => 'folder', :action => 'list', :id => folder_id and return false\n end\n end", "def revoke_admin_rights(member)\r\n fail \"#{member.email} is not a admin of this organisation\" unless admins[member.email]\r\n fail \"not enough admins left\" unless self.admin_count > 1\r\n self.admins.delete(member.email)\r\n end", "def local_revoke(peer)\n @var[:revoked] << peer unless @var[:revoked].include?(peer)\n _notice \"You have revoked access to #{peer}\"\n local_rekey('')\nend", "def remove_user_privilege(channel, nick, privilege)\n channel = normalized_channel_name(channel)\n privcode = server_type.privilege.key(privilege).chr if server_type.privilege.value? privilege\n privcode ||= privilege\n mode channel, \"-#{privcode}\", nick\n end", "def unauthorize\n Logger.info \"Cleaning up authorization for #{@registry.prefix}\"\n FileUtils.rm_rf(@gcloud_config_dir) unless @gcloud_config_dir.nil?\n end", "def permission_revoked note, user\n @note = note\n @user = user\n\n mail(to: @user.email, subject: 'Você recebeu um convite para editar uma nota')\n end", "def chown_r(user, group, options={})\n #list = list.to_a\n fileutils.chown_r(user, group, list, options)\n end", "def adjust(path, permissions)\n\n # chowns all run user files to the sftp user\n with_tempfile do |tf|\n sudo(run_user_uid,group_gid) do\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type d > #{tf}\")\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type f >> #{tf}\")\n end\n on_filelist(File.read(tf),run_user_uid) do |p|\n FileUtils.chown( options['sftp_user'], options['group'], p)\n end\n end\n # chmod runs as sftp user, which should own all the relevant files now\n sudo(sftp_user_uid,group_gid) do\n cmd(\"chmod -R #{permissions} #{shellescape(path)}\")\n end\n log \"Adjusted #{path} with #{permissions} and #{options['sftp_user']}:#{options['group']}\"\nrescue => e\n log \"Error while adjusting path #{path}: #{e.message}\"\nend", "def local_remove(body)\n key_hash = _user_keyhash(body)\n raise \"Invalid username\" unless key_hash\n raise \"That user is signed in!\" if @var[:presence][key_hash]\n @connection.comm.rsa_keys.delete(body)\n @connection.comm.names.delete(key_hash)\n @var[:user_keys].delete body\n _save_env\n _notice \"User '#{body}' has been removed from your key repository\"\nend", "def wipe_all\n return unless current_user.user_role.can_delete_users\n\n user_role = UserRole.find_by(name: 'User')\n\n users = user_role.users\n users.each(&:destroy)\n flash[:notice] = 'Sytem Wiped of all normal users'\n redirect_to root_path\n end", "def unauthorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"unauth\", @user, @group)\n end", "def remove_admin(user)\n user = User.get_user(user, client)\n response = client.delete \"/admin/#{user.jid}/?actor_token=#{CGI.escape client.system_token}\"\n if response.success?\n true\n else\n raise APIException.new(response.body)\n end\n end", "def chg_permission(groups, arg, mode)\n arg = UserGroup.one_user(arg) if arg.is_a?(User)\n if (mode == :add) &&\n groups.exclude?(arg)\n groups.push(arg)\n elsif (mode == :remove) &&\n groups.include?(arg)\n groups.delete(arg)\n end\n end", "def disable_ownership\n run_baby_run 'diskutil', ['disableOwnership', self.dev_node], :sudo => true\n end", "def revoke(userid=nil, email=nil) #(userid OR email) required\n end", "def authorize_deleting\n unless current.user.can_delete? folder_id\n flash[:folder_error] = 'You don\\'t have delete permissions for this folder.'\n redirect_to folder_path(folder_id)\n end\n end", "def removeWorkingUser user\n @workingUsers.delete user\n end", "def revoke\n useraccount = Useraccount.find_by_username(params[:username])\n right = Right.find(params[:right_id])\n useraccount.rights.delete(right)\n useraccount.touch # sets useraccount.updated_at to now\n \n redirect_to :action => 'rightassignment', :username => params[:username]\n end", "def delete_user\n begin\n if @kernel_version_major < 11\n guid = @user['generateduid'][0].to_ruby\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n FileUtils.rm_rf(password_hash_file)\n end\n FileUtils.rm_rf(@file)\n rescue Puppet::ExecutionFailure => detail\n fail(\"Could not destroy the user account #{resource[:name]}: #{detail}\")\n end\n end", "def logged_out(user)\n # put perms here that are for logged out users ONLY.\n # if any one should have this perm put it in any_one\n\n # TEAM\n # logged out users (only) can create a team, but only through one\n # specific action (teams#guest_create).\n can :guest_create, Team\n can :guest_update, Team do |team|\n team.founder.nil?\n end\n\n # used when a logged out user has created a team, just before they register\n # and in doing so should become that teams organiser\n can :become_organiser, Team do |team|\n team.founder.nil?\n end\n end", "def clear_user_role_cache\n user&.clear_role_names!\n end", "def rem_admin oid\n self.admins.delete oid\n end", "def change_user!\n tgt_uid = self.target_user.is_a?(Fixnum) ? self.target_user : Etc.getpwnam(self.target_user).uid\n chown_params = [tgt_uid, nil, self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chown'))\n File.lchown *chown_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chown'))\n #DOcumenation for FileUtils.chown_R is wrong (at least for Ubuntu 8.1, takes ID as String.)\n chown_params[1] = chown_params[1].to_s\n FileUtils.chown_R *chown_params\n else\n File.chown *chown_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchown is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change user for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end", "def cancel_user user\n execute { GoGoGibbon::Commands.cancel_user user }\n end", "def revoke(user_id)\n require_user\n\n user = User.find(user_id)\n user.secrets.each do |secret|\n secret.destroy\n end\n\n user.destroy\n end", "def change_privilege\n if Merb::Config[:user] && Merb::Config[:group]\n Merb.logger.verbose! \"About to change privilege to group \" \\\n \"#{Merb::Config[:group]} and user #{Merb::Config[:user]}\"\n _change_privilege(Merb::Config[:user], Merb::Config[:group])\n elsif Merb::Config[:user]\n Merb.logger.verbose! \"About to change privilege to user \" \\\n \"#{Merb::Config[:user]}\"\n _change_privilege(Merb::Config[:user])\n else\n return true\n end\n end", "def remove_user_ban(data); end", "def remove_user_ban(data); end", "def remove_readwrite_user(opts)\n opts = check_params(opts,[:rw_user_info])\n super(opts)\n end", "def change_owner(username, group, path)\n %x(sudo chown -R #{Shellwords.escape(username)}:#{Shellwords.escape(group)} #{path})\n\n $?.success?\n end", "def execute(user, options = {})\n delete_solo_owned_groups = options.fetch(:delete_solo_owned_groups, options[:hard_delete])\n\n unless Ability.allowed?(current_user, :destroy_user, user)\n raise Gitlab::Access::AccessDeniedError, \"#{current_user} tried to destroy user #{user}!\"\n end\n\n if !delete_solo_owned_groups && user.solo_owned_groups.present?\n user.errors[:base] << 'You must transfer ownership or delete groups before you can remove user'\n return user\n end\n\n # Calling all before/after_destroy hooks for the user because\n # there is no dependent: destroy in the relationship. And the removal\n # is done by a foreign_key. Otherwise they won't be called\n user.members.find_each { |member| member.run_callbacks(:destroy) }\n\n user.solo_owned_groups.each do |group|\n Groups::DestroyService.new(group, current_user).execute\n end\n\n namespace = user.namespace\n namespace.prepare_for_destroy\n\n user.personal_projects.each do |project|\n success = ::Projects::DestroyService.new(project, current_user).execute\n raise DestroyError, \"Project #{project.id} can't be deleted\" unless success\n end\n\n yield(user) if block_given?\n\n MigrateToGhostUserService.new(user).execute unless options[:hard_delete]\n\n # Destroy the namespace after destroying the user since certain methods may depend on the namespace existing\n user_data = user.destroy\n namespace.destroy\n\n user_data\n end" ]
[ "0.65115905", "0.6319871", "0.6299845", "0.6263596", "0.62233466", "0.61437553", "0.61226535", "0.6064314", "0.60449004", "0.60337406", "0.600585", "0.5873958", "0.58720857", "0.58468723", "0.58057785", "0.58057785", "0.58040315", "0.57888716", "0.5787666", "0.5762418", "0.57521504", "0.5745588", "0.57451797", "0.5742809", "0.57395864", "0.5720618", "0.5717186", "0.570869", "0.5707036", "0.5695216", "0.5681445", "0.5678035", "0.5665372", "0.56587464", "0.5654638", "0.56500244", "0.5649768", "0.56453604", "0.5641339", "0.5640685", "0.5632888", "0.56313443", "0.56299555", "0.56155354", "0.56104696", "0.5599043", "0.55860704", "0.5585313", "0.5574507", "0.5560371", "0.5541317", "0.55398476", "0.55214965", "0.5514689", "0.5483761", "0.5483066", "0.5478316", "0.5474252", "0.546928", "0.5461396", "0.54608905", "0.54602444", "0.5459332", "0.5457437", "0.5446184", "0.5442845", "0.5439959", "0.5439312", "0.54328924", "0.54291", "0.5416734", "0.54157346", "0.5406679", "0.5397955", "0.53902924", "0.538828", "0.5387087", "0.53865343", "0.53858215", "0.53824365", "0.537312", "0.53703153", "0.53682333", "0.53680414", "0.5359989", "0.5359494", "0.5353755", "0.5350419", "0.53501666", "0.5347771", "0.5345307", "0.5326805", "0.5324645", "0.5319215", "0.5318214", "0.53174084", "0.53174084", "0.52953094", "0.52899724", "0.52893275" ]
0.5345394
90
Returns a permission list for the given folder.
def getacl url = prefix + "getacl" return response(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_permissions\n BrickFTP::API::Permission.all\n end", "def list_permissions\n BrickFTP::API::Permission.all\n end", "def all_permissions\n array = []\n @permissions.each { |_, permission| array << permission }\n @groups.each do |_, group|\n group.all_permissions.each do |permission|\n array << permission\n end\n end\n array\n end", "def get_permissions\n permissions.keys\n end", "def get_permissions\n permissions.keys\n end", "def get_list_folders()\n\t\trefresh_access_token()\n\t\trequest_url = \"https://www.googleapis.com/drive/v2/files?q=mimeType='application/vnd.google-apps.folder'&access_token=#{@access_token}\"\n\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\t\tfolders = Hash.new\n\n\t\tresponse_body['items'].each do |item|\n\t\t\tfolders[item['title']] = item['id']\n\t\tend\n\n\t\treturn folders\n\tend", "def get_list_files_folder(*folder_name)\n\n\t\tfiles = Array.new\n\t\tif (folder_name.length==0)\n\t\t\tfolders = get_list_folders()\n\t\t\t#Give the folder you want to use otherwise we'll have to loop through\n\t\t\tfolder_id = folders['Adwords']\n\t\t\trefresh_access_token()\n\n\t\t\trequest_url = \"https://www.googleapis.com/drive/v2/files/#{folder_id}/children?access_token=#{@access_token}\"\n\t\t\tresponse = RestClient.get request_url\n\t\t\tresponse_body = JSON.parse(response.body)\n\t\t\t#puts pp(response_body)\n\n\t\t\tresponse_body['items'].each do |item|\n\t\t\t\tfiles.push(item['id'])\n\t\t\tend\n\n\t\t\treturn files\n\t\tend\n\tend", "def index\n @folder_types = current_user.folder_types\n end", "def list(folder)\n\t\tc = 0\n\t\tfolder = '/' + folder\t\t\t\n\t\tresp = @client.metadata(folder)\n\t\tputs \"\\n List of contents in \" + folder + \"\\n\"\n\t\tfor item in resp['contents']\t\t\n\t\t\tputs item['path']\n\n\t\t\tc=c+1\n\t\tend\t\n\t\t\n\tend", "def all_permissions\n permissions = Array.new\n \n all_roles.each do |role|\n permissions.concat(role.permissions)\n end\n \n return permissions\n end", "def folder_list(opts = {})\n optional_inputs = {\n include_deleted: false,\n include_media_info: false,\n }.merge(opts)\n input_json = {\n id: optional_inputs[:id],\n path: optional_inputs[:path],\n include_deleted: optional_inputs[:include_deleted],\n include_media_info: optional_inputs[:include_media_info],\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/folder_list\", input_json)\n Dropbox::API::FolderAndContents.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def list(current_folder)\n # Ensure API availability\n api.call(\"system\", \"greet\")\n\n api.call(files_project, \"listFolder\", { folder: current_folder, only: 'folders' })\n end", "def get_permissions(poll_path, polls = read_polls_data)\n if signed_in?\n @user.permissions(poll_path, polls)\n else\n []\n end\n end", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def folder_permissions_groups_only\n @attributes[:folder_permissions_groups_only]\n end", "def extended_folder_permissions\n @attributes[:extended_folder_permissions]\n end", "def folders\n html = http_request(@uri + '/wato.py', {\n folder: '',\n mode: 'folder',\n }, false)\n html.split(/\\n/).each do |line|\n next unless line =~ /class=\"folderpath\"/\n end\n res = []\n html.split(/\\n/).grep(/mode=editfolder/).each do |line|\n line =~ /folder=(.*?)'/\n res.push $1 unless $1.nil?\n end\n res\n end", "def getPermissions\n perms = []\n perms.push :disseminate if params[:disseminate_perm] == \"on\"\n perms.push :withdraw if params[:withdraw_perm] == \"on\"\n perms.push :peek if params[:peek_perm] == \"on\"\n perms.push :submit if params[:submit_perm] == \"on\"\n perms.push :report if params[:report_perm] == \"on\" \n perms \n end", "def all_chanperms\n Ricer::Irc::Chanperm.where(:user_id => self.id)\n end", "def list_folders\n http_get(:uri=>\"/folders\", :fields=>x_cookie)\n end", "def index\n @folders = Folder.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @folders }\n end\n end", "def find_permissions_from_path(path)\n unless path.is_a?(String) && path.length > 0\n raise PermissionNotFoundError, \"Must provide a permission path\"\n end\n\n path_parts = path.split('.').map(&:to_sym)\n last_group_or_permission = self\n while part = path_parts.shift\n if part == :*\n if path_parts.empty?\n # We're at the end of the path, that's an acceptable place for a wildcard.\n # Return all the permissions in the final group.\n return last_group_or_permission.permissions.values\n else\n raise Error, \"Wildcards must be placed at the end of a permission path\"\n end\n elsif part == :** && path_parts[0] == :*\n # If we get a **.* wildcard, we should find permissions in the sub groups too.\n return last_group_or_permission.all_permissions\n else\n last_group_or_permission = last_group_or_permission.group_or_permission(part)\n if last_group_or_permission.is_a?(Permission) && !path_parts.empty?\n raise Error, \"Permission found too early in the path. Permission key should always be at the end of the path.\"\n elsif last_group_or_permission.nil?\n raise PermissionNotFoundError, \"No permission found matching '#{path}'\"\n end\n end\n end\n\n if last_group_or_permission.is_a?(Permission)\n [last_group_or_permission]\n else\n raise Error, \"Last part of path was not a permission. Last part of permission must be a path\"\n end\n end", "def folders_listing path\n cmd = \"find #{path} -type d \"\n if @folder_regexp\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@folder_regexp}\\\"\"\n end\n folders = exec_cmd(cmd)\n folders\n end", "def folder_feeds(folder, include_read: false)\n FolderManager.folder_feeds folder, self, include_read: include_read\n end", "def can_read?(folder_id)\n administrator? or\n permissions.for_read.exists? :folder_id => folder_id\n end", "def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end", "def permissions\n [\"read_permissions\", \"update_permissions\", \"delete_permissions\"].each do |p|\n perms = self.send(p)\n perm_string = []\n AssetPermission::GROUP.each do |g, v|\n if perms & AssetPermission::GROUP[g] > 0\n perm_string << g\n end\n end\n puts \"#{self.name}: #{p}: #{perm_string.join(',')}\"\n end\n end", "def list_folder_behaviors(path:)\n BrickFTP::API::FolderBehavior.all(path: path)\n end", "def list_folder_behaviors(path:)\n BrickFTP::API::FolderBehavior.all(path: path)\n end", "def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end", "def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end", "def get_all_folderdata_for_folder_id(folder_id)\n return $db.execute(\"SELECT * FROM folders WHERE folder_id = ?\", folder_id)\nend", "def all_permissions( privilege, klass )\n\n class_perms = self.perms_for_class( klass.name ) || {}\n all_perms = class_perms[ privilege ] || []\n\n if !class_perms[ :any ].nil?\n all_perms = all_perms + class_perms[ :any ]\n end\n\n return all_perms\n\n end", "def list\r\n # Get the folder\r\n @folder = Folder.find_by_id(folder_id)\r\n\r\n # Set if the user is allowed to update or delete in this folder;\r\n # these instance variables are used in the view.\r\n @can_update = @logged_in_user.can_update(@folder.id)\r\n @can_delete = @logged_in_user.can_delete(@folder.id)\r\n\r\n # determine the order in which files are shown\r\n file_order = 'filename '\r\n file_order = params[:order_by].sub('name', 'filename') + ' ' if params[:order_by]\r\n file_order += params[:order] if params[:order]\r\n\r\n # determine the order in which folders are shown\r\n folder_order = 'name '\r\n if params[:order_by] and params[:order_by] != 'filesize' \r\n folder_order = params[:order_by] + ' '\r\n folder_order += params[:order] if params[:order]\r\n end\r\n\r\n # List of subfolders\r\n @folders = @folder.list_subfolders(@logged_in_user, folder_order.rstrip)\r\n\r\n # List of files in the folder\r\n @myfiles = @folder.list_files(@logged_in_user, file_order.rstrip)\r\n\r\n #get the correct URL\r\n url = url_for(:controller => 'folder', :action => 'list', :id => nil)\r\n\r\n # it's nice to have the possibility to go up one level\r\n @folder_up = '<a href=\"' + url + '/' + @folder.parent.id.to_s + '\">..</a>' if @folder.parent\r\n end", "def index\n\t\t@permissions = (session[:list_id]) ? Permission.find_all_by_list_id(session[:list_id]) : Permission.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml\t{ render :xml => @permissions }\n\t\tend\n\tend", "def permissions_for(game)\n self.permissions.where(\"user_roles.game_id = ?\", game.id)\n end", "def retrieve_permissions(file_id)\n\t\t@client ||= api_client()\n\n\t api_result = @client.execute(\n\t :api_method => @drive.permissions.list,\n\t :parameters => { 'fileId' => file_id })\n\t if api_result.status == 200\n\t permissions = api_result.data\n\t permissions.items.each do |perm|\n\t \tif perm['role'] == 'owner'\n\t \t\tRails.logger.info \"Found Permission #{perm['id']}\"\n\t \t\treturn perm['id']\n\t \tend\n\t end\n\t else\n\t Rails.logger.info \"An error occurred: #{api_result.data['error']['message']}\"\n\t end\n\n\t return false\n\tend", "def core_getUsersPermissions\n # definisco permessi iniziali\n initial_permissions = (1...11).to_a\n\n unpermitted = core_getHideUsersPermissionsSettings\n permitted_permissions = initial_permissions\n permitted_permissions = initial_permissions - unpermitted if unpermitted\n\n permissions = []\n names = core_getUsersPermissionsNamesSettings\n return permitted_permissions if !names\n\n permitted_permissions.each do |permission|\n names.each do |name|\n permissions.push([permission, name.last]) if permission === name.first.to_i\n end\n end\n\n return permissions\n end", "def call(path: nil)\n endpoint = '/api/rest/v1/permissions.json'\n endpoint = \"#{endpoint}?path=#{ERB::Util.url_encode(path)}\" unless path.nil?\n res = client.get(endpoint)\n\n res.map { |i| BrickFTP::Types::Permission.new(**i.symbolize_keys) }\n end", "def allowed_acl(sid, expected_perms, flags = 0)\n acl = [ ACE.access_allowed(sid, expected_perms[:specific], flags) ]\n if expected_perms[:generic]\n acl << ACE.access_allowed(sid, expected_perms[:generic], (Chef::ReservedNames::Win32::API::Security::SUBFOLDERS_AND_FILES_ONLY))\n end\n acl\n end", "def index\n @folders = @user.folders.all\n end", "def custom_permissions\n discover_permissions\n export_sets_permissions\n batches_permissions\n preservation_events_permissions\n end", "def get_folder_files(folder_path)\n ensure_file_open!\n @file.glob(\"#{folder_path}/**/*\").to_h do |entry|\n entry_file_name = Pathname.new(entry.name)\n file_name = entry_file_name.relative_path_from(folder_path)\n [file_name, entry.get_input_stream(&:read)]\n end\n end", "def get_entries(dir, subfolder); end", "def copy_permissions_to_new_folder(folder)\r\n # get the 'parent' GroupPermissions\r\n GroupPermission.find_all_by_folder_id(folder_id).each do |parent_group_permissions|\r\n # create the new GroupPermissions\r\n group_permissions = GroupPermission.new\r\n group_permissions.folder = folder\r\n group_permissions.group = parent_group_permissions.group\r\n group_permissions.can_create = parent_group_permissions.can_create\r\n group_permissions.can_read = parent_group_permissions.can_read\r\n group_permissions.can_update = parent_group_permissions.can_update\r\n group_permissions.can_delete = parent_group_permissions.can_delete\r\n group_permissions.save\r\n end\r\n end", "def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end", "def access_rights_for_permission(perm)\n sym = Lockdown.get_symbol(perm)\n\n permissions[sym]\n rescue \n raise SecurityError, \"Permission requested is not defined: #{sym}\"\n end", "def perms_for(pathname, options = {})\n if @permissions.nil?\n @permissions = {}\n# find root name and get all rules, that are for descendent of root.\n# There can be more than one root, because each site can have its own root\n root = pathname.root.to_s.sub(Rails.root.join('public').to_s,'')\n DcFolderPermission.where(folder_name: /#{root}*/).sort(folder_name: 1).each do |permission|\n folder = permission.folder_name.sub(root,'')\n folder.gsub!(/^\\/|\\/$/, '')\n# root is always ., remove leading and trailing /\n folder = '.' if folder.blank?\n# no rights by default. \n h = {read: false, write: false, rw: false, inherited: permission.inherited}\n# go through policy_rules and set rights if role matches rules role \n permission.dc_policy_rules.each do |r|\n @options[:user_roles].each do |role|\n next unless role == r.dc_policy_role_id\n h[:read] ||= r.permission > 0\n h[:write] ||= r.permission > 1\n h[:rw] ||= r.permission > 8\n end\n @permissions[folder] = h \n end\n end\n end\n# create response. First check for defaults of root folder\n response = {}\n response[:read] = pathname.exist? && @permissions['.'][:read]\n response[:write] = pathname.exist? && @permissions['.'][:write]\n response[:rm] = !pathname.is_root? && @permissions['.'][:rw]\n dir = ''\n# go through every subfolder part. Policy is: if right has been revoked on \n# parent folder it can't be set on child unless inherited is false.\n pathname.path.to_s.split('/').each do |path|\n dir << (dir.size > 0 ? '/' : '') + path\n pe = @permissions[dir]\n next if pe.nil? # ignore if not set\n if pe[:inherited]\n response[:read] &&= pe[:read]\n response[:write] &&= pe[:write]\n response[:rm] &&= pe[:rw]\n else\n response[:read] = pe[:read]\n response[:write] = pe[:write]\n response[:rm] = pe[:rw]\n end \n end\n response[:hidden] = false\n response\nend", "def show\n @all_permissions = Permission.all\n end", "def get_current_permissions\n sd = get_security_descriptor(DO_NOT_REFRESH_SD)\n permissions = []\n unless sd.nil?\n permissions if sd.dacl.nil?\n sd.dacl.each do |ace|\n permissions << Puppet::Type::Acl::Ace.new(convert_to_permissions_hash(ace), self)\n end\n end\n permissions\n end", "def permissions(poll_path, polls = read_polls_data)\n poll = Poll.new(poll_path, polls)\n\n permissions = []\n\n permissions.push('vote') unless votes[poll.id]\n permissions.push('delete') if can_delete?(poll)\n permissions.push('reset') if username == 'admin'\n\n permissions\n end", "def list(path=nil)\n remote_path = list_path(path)\n begin\n folder = @client.folder(remote_path)\n raise Error if folder.nil?\n folder.items.map do |elem|\n {\n name: elem.name,\n path: \"#{remote_path}/#{elem.name}\",\n type: elem.type\n }\n end\n rescue RubyBox::AuthError\n box_error\n end\n end", "def permissions\n return @permissions\n end", "def folder_entries(folder, include_read: false, page: nil)\n EntriesPagination.folder_entries folder, self, include_read: include_read, page: page\n end", "def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end", "def list(path='root')\n puts \"#list('#{path}')\"\n listed_files =[]\n @drive.folder = path\n children = @drive.children\n list_files_metadata(children)\n raise 'There are no files in directory' if children.count < 1\n children.each do |item|\n listed_files << \"#{item.path.gsub('/drive/', 'drive/')}/#{item.name}\" unless item.folder?\n end\n @logger.info 'Children list acquired.'\n pp listed_files\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::AccountPermissionListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"AccountPermissions.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.permissions.each do |plumbing_item|\n g.yield Plumbing::convert_account_permission_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def permissions\n User.do_find_permissions session_id: kb_session_id\n end", "def find_permissions\n\n return nil if @user.admin?\n\n groupnames = Group.find_groups(@user)\n\n StorePermission.find_all_by_groupname(groupnames).inject({}) do \n |result, permission|\n\n result[permission.storename] = permission\n result\n end\n end", "def give_permissions_to_folders(group, permission_to_everything)\n Folder.find(:all).each do |folder|\n add_to_group_permissions(group, folder, permission_to_everything)\n end\n end", "def list_subfolders(logged_in_user, order)\n folders = []\n if logged_in_user.can_read(self.id)\n self.children.find(:all, :order => order).each do |sub_folder|\n folders << sub_folder if logged_in_user.can_read(sub_folder.id)\n end\n end\n\n # return the folders:\n return folders\n end", "def authorize_reading\n unless current.user.can_read? folder_id\n flash[:folder_error] = 'You don\\'t have read permissions for this folder.'\n redirect_to root_path\n end\n end", "def authorize_reading\n unless @logged_in_user.can_read(folder_id)\n flash.now[:folder_error] = \"You don't have read permissions for this folder.\"\n redirect_to :controller => 'folder', :action => 'list', :id => nil and return false\n end\n end", "def get_permission_list\n db = open_rds_db();\n result = db.query(\"SELECT * FROM autoretouch.Permission_List\");\n result.each do |row|\n puts row\n end\n db.close();\n end", "def folders\n ContextIO::Folder.all(@account_id, @label)\n end", "def permissions\n if @permissions.nil?\n perm_array = []\n roles.each { |r| perm_array << r.permission_ids }\n @permissions = perm_array.flatten.uniq\n else\n @permissions\n end\n end", "def permissions_assignable_for_user(usr)\n return [] if usr.nil?\n if administrator?(usr)\n get_permissions.collect do |k| \n ::Permission.find_by_name(Lockdown.get_string(k))\n end.compact\n else\n user_groups_assignable_for_user(usr).collect do |g| \n g.permissions\n end.flatten.compact\n end\n end", "def permissions\n read_attribute(:permissions) || {}\n end", "def folder_names\n names = []\n frm.table(:class=>/listHier lines/, :text=>/Title/).rows.each do |row|\n next if row.td(:class=>\"specialLink\").exist? == false\n next if row.td(:class=>\"specialLink\").link(:title=>\"Folder\").exist? == false\n names << row.td(:class=>\"specialLink\").link(:title=>\"Folder\").text\n end\n return names\n end", "def get_permissions who, resource_tree\n who = get_group(who) unless who.is_a?(Group)\n \n last_resource = resource_tree.last\n \n # go down the resource tree to determine the permissions\n resource_tree.each do |resource|\n raise \"unknown resource\" unless resource\n \n # get permissions to resource\n r = w = x = false\n\n ownership = belongs_to_group?(who, resource.owner_uuid)\n\n get_permissions_by_resource(resource).each do |permission|\n next unless belongs_to_group?(who, permission.group_uuid, ownership)\n\n # group has effect on permissions\n r = true if permission.is_readable\n w = true if permission.is_writable\n x = true if permission.is_executable\n end\n \n # return permissions of resource if last\n return [r,w,x] if last_resource == resource\n \n # no read permission => no permission to browse further\n return [false, false, false] unless r\n end\n \n raise \"internal error\"\n end", "def folder\n @folders[@folder_name]\n end", "def index\n @role_permissions = RolePermission.all\n end", "def permissions_assignable_for_user(usr)\n return [] if usr.nil?\n if administrator?(usr)\n get_permissions.collect{|k| Permission.find_by_name(Lockdown.get_string(k)) }.compact\n else\n user_groups_assignable_for_user(usr).collect{|g| g.permissions}.flatten.compact\n end\n end", "def index\n @permissions = Permission.all\n end", "def get_specific_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def findProjectPermissions(workspace, user)\n query_result = @rally.find(:project_permission, :fetch => true, :pagesize => 100) {\n equal :\"user.login_name\", user.login_name\n }\n \n projectPermissions = []\n query_result.each { |pp|\n if ( pp.project.workspace == workspace)\n projectPermissions.push(pp)\n end\n }\n projectPermissions\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n return @account_permissions.list(\n filter,\n *args,\n deadline: deadline,\n )\n end", "def perms\n if @perms.nil?\n @perms = {}\n permissions = ['comment', 'edit', 'reassign', 'prioritize', 'close', 'milestone']\n permissions.each do |p|\n if @task.project_id.to_i == 0 || current_user.can?(@task.project, p)\n @perms[p] = {}\n else\n @perms[p] = { :disabled => 'disabled' }\n end\n end\n\n end\n\n @perms\n end", "def permissions = {}", "def permissions\n\t\tauthorize @user\n\t\t@permissions = []\n\t\tonly_theirs = \"Only theirs\"\n\t\tyes = \"Yes\"\n\t\tno = \"No\"\n\t\tnames = [\"View positions\", \"Create positions\", \"Edit positions\", \"Delete positions\",\n\t\t \"Apply\", \"View applications\", \"Edit applications\", \"Delete applications\",\n\t\t \"Change application submission status\"]\n\t\tadmin_permissions = [yes, yes, yes, yes, yes, \"All\", yes, yes, yes]\n\t\tmod_permissions = [yes, no, yes, no, yes, \"All but incomplete\", only_theirs, only_theirs, yes]\n\t\tuser_permissions = [yes, no, no, no, yes, only_theirs, only_theirs, only_theirs, no]\n\t\tnames.each_with_index do |permission, index|\n\t\t\t@permissions << { name: names[index], admin: admin_permissions[index], mod: mod_permissions[index], user: user_permissions[index]}\n\t\tend\n\n @title = 'Permissions'\n\tend", "def get_folder(folder_id)\n @folders[folder_id]\n end", "def get_folder(folder_id)\n @folders[folder_id]\n end", "def list_boxes\r\n command = 'List-Folder'\r\n execute_outlook_script(command)\r\n end", "def update_permissions\r\n if request.post? and @logged_in_user.is_admin?\r\n # update the create, read, update, delete right for this folder:\r\n update_group_permissions(folder_id, params[:create_check_box], 'create', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:read_check_box], 'read', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:update_check_box], 'update', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:delete_check_box], 'delete', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n end\r\n\r\n # Return to the folder\r\n redirect_to :action => 'list', :id => folder_id\r\n end", "def index\n @group_repo_permissions = GroupRepoPermission.all\n end", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= '/'\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n\n begin\n api_result = @client.metadata(result[:folder_id], 1000, true)\n rescue\n return nil\n end\n \n if api_result.present? && api_result['contents'].present?\n api_result['contents'].each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n end\n \n result\n end", "def get_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def get_permissions (user, store_name)\n s = \"\"\n [ :read, :write, :delegate ].each do |action|\n s << action.to_s[0, 1] \\\n if @auth_system.authorized?(user, store_name, action)\n end\n s\n end", "def permissions_for_user_group(ug)\n sym = Lockdown.get_symbol(ug)\n perm_array = [] \n\n if has_user_group?(sym)\n permissions = user_groups[sym] || []\n else\n if ug.respond_to?(:permissions)\n permissions = ug.permissions\n else\n raise GroupUndefinedError, \"#{ug} not found in init.rb and does not respond to #permissions\"\n end\n end\n\n\n permissions.each do |perm|\n perm_sym = Lockdown.get_symbol(perm)\n\n unless permission_exists?(perm_sym)\n msg = \"Permission associated to User Group is invalid: #{perm}\"\n raise SecurityError, msg\n end\n\n perm_array << perm_sym\n end\n\n perm_array \n end", "def index\n @rolepermissions = Rolepermission.all\n end", "def get_folders(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'Folder deletion was successful.'\n grafana_options[:unknown_code_msg] = 'FolderApi::get_folder_by_uid unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/folders'\n\n folder_list = []\n Array(do_request(grafana_options)).each do |folder|\n folder_list.insert(-1, get_folder(folder, grafana_options))\n end\n folder_list\n end", "def folder\n connection.directories.get(folder_name)\n end", "def get_list(dir = nil)\n @ftp.ls(dir)[3..-1]\n end", "def index\n @folders = current_user.folders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @folders }\n end\n end", "def permission_checks(permission)\n keys = []\n\n if permission.action\n # Add '<kind>:<name>:<action>'\n keys << [ permission.kind, permission.name, permission.action ].join(':')\n\n # Add '<kind>:all(:<action>'\n keys << [ permission.kind, 'all', permission.action ].join(':')\n end\n\n # Add '<kind>:<name>'\n keys << [ permission.kind, permission.name ].join(':')\n\n # Add '<kind>:all'\n keys << [ permission.kind, 'all' ].join(':')\n\n # Add 'all'\n keys << 'all'\n\n keys\n end", "def updatedb_search_permissions(perms)\n file_list = []\n updatedb.each_pair do | file, meta |\n if meta\n permissions = meta.split(\" \")[0]\n if permissions.match(perms)\n file_list << file\n end\n end\n end\n file_list\n end", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= self.get_root_folder_id\n return nil if params[:folder_id].blank?\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n parameters = {}\n parameters['q'] = \"'#{params[:folder_id]}' in parents\"\n parameters['maxResults'] = result[:per_page]\n \n # Make api request\n begin\n drive = @client.discovered_api('drive', 'v2')\n api_result = @client.execute(:api_method => drive.files.list, :parameters => parameters)\n rescue\n return nil\n end\n \n \n if api_result.status == 200\n files = api_result.data\n files.items.each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n else\n result[:error] = {:code => api_result.status, :message => api_result.data['error']['message']} \n end\n result\n end", "def index\n @project_permissions = ProjectPermission.all\n end", "def permissions(username,path)\n # walk the path from the most specific to the least specific scanning the\n # rules at each way point, capturing any explicit user name match and merging\n # any matching group permissios. The first such match is the result\n #\n repo , dir = path.split(':')\n @path_routes.each do |point|\n next if !(path =~ /^#{point}/) && !(dir =~ /^#{point}/)\n gperms = []\n uperms = nil\n @paths[point].each do |selector,rule|\n fail \"Syntax error #{selector}='#{rule}'\" if rule.tr('^rw','')!=rule\n p = (rule=='rw')? ['r', 'w'] : [rule]\n if username==selector || @aliases[username]==selector\n uperms = p # user permssion\n elsif user_included?(username,selector)\n gperms |= p # group permission\n end\n end\n gperms |= [uperms] if !uperms.nil? # user perms extend group perms\n return gperms.sort.join('') if !gperms.empty?\n end\n '' # no matching rule\n end", "def get_files(site, folder)\n files = []\n Dir.chdir(File.join(site.source, folder)) { files = filter_entries(Dir.glob('**/*.*')) }\n files\n end", "def index\n @folders = UploadFolder.all(:include=>:upload_files)\n\t\tauthorize! :update, UploadFolder\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @folders }\n end\n end" ]
[ "0.6720204", "0.6720204", "0.62427324", "0.6049742", "0.6049742", "0.6039531", "0.5996304", "0.589349", "0.58625734", "0.5857898", "0.5839366", "0.5838928", "0.5835058", "0.583343", "0.5824475", "0.5774759", "0.5771925", "0.5760927", "0.57548547", "0.57547843", "0.57204574", "0.57105154", "0.5701764", "0.5684166", "0.5681422", "0.56745666", "0.56538004", "0.5590675", "0.55898035", "0.55742115", "0.55652446", "0.5545781", "0.55353826", "0.55260116", "0.5515738", "0.54967105", "0.54888314", "0.548348", "0.54695475", "0.5466105", "0.54630154", "0.5459569", "0.54587185", "0.5446745", "0.544001", "0.5432472", "0.5432269", "0.5426978", "0.5425972", "0.5408111", "0.540607", "0.5402702", "0.53969526", "0.5366528", "0.5355696", "0.5348557", "0.5347463", "0.5347135", "0.53324676", "0.53290147", "0.53223085", "0.53206503", "0.53167105", "0.5302353", "0.5285376", "0.52833456", "0.5272543", "0.52675056", "0.5256536", "0.5254004", "0.525298", "0.52514464", "0.52481616", "0.52416635", "0.524042", "0.5223913", "0.52232295", "0.5222437", "0.52152795", "0.52145636", "0.5208864", "0.5208864", "0.5193611", "0.5183202", "0.5178288", "0.5174087", "0.51732457", "0.5173205", "0.5162809", "0.5161981", "0.51492906", "0.51335484", "0.51328593", "0.5126134", "0.512063", "0.5120382", "0.51146626", "0.5114413", "0.5109967", "0.51063406", "0.5105696" ]
0.0
-1
populates Folder.children list. Can be done at initialize using include_children=true
def fetch_children @children = [] for item in self.listex if item["type"] == "folder" and item["id"]!=@id #sharefile API includes self in list @children << Folder.new(item["id"], @authid, @subdomain, false, item) elsif item["type"] == "file" @children << File.new(item["id"], @authid, @subdomain, item) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_children(accummulator=[])\n return accummulator if children.size == 0\n children.each do |child_id|\n child = Folder.get(child_id)\n accummulator << child\n child.all_children(accummulator)\n end\n accummulator\n end", "def fetch_children\n @children = []\n for item in self.listex\n if item[\"type\"] == \"folder\" and item[\"id\"]!=@id #sharefile API includes self in list\n @children << ShareFolder.new(item[\"id\"], @authid, false, item)\n elsif item[\"type\"] == \"file\"\n @children << ShareFile.new(item[\"id\"], @authid, item)\n end\n end\n end", "def children\n return @children unless @children.nil?\n @children = if exists? && directory?\n Dir.glob( File.join(absolute_path,'*') ).sort.map do |entry|\n git_flow_repo.working_file(\n entry.gsub( /^#{Regexp.escape absolute_path}/, tree )\n )\n end\n else\n false\n end\n end", "def children\n return @children if [email protected]?\n @children = all_children.find_all{|collection| collection.url.count('/') == self.url.count('/') + 1}\n end", "def children\n @children ||= []\n end", "def _children\n @children\n end", "def build_subtree(folder, include_files = true)\n folder_metadata = {}\n folder_metadata['subfolders'] = (folder.is_virtual? ?\n folder.subfolders : MaterialFolder.accessible_by(current_ability).where(:parent_folder_id => folder))\n .map { |subfolder|\n build_subtree(subfolder, include_files)\n }\n if (folder.parent_folder == nil) and not (folder.is_virtual?) then\n folder_metadata['subfolders'] += virtual_folders.map { |subfolder|\n build_subtree(subfolder, include_files)\n }\n end\n\n folder_metadata['id'] = folder.id\n folder_metadata['name'] = folder.name\n folder_metadata['url'] = folder.is_virtual? ? course_material_virtual_folder_path(@course, folder) : course_material_folder_path(@course, folder)\n folder_metadata['parent_folder_id'] = folder.parent_folder_id\n folder_metadata['count'] = folder.files.length\n folder_metadata['is_virtual'] = folder.is_virtual?\n if include_files then\n folder_metadata['files'] = (folder.is_virtual? ?\n folder.files : Material.accessible_by(current_ability).where(:folder_id => folder))\n .map { |file|\n current_file = {}\n\n current_file['id'] = file.id\n current_file['name'] = file.filename\n current_file['description'] = file.description\n current_file['folder_id'] = file.folder_id\n current_file['url'] = course_material_file_path(@course, file)\n\n if not(folder.is_virtual? || @curr_user_course.seen_materials.exists?(file.id)) then\n current_file['is_new'] = true\n folder_metadata['contains_new'] = true\n end\n\n current_file\n }\n end\n\n folder_metadata\n end", "def all_children\n @all_children ||= children + children.inject([]) {|records, child| records + child.all_children}\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def children\n # Check to see whether dir exists.\n Slimdown::Folder.new(@absolute_path.chomp('.md')).pages\n end", "def children( with_directory = ( self != '.' ) )\n ( Dir.entries( expand_tilde ) - DOTS ).map do | entry |\n with_directory ? join( entry ) : self.class.new( entry )\n end\n end", "def child_items\n items = []\n if dir?\n @path.sort_files(@path.children).each do |child|\n if child.directory?\n child = Path.new(child.to_s)\n end\n items << Item.new(child)\n end\n return items\n end\n nil\n end", "def child_folder_list(parent_folder)\n if parent_folder.child_folder_count == 0\n [parent_folder]\n else\n # recurse over the children to find all descendants\n children = parent_folder.find_folders(FolderView.new(parent_folder.child_folder_count)).folders\n children.flat_map(&method(:child_folder_list)).unshift(parent_folder)\n end\n end", "def get_children\n \t@children\n end", "def get_children\n @children\n end", "def multiple_children(paths)\n end", "def add_children children\n children.each { |child| add_child child }\n end", "def all_children\n return @all_children if !@all_children.nil?\n @all_children = PhotoCollection.all_urls.find_all{|url| url[self.url] && url != self.url}.collect{|url| PhotoCollection.find_by_url(url)}\n end", "def children\n @id = fix_id(params[:id], params[:format], params[:extra])\n if params[:root]==\"source\" then\n @isRoot = true;\n @work = DcmWork.new(@id)\n @children = [@work.pi]\n else\n @isRoot = false;\n @children = get_children(\"nla.\"+params[:root])\n end\n render :action => \"children.json\"\n end", "def children\n _children\n end", "def download_children(children, path)\n children.each do |child|\n new_path = \"#{path}/#{child.title}\"\n backup_folder_rec child.id, new_path if child.mimeType == FOLDER\n download_if_allowed_child child, new_path\n end\n end", "def children\n @children ||= {}.with_indifferent_access\n end", "def get_children_folders(folder_id)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/children\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n response = http.request(request)\n\n folders_json = ''\n\n if response.code == 200.to_s\n folders_json = JSON.parse(response.read_body)['data']\n else\n puts \"Problem with getting folders. Status: #{response.code}\"\n puts response.body\n end\n folders_json\nend", "def create_child_items\n category.path.each do |category|\n create_child_item_for_category category\n end\n end", "def get_entries(dir, subfolder); end", "def all_children\n children(all: true)\n end", "def add_folder_recursive(folder_params)\n folder = browse(folder_params[:foreign_ref])\n\n # prepare file array\n files = []\n\n folder.each do |child|\n # prepare child parameters\n child_params = extract_file_params(child)\n # check if it is a directory or not\n if is_dir?(child)\n # concat merges two arrays, use extract method below\n files.concat(add_folder_recursive(child_params))\n else\n # add new file\n files << add_file(child_params)\n end\n end\n\n # return list of added files\n files\n end", "def children; []; end", "def children(options = {})\n children = get_children(\"directory\").collect { |child| Dirk.new(child) }\n children.reject! { |child| child.published == false || child.draft == true }\n children.sort! { |a, b| a.send(options[:sort]).to_s <=> b.send(options[:sort]).to_s } if options[:sort]\n children.reverse if options[:order].to_s.upcase == \"DESC\"\n children\n end", "def with_children\n [self].tap do |self_with_children|\n if children\n self_with_children.concat(child_nodes)\n end\n end\n end", "def children\n @root.children & @initial_contents\n end", "def descendants\n self.subfolders.collect do |s|\n [s] + s.descendants\n end.flatten\n end", "def children() []; end", "def walk\n FileTreeProfiler.monitor_report(:profile, :dir, path)\n @children = []\n Dir.foreach(path) do |entry|\n next if (entry == '..' || entry == '.')\n full_path = ::File.join(path, entry)\n if ::File.directory?(full_path)\n children.push DirFile.new(self, entry)\n else\n children.push DataFile.new(self, entry)\n end\n end\n end", "def add_child(folder, wawaccess)\n @children[folder] = wawaccess\n end", "def children\n tree_search_class.where(tree_parent_id_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def get_children\n return @children\n end", "def children\n params[:scope] ||= \"private\"\n\n children = if params[:scope] == Scopes::SCOPE_PRIVATE\n @folder&.children ||\n current_user.nodes.where(parent_folder_id: nil)\n elsif params[:scope] == Scopes::SCOPE_PUBLIC\n @folder&.children ||\n Node.where(scope: params[:scope], parent_folder_id: nil)\n end\n\n if [Scopes::SCOPE_PRIVATE, Scopes::SCOPE_PUBLIC].include?(params[:scope])\n children = children.where.not(sti_type: \"Asset\")\n end\n\n children = children.where(scope: params[:scope]).order(:sti_type, :name)\n\n render json: children, root: \"nodes\", adapter: :json\n end", "def get_children\n return children\n end", "def children\n return [] if child_count <= 0\n with_cache(:children) do\n @od.request(\"#{api_path}/children?$top=1000\")['value'].map do |child|\n OneDriveItem.smart_new(@od, child)\n end\n end\n end", "def children\n children = []\n\n unless leaf?\n zipper = down\n children << zipper\n\n until zipper.last?\n zipper = zipper.next\n children << zipper\n end\n end\n\n children\n end", "def set_children_for(category, hash)\n if hash['children']\n hash['children'].each do |ch|\n child = Documents::Category.find(ch['id'])\n child.parent = category\n child.save\n\n set_children_for(child, ch)\n end\n else\n # Can't remove children, so nil out the parent of anything that's listed\n # as a child of this node\n category.children.each do |c|\n c.parent = nil\n c.save\n end\n end\n end", "def subfolders\n if new_record?\n raise Errors::FolderNotFound.new(@id, \"Folder does only exist locally\")\n else\n begin\n self.class.some(@conn_id, @location.path)\n rescue Errors::FolderNotFound\n []\n end\n end\n end", "def all_children\n reload\n nodes = []\n queue = children.to_a\n until queue.empty?\n node = queue.pop\n nodes.push(node)\n queue += node.children.to_a\n queue.flatten!\n end\n nodes\n end", "def children\n @children\n end", "def children\n @children\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def rearrange_children\n if rearrange_children?\n self.disable_timestamp_callback()\n self.children.each do |child|\n child.update_path!\n child.save\n # child.reload # might not need to reload?\n end\n self.enable_timestamp_callback()\n end\n @rearrange_children = false\n true\n end", "def children\n []\n end", "def children\n []\n end", "def deep_branch_children\n if self.branch?\n arr = []\n children.each do |child|\n if child.branch?\n arr.concat child.deep_branch_children\n end\n end\n arr.push self\n arr\n else\n nil # caller shouldn't be asking for branch children anyway\n end\n end", "def grand_children\n []\n end", "def update_children\n self.children.each do |child|\n child.update_children\n unless child.new_record?\n child.save\n child.move_to_child_of(self) if child.parent_id != self.id\n end\n end if self.changed?\n end", "def get_children()\n {}\n end", "def init_existing\n return unless current_directory?\n\n FolderTree.for_path linked_path, root: directory, limit: folder_limit\n end", "def children_for page, title\n page.children.create({\n :title => title,\n :deletable => true,\n :status => 'live',\n :show_in_menu => true,\n :parent_id => page.id\n })\nend", "def children(options={})\n @global_page.children.all options\n end", "def expand!\n @children = {}\n for child in Dir[\"#{@target}/*\"]\n name = File.basename child\n @children[name] = Symlink::Node.new name, child\n end\n @target = nil\n end", "def children\n self.class.children(self) \n end", "def recurse_link(children)\n perform_recursion(self[:target]).each do |meta|\n if meta.relative_path == \".\"\n self[:ensure] = :directory\n next\n end\n\n children[meta.relative_path] ||= newchild(meta.relative_path)\n if meta.ftype == \"directory\"\n children[meta.relative_path][:ensure] = :directory\n else\n children[meta.relative_path][:ensure] = :link\n children[meta.relative_path][:target] = meta.full_path\n end\n end\n children\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def get_level_children(dirname,level) #:nodoc:\n dir_children = full_entries(dirname)\n @level_children += dir_children\n if level < @max_level\n dir_children.each {|e|\n if File.directory?(e)\n get_level_children(e,level + 1)\n end\n }\n end\n end", "def children\n []\n end", "def apply_children\n \n end", "def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend", "def setup_child_parent_links\n # Clear all links\n @items.each do |item|\n item.parent = nil\n item.children = []\n end\n\n @items.each do |item|\n # Get parent\n parent_identifier = item.identifier.sub(/[^\\/]+\\/$/, '')\n parent = @items.find { |p| p.identifier == parent_identifier }\n next if parent.nil? or item.identifier == '/'\n\n # Link\n item.parent = parent\n parent.children << item\n end\n end", "def setup_child_parent_links\n # Clear all links\n @items.each do |item|\n item.parent = nil\n item.children = []\n end\n\n @items.each do |item|\n # Get parent\n parent_identifier = item.identifier.sub(/[^\\/]+\\/$/, '')\n parent = @items.find { |p| p.identifier == parent_identifier }\n next if parent.nil? or item.identifier == '/'\n\n # Link\n item.parent = parent\n parent.children << item\n end\n end", "def << folder\n @folders << folder && self\n end", "def children_get()\n @children\n end", "def children\n entries\n end", "def children\n EarLogger.instance.log \"Finding children for #{self}\"\n ObjectManager.instance.find_children(self.id, self.class.to_s)\n end", "def navigation_children\n sorted_children\n end", "def children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\n end", "def children=(_arg0); end", "def children=(_arg0); end", "def all\r\n\t\t\t\tself.find(:all, :conditions => 'parent_id IS NOT NULL', :order => 'path ASC')\r\n\t\t\tend", "def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end", "def setup subdirs\n FileUtils.mkdir_p @root\n if subdirs and subdirs.length > 0\n subdirs.each do |subdir|\n FileUtils.mkdir_p \"#{@root}#{@ds}#{subdir}\"\n end\n @subdirs = subdirs\n end\n end", "def sub_tree\n files = ProjectFile.where(directory_id: id)\n files = files.nil? ? [] : files \n\n files.sort{|x,y| \n if x.is_directory and not y.is_directory\n -1\n elsif not x.is_directory and y.is_directory\n 1\n else\n x.name <=> y.name\n end\n }\n end", "def get_sub_folder_contents\n # Convert the object received in parameters to a FolderNode object.\n folder_node = (params[:reactParams2][:nodeType]).constantize.new\n params[:reactParams2][:child_nodes].each do |key, value|\n folder_node[key] = value\n end\n\n # Get all of the children in the sub-folder.\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_sub_folder_to_json(node))\n end\n respond_to do |format|\n format.html { render json: contents }\n end\n end", "def children\n NodeSetProxy.new(@node.children, self)\n end", "def sort!\n return unless has_children?\n sorted_children = children.sort\n self.children = sorted_children\n end" ]
[ "0.7190435", "0.70447356", "0.6711489", "0.64942795", "0.64935386", "0.6400081", "0.639999", "0.63813865", "0.63761085", "0.6356016", "0.6356016", "0.6356016", "0.6356016", "0.6347648", "0.6298537", "0.6259552", "0.6251697", "0.6223707", "0.61692876", "0.6168176", "0.6153295", "0.61511415", "0.6122627", "0.6114798", "0.60983133", "0.6091292", "0.6089837", "0.60702175", "0.6062615", "0.6049424", "0.60180247", "0.6015688", "0.6014972", "0.6011908", "0.5993567", "0.59791154", "0.59530234", "0.5944272", "0.59416324", "0.59416044", "0.59317136", "0.59308213", "0.5927622", "0.5919521", "0.5918878", "0.58990335", "0.5894114", "0.5888432", "0.5886453", "0.5886453", "0.58629453", "0.58629453", "0.58629453", "0.58629453", "0.58629453", "0.58629453", "0.58629453", "0.58629453", "0.58629453", "0.58629453", "0.58629453", "0.58629453", "0.58519226", "0.5851622", "0.5851622", "0.58505845", "0.58496165", "0.5844133", "0.5843787", "0.58411944", "0.5839175", "0.58353096", "0.58280736", "0.58275557", "0.58212864", "0.58130234", "0.58080447", "0.58080447", "0.58080447", "0.5803144", "0.58012855", "0.5798426", "0.5782421", "0.57808775", "0.57808775", "0.5769644", "0.57654506", "0.57653946", "0.57522297", "0.5751751", "0.57512695", "0.5750466", "0.5750466", "0.5749125", "0.5746317", "0.57295233", "0.57241446", "0.5715901", "0.5704941", "0.5704243" ]
0.77227366
0
Returns a list of all subfolders and files in the current folder with additional information.
def listex url = prefix + "listex" return response(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entries(dir, subfolder); end", "def list_all_in_current_directory\n Dir.glob('**/*').sort\nend", "def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n current_dir = current_dir + \"/\" + name\n when :file\n file_list.push(current_dir + \"/\" + name)\n else\n throw \"BAD VISIT TYREE TYPE. #{type}\"\n end\n end\n file_list\n end", "def list(path='root')\n puts \"#list('#{path}')\"\n listed_files =[]\n @drive.folder = path\n children = @drive.children\n list_files_metadata(children)\n raise 'There are no files in directory' if children.count < 1\n children.each do |item|\n listed_files << \"#{item.path.gsub('/drive/', 'drive/')}/#{item.name}\" unless item.folder?\n end\n @logger.info 'Children list acquired.'\n pp listed_files\n end", "def list(current_folder)\n # Ensure API availability\n api.call(\"system\", \"greet\")\n\n api.call(files_project, \"listFolder\", { folder: current_folder, only: 'folders' })\n end", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend", "def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend", "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def files\n return unless session\n session.files.find_all_by_parent_folder_id(id)\n end", "def list_folders\n http_get(:uri=>\"/folders\", :fields=>x_cookie)\n end", "def list_files(path)\n base_directory_content = Dir.glob(File.join(path, \"*\"))\n nested_directory_content = Dir.glob(File.join(path, \"*/**/*\"))\n [base_directory_content, nested_directory_content].flatten\n end", "def all\n rootdir = Cfg.rootdir\n dirlist = [\"#{rootdir}/*/*\", \"#{rootdir}/*/*/*/*\"]\n filelist = [\"Packages\", \"Packages.gz\", \"Release\", \"Release.gpg\" ]\n files = []\n\n dirlist.each do |dirs|\n Dir.glob(dirs).each do |dir|\n filelist.each do |file|\n fullname = File.join(dir, file)\n files << fullname if File.exists? fullname\n end\n end\n end\n return files\n end", "def expanded\n raise \"You need to set a path root\" unless @root.path\n result = []\n\n each do |path|\n path = File.expand_path(path, @root.path)\n\n if @glob && File.directory?(path)\n result.concat files_in(path)\n else\n result << path\n end\n end\n\n result.uniq!\n result\n end", "def child_items\n items = []\n if dir?\n @path.sort_files(@path.children).each do |child|\n if child.directory?\n child = Path.new(child.to_s)\n end\n items << Item.new(child)\n end\n return items\n end\n nil\n end", "def list_subfolders(logged_in_user, order)\n folders = []\n if logged_in_user.can_read(self.id)\n self.children.find(:all, :order => order).each do |sub_folder|\n folders << sub_folder if logged_in_user.can_read(sub_folder.id)\n end\n end\n\n # return the folders:\n return folders\n end", "def sub_listing switch\n path = ::File.join(@source.base_dir,switch)\n folders = folders_listing path\n folders = folders_filtering folders\n files = []\n folders.each do |folder|\n files += files_listing folder\n end\n files\n end", "def find_files folder\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n if @subfolders\n files = sub_listing folder\n else\n path = ::File.join(@source.base_dir,folder)\n files = files_listing path\n end\n files = files_filtering files\n files = files.take(@take) if @take\n to_file(files)\n end", "def list\r\n # Get the folder\r\n @folder = Folder.find_by_id(folder_id)\r\n\r\n # Set if the user is allowed to update or delete in this folder;\r\n # these instance variables are used in the view.\r\n @can_update = @logged_in_user.can_update(@folder.id)\r\n @can_delete = @logged_in_user.can_delete(@folder.id)\r\n\r\n # determine the order in which files are shown\r\n file_order = 'filename '\r\n file_order = params[:order_by].sub('name', 'filename') + ' ' if params[:order_by]\r\n file_order += params[:order] if params[:order]\r\n\r\n # determine the order in which folders are shown\r\n folder_order = 'name '\r\n if params[:order_by] and params[:order_by] != 'filesize' \r\n folder_order = params[:order_by] + ' '\r\n folder_order += params[:order] if params[:order]\r\n end\r\n\r\n # List of subfolders\r\n @folders = @folder.list_subfolders(@logged_in_user, folder_order.rstrip)\r\n\r\n # List of files in the folder\r\n @myfiles = @folder.list_files(@logged_in_user, file_order.rstrip)\r\n\r\n #get the correct URL\r\n url = url_for(:controller => 'folder', :action => 'list', :id => nil)\r\n\r\n # it's nice to have the possibility to go up one level\r\n @folder_up = '<a href=\"' + url + '/' + @folder.parent.id.to_s + '\">..</a>' if @folder.parent\r\n end", "def ls\n Dir.entries(@working_dir)\n end", "def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end", "def all_files; end", "def all_files; end", "def all\n @files\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def index\n if user_signed_in?\n # show folders shared by others\n @being_shared_folders = current_user.shared_folders_by_others\n\n # load current user's root folders (which have no parent folders)\n @folders = current_user.folders.roots\n\n # load current user's root files (assets) (which aren't in a folder)\n @assets = current_user.assets.where(\"folder_id is null and is_chunk = false\").order(\"uploaded_file_updated_at desc\")\n end\n end", "def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend", "def index\n @file_folders = FileFolder.all\n end", "def descendants\n self.subfolders.collect do |s|\n [s] + s.descendants\n end.flatten\n end", "def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end", "def folders\n ContextIO::Folder.all(@account_id, @label)\n end", "def file_list path = false, only_extensions = []\n data = []\n path = @path unless path\n if File.exists?(path) && File.directory?(path)\n Dir.foreach(path) do |entry|\n next if entry == '..' or entry == '.' or entry.start_with?(\".\")\n full_path = File.join(path, entry)\n if File.directory?(full_path)\n data.concat(file_list(full_path, only_extensions))\n else\n if only_extensions.size > 0\n data << { \n :name => entry,\n :path => full_path\n } if only_extensions.all? {|extension| true if entry.end_with?(extension) }\n else\n data << { \n :name => entry,\n :path => full_path\n }\n end\n end\n end\n end\n return data\n end", "def browse\n # Get the folders owned/created by the current_user\n @current_folder = current_user.folders.find(params[:folder_id])\n \n if @current_folder\n # Getting the folders which are inside this @current_folder\n @folders = @current_folder.children\n \n # We need to fix this to show files under a specific folder if we are viewing that folder\n @assets = @current_folder.assets.order(\"uploaded_file_file_name desc\")\n \n render :action => \"index\"\n else\n flash[:error] = \"Don't be cheeky! Mind your own folders!\"\n redirect_to root_url\n end\n end", "def fetch_children\n @children = []\n for item in self.listex\n if item[\"type\"] == \"folder\" and item[\"id\"]!=@id #sharefile API includes self in list\n @children << Folder.new(item[\"id\"], @authid, @subdomain, false, item)\n elsif item[\"type\"] == \"file\"\n @children << File.new(item[\"id\"], @authid, @subdomain, item)\n end\n end\n end", "def all\n @@directory_lock.synchronize { @@directory.keys }\n end", "def list_other_files\n\n list = []\n\n Dir[\"#{@directory_path}/*\"].each do |entry|\n\n raise PackageError, \"Found subdirectory '#{entry}' in package\" if File.directory?(entry)\n raise PackageError, \"Found unreadable file '#{entry}' in package\" unless File.readable?(entry)\n\n filename = File.basename entry\n next if [ '.', '..', 'manifest.xml', 'marc.xml', 'mets.xml', \"#{directory_name}.xml\" ].include? filename\n list.push filename\n end\n\n return list\n end", "def SubPaths()\n #puts \"Searching subpaths in #{to_s()}\"\n entries = Dir.entries(AbsolutePath())\n subPaths = []\n \n #puts \"Found entries #{entries}\"\n \n entries.each do |entry|\n if(entry == \"..\" || entry == \".\")\n next\n end\n \n copy = CreateCopy()\n \n #puts \"Copy is #{copy}\"\n \n copy.RelativePath = JoinPaths([copy.RelativePath, entry])\n subPaths.push(copy)\n \n #puts \"Created path #{copy} for entry #{entry}\"\n end\n \n return subPaths\n end", "def show\n @folder = Folder.includes(:subfolders).find(params[:id])\n\n # See if there is a better way to add filenames at a later date\n render json: @folder.as_json(include: :subfolders).merge(\n { filenames: @folder.extract_filenames }\n )\n end", "def all_directories dir\n Dir[\"#{dir}**/\"]\nend", "def list_other_files\n\n list = []\n\n Dir[\"#{@directory_path}/*\"].each do |entry|\n\n raise PackageError, \"Found subdirectory '#{entry}' in package\" if File.directory?(entry)\n raise PackageError, \"Found unreadable file '#{entry}' in package\" unless File.readable?(entry)\n\n filename = File.basename entry\n next if [ '.', '..', 'manifest.xml', 'marc.xml', \"#{directory_name}.xml\" ].include? filename\n list.push filename\n end\n\n return list\n end", "def visible_files\n result = []\n for dir in @dirs\n result += visible_files_under(dir)\n end\n return result\n end", "def get_files(site, folder)\n files = []\n Dir.chdir(File.join(site.source, folder)) { files = filter_entries(Dir.glob('**/*.*')) }\n files\n end", "def index\n\t\t@users = User.all_except(current_user)\n @folders = current_user.folders unless current_user.nil?\n end", "def index\n @folders = @user.folders.all\n end", "def all\r\n\t\t\t\tself.find(:all, :conditions => 'parent_id IS NOT NULL', :order => 'path ASC')\r\n\t\t\tend", "def index\n @folder_types = current_user.folder_types\n end", "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "def directories\n directory.directoires\n end", "def index\n @folders = Folder.where(user_id: current_user.id)\n end", "def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend", "def test_files\n get_folder_files(TESTS_PATH)\n end", "def list\n require_public = ( params[:user].nil? ? false : true )\n user = ( params[:user].nil? ? session[:user] : User.first(id: params[:user]) )\n raise RequestError.new(:bad_params, \"User does not exist\") unless user\n raise RequestError.new(:bad_params, \"Depth not valid\") if params[:depth].to_i < 0\n depth = (params[:depth] ? params[:depth].to_i : -1)\n xfile = ( params[:id].nil? ? user.root_folder : WFolder.get(params[:id]) )\n raise RequestError.new(:internal_error, \"No root directory. Please contact your administrator\") if xfile.nil? && params[:id].nil?\n raise RequestError.new(:folder_not_found, \"File or folder not found\") if xfile.nil?\n if (require_public && params[:id] && session[:user].admin == false) then\n raise RequestError.new(:folder_not_public, \"Folder is not public\") if xfile.folder == true && xfile.public == false\n raise RequestError.new(:folder_not_public, \"File is not public\") if xfile.folder == false && xfile.public == false\n end\n if xfile.folder then\n @result = { folder: crawl_folder(xfile, require_public, depth), success: true }\n else \n @result = { file: xfile.description(session[:user]) , success: true }\n end\n end", "def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end", "def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend", "def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end", "def fakedir_get_all_names(root, basename = '')\n result = (['.', '..'] + root[:files] + root[:dirs].keys).map{|e| basename + e}\n root[:dirs].each do |name, content|\n result += fakedir_get_all_names(content, \"#{basename}#{name}/\")\n end\n result\n end", "def get_sub_folder_contents\n # Convert the object received in parameters to a FolderNode object.\n folder_node = (params[:reactParams2][:nodeType]).constantize.new\n params[:reactParams2][:child_nodes].each do |key, value|\n folder_node[key] = value\n end\n\n # Get all of the children in the sub-folder.\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_sub_folder_to_json(node))\n end\n respond_to do |format|\n format.html { render json: contents }\n end\n end", "def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end", "def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end", "def _folders\r\n Dir.glob(File.join(\"templates\", \"**/\"))\r\n end", "def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(directory,f)) &&\n f != '.' && f != '..' }\n files = allFiles.reject{ |f| File.directory?(File.join(directory,f)) }\n result += files\n dirs.each do |subdir|\n result += visible_files_under(File.join(directory,subdir))\n end\n end\n return result\n end", "def subfolders\n if new_record?\n raise Errors::FolderNotFound.new(@id, \"Folder does only exist locally\")\n else\n begin\n self.class.some(@conn_id, @location.path)\n rescue Errors::FolderNotFound\n []\n end\n end\n end", "def filelist\n @filelist ||= begin\n list = common_filelist(super) # Always pick up the parent list\n list\n end\n end", "def all_files_in_dir(p_dir)\n [File.join(p_dir, \"**\", \"*\"), File.join(p_dir, \"**\", \".*\")]\n end", "def files() = files_path.glob('**/*')", "def all_files\n parse!\n @all_files\n end", "def get_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def get_list_of_files\n\t\t@list_of_files = Dir.entries(@wallpaper_dir) \n\tend", "def files(recurse)\n if recurse\n Dir['**/*'].select { |f| File.file?(f) }\n else\n Dir.entries(Dir.pwd).select { |f| File.file? f }\n end\n end", "def all_files_in(dir_name)\n Nanoc::FilesystemTools.all_files_in(dir_name)\n end", "def list(folder)\n\t\tc = 0\n\t\tfolder = '/' + folder\t\t\t\n\t\tresp = @client.metadata(folder)\n\t\tputs \"\\n List of contents in \" + folder + \"\\n\"\n\t\tfor item in resp['contents']\t\t\n\t\t\tputs item['path']\n\n\t\t\tc=c+1\n\t\tend\t\n\t\t\n\tend", "def iterationFolder(path) \r\n\t\tfolderArray = []\r\n\t\tDir.entries(path).each do |sub| \r\n\t\t\tif sub != '.' && sub != '..' \r\n\t\t\t if File.directory?(\"#{path}/#{sub}\") \r\n\t\t\t\t#puts \"[#{sub}]\"\r\n\t\t\t\titerationFolder(\"#{path}/#{sub}\") \r\n\t\t\t else \r\n\t\t\t\t#puts \"|--#{sub}\"\r\n\t\t\t\tfolderArray << $SCRIPT_DIR_PATH + \"/\" + \"#{sub}\"\r\n\t\t\t end \r\n\t\t\tend \r\n\t\tend \r\n\t\treturn folderArray\r\n\tend", "def list_fs_files\n all_files = []\n current_user_role_names.each do |role_name|\n next unless Filesystem.test_dir role_name, self, :read\n\n p = path_for role_name: role_name\n # Don't use Regex - it breaks if there are special characters\n paths = Dir.glob(\"#{p}/**/*\").reject do |f|\n Pathname.new(f).directory?\n end\n\n all_files += paths.map { |f| f.sub(\"#{p}/\", '').sub(p, '') }\n end\n\n all_files.uniq\n end", "def get_flist\n pp_ok \"Started in directory #{Dir.pwd}\"\n Dir.chdir(@xml_dir)\n pp_ok \"Moved to directory #{Dir.pwd}\"\n return Dir.glob(\"*.{xml}\")\n end", "def all\n Directory.all.map do |node_id|\n find node_id\n end\n end", "def walk_tree(folder = @folder)\n\t\tFind.find(folder) do |f|\n\t\t\tif File.file?(f)\n\t\t\t\tbegin\n\t\t\t\t\tsize = Integer(File.size?(f))\n\t\t\t\t\t@files[f] = size\n\t\t\t\trescue TypeError\n\t\t\t\tend\n\t\t\telsif folder.eql?(f)\n\t\t\t\t#the current folder shows up in this list - so skip it\n\t\t\telsif File.directory?(f)\n\t\t\t\t@sub_folders[f] = 0\n\t\t\t\twalk_tree(f)\n\t\t\tend\t\n\t\tend\n\tend", "def walk\n FileTreeProfiler.monitor_report(:profile, :dir, path)\n @children = []\n Dir.foreach(path) do |entry|\n next if (entry == '..' || entry == '.')\n full_path = ::File.join(path, entry)\n if ::File.directory?(full_path)\n children.push DirFile.new(self, entry)\n else\n children.push DataFile.new(self, entry)\n end\n end\n end", "def list_directories(options = {})\n options = DEFAULTS.merge(options)\n\n path = options[:path]\n all = options[:all]\n\n path = \"#{path}/\" unless path == '' or path.end_with?('/')\n path = path+'**/' if all\n \n\n Dir.glob(\"#{path}*/\")\n end", "def breadcrumb_files\n Dir[*Gretel.breadcrumb_paths]\n end", "def index\n\t\t@directories = []\n\t\troot_directory = Jedd::Directory.joins(:v_user).where(:v_users => {:nick => params[:v_user_nick]}).includes(:jedd_file_nodes).first\n\t\t# root_directory = V::User.find_by_nick(params[:v_user_nick]).jedd_directories.where(:jedd_directory_id => nil).joins(:jedd_directories => [:jedd_file_nodes]).first\n\t\tnot_found unless root_directory\n\n\t\tif root_directory\n\t\t\t@directories << root_directory\n\t\tend\n\tend", "def ls(path) \n ary = Array.new\n Dir.chdir(path) {\n Dir.glob(\"*\").each {|dir|\n ary.push(dir)\n }\n }\n return ary\nend", "def children\n files = if index?\n # about/index.html => about/*\n File.expand_path('../*', @file)\n else\n # products.html => products/*\n base = File.basename(@file, '.*')\n File.expand_path(\"../#{base}/*\", @file)\n end\n\n Set.new Dir[files].\n reject { |f| f == @file || project.ignored_files.include?(f) }.\n map { |f| self.class[f, project] }.\n compact.sort\n end", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= '/'\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n\n begin\n api_result = @client.metadata(result[:folder_id], 1000, true)\n rescue\n return nil\n end\n \n if api_result.present? && api_result['contents'].present?\n api_result['contents'].each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n end\n \n result\n end", "def file_get_more_information(directory) \n @files = []\n @file_information = {} # {\"/directory\"=>[\"file\"], \"/directory/directory\"=>[\"file\", \"file\"]\n directory = \"#{@current_directory}/#{directory}\" unless @current_directory == \"\"\n @current_directory = directory \n Dir.chdir(\"#{directory}\") \n Dir.foreach(\"#{directory}\") { |d| @files.push(d) unless d == \".\" || d == \"..\" }\n @file_information.store(directory, @files)\n @files = []\n return @file_information\n end", "def get_folder_files(folder_path)\n ensure_file_open!\n @file.glob(\"#{folder_path}/**/*\").to_h do |entry|\n entry_file_name = Pathname.new(entry.name)\n file_name = entry_file_name.relative_path_from(folder_path)\n [file_name, entry.get_input_stream(&:read)]\n end\n end", "def listDirectories\n return contentHost.listDirectories(baseDir)\n end", "def index\n @folders = Folder.all\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def get_important_files dir\n # checks various lists like visited_files and bookmarks\n # to see if files from this dir or below are in it.\n # More to be used in a dir with few files.\n list = []\n l = dir.size + 1\n\n # 2019-03-23 - i think we are getting the basename of the file\n # if it is present in the given directory XXX\n @visited_files.each do |e|\n list << e[l..-1] if e.index(dir) == 0\n end\n list = get_recent(list)\n\n # bookmarks if it starts with this directory then add it\n # FIXME it puts same directory cetus into the list with full path\n # We need to remove the base until this dir. get relative part\n list1 = @bookmarks.values.select do |e|\n e.index(dir) == 0 && e != dir\n end\n\n list.concat list1\n list\nend", "def dir_list(path, bases, paging)\n items = paging[:items]\n page = paging[:page]\n offset = paging[:offset]\n raise 'Disabling paging is not supported for a directory listing' if paging[:disable_paging]\n\n max_items = 1000\n\n child_paths, total = FileSystems::Combined.directory_list(path, items, offset, max_items)\n\n children = child_paths.map { |full_path|\n if FileSystems::Combined.directory_exists?(full_path)\n dir_info(full_path, bases)\n else\n raise 'File should exist' unless FileSystems::Combined.file_exists?(full_path)\n\n file_info(full_path)\n end\n }\n\n paging[:total] = total\n paging[:warning] = \"Only first #{max_items} results are available\" if total >= max_items\n\n children\n end", "def files(folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def get_specific_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def build_cache\n all_files = []\n\n Find.find(@root) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == ?.\n Find.prune\n else\n next\n end\n else\n path.slice!(\"#{@root}/\")\n all_files << path\n end\n end\n\n return all_files\n end", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= self.get_root_folder_id\n return nil if params[:folder_id].blank?\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n parameters = {}\n parameters['q'] = \"'#{params[:folder_id]}' in parents\"\n parameters['maxResults'] = result[:per_page]\n \n # Make api request\n begin\n drive = @client.discovered_api('drive', 'v2')\n api_result = @client.execute(:api_method => drive.files.list, :parameters => parameters)\n rescue\n return nil\n end\n \n \n if api_result.status == 200\n files = api_result.data\n files.items.each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n else\n result[:error] = {:code => api_result.status, :message => api_result.data['error']['message']} \n end\n result\n end", "def file_list(full_directory_path)\r\n path = File.join(full_directory_path, '*')\r\n Dir[path].reject { |fn| File.directory?(fn) || File.basename(fn) == @folder_config }\r\n end", "def children( with_directory = ( self != '.' ) )\n ( Dir.entries( expand_tilde ) - DOTS ).map do | entry |\n with_directory ? join( entry ) : self.class.new( entry )\n end\n end", "def get_important_files dir\n list = []\n l = dir.size + 1\n s = nil\n ($visited_files + $bookmarks.values).each do |e|\n if e.index(dir) == 0\n #list << e[l..-1]\n s = e[l..-1]\n next unless s\n if s.index \":\"\n s = s[0, s.index(\":\")] + \"/\"\n end\n # only insert if the file is in a deeper dir, otherwise we'll be duplicating files from this folder\n list << s if s.index \"/\"\n end\n end\n # bookmarks have : which needs to be removed\n #list1 = $bookmarks.values.select do |e|\n #e.index(dir) == 0\n #end\n #list.concat list1\n return list\nend", "def folders\n html = http_request(@uri + '/wato.py', {\n folder: '',\n mode: 'folder',\n }, false)\n html.split(/\\n/).each do |line|\n next unless line =~ /class=\"folderpath\"/\n end\n res = []\n html.split(/\\n/).grep(/mode=editfolder/).each do |line|\n line =~ /folder=(.*?)'/\n res.push $1 unless $1.nil?\n end\n res\n end" ]
[ "0.69303924", "0.69224375", "0.670484", "0.6701903", "0.6562339", "0.6547763", "0.64995825", "0.6338724", "0.62775314", "0.6265487", "0.62319446", "0.620115", "0.6195857", "0.6195348", "0.61823523", "0.618143", "0.61789215", "0.617667", "0.61692274", "0.616501", "0.6143128", "0.61394083", "0.613502", "0.6129039", "0.6129039", "0.6128185", "0.6101441", "0.6101441", "0.6090023", "0.60873795", "0.6085089", "0.60611546", "0.6045682", "0.60399055", "0.6036028", "0.6035266", "0.6034191", "0.6030748", "0.6028028", "0.60280013", "0.60237944", "0.6023491", "0.60154945", "0.6013938", "0.60065687", "0.6004292", "0.59921694", "0.59591424", "0.59584606", "0.5957014", "0.59525627", "0.5943135", "0.5941842", "0.5921019", "0.58990705", "0.5897912", "0.5891787", "0.5884782", "0.5874308", "0.58704", "0.58607656", "0.58607656", "0.5852586", "0.5852172", "0.58518827", "0.5842549", "0.58425415", "0.58156866", "0.5814605", "0.5811661", "0.5802694", "0.5799141", "0.5795071", "0.5790151", "0.577444", "0.57737964", "0.577141", "0.57625574", "0.5753772", "0.5746987", "0.5742978", "0.5732988", "0.57322794", "0.5726988", "0.5724181", "0.5722769", "0.5722234", "0.5721309", "0.5720547", "0.57149607", "0.57140917", "0.57100993", "0.5706993", "0.5701915", "0.56945676", "0.5689611", "0.5686234", "0.568506", "0.568123", "0.56787306", "0.56745815" ]
0.0
-1
Returns a list of all subfolders and files in the current folder
def list url = prefix + "list" return response(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_in_current_directory\n Dir.glob('**/*').sort\nend", "def list(path='root')\n puts \"#list('#{path}')\"\n listed_files =[]\n @drive.folder = path\n children = @drive.children\n list_files_metadata(children)\n raise 'There are no files in directory' if children.count < 1\n children.each do |item|\n listed_files << \"#{item.path.gsub('/drive/', 'drive/')}/#{item.name}\" unless item.folder?\n end\n @logger.info 'Children list acquired.'\n pp listed_files\n end", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def list_files(path)\n base_directory_content = Dir.glob(File.join(path, \"*\"))\n nested_directory_content = Dir.glob(File.join(path, \"*/**/*\"))\n [base_directory_content, nested_directory_content].flatten\n end", "def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend", "def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end", "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n current_dir = current_dir + \"/\" + name\n when :file\n file_list.push(current_dir + \"/\" + name)\n else\n throw \"BAD VISIT TYREE TYPE. #{type}\"\n end\n end\n file_list\n end", "def get_entries(dir, subfolder); end", "def all_directories dir\n Dir[\"#{dir}**/\"]\nend", "def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend", "def files\n return unless session\n session.files.find_all_by_parent_folder_id(id)\n end", "def expanded\n raise \"You need to set a path root\" unless @root.path\n result = []\n\n each do |path|\n path = File.expand_path(path, @root.path)\n\n if @glob && File.directory?(path)\n result.concat files_in(path)\n else\n result << path\n end\n end\n\n result.uniq!\n result\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end", "def list(current_folder)\n # Ensure API availability\n api.call(\"system\", \"greet\")\n\n api.call(files_project, \"listFolder\", { folder: current_folder, only: 'folders' })\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all_files\n `git ls-files`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "def all\n rootdir = Cfg.rootdir\n dirlist = [\"#{rootdir}/*/*\", \"#{rootdir}/*/*/*/*\"]\n filelist = [\"Packages\", \"Packages.gz\", \"Release\", \"Release.gpg\" ]\n files = []\n\n dirlist.each do |dirs|\n Dir.glob(dirs).each do |dir|\n filelist.each do |file|\n fullname = File.join(dir, file)\n files << fullname if File.exists? fullname\n end\n end\n end\n return files\n end", "def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend", "def iterationFolder(path) \r\n\t\tfolderArray = []\r\n\t\tDir.entries(path).each do |sub| \r\n\t\t\tif sub != '.' && sub != '..' \r\n\t\t\t if File.directory?(\"#{path}/#{sub}\") \r\n\t\t\t\t#puts \"[#{sub}]\"\r\n\t\t\t\titerationFolder(\"#{path}/#{sub}\") \r\n\t\t\t else \r\n\t\t\t\t#puts \"|--#{sub}\"\r\n\t\t\t\tfolderArray << $SCRIPT_DIR_PATH + \"/\" + \"#{sub}\"\r\n\t\t\t end \r\n\t\t\tend \r\n\t\tend \r\n\t\treturn folderArray\r\n\tend", "def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end", "def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end", "def get_files(site, folder)\n files = []\n Dir.chdir(File.join(site.source, folder)) { files = filter_entries(Dir.glob('**/*.*')) }\n files\n end", "def descendants\n self.subfolders.collect do |s|\n [s] + s.descendants\n end.flatten\n end", "def list_folders\n http_get(:uri=>\"/folders\", :fields=>x_cookie)\n end", "def _folders\r\n Dir.glob(File.join(\"templates\", \"**/\"))\r\n end", "def list_subfolders(logged_in_user, order)\n folders = []\n if logged_in_user.can_read(self.id)\n self.children.find(:all, :order => order).each do |sub_folder|\n folders << sub_folder if logged_in_user.can_read(sub_folder.id)\n end\n end\n\n # return the folders:\n return folders\n end", "def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end", "def visible_files\n result = []\n for dir in @dirs\n result += visible_files_under(dir)\n end\n return result\n end", "def ls(path) \n ary = Array.new\n Dir.chdir(path) {\n Dir.glob(\"*\").each {|dir|\n ary.push(dir)\n }\n }\n return ary\nend", "def SubPaths()\n #puts \"Searching subpaths in #{to_s()}\"\n entries = Dir.entries(AbsolutePath())\n subPaths = []\n \n #puts \"Found entries #{entries}\"\n \n entries.each do |entry|\n if(entry == \"..\" || entry == \".\")\n next\n end\n \n copy = CreateCopy()\n \n #puts \"Copy is #{copy}\"\n \n copy.RelativePath = JoinPaths([copy.RelativePath, entry])\n subPaths.push(copy)\n \n #puts \"Created path #{copy} for entry #{entry}\"\n end\n \n return subPaths\n end", "def files(recurse)\n if recurse\n Dir['**/*'].select { |f| File.file?(f) }\n else\n Dir.entries(Dir.pwd).select { |f| File.file? f }\n end\n end", "def directories\n directory.directoires\n end", "def find_files folder\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n if @subfolders\n files = sub_listing folder\n else\n path = ::File.join(@source.base_dir,folder)\n files = files_listing path\n end\n files = files_filtering files\n files = files.take(@take) if @take\n to_file(files)\n end", "def files\n return unless git_repo?\n output = Licensed::Shell.execute(\"git\", \"ls-files\", \"--full-name\", \"--recurse-submodules\")\n output.lines.map(&:strip)\n end", "def listDirectories\n return contentHost.listDirectories(baseDir)\n end", "def child_items\n items = []\n if dir?\n @path.sort_files(@path.children).each do |child|\n if child.directory?\n child = Path.new(child.to_s)\n end\n items << Item.new(child)\n end\n return items\n end\n nil\n end", "def all_files_in(dir_name)\n Nanoc::FilesystemTools.all_files_in(dir_name)\n end", "def fakedir_get_all_names(root, basename = '')\n result = (['.', '..'] + root[:files] + root[:dirs].keys).map{|e| basename + e}\n root[:dirs].each do |name, content|\n result += fakedir_get_all_names(content, \"#{basename}#{name}/\")\n end\n result\n end", "def ls\n Dir.entries(@working_dir)\n end", "def test_files\n get_folder_files(TESTS_PATH)\n end", "def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(directory,f)) &&\n f != '.' && f != '..' }\n files = allFiles.reject{ |f| File.directory?(File.join(directory,f)) }\n result += files\n dirs.each do |subdir|\n result += visible_files_under(File.join(directory,subdir))\n end\n end\n return result\n end", "def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend", "def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end", "def all\n @files\n end", "def all_files_in_dir(p_dir)\n [File.join(p_dir, \"**\", \"*\"), File.join(p_dir, \"**\", \".*\")]\n end", "def all_files; end", "def all_files; end", "def file_list(full_directory_path)\r\n path = File.join(full_directory_path, '*')\r\n Dir[path].reject { |fn| File.directory?(fn) || File.basename(fn) == @folder_config }\r\n end", "def build_cache\n all_files = []\n\n Find.find(@root) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == ?.\n Find.prune\n else\n next\n end\n else\n path.slice!(\"#{@root}/\")\n all_files << path\n end\n end\n\n return all_files\n end", "def index\n @file_folders = FileFolder.all\n end", "def files() = files_path.glob('**/*')", "def list_fs_files\n all_files = []\n current_user_role_names.each do |role_name|\n next unless Filesystem.test_dir role_name, self, :read\n\n p = path_for role_name: role_name\n # Don't use Regex - it breaks if there are special characters\n paths = Dir.glob(\"#{p}/**/*\").reject do |f|\n Pathname.new(f).directory?\n end\n\n all_files += paths.map { |f| f.sub(\"#{p}/\", '').sub(p, '') }\n end\n\n all_files.uniq\n end", "def get_file_list relative_path\n\t\t\t\tpath = File.join(@src, relative_path)\n\t\t\t\tresult = nil\n\t\t\t\tFileUtils.cd(path) do\n\t\t\t\t\tresult = Dir.glob(\"**/*\", File::FNM_DOTMATCH)\n\t\t\t\t\tresult.reject! { |fn| File.directory?(fn) }\n\t\t\t\t\tresult.reject! { |fn| fn =~ /(^_|\\/_)/ }\n\t\t\t\tend\n\t\t\t\tresult\n\t\t\tend", "def directory_subdirectories(path)\n\tputs ''\n\tfor i in subdir_paths(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend", "def all\r\n\t\t\t\tself.find(:all, :conditions => 'parent_id IS NOT NULL', :order => 'path ASC')\r\n\t\t\tend", "def get_ls(path)\n #repo = @repo\n #head = repo.commits.first\n #tree = head.tree @branch\n\n tree = @repo.tree @branch\n\n #strip trailing /\n path.sub! /[\\/]*$/, ''\n\n # find dir\n while !path.empty?\n tdir = tree / path\n break if tdir.is_a?(Grit::Tree)\n # strip last conponent to /\n path.sub! /(^|\\/)[^\\/]*$/, ''\n end\n\n if path.empty?\n tdir = tree\n else\n path += '/'\n end\n print \"path:\", path, \"\\n\"\n print \"tdir:\", tdir, \"\\n\"\n\n files = tdir.blobs.map do |b|\n { path: \"#{path}#{b.name}\", name: b.name, siz: b.size }\n end\n dirs = tdir.trees.map do |t|\n { path: \"#{path}#{t.name}\", name: t.name}\n end\n if !path.empty?\n dirs.push( { path: path.sub(/(^|\\/)[^\\/]*\\/$/, ''),\n name: '..'} )\n end\n\n [files, dirs, path]\n end", "def get_folder_files(folder_path)\n ensure_file_open!\n @file.glob(\"#{folder_path}/**/*\").to_h do |entry|\n entry_file_name = Pathname.new(entry.name)\n file_name = entry_file_name.relative_path_from(folder_path)\n [file_name, entry.get_input_stream(&:read)]\n end\n end", "def files(folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def folders\n ContextIO::Folder.all(@account_id, @label)\n end", "def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend", "def list_directories(options = {})\n options = DEFAULTS.merge(options)\n\n path = options[:path]\n all = options[:all]\n\n path = \"#{path}/\" unless path == '' or path.end_with?('/')\n path = path+'**/' if all\n \n\n Dir.glob(\"#{path}*/\")\n end", "def files_in_path\n Dir.glob(\"#{@path}/**/*/**\") | Dir.glob(\"#{@path}/**\")\n end", "def read_dirs(indir)\n @all_files = []\n Dir.chdir(indir)\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n\n @all_files = Dir.glob(\"**/*\").select { |f| File.file? f }\n all_dirs = Dir.glob('*').select { |f| File.directory? f }\n all_dirs.each do |subdir|\n read_dir(subdir)\n end\n end", "def all\n @@directory_lock.synchronize { @@directory.keys }\n end", "def files\n get_back_here = Dir.pwd\n Dir.chdir(@path)\n @files = Dir.glob(\"*.mp3\")\n Dir.chdir(get_back_here)\n @files\n end", "def folders\n return unless session\n session.folders.find_all_by_parent_folder_id(id)\n end", "def breadcrumb_files\n Dir[*Gretel.breadcrumb_paths]\n end", "def all_files_under(path, &ignore)\n path = Pathname(path)\n\n if path.directory?\n path.children.flat_map do |child|\n all_files_under(child, &ignore)\n end.compact\n elsif path.file?\n if block_given? && ignore.call(path)\n []\n else\n [path]\n end\n else\n []\n end\n end", "def sub_listing switch\n path = ::File.join(@source.base_dir,switch)\n folders = folders_listing path\n folders = folders_filtering folders\n files = []\n folders.each do |folder|\n files += files_listing folder\n end\n files\n end", "def files\n @files = Dir.entries(@path)\n @files.delete_if {|file| file == \".\" || file == \"..\"}\n end", "def file_list path = false, only_extensions = []\n data = []\n path = @path unless path\n if File.exists?(path) && File.directory?(path)\n Dir.foreach(path) do |entry|\n next if entry == '..' or entry == '.' or entry.start_with?(\".\")\n full_path = File.join(path, entry)\n if File.directory?(full_path)\n data.concat(file_list(full_path, only_extensions))\n else\n if only_extensions.size > 0\n data << { \n :name => entry,\n :path => full_path\n } if only_extensions.all? {|extension| true if entry.end_with?(extension) }\n else\n data << { \n :name => entry,\n :path => full_path\n }\n end\n end\n end\n end\n return data\n end", "def browse\n # Get the folders owned/created by the current_user\n @current_folder = current_user.folders.find(params[:folder_id])\n \n if @current_folder\n # Getting the folders which are inside this @current_folder\n @folders = @current_folder.children\n \n # We need to fix this to show files under a specific folder if we are viewing that folder\n @assets = @current_folder.assets.order(\"uploaded_file_file_name desc\")\n \n render :action => \"index\"\n else\n flash[:error] = \"Don't be cheeky! Mind your own folders!\"\n redirect_to root_url\n end\n end", "def index\n @folders = @user.folders.all\n end", "def list(path, recursive=true, dirs=false)\n # TODO : this might need to be changed as it returns dir and contents\n # if there are contents\n nodes = []\n prune = recursive ? nil : 2\n @content_tree.with_subtree(path, nil, prune, dirs) do |node|\n nodes << node.path\n end\n nodes.sort.uniq\n end", "def ls\n table Dir.entries( Dir.pwd ).reject { |f| f.match /^\\..*$/ }\n end", "def folders_listing path\n cmd = \"find #{path} -type d \"\n if @folder_regexp\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@folder_regexp}\\\"\"\n end\n folders = exec_cmd(cmd)\n folders\n end", "def children\n files = if index?\n # about/index.html => about/*\n File.expand_path('../*', @file)\n else\n # products.html => products/*\n base = File.basename(@file, '.*')\n File.expand_path(\"../#{base}/*\", @file)\n end\n\n Set.new Dir[files].\n reject { |f| f == @file || project.ignored_files.include?(f) }.\n map { |f| self.class[f, project] }.\n compact.sort\n end", "def all_files\n loc_pat = File.join(@base, '**/*')\n Dir.glob(loc_pat, File::FNM_DOTMATCH)\n .select { |e| File.file?(e) }\n .map { |f| f[@base.size + 1..-1] }\n end", "def files(treeish = nil)\n tree_list(treeish || @ref, false, true)\n end", "def folders\n html = http_request(@uri + '/wato.py', {\n folder: '',\n mode: 'folder',\n }, false)\n html.split(/\\n/).each do |line|\n next unless line =~ /class=\"folderpath\"/\n end\n res = []\n html.split(/\\n/).grep(/mode=editfolder/).each do |line|\n line =~ /folder=(.*?)'/\n res.push $1 unless $1.nil?\n end\n res\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def index\n\t\t@users = User.all_except(current_user)\n @folders = current_user.folders unless current_user.nil?\n end", "def subdirectories()\n children.select { |c| c.directory? }\n end", "def subfolders\n if new_record?\n raise Errors::FolderNotFound.new(@id, \"Folder does only exist locally\")\n else\n begin\n self.class.some(@conn_id, @location.path)\n rescue Errors::FolderNotFound\n []\n end\n end\n end", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end", "def ls(path)\n files = []\n Dir.glob(\"#{path}/*\") {|f| files << f.split('/').last}\n\n return files\n end", "def subdirectories\n Dir.glob(File.join(base_path, \"*\")).reject { |i| !File.directory?(i) }\n end", "def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end", "def get_entries(dir, subfolder)\n base = site.in_source_dir(dir, subfolder)\n return [] unless File.exist?(base)\n\n entries = Dir.chdir(base) { filter_entries(Dir[\"**/*\"], base) }\n entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }\n end", "def list_of_directories\n Dir.entries(\"./inspections\").select {|d| !d.start_with?(\".\") }\n end", "def list\r\n # Get the folder\r\n @folder = Folder.find_by_id(folder_id)\r\n\r\n # Set if the user is allowed to update or delete in this folder;\r\n # these instance variables are used in the view.\r\n @can_update = @logged_in_user.can_update(@folder.id)\r\n @can_delete = @logged_in_user.can_delete(@folder.id)\r\n\r\n # determine the order in which files are shown\r\n file_order = 'filename '\r\n file_order = params[:order_by].sub('name', 'filename') + ' ' if params[:order_by]\r\n file_order += params[:order] if params[:order]\r\n\r\n # determine the order in which folders are shown\r\n folder_order = 'name '\r\n if params[:order_by] and params[:order_by] != 'filesize' \r\n folder_order = params[:order_by] + ' '\r\n folder_order += params[:order] if params[:order]\r\n end\r\n\r\n # List of subfolders\r\n @folders = @folder.list_subfolders(@logged_in_user, folder_order.rstrip)\r\n\r\n # List of files in the folder\r\n @myfiles = @folder.list_files(@logged_in_user, file_order.rstrip)\r\n\r\n #get the correct URL\r\n url = url_for(:controller => 'folder', :action => 'list', :id => nil)\r\n\r\n # it's nice to have the possibility to go up one level\r\n @folder_up = '<a href=\"' + url + '/' + @folder.parent.id.to_s + '\">..</a>' if @folder.parent\r\n end", "def files()\n children.select { |c| c.file? }\n end", "def index\n @folders = Folder.where(user_id: current_user.id)\n end", "def index\n if user_signed_in?\n # show folders shared by others\n @being_shared_folders = current_user.shared_folders_by_others\n\n # load current user's root folders (which have no parent folders)\n @folders = current_user.folders.roots\n\n # load current user's root files (assets) (which aren't in a folder)\n @assets = current_user.assets.where(\"folder_id is null and is_chunk = false\").order(\"uploaded_file_updated_at desc\")\n end\n end", "def files\n @files.map do |file|\n if File.directory?(file)\n Dir[File.join(file, '**', '*.rb')]\n else\n file\n end\n end.flatten\n end", "def index(base_path, glob = nil)\n\t\tglob = '*' if glob == '' or glob.nil?\n\t\tdirs = []\n\t\tfiles = []\n\t\t::Dir.chdir(base_path) do\n\t\t\t::Dir.glob(glob).each do |fname|\n\t\t\t\tif ::File.directory?(fname)\n\t\t\t\t\tdirs << fname + '/'\n\t\t\t\telse\n\t\t\t\t\tfiles << fname\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdirs.sort + files.sort\n\trescue Errno::ENOENT\n\t\traise Rush::DoesNotExist, base_path\n\tend", "def paths\n root.paths\n end", "def list_files_from_dir(path)\n Dir[path + \"/*/\"].map { |file| File.basename(file) }\n end" ]
[ "0.7424879", "0.7160962", "0.7145911", "0.7100264", "0.70638174", "0.70392877", "0.7035852", "0.6972089", "0.6952065", "0.6929919", "0.69291836", "0.6903333", "0.6880258", "0.68312097", "0.68187004", "0.6803622", "0.6793606", "0.6793606", "0.67648256", "0.6761874", "0.6713602", "0.6672128", "0.6661478", "0.66567224", "0.6634505", "0.6618409", "0.65955585", "0.6593626", "0.65807074", "0.65789896", "0.65468067", "0.65384954", "0.6511681", "0.64832973", "0.64694124", "0.6462141", "0.6449273", "0.64389163", "0.6431429", "0.6429277", "0.6424381", "0.6422885", "0.64178115", "0.64120144", "0.63933194", "0.6391846", "0.6391412", "0.6389834", "0.6389834", "0.6388878", "0.6384348", "0.63816947", "0.6374586", "0.6363063", "0.63556206", "0.6343304", "0.63390964", "0.6333787", "0.6321147", "0.6308648", "0.63052756", "0.63020897", "0.62995976", "0.629852", "0.62866557", "0.62825495", "0.6278967", "0.62788653", "0.6272515", "0.62548965", "0.62545633", "0.6250159", "0.6247595", "0.6247586", "0.6246776", "0.6243106", "0.62376934", "0.6231066", "0.62228215", "0.62052006", "0.62018025", "0.61927515", "0.6192571", "0.61907727", "0.6184706", "0.61834127", "0.61833274", "0.61655486", "0.61645275", "0.61628217", "0.61566144", "0.61566144", "0.61478055", "0.6144698", "0.61438346", "0.614293", "0.61426246", "0.612874", "0.61230636", "0.6117592", "0.61117303" ]
0.0
-1
Returns id of the current folder verifying it exists
def get url = prefix + "get" return response(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def folder_id\n current.folder.id\n end", "def root_folder_id\n self.root_folder\n end", "def last_opened_folder_id(project)\n cooky = cookies[:folder_browsed_json]\n cooky ||= {}.to_json\n cooky = ActiveSupport::JSON.decode(cooky)\n folder_id = cooky[project.id.to_s]\n\n folder_id = nil if folder_id && !ProjectFolder.find_by_id(folder_id)\n\n folder_id ||= ProjectFolder.new_items_folder(project).try(:id)\n folder_id\n end", "def folder_id\n self.folder.id\n end", "def require_existing_folder\n @folder = get_folder_or_redirect(params[:id])\n end", "def getFolderId\r\n\t\t\t\t\treturn @folderId\r\n\t\t\t\tend", "def folder_location\n @folder_location ||= Find.find(root_path).find do |path|\n FileTest.directory?(path) && path.split(\"/\").last == id.to_s\n end\n end", "def get_root_folder_id\n begin\n drive = @client.discovered_api('drive', 'v2')\n result = @client.execute(:api_method => drive.about.get)\n rescue\n return nil\n end\n \n if result.status == 200\n result.data.rootFolderId\n else\n nil\n end\n end", "def does_folder_exist\n @folder = Folder.find(params[:id]) if params[:id]\n rescue\n flash.now[:folder_error] = 'Someone else deleted the folder you are using. Your action was cancelled and you have been taken back to the root folder.'\n redirect_to root_path\n end", "def does_folder_exist\n @folder = Folder.find(params[:id]) if params[:id]\n rescue\n flash.now[:folder_error] = 'Someone else deleted the folder you are using. Your action was cancelled and you have been taken back to the root folder.'\n redirect_to :controller => 'folder', :action => 'list' and return false\n end", "def root?\n \tfolder_id.nil?\n end", "def folder_id\n case params[:controller] + '/' + params[:action]\n when 'folder/index', 'folder/list', 'folder/new', 'folder/create', 'folder/update_permissions', 'folder/feed', 'file/upload', 'file/validate_filename'\n current_folder_id = 1 unless current_folder_id = params[:id]\n when 'file/do_the_upload'\n # This prevents a URL like 0.0.0.0/file/do_the_upload/12,\n # which breaks the upload progress. The URL now looks like this:\n # 0.0.0.0/file/do_the_upload/?folder_id=12\n current_folder_id = 1 unless current_folder_id = params[:folder_id]\n when 'folder/rename', 'folder/update', 'folder/destroy'\n current_folder_id = @folder.parent_id if @folder\n when 'file/download', 'file/rename', 'file/update', 'file/destroy', 'file/preview'\n current_folder_id = @myfile.folder.id\n when 'inbox/do_the_upload', 'inbox/index'\n unless params[:user_id].nil?\n current_folder_id = Folder.fetch_user_inbox(params[:user_id]).id \n else\n current_folder_id = Folder.fetch_user_inbox(@logged_in_user.id).id \n end\n end\n\n case params[:controller]\n when 'claims'\n current_folder_id = 2\n end\n\n return current_folder_id\n end", "def parent_folder_id\n return @parent_folder_id\n end", "def exists?\n folder_location.present?\n end", "def team_folder_id(folder_name:, trace: false)\n team_folder_list(trace: trace) do |tf|\n if tf['name'] == folder_name\n return tf['team_folder_id']\n end\n end\n return nil\n end", "def id; dir end", "def root_folder\n folders.first({ title: Folder::DefaultFolder, folder_id: nil })\n end", "def current_path\n current_folder.path\n end", "def folder\n File.join self.class::FOLDER, model_id.to_s\n end", "def root_folder\n if new_record?\n material_folders.find(&:root?) || (raise ActiveRecord::RecordNotFound)\n else\n material_folders.find_by!(parent: nil)\n end\n end", "def dir\n File.join(DOTDIR, id)\n end", "def folder\n @root_folder\n end", "def get_parent_folder_id(file_id)\n return nil if file_id == '/'\n file_id = file_id.chomp('/')\n file_id.slice(0..(file_id.rindex('/')))\n end", "def parent_sub_dir\n return unless Filesystem.use_parent_sub_dir\n\n setting = Admin::AppConfiguration.find_default_app_config(app_type_id, 'filestore directory id')\n if setting\n unless setting.value.in?(Master.alternative_id_fields.map(&:to_s))\n raise FsException, 'An id name ending with \"_id\" is expected for \"filestore directory id\"'\n end\n\n \"#{setting.value.hyphenate}-#{master.send(setting.value)}\"\n else\n \"master-#{master_id}\"\n end\n end", "def get_folder(folder_id)\n @folders[folder_id]\n end", "def get_folder(folder_id)\n @folders[folder_id]\n end", "def root_folder?\n if new_record?\n material_folders.find(&:root?).present?\n else\n material_folders.find_by(parent: nil).present?\n end\n end", "def get_parent_id_folder(id)\n if id.to_s.length > 4\n id.to_s[0..id.to_s.length-2]\n else\n id.to_s\n end\nend", "def exist?(id)\n path = record_path(id)\n File.exist?(path) ? path : nil\n end", "def show\n @folder = current_user.folders.find(params[:id])\n end", "def get_folder()\n f = Kamelopard::DocumentHolder.instance.current_document.folders.last\n Kamelopard::Folder.new() if f.nil?\n Kamelopard::DocumentHolder.instance.current_document.folders.last\n end", "def set_folder\n @folder = PulStore::Lae::Folder.find(params[:id])\n end", "def folder\n nil\n end", "def new_folder_request(dir_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"name\": dir_name,\n \"parent-id\": $root_folder_id\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n id = ''\n\n if response.code == 422.to_s\n id = JSON.parse(response.read_body)['existing_folder_id']\n puts \"Folder already exist. id: #{id}\"\n elsif response.code == 201.to_s\n id = JSON.parse(response.read_body)['data']['id']\n puts \"Folder created. id: #{id}\"\n end\n\n id\nend", "def get_folder folder_id\n get(\"/projects/#{folder_id}\")\n end", "def location\n return unless exists?\n folder_pathname.relative_path_from(root_path)\n end", "def userfolder\n # \"public/upload/user_id_\" + self.user_id.to_s\n User.find_by_id( self.user_id ).userfolder\n end", "def set_folder\n @folder = Folder.find_by!(id: params[:id], user_id: current_user.id)\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def parent_folder_id=(value)\n @parent_folder_id = value\n end", "def get_parent_folder_id(file_id)\n begin\n drive = @client.discovered_api('drive', 'v2')\n result = @client.execute(:api_method => drive.files.get, :parameters => { 'fileId' => file_id })\n rescue\n return nil\n end\n \n if result.status == 200\n result.data.parents[0].id if result.data.parents.present?\n else\n nil\n end\n end", "def folder_name\n @folder_name\n end", "def folder_reachable?\n Dir.exists? folder_path\n end", "def folder\n @folders[@folder_name]\n end", "def id\n raise Errno::ENOENT, \"This object has been deleted.\" if self.deleted?\n raise \"No ID on object.\" if !@id\n return @id\n end", "def set_folder\n begin\n @folder = Folder.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n render json: {\n error: e.to_s\n }, status: :not_found\n end\n end", "def folder_path\n File.expand_path @folder_path\n end", "def root_id\n if is_root?\n id\n else\n root.id\n end\n end", "def get_parent_folder\n parent_folder_option = self.class.class_variable_get(:\"@@parent_folder_holder\")\n if parent_folder_option && respond_to?(parent_folder_option.to_sym) && folder_holder = send(parent_folder_option.to_sym)\n folder_holder.folder\n else\n slug = parent_folder_option || self.class.to_s.titlecase.split('/').last.pluralize\n Droom::Folder.where(:slug => slug, :parent_id => nil).first_or_create\n end\n end", "def folder(id)\n Box::Folder.new(@api, nil, :id => id)\n end", "def folder\n connection.directories.get(folder_name)\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def check_same_directory?(old_id, new_id)\n Assignment.find(old_id).directory_path == Assignment.find(new_id).directory_path\n end", "def parent_id\n @path.split('/').last if @path\n end", "def folder_path\n File.join(location.path, folder_name)\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def root\n folders.first\n end", "def submission_folder\n submission_folders.where(is_permanent: true).first\n end", "def unique_dir\n taken_ints = taken_paths.map { |path| path.basename.to_s.to_i }\n (taken_ints.count > 0) ? (taken_ints.max + 1).to_s : 1.to_s\n end", "def checkforGoogleFolder(googlefolder)\n session = GoogleDrive::Session.from_config(\"config.json\")\n folder = session.collection_by_title(googlefolder)\n if folder.nil?\n session.root_collection.create_subcollection(googlefolder)\n end\nend", "def exists?(id)\n path(id).exist?\n end", "def exists?(id)\n path(id).exist?\n end", "def favorite_folder\n favorite_folders.where(is_permanent: true).first\n end", "def path(id)\n directory.join(relative(id))\n end", "def getFolder\r\n\t\t\t\t\treturn @folder\r\n\t\t\t\tend", "def folder\n @folder ||= File.expand_path('.')\n end", "def folder_exists?\n empty_name?\n\n if File.exists?(\"#{LOCAL_PATH}/#{@name}\") || File.exists?(\"#{REMOTE_PATH}/#{@name}.git\")\n if File.exists?(\"#{LOCAL_PATH}/#{@name}\")\n print \"Directory `#{@name}` exists in #{LOCAL_PATH}. Pass a new name: \"\n elsif File.exists?(\"#{REMOTE_PATH}/#{@name}.git\")\n print \"Directory `#{@name}.git` exists in #{REMOTE_PATH}. Pass a new name: \"\n end\n\n @name = gets.chomp\n folder_exists?\n end\n\n false\n end", "def folder\n model.folder\n end", "def get_or_create_suite_id(suite_name, suite_comment_if_new=nil)\n parent_id = nil\n suite_id = nil\n # Two cases, either there's a folder path, or there isn't\n # If there is, we will find the parent folder ID\n # In either case, we will find the suite ID if it already exists\n if @test_folder_path.nil? || @test_folder_path.empty? then\n suite_id = @tl.getFirstLevelTestSuiteIDByName(suite_name, @test_proj)\n else\n folder_path=@test_folder_path.clone #We will perform destructive actions on this array, so copy it\n parent_id = @tl.getFirstLevelTestSuiteIDByName(folder_path.shift, @test_proj)\n folder_path.each { |folder| parent_id = @tl.getChildTestSuiteIDByName(folder, parent_id)}\n raise \"Folder path does not exist in Testlink: #{@test_proj} -> #{@test_folder_path.join(\" -> \")}\" if parent_id.nil?\n suite_id = @tl.getChildTestSuiteIDByName(suite_name, parent_id)\n end\n\n # If the suite_id is nil, the suite needs to be created\n suite_id = @tl.createTestSuite(suite_name, @test_proj, suite_comment_if_new, parent_id).first[\"id\"] if suite_id.nil?\n\n return suite_id.to_i\n end", "def has_file\n if id == nil \n false\n else\n FileTest.exists?( local_file_path )\n end\n end", "def parent_folder_name(item_scope = scope)\n folder = parent_folder(item_scope)\n folder.blank? ? \"/\" : folder.name\n end", "def get_team_folder\n\n Team.get_team_folder(self.id)\n end", "def folder_pathname\n return unless exists?\n @folder_pathname ||= Pathname.new(folder_location)\n end", "def parent_of?(folder)\n @location.parent_of?(folder.location)\n end", "def get_folder_by_id(folder, grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'Folder deletion was successful.'\n grafana_options[:unknown_code_msg] = 'FolderApi::get_folder_by_id unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/folders/id/' + get_folder_id(folder)\n\n folder_obj = do_request(grafana_options)\n\n return if folder_obj[:message] == 'Folder not found'\n folder_obj\n end", "def exist?(id)\n db_root.join(id).exist?\n end", "def current_folder\n tree.terminal\n end", "def path(id)\n directory.join(id.gsub(\"/\", File::SEPARATOR))\n end", "def show\n begin\n @folder = Folder.find(params[:id])\n set_current_folder params[:id]\n set_current_children\n set_new_items\n @chat_room = current_folder.chat_room\n rescue ActiveRecord::RecordNotFound\n flash[:warning] = 'Không tìm thấy folder. Quay về home.'\n redirect_to folders_path\n end\n end", "def folder_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s + '/'\n\tend", "def show\n @folder = Folder.find(params[:id])\n end", "def init_existing\n return unless current_directory?\n\n FolderTree.for_path linked_path, root: directory, limit: folder_limit\n end", "def create_user_ingest_folder(user_name, parent = '0BxnZXCons72AYXZOTVVrdGk0bTg')\n metadata = @drive.files.insert.request_schema.new({\n 'title' => user_name,\n 'mimeType' => \"application/vnd.google-apps.folder\",\n 'parents' => [{'id' => parent}]\n })\n result = @client.execute( :api_method => @drive.files.insert, :body_object => metadata )\n result.data[\"id\"]\n end", "def folder_data\n @folder_data ||= Unan::folder_data + \"user/#{id}\"\n end", "def ensure_unique_node(path, name)\n name = SecureRandom.hex(8) while File.exist? File.join(path, name)\n Folder.new File.join(path, name)\n end", "def exists(files)\r\n files.each do |f|\r\n if f.name == 'Code Review Report'\r\n return f.id\r\n end\r\n end\r\n false\r\nend", "def myworkspace_id\n if framework.db.active\n myworkspace.id\n else\n nil\n end\n end", "def probably_unique_id\n @probably_unique_id||=complete_path.base26_hash\n end", "def path!(id)\n path = path(id)\n FileUtils.mkdir_p(path.dirname, mode: directory_permissions)\n path\n end", "def folder\n @attributes[:folder]\n end", "def set_sharedfolder\n @sharedfolder = Sharedfolder.find(params[:id])\n end", "def root_folder\n scheduler_service.GetFolder(\"\\\\\")\n end", "def parent\n parent_path = @location.parent_path\n \n if parent_path.nil?\n nil\n else\n begin\n self.class.find(@conn_id, parent_path)\n rescue Errors::FolderNotFound, parent_path\n nil\n end\n end\n end", "def has_access_to_folder(folder_id, user_id)\n if get_all_user_data(user_id).first[\"rank\"] >= 1\n return true\n end\n owner_id = $db.execute(\"SELECT owner_id FROM folders WHERE folder_id = ?\", folder_id).first[\"owner_id\"]\n if owner_id == user_id\n return true\n else\n return false\n end\nend", "def folder_exists?(path, site_path=nil)\n url = computed_web_api_url(site_path)\n path = [site_path, path].compact.join('/')\n url = uri_escape \"#{url}GetFolderByServerRelativeUrl('#{path}')\"\n easy = ethon_easy_json_requester\n easy.http_request(url, :get)\n easy.perform\n easy.response_code == 200\n end", "def directory_scope_id\n return @directory_scope_id\n end" ]
[ "0.75070214", "0.7159271", "0.69213814", "0.6866117", "0.6857331", "0.6830864", "0.6808344", "0.67132854", "0.6700107", "0.6572976", "0.6526553", "0.65000993", "0.6376463", "0.62645715", "0.6229899", "0.6183787", "0.61743736", "0.614659", "0.61096394", "0.60920227", "0.60654765", "0.59936965", "0.59927154", "0.59831166", "0.5977814", "0.5977814", "0.5960948", "0.59586966", "0.5923662", "0.5863574", "0.58598924", "0.5844516", "0.5818849", "0.58165", "0.57943803", "0.5793332", "0.57825655", "0.5767376", "0.57620865", "0.57620865", "0.5753862", "0.57527906", "0.5748497", "0.57440543", "0.5739466", "0.57352704", "0.573227", "0.5728817", "0.57139474", "0.57026184", "0.5688107", "0.5685987", "0.5683415", "0.568064", "0.56541705", "0.5649619", "0.5641752", "0.5641752", "0.5641752", "0.5641752", "0.5641752", "0.56324846", "0.5605251", "0.559648", "0.55949587", "0.5586808", "0.5586808", "0.55843246", "0.5577124", "0.5569242", "0.5568469", "0.5558697", "0.55414504", "0.5530186", "0.55273336", "0.5525818", "0.5514821", "0.55083174", "0.55039465", "0.54976904", "0.54964024", "0.5494817", "0.54802316", "0.5477034", "0.5466975", "0.54650867", "0.5461598", "0.54513377", "0.5450899", "0.5444618", "0.5441343", "0.5441274", "0.54368293", "0.54227144", "0.5420319", "0.540211", "0.53984284", "0.5391447", "0.5374242", "0.5365151", "0.5361863" ]
0.0
-1
Returns all metadata of the requested folder id
def getex url = prefix + "getex" return response(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(folder)\n\t\tc = 0\n\t\tfolder = '/' + folder\t\t\t\n\t\tresp = @client.metadata(folder)\n\t\tputs \"\\n List of contents in \" + folder + \"\\n\"\n\t\tfor item in resp['contents']\t\t\n\t\t\tputs item['path']\n\n\t\t\tc=c+1\n\t\tend\t\n\t\t\n\tend", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= '/'\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n\n begin\n api_result = @client.metadata(result[:folder_id], 1000, true)\n rescue\n return nil\n end\n \n if api_result.present? && api_result['contents'].present?\n api_result['contents'].each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n end\n \n result\n end", "def metadata_by_id(file_id)\n if file_id.is_a? String\n client = google_api_client\n metadata = client.get_file(\n file_id,\n fields: 'id, name, thumbnailLink, webContentLink, webViewLink, trashed'\n )\n validate_metadata(metadata)\n metadata\n end\n end", "def metadata(id)\n id = self.to_id(id)\n io = self.grid.get(id)\n { filename: io.filename, content_type: io.content_type }\n rescue ::Mongo::GridFileNotFound\n nil\n end", "def get_all_folderdata_for_folder_id(folder_id)\n return $db.execute(\"SELECT * FROM folders WHERE folder_id = ?\", folder_id)\nend", "def get_folder(folder_id)\n @folders[folder_id]\n end", "def get_folder(folder_id)\n @folders[folder_id]\n end", "def folder_id\n self.folder.id\n end", "def folder_data\n @folder_data ||= Unan::folder_data + \"user/#{id}\"\n end", "def get_folder(folder_id)\n\tputs \"Getting folder: \" + folder_id\n\tresponse = request_get('/api/partner/folder/' + folder_id)\n\tputs response.body\nend", "def get_folder folder_id\n get(\"/projects/#{folder_id}\")\n end", "def describe\n self.mclient = get_metadata_client\n begin\n response = self.mclient.request :describe_metadata do |soap|\n soap.header = get_soap_header \n soap.body = \"<apiVersion>#{MM_API_VERSION}</apiVersion>\"\n end\n rescue Savon::SOAP::Fault => fault\n raise Exception.new(fault.to_s)\n end\n puts \"<br/><br/> describe response: \" + response.to_hash.inspect\n hash = response.to_hash\n folders = Array.new\n hash[:describe_metadata_response][:result][:metadata_objects].each { |object| \n children = []\n if object[:child_xml_names] and object[:child_xml_names].kind_of? String\n children.push(object[:child_xml_names])\n else\n children = object[:child_xml_names]\n end\n folders.push({\n :title => object[:directory_name],\n :isLazy => true,\n :isFolder => true,\n :directory_name => object[:directory_name],\n :meta_type => object[:xml_name],\n :select => CORE_METADATA_TYPES.include?(object[:xml_name]) ? true : false,\n :child_metadata => children,\n :has_child_metadata => ! children.nil?,\n :in_folder => object[:in_folder]\n })\n }\n folders.sort! { |a,b| a[:title] <=> b[:title] }\n puts \"\\n\\n\\n\\n\\n\"\n puts folders.to_json\n return folders.to_json\n end", "def getFolderId\r\n\t\t\t\t\treturn @folderId\r\n\t\t\t\tend", "def obtain_file_metadata(file_id)\n begin\n metadata = @drive_manager[file_id].get\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{file_path}\"\n return\n end\n\n metadata = JSON.parse(metadata)\n metadata\n end", "def files(id)\n criteria = {:type_ids => [Runcible::Extensions::File.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "def folder\n connection.directories.get(folder_name)\n end", "def show\n @folder = Folder.includes(:subfolders).find(params[:id])\n\n # See if there is a better way to add filenames at a later date\n render json: @folder.as_json(include: :subfolders).merge(\n { filenames: @folder.extract_filenames }\n )\n end", "def get_specific_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def contents(id = '')\n folder = id.empty? ? box_client.root_folder : box_client.folder_by_id(id)\n values = []\n\n folder.items(ITEM_LIMIT, 0, %w[name size created_at]).collect do |f|\n values << directory_entry(f)\n end\n @entries = values.compact\n\n @sorter.call(@entries)\n end", "def rpms(id)\n criteria = {:type_ids => [Runcible::Extensions::Rpm.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "def query_folder\n @attributes[:query_folder]\n end", "def get_list_folders()\n\t\trefresh_access_token()\n\t\trequest_url = \"https://www.googleapis.com/drive/v2/files?q=mimeType='application/vnd.google-apps.folder'&access_token=#{@access_token}\"\n\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\t\tfolders = Hash.new\n\n\t\tresponse_body['items'].each do |item|\n\t\t\tfolders[item['title']] = item['id']\n\t\tend\n\n\t\treturn folders\n\tend", "def rip_folder(folder_id)\n \n query_string = \"SELECT ZICCLOUDSYNCINGOBJECT.ZTITLE2, ZICCLOUDSYNCINGOBJECT.ZOWNER, \" + \n \"ZICCLOUDSYNCINGOBJECT.Z_PK \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZICCLOUDSYNCINGOBJECT.Z_PK=?\"\n\n #Change things up for the legacy version\n if @version == IOS_LEGACY_VERSION\n query_string = \"SELECT ZSTORE.Z_PK, ZSTORE.ZNAME as ZTITLE2, \" +\n \"ZSTORE.ZACCOUNT as ZOWNER \" + \n \"FROM ZSTORE \" +\n \"WHERE ZSTORE.Z_PK=?\"\n end\n\n @database.execute(query_string, folder_id) do |row|\n tmp_folder = AppleNotesFolder.new(row[\"Z_PK\"],\n row[\"ZTITLE2\"],\n get_account(row[\"ZOWNER\"]))\n @folders[folder_id] = tmp_folder\n end \n end", "def get_image_data_by_id(image_id)\r\n execute <<-SQL\r\n SELECT name, folder\r\n FROM images\r\n WHERE id=#{image_id}\r\n LIMIT 1\r\n SQL\r\n end", "def folder\n @attributes[:folder]\n end", "def get_dir_contents(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tcontents_paths = []\n\tfor i in contents\n\t\tcontents_paths << i['path']\n\tend\n\tcontents_paths\nend", "def get_directory_listing_for(params)\n # Get parent folder id\n parent_folder_id = params[:folder_id].present? ? self.get_parent_folder_id(params[:folder_id]) : nil\n \n # Get root folder id if blank\n params[:folder_id] ||= self.get_root_folder_id\n return nil if params[:folder_id].blank?\n \n # Set default params\n result = {:folder_id => params[:folder_id], :parent_folder_id => parent_folder_id, :per_page => 500, :results => []}\n parameters = {}\n parameters['q'] = \"'#{params[:folder_id]}' in parents\"\n parameters['maxResults'] = result[:per_page]\n \n # Make api request\n begin\n drive = @client.discovered_api('drive', 'v2')\n api_result = @client.execute(:api_method => drive.files.list, :parameters => parameters)\n rescue\n return nil\n end\n \n \n if api_result.status == 200\n files = api_result.data\n files.items.each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n else\n result[:error] = {:code => api_result.status, :message => api_result.data['error']['message']} \n end\n result\n end", "def get_all_folderdata_for_user_id(user_id)\n return $db.execute(\"SELECT * FROM folders WHERE owner_id = ?\", user_id)\nend", "def get_metadata\n DatasetService.get_metadata self.dataset_id\n end", "def folder_list(opts = {})\n optional_inputs = {\n include_deleted: false,\n include_media_info: false,\n }.merge(opts)\n input_json = {\n id: optional_inputs[:id],\n path: optional_inputs[:path],\n include_deleted: optional_inputs[:include_deleted],\n include_media_info: optional_inputs[:include_media_info],\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/folder_list\", input_json)\n Dropbox::API::FolderAndContents.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def metadata(rft_id)\n Djatoka::Metadata.new(self, rft_id)\n end", "def index_folder\n @folder = current_user.folders.find params[:folder_id]\n if @folder.present?\n # If feed subscriptions in the folder have not changed, return a 304\n if stale? EtagCalculator.etag(@folder.subscriptions_updated_at),\n last_modified: @folder.subscriptions_updated_at\n @feeds = current_user.folder_feeds @folder, include_read: @include_read\n index_feeds\n end\n else\n Rails.logger.info \"User #{current_user.id} - #{current_user.email} tried to index feeds in folder #{params[:folder_id]} which does not exist or he does not own\"\n head 404\n end\n\n end", "def dataset_metadata(id)\n return uri(\"views/\" + id + \".json\")\n end", "def folder(id)\n Box::Folder.new(@api, nil, :id => id)\n end", "def metadata\n DatasetService.get_metadata dataset_id\n end", "def index\n @response, @documents = get_solr_response_for_field_values(\"id\",session[:folder_document_ids] || [])\n end", "def get_entries(dir, subfolder); end", "def get_folder_csv\n to_return = [AppleNotesFolder.to_csv_headers]\n @folders.each do |key, folder|\n to_return.push(folder.to_csv)\n end\n to_return\n end", "def get_all_files_in_folder(folder_id)\n return $db.execute(\"SELECT * FROM files WHERE folder_id = ?\", folder_id)\nend", "def get_drive_metadata\n execute!(drive.about.get).data\n end", "def folder\n @folders[@folder_name]\n end", "def image_list\n @folder = PulStore::Lae::Folder.find(params[:id])\n @page_title = \"Folder #{@folder.physical_number}\"\n @pages_list = get_pages_by_folder @folder.id\n respond_to do |format|\n format.html\n end\n end", "def get_list_files_folder(*folder_name)\n\n\t\tfiles = Array.new\n\t\tif (folder_name.length==0)\n\t\t\tfolders = get_list_folders()\n\t\t\t#Give the folder you want to use otherwise we'll have to loop through\n\t\t\tfolder_id = folders['Adwords']\n\t\t\trefresh_access_token()\n\n\t\t\trequest_url = \"https://www.googleapis.com/drive/v2/files/#{folder_id}/children?access_token=#{@access_token}\"\n\t\t\tresponse = RestClient.get request_url\n\t\t\tresponse_body = JSON.parse(response.body)\n\t\t\t#puts pp(response_body)\n\n\t\t\tresponse_body['items'].each do |item|\n\t\t\t\tfiles.push(item['id'])\n\t\t\tend\n\n\t\t\treturn files\n\t\tend\n\tend", "def folder_id\n current.folder.id\n end", "def root_folder_id\n self.root_folder\n end", "def files\n return unless session\n session.files.find_all_by_parent_folder_id(id)\n end", "def get_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def find_many_file_metadata_by_ids(ids:, use_valkyrie: true)\n results = []\n ids.each do |alt_id|\n begin\n # For Wings, the id and alt_id are the same, so just use alt id querying.\n file_metadata = query_service.custom_queries.find_file_metadata_by_alternate_identifier(alternate_identifier: alt_id, use_valkyrie: use_valkyrie)\n results << file_metadata\n rescue Hyrax::ObjectNotFoundError\n next\n end\n end\n results\n end", "def extract_metadata; end", "def folder\n query = Builder::XmlMarkup.new.Query do |xml|\n xml.Where do |xml|\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FileRef\")\n xml.Value(::File.dirname(url).sub(/\\A\\//, \"\"), :Type => \"Text\")\n end\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FSObjType\")\n xml.Value(1, :Type => \"Text\")\n end\n end\n end\n @list.items(:folder => :all, :query => query).first\n end", "def get_folder_by_id(folder, grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'Folder deletion was successful.'\n grafana_options[:unknown_code_msg] = 'FolderApi::get_folder_by_id unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/folders/id/' + get_folder_id(folder)\n\n folder_obj = do_request(grafana_options)\n\n return if folder_obj[:message] == 'Folder not found'\n folder_obj\n end", "def folders\n ContextIO::Folder.all(@account_id, @label)\n end", "def id; dir end", "def get_file_details(id)\n uri = ENDPOINT + \"file/details/#{key}/#{id}\"\n data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)\n Reach::Helper::convert_keys(data)\n end", "def folder\n model.folder\n end", "def show\n @folder = Folder.find(params[:id])\n end", "def docker_manifests(id)\n criteria = {:type_ids => [Runcible::Extensions::DockerManifest.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "def list(type=\"\",raw=false,format=\"json\")\n \n metadata_type = MavensMate::FileFactory.get_meta_type_by_name(type) || {}\n has_children_metadata = false\n if ! metadata_type[:child_xml_names].nil? and metadata_type[:child_xml_names].kind_of? Array\n has_children_metadata = true\n end\n is_folder_metadata = metadata_type[:in_folder]\n \n metadata_request_type = (is_folder_metadata == true) ? \"#{type}Folder\" : type\n if metadata_request_type == \"EmailTemplateFolder\"\n metadata_request_type = \"EmailFolder\"\n end\n \n #puts metadata_type.inspect + \"\\n\\n\"\n \n self.mclient = get_metadata_client\n begin\n response = self.mclient.request :list_metadata do |soap|\n soap.header = get_soap_header \n soap.body = \"<ListMetadataQuery><type>#{metadata_request_type}</type></ListMetadataQuery>\"\n end\n rescue Savon::SOAP::Fault => fault\n raise Exception.new(fault.to_s) if fault.to_s.not.include? \"sf:INVALID_TYPE\"\n end \n \n begin\n #puts \"beginning\"\n return response unless ! raw\n \n if response.nil?\n return []\n end\n \n #puts \"RESPONSE HASH: \" + response.to_hash.inspect + \"<br/><br/>\"\n \n #if theres nothing there, return an empty array\n if response.to_hash[:list_metadata_response].nil? or response.to_hash[:list_metadata_response] == nil\n return []\n end\n \n hash = response.to_hash\n \n els = Array.new\n result_elements = [] \n if hash[:list_metadata_response][:result].kind_of? Hash\n result_elements.push(hash[:list_metadata_response][:result])\n else\n result_elements = hash[:list_metadata_response][:result]\n end\n #puts \"result_elements: \" + hash.inspect\n \n #if this type has children, make a retrieve request for the type\n #parse the response as appropriate\n object_hash = {} #=> {\"Account\" => [ {\"fields\" => [\"foo\", \"bar\"]}, \"listviews\" => [\"foo\", \"bar\"] ], \"Contact\" => ... }\n \n if has_children_metadata == true && result_elements.length > 0\n #testing stuff\n require 'zip/zipfilesystem'\n require 'fileutils'\n retrieve_body = \"<RetrieveRequest><unpackaged><types><name>#{metadata_request_type}</name>\"\n result_elements.each { |el| \n retrieve_body << \"<members>#{el[:full_name]}</members>\"\n }\n retrieve_body << \"</types></unpackaged><apiVersion>#{MM_API_VERSION}</apiVersion></RetrieveRequest>\"\n zip_file = retrieve({ :body => retrieve_body })\n \n tmp_dir = Dir.tmpdir \n random = MavensMate::Util.get_random_string\n mm_tmp_dir = \"#{tmp_dir}/.org.mavens.mavensmate.#{random}\" \n \n Dir.mkdir(mm_tmp_dir)\n File.open(\"#{mm_tmp_dir}/metadata.zip\", \"wb\") {|f| f.write(Base64.decode64(zip_file))}\n Zip::ZipFile.open(\"#{mm_tmp_dir}/metadata.zip\") { |zip_file|\n zip_file.each { |f|\n f_path=File.join(mm_tmp_dir, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n }\n require 'nokogiri'\n # [{\"Account\" => [ {\"fields\" => [\"foo\", \"bar\"]}, \"listviews\" => [\"foo\", \"bar\"] ] }, ]\n \n Dir.foreach(\"#{mm_tmp_dir}/unpackaged/#{metadata_type[:directory_name]}\") do |entry| #iterate the metadata folders\n #entry => Account.object\n \n next if entry == '.' || entry == '..' || entry == '.svn' || entry == '.git'\n #puts \"processing: \" + entry + \"\\n\"\n \n doc = Nokogiri::XML(File.open(\"#{mm_tmp_dir}/unpackaged/#{metadata_type[:directory_name]}/#{entry}\"))\n doc.remove_namespaces!\n \n c_hash = {}\n metadata_type[:child_xml_names].each { |c|\n tag_name = c[:tag_name]\n items = []\n doc.xpath(\"//#{tag_name}/fullName\").each do |node|\n items.push(node.text)\n end \n c_hash[tag_name] = items\n }\n base_name = entry.split(\".\")[0]\n object_hash[base_name] = c_hash\n end \n FileUtils.rm_rf mm_tmp_dir\n end\n\n result_elements.each { |el| \n #puts \"RESULT ELEMENT: \" + el.inspect + \"<br/>\"\n #el => \"Account\"\n children = []\n full_name = el[:full_name]\n \n full_name = \"Account\" if full_name == \"PersonAccount\"\n object_detail = object_hash[full_name]\n \n #if this type has child metadata, we need to add the details\n if has_children_metadata == true\n #puts \"OBJECT DETAIL: \" + object_detail.inspect + \"<br/><br/>\" \n next if object_detail.nil?\n metadata_type[:child_xml_names].each { |child_xml|\n #puts child_xml.inspect\n #puts child_xml[:tag_name]\n \n tag_name = child_xml[:tag_name]\n #puts object_detail.inspect\n if object_detail[tag_name].size > 0\n gchildren = []\n object_detail[tag_name].each do |gchild_el|\n gchildren.push({\n :title => gchild_el,\n :key => gchild_el,\n :isLazy => false,\n :isFolder => false,\n :selected => false\n })\n end\n \n children.push({\n :title => child_xml[:tag_name],\n :key => child_xml[:tag_name],\n :isLazy => false,\n :isFolder => true,\n :children => gchildren,\n :selected => false\n })\n end\n } \n end\n \n #if this type has folders, run queries to grab all metadata in the folders\n if is_folder_metadata == true \n next if el[:manageable_state] != \"unmanaged\"\n folders = \"<folder>#{el[:full_name]}</folder>\"\n begin\n response = self.mclient.request :list_metadata do |soap|\n soap.header = get_soap_header \n soap.body = \"<ListMetadataQuery><type>#{type}</type>#{folders}</ListMetadataQuery>\"\n end\n rescue Savon::SOAP::Fault => fault\n raise Exception.new(fault.to_s)\n end\n \n folder_elements = [] \n folder_hash = response.to_hash \n if folder_hash[:list_metadata_response] && folder_hash[:list_metadata_response][:result]\n if folder_hash[:list_metadata_response][:result].kind_of? Hash\n folder_elements.push(folder_hash[:list_metadata_response][:result])\n else\n folder_elements = folder_hash[:list_metadata_response][:result]\n end \n end\n \n folder_elements.each { |folder_el|\n children.push({\n :title => folder_el[:full_name].split(\"/\")[1],\n :key => folder_el[:full_name],\n :isLazy => false,\n :isFolder => false,\n :selected => false\n })\n } \n end\n \n els.push({\n :title => el[:full_name],\n :key => el[:full_name],\n :isLazy => is_folder_metadata || has_children_metadata,\n :isFolder => is_folder_metadata || has_children_metadata,\n :children => children,\n :selected => false\n })\n }\n els.sort! { |a,b| a[:title].downcase <=> b[:title].downcase }\n \n if format == \"json\"\n return els.to_json\n else\n return els\n end\n rescue Exception => e\n puts \"\\n\\n\\n\" + e.message + \"\\n\" + e.backtrace.join(\"\\n\")\n end\n end", "def list_all_files()\n\t\tfiles = Hash.new\n\t\trefresh_access_token()\n\t\trequest_url = \"https://www.googleapis.com/drive/v2/files?access_token=#{@access_token}\"\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\t\tresponse_body['items'].each do |item|\n\t\t\t\tfiles[item['id']] = item['title']\n\t\tend\n\t\treturn files\n\tend", "def find_metadata(*args)\n results = []\n @filesets.each do |volid, fileset|\n results += fileset.find_metadata(*args)\n end\n return results\n end", "def read_metadata; end", "def read_metadata\n @client.get(metadata_path)\n end", "def get_children_folders(folder_id)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/children\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n response = http.request(request)\n\n folders_json = ''\n\n if response.code == 200.to_s\n folders_json = JSON.parse(response.read_body)['data']\n else\n puts \"Problem with getting folders. Status: #{response.code}\"\n puts response.body\n end\n folders_json\nend", "def find_many_file_metadata_by_ids(ids:)\n results = query_service.find_many_by_ids(ids: ids)\n results.select { |resource| resource.is_a? Hyrax::FileMetadata }\n end", "def find_many_file_metadata_by_ids(ids:)\n results = query_service.find_many_by_ids(ids: ids)\n results.select { |resource| resource.is_a? Hyrax::FileMetadata }\n end", "def get_folder_csv\n to_return = [AppleNotesFolder.to_csv_headers]\n @folders.sort_by{|key, folder| key}.each do |key, folder|\n to_return.push(folder.to_csv)\n end\n to_return\n end", "def show\n @folder = current_user.folders.find(params[:id])\n end", "def folders\r\n @folders ||= begin\r\n request_body = <<-eos\r\n \t\t<?xml version=\"1.0\"?>\r\n \t\t\t\t<D:searchrequest xmlns:D = \"DAV:\">\r\n \t\t\t\t\t <D:sql>\r\n \t\t\t\t\t SELECT \"DAV:displayname\", \"DAV:contentclass\"\r\n \t\t\t\t\t FROM SCOPE('shallow traversal of \"#{to_s}\"')\r\n \t\t\t\t\t WHERE \"DAV:ishidden\" = false\r\n AND \"DAV:isfolder\" = true\r\n \t\t\t\t\t </D:sql>\r\n \t\t\t\t</D:searchrequest>\r\n eos\r\n\r\n response = DavSearchRequest.execute(@credentials, :body => request_body)\r\n\r\n folders = {}\r\n\r\n # iterate through folders query and add a new Folder\r\n # object for each, under a normalized name.\r\n xpath_query = \"//a:propstat[a:status/text() = 'HTTP/1.1 200 OK']/a:prop\"\r\n XML::Parser.string(response.body).parse.find(xpath_query).each do |m|\r\n displayname = m.find_first('a:displayname').content\r\n contentclass = m.find_first('a:contentclass').content\r\n folders[displayname.normalize] = Folder.new(@credentials, self, displayname, contentclass.split(':').last.sub(/folder$/, '')) \r\n end\r\n \r\n folders\r\n end\r\n end", "def set_folder\n @folder = PulStore::Lae::Folder.find(params[:id])\n end", "def folder_feeds(folder, include_read: false)\n FolderManager.folder_feeds folder, self, include_read: include_read\n end", "def show\n @folder = current_user.folders.find_by_name(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @folder }\n end\n end", "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.metadata\n end\n end", "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.metadata\n end\n end", "def fetch_metadata\n {\n \"public_fqdn\" => fetch_metadata_item(\"getFullyQualifiedDomainName.txt\"),\n \"local_ipv4\" => fetch_metadata_item(\"getPrimaryBackendIpAddress.txt\"),\n \"public_ipv4\" => fetch_metadata_item(\"getPrimaryIpAddress.txt\"),\n \"region\" => fetch_metadata_item(\"getDatacenter.txt\"),\n \"instance_id\" => fetch_metadata_item(\"getId.txt\"),\n }\n end", "def folders\n return unless session\n session.folders.find_all_by_parent_folder_id(id)\n end", "def metadata_for_album_photos\n commentables = Commentable.find_for_album_photos(params[:album_id])\n render_commentables(commentables)\n end", "def get_metadata(*args)\n self.metadata.get(*args)\n end", "def folder_get_info(folder_node)\n nodetype, nodeid = folder_node.split(\"_\")\n @sb[:mode] = nil\n @sb[:nodeid] = nil\n @sb[:folder] = nodeid.nil? ? nodetype.split(\"-\").last : nodeid\n @conditions = Condition.where(:towhat => @sb[:folder].camelize).sort_by { |c| c.description.downcase }\n set_search_text\n @conditions = apply_search_filter(@search_text, @conditions) if @search_text.present?\n @right_cell_text = _(\"All %{typ} Conditions\") % {:typ => ui_lookup(:model => @sb[:folder].try(:camelize))}\n @right_cell_div = \"condition_list\"\n end", "def metar(id)\n perform_get(\"/metars/#{id}.xml\")\n end", "def get_file_metadatas(path: nil, environment:, recurse: :false, recurselimit: nil, max_files: nil, ignore: nil, links: :manage, checksum_type: Puppet[:digest_algorithm], source_permissions: :ignore)\n validate_path(path)\n\n headers = add_puppet_headers('Accept' => get_mime_types(Puppet::FileServing::Metadata).join(', '))\n\n response = @client.get(\n with_base_url(\"/file_metadatas#{path}\"),\n headers: headers,\n params: {\n recurse: recurse,\n recurselimit: recurselimit,\n max_files: max_files,\n ignore: ignore,\n links: links,\n checksum_type: checksum_type,\n source_permissions: source_permissions,\n environment: environment,\n }\n )\n\n process_response(response)\n\n [response, deserialize_multiple(response, Puppet::FileServing::Metadata)]\n end", "def get_file_details(file_id)\n begin\n api_result = @client.metadata(file_id, 1, true)\n rescue\n return nil\n end\n \n if api_result.present?\n self.item_into_standard_format(api_result, true)\n else\n nil\n end\n end", "def docker_manifest_lists(id)\n criteria = {:type_ids => [Runcible::Extensions::DockerManifestList.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "def get_document_metadata(d)\n md = []\n begin\n md = d.stuffing_metadata\n rescue\n log_and_print \"WARN: get_document_metadata threw an unknown exception\"\n md = []\n end\n\n if md == nil\n md = []\n end\n \n return md\n end", "def index\n @include_read = param_str_to_boolean :include_read, params\n\n if params[:folder_id].present?\n # Retrieve subscribed feeds in the passed folder\n index_folder\n else\n # Retrieve subscribed feeds regardless of folder\n index_all\n end\n rescue => e\n handle_error e\n end", "def give_metadata(name, folder_name, url)\n album_parts = name.split(\" _ALBUM_ \")\n single_parts = name.split(\" _SINGLE_ \")\n album_parts, single_parts = [album_parts, single_parts].map do |parts_set|\n (parts_set.length < 2) ? nil : parts_set\n end\n artist, album = album_parts || single_parts\n Dir.glob(\"./audio/#{folder_name}/**/*.mp3\").each do |path|\n Mp3Info.open(path) do |mp3|\n mp3.tag.artist = artist\n mp3.tag.album = \"#{album_parts ? \"ALBUM\" : \"SINGLE\"} #{album}\"\n end\n end\n end", "def folder_entries(folder, include_read: false, page: nil)\n EntriesPagination.folder_entries folder, self, include_read: include_read, page: page\n end", "def getFolder\r\n\t\t\t\t\treturn @folder\r\n\t\t\t\tend", "def get_folder_videos folder_id, **args\n get(\"/projects/#{folder_id}/videos\", args)\n end", "def load_metadata(groups)\n nameset = groups.values.flatten.uniq\n basenames = nameset.map { |n| File.basename(n) }\n names = basenames.join(' ')\n raw = JSON.parse(%x(brew info --json=v1 #{names}))\n\n raw.inject({}) do |named, entry|\n named[entry['full_name']] = entry\n named\n end\nend", "def folder_name\n @folder_name\n end", "def metadata\n if any? && metadata_schema\n response = api('request',\n :uri => \"hm://metadata/#{resource_name}s\",\n :batch => true,\n :payload => map {|resource| {:uri => resource.metadata_uri}},\n :response_schema => metadata_schema\n )\n response['result']\n else\n []\n end\n end", "def index\n client = DropboxApi::Client.new(\"C8Eg7_xlTzAAAAAAAAAAMduh226EdjZy_X_pVqXkbOUenDBMOVpQwo0zhF9sr8bC\")\n @result = client.list_folder \"/Yann Doré\"\n pp @result.entries\n @result.has_more? \n end", "def index\n @trip = Trip.find_by_name(params[:trip_id])\n @folder = @trip.folders.find_by_name(params[:folder_id])\n @photos = @folder.photos.group_by{ |photo| photo.album }\n if request.headers['X-PJAX']\n render :layout => false\n else\n render :layout => \"folder\"\n end\n end", "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folder }\n end\n end", "def images_for_gallery gallery_id, info_level = \"Full\", include_photos = \"true\"\n\t\t\t@response = api_request 'LoadPhotoSet', [gallery_id, info_level, include_photos]\n\t\t\traise ZenfolioAPI::ZenfolioAPISessionError, @response['error']['message'] if @response['result'].nil? && @response['error'].length > 0\n\n\t\t\t@response['result']['Photos'].each do |value|\n\t\t\t\taccess_descriptor = ZenfolioAPI::Model::AccessDescriptor.new(:realm_id => value['AccessDescriptor']['RealmId'], \n\t\t\t\t\t:access_type => value['AccessDescriptor']['AccessType'], :is_derived => value['AccessDescriptor']['IsDerived'], \n\t\t\t\t\t:access_mask => value['AccessDescriptor']['AccessMask'], :password_hint => value['AccessDescriptor']['PasswordHint'], \n\t\t\t\t\t:src_password_hint => value['AccessDescriptor']['SrcPasswordHint'])\n\n\t\t\t\t@photos << ZenfolioAPI::Model::Image.new(:id => value['Id'], :width => value['Width'], :height => value['Height'], :sequence => value['Sequence'], \n\t\t\t\t\t:access_descriptor => access_descriptor, :owner => value['Owner'], :title => value['Title'], :mime_type => value['MimeType'], \n\t\t\t\t\t:size => value['Size'], :gallery => value['Gallery'], :original_url => value['OriginalUrl'], :url_core => value['UrlCore'], \n\t\t\t\t\t:url_host => value['UrlHost'], :url_token => value['UrlToken'], :page_url => value['PageUrl'], :mailbox_id => value['MailboxId'], \n\t\t\t\t\t:text_cn => value['TextCn'], :flags => value['Flags'], :is_video => value['IsVideo'], :duration => value['Duration'], :caption => value['Caption'], \n\t\t\t\t\t:file_name => value['FileName'], :uploaded_on => value['UploadedOn']['Value'], :taken_on => value['TakenOn']['Value'], :keywords => value['keywords'], \n\t\t\t\t\t:categories => value['Categories'], :copyright => value['Copyright'], :rotation => value['Rotation'], :exif_tags => value['ExifTags'], :short_exif => value['ShortExif'])\n\t\t\tend\n\n\t\t\t@photos\n\t\tend", "def list\n client = get_dropbox_client\n unless client\n redirect_to(:action => 'auth_start') and return\n end\n @dropbox_docs = []\n path = \"/\"\n\n metadata = client.metadata(path, file_limit=25000, list=true, hash=nil, rev=nil, include_deleted=false)\n for dfile in metadata['contents']\n \tname = dfile['path']\n \t@dropbox_docs << name[1..-1]\n \tend\n \tgoogle_session = GoogleDrive.login_with_oauth(session[:google_token])\n \t@google_docs = []\n \tfor file in google_session.files\n \t\t@google_docs << file.title \n \tend\n #drivelist = get_dr.slice!(-)\n #render :inline => \"#{metadata['contents']} \\n\\n\\n\"\n #render json: metadata\n\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def set_folder\n @folder = Folder.find(params[:id])\n end", "def get_gallery(username: nil, folderid: nil, mode: nil, offset: 0, limit: 10)\n params = {}\n params['username'] = username unless username.nil?\n params['mode'] = mode unless mode.nil?\n params['offset'] = offset if offset != 0\n params['limit'] = limit if limit != 10\n unless folderid.nil?\n path = \"/api/v1/oauth2/gallery/#{folderid}\"\n else\n path = '/api/v1/oauth2/gallery/'\n end\n perform(DeviantArt::Gallery, :get, path, params)\n end", "def get_file_info(object_id:)\n {\n method: \"DOM.getFileInfo\",\n params: { objectId: object_id }.compact\n }\n end", "def index\n @file_folders = FileFolder.all\n end" ]
[ "0.6633125", "0.65705955", "0.6556665", "0.6538375", "0.64779276", "0.6292984", "0.6292984", "0.6275695", "0.62209696", "0.6160511", "0.6083531", "0.6073009", "0.60697556", "0.60639167", "0.60281014", "0.6023086", "0.601532", "0.5948098", "0.5918275", "0.5898173", "0.58630055", "0.5858862", "0.5846645", "0.5818643", "0.57778645", "0.5773603", "0.57646275", "0.5745028", "0.5739584", "0.57388675", "0.572681", "0.5722889", "0.57133955", "0.5709618", "0.568757", "0.56849027", "0.56666946", "0.5666626", "0.56178236", "0.5604413", "0.5578566", "0.5574565", "0.55702996", "0.5557604", "0.5553479", "0.555199", "0.55406183", "0.55391866", "0.5538683", "0.5527504", "0.552063", "0.55108374", "0.55008143", "0.5496158", "0.5493732", "0.5488345", "0.54691017", "0.5460931", "0.54547805", "0.5442884", "0.5439418", "0.5437784", "0.5436197", "0.54343873", "0.54343873", "0.5427644", "0.5412805", "0.5406356", "0.5402557", "0.5398857", "0.53959805", "0.53920406", "0.53920406", "0.53875357", "0.53857833", "0.53830045", "0.53759027", "0.53751034", "0.5365588", "0.53444386", "0.5340708", "0.5336865", "0.53282285", "0.5310904", "0.5304153", "0.52980936", "0.5294791", "0.529391", "0.528804", "0.52830213", "0.5279447", "0.52624744", "0.5243156", "0.5243069", "0.5231353", "0.52277005", "0.52228296", "0.52228296", "0.5210323", "0.52058166", "0.52051497" ]
0.0
-1
Noop return self as cached environment.
def cached self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache\n @__cache ||= Cache.new self\n end", "def cache\n @cache ||= build_cache\n end", "def cache\n env[CACHE] ||= Hash.new {|hash, sha| hash[sha] = read(sha) }\n end", "def cache!\n @@cache\n end", "def cached\n raise NotImplementedError\n end", "def cache\n @cache ||= Flareshow::Cache.new\n end", "def cached?; end", "def singleton_cache; end", "def cache\n if Esi.config.cache.nil?\n @cache ||= ActiveSupport::Cache::NullStore.new\n else\n Esi.config.cache\n end\n end", "def cache\n clone.tap { |crit| crit.options.merge!(:cache => true) }\n end", "def simple_cache\n @@cache_store\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= MemoryCache.new\n end", "def cache\n @cache ||= Chef::Cache.new()\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def current_environment\n read_environment_from_cache\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def cache_store\n return nil if context.environment.cache.nil?\n\n CacheStore.new context.environment\n end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cached_instance\n @cached_instance ||= read_instance\n end", "def clear_env\n DataCache.env_hash = {}\n end", "def initialize\n @cache = {}\n end", "def globalcache\n @globalcache ||= GlobalCacheHelper.new(@parent)\n end", "def cached\n @cached ||= Rails.cache.read(self.cache_key, opts_for_cache)\n end", "def cache\n @cache ||= ::Shopidav::Cache.new(site)\n end", "def singleton0_cache; end", "def env_hash\n read_env || reset_env unless defined?(DataCache.env_hash)\n DataCache.env_hash\n end", "def disable_caching=(_arg0); end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache(new_cache = nil)\n @cache = new_cache if new_cache\n @cache\n end", "def instance_cache; end", "def cache\n @@cache ||= PStore.new(File.expand_path(@@cache_file))\n end", "def current\n env[REPO] ||= new(env)\n end", "def initialize(cache = Global.cache)\n @cache = cache.new\n end", "def reset_cache!\n return unless Praxis::Blueprint.caching_enabled?\n\n Praxis::Blueprint.cache = Hash.new do |hash, key|\n hash[key] = {}\n end\n end", "def cache\n # Do a deep copy\n Marshal.load(Marshal.dump(@@cache))\n end", "def init!\n unless(Thread.current[:sparkle_cache])\n Thread.current[:sparkle_cache] = {}\n end\n self\n end", "def initialize_cache\n @elephant_cache = {}\n end", "def make_cache\n if !@thread_safe \n @@c = {}\n elsif defined?(ThreadSafe)\n @@c = ThreadSafe::Hash.new\n else\n raise 'ThreadSafe is required to use the Memory cache.'\n end \n end", "def cache\n DataCache\n end", "def prepare\n scope.send(:memoized_methods).instance_variable_get(:@memory).delete(name)\n super\n self\n end", "def _init_cache\n @cache_parent = {}\n end", "def cache_store\n\t\t\t\treturn nil if context.environment.cache.nil?\n\n\t\t\t\tif defined?(Sprockets::SassCacheStore)\n\t\t\t\t\tSprockets::SassCacheStore.new context.environment\n\t\t\t\telse\n\t\t\t\t\tCacheStore.new context.environment\n\t\t\t\tend\n\t\t\tend", "def new_store\n Cache.new\n end", "def environment\n @environment ||= nil\n end", "def freeze\n self\n end", "def env\n @env || {}\n end", "def hacked_env\n @hacked_env ||= {}\n end", "def prepare_for_caching\n @predictor.instance_variable_set(:@data_set, nil)\n end", "def cache\n yield\n end", "def reset_cache!\n @@cache = { :default => {} }.with_indifferent_access\n true\n end", "def env\r\n original_env.merge(hacked_env)\r\n end", "def original_env; end", "def cache\n store = Moneta.new :File, dir: 'moneta'\n Cachy.cache_store = store\n Cachy\n end", "def env\n super.merge(hacked_env)\n end", "def set_no_caching\n self.vdo_caching = 1\n self.auto_caching = 1\n end", "def cache\n @@_cache[self.class.name]\n end", "def environment; end", "def cache_store=(_arg0); end", "def cache_store=(_arg0); end", "def main\n @cache[:main]\n end", "def cache; shrine_class.new(cache_key); end", "def git_cache\n @git_cache ||= GitCache.new(self)\n end", "def simple_variables\n strong_memoize(:simple_variables) do\n scoped_variables(environment: nil)\n end\n end", "def use_clean_cache\n ActionController::Base.config.cache_store = Rails.cache = ActiveSupport::Cache::MemoryStore.new\n end", "def configure_cache; end", "def reset_cache\n envspecific_regexs(true)\n end", "def env\n return {} unless instance.respond_to? :env\n\n instance.env\n end", "def cache_store; end", "def cache_store; end", "def environment\n if [email protected]_a?(Condenser) && @environment.respond_to?(:call)\n @environment = @environment.call\n else\n @environment\n end\n end", "def no_cache!\n @cacheable = false\n end", "def cache_request\n cache\n end", "def env\n @env ||= env_with_params\nend", "def cached_view_context(engine=nil)\n @_view_context_cache ||= clean_view_context(engine)\n end", "def scope\n @env.unshift({})\n begin\n yield\n ensure\n @env.shift\n raise \"You went too far unextending env\" if @env.empty?\n end\n end", "def cache\n @options[:cache]\n end", "def env_defaults\n DataCache.env_defaults\n end", "def clear\n @cache.clear\n self\n end", "def freeze\n super\n _container.freeze\n self\n end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end" ]
[ "0.6782927", "0.67637193", "0.668713", "0.666474", "0.6606244", "0.6585674", "0.63838744", "0.6359243", "0.6357623", "0.63493055", "0.63162357", "0.6282738", "0.6279236", "0.62667125", "0.62440324", "0.62440324", "0.6226499", "0.62198174", "0.62198174", "0.6177602", "0.6171823", "0.6171823", "0.6171823", "0.6171823", "0.61511964", "0.61227566", "0.6112653", "0.6112301", "0.6100483", "0.6087874", "0.607948", "0.6036675", "0.6018579", "0.5998845", "0.5998845", "0.5998845", "0.5998845", "0.5998845", "0.5998845", "0.5998845", "0.59886646", "0.59744185", "0.59632677", "0.59600395", "0.5959709", "0.5937356", "0.5923049", "0.5911251", "0.59052205", "0.58981675", "0.58751905", "0.5863771", "0.5856326", "0.58548045", "0.5846246", "0.58257663", "0.58059996", "0.58041126", "0.57997406", "0.5790134", "0.5778116", "0.57667243", "0.57612604", "0.5740639", "0.5739831", "0.57336706", "0.573333", "0.57279277", "0.57273257", "0.57270056", "0.57270056", "0.5726124", "0.57205343", "0.5708495", "0.5706211", "0.5700379", "0.5688407", "0.56800115", "0.5655864", "0.564147", "0.564147", "0.56374794", "0.56366926", "0.5630989", "0.562727", "0.5622176", "0.56204545", "0.5620294", "0.56115025", "0.56078225", "0.5604339", "0.557973", "0.557973", "0.557973", "0.557973", "0.557973", "0.557973", "0.557973", "0.557973", "0.557973" ]
0.705013
0
Cache is immutable, any methods that try to clear the cache should bomb.
def mutate_config(*args) raise RuntimeError, "can't modify immutable cached environment" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_cache; end", "def clear_cache() @cache = {}; end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def clear_cache!\n # this should be overridden by concrete adapters\n end", "def clear\n @cache.clear\n end", "def clear!\n @cache = {}\n end", "def clear_cache!\n @cache = {}\n end", "def clear_cache!\n @cache = {}\n end", "def clear_cache\n @cache = {}\n end", "def clear\n cache.clear\n end", "def clear\n @cache.clear\n self\n end", "def flush_cache; end", "def clear\n @cache = {}\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache!\n @@cache\n end", "def clear\r\n @cache.flush\r\n end", "def clear_cache\n @access.refresh\n end", "def clear_cache\n @access.refresh\n end", "def reset\r\n @cache.reset\r\n end", "def cached\n raise NotImplementedError\n end", "def cache_clear\n @moneta.clear\n end", "def invalidate!\n @cache = MiniCache::Store.new\n return nil\n end", "def flush!\n @_cache = {}\n end", "def reset_cache\n self.class.reset_cache\n end", "def memoize_cache_clear\n __memoize_cache__.clear\n self\n end", "def clear\n @cache.clear\n entries.clear\n self\n end", "def cache_clear\n @store.flush_all\n rescue ::MemCache::MemCacheError => e\n Log.error(e)\n nil\n end", "def expire_cache!(key)\n raise 'The expire_cache method must be implemented'\n end", "def invalidate_cache! now\n end", "def refresh_cache\n @cache = build_cache\n end", "def cache_clear\n @store.clear\n end", "def update_cache\r\n Rails.cache.delete(\"All#{self.class.name.to_s}\")\r\n end", "def reset\n @entry_cache.clear\n end", "def reset\n hash.clear\n expire_cache!\n self\n end", "def expire_cache!\n @snapshot = nil\n end", "def clear_cache\n Rails.cache.delete(self.class.cache_key(self.key))\n end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def dirty_cache(key=nil)\n if(key.nil?)\n @elephant_cache.clear\n else\n @elephant_cache.delete(key)\n end\n end", "def reset!\n @cache = nil\n end", "def invalidate\n @cache_version ||= 0\n @cache_version += 1\n end", "def clear_all!\n @cache = Cache.new\n end", "def clear_cache(create_new_object = T.unsafe(nil)); end", "def clear_cache\n @all = nil\n end", "def cached?; end", "def without_cache(&block); end", "def without_cache(&block); end", "def cache_clear\n @client.flushall\n end", "def cache\n @cache ||= build_cache\n end", "def no_cache!\n @cacheable = false\n end", "def uncacheable!\n @stack.each { |t| t.cacheable = false }\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def expire_cache(key)\n end", "def cache_store; end", "def cache_store; end", "def clear!(key = nil)\n resp = super\n resp.instance_of?(TimeCacheItem) ? resp.value : resp\n end", "def cache_clear\n @store.delete\n end", "def cache_get(key)\n nil\n end", "def _clear_cache\n @cache_parent.clear\n end", "def uncached\n yield\n end", "def initialize\n @cache = {}\n end", "def disable_cache; end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def clear_cache\n $redis.del self.id\n end", "def clear_cache\n $redis.del self.id\n end", "def cache\n @__cache ||= Cache.new self\n end", "def flush!\n unless @cache.empty?\n $stderr.puts \" FLUSHING CACHE!\"\n @cache.clear\n end\n self\n end", "def clear_cache\n ccs.each(&:clear_cache)\n end", "def reset_cache!\n @@cache = { :default => {} }.with_indifferent_access\n true\n end", "def set_cache(value); end", "def set_cache(value); end", "def cache_clear\n @dataset.delete\n end", "def cache_clear\n @dataset.delete\n end", "def cache\n # Do a deep copy\n Marshal.load(Marshal.dump(@@cache))\n end", "def filter_cache; end", "def reset_cache!\n return unless Praxis::Blueprint.caching_enabled?\n\n Praxis::Blueprint.cache = Hash.new do |hash, key|\n hash[key] = {}\n end\n end", "def clear\n FileUtils.rm_f(cache_file)\n initialize!\n end", "def clear_cache\n property_cache.clear\n end", "def cache_delete\n model.send(:cache_delete, cache_key)\n end", "def disable_caching; end", "def invalidate_cache\n accessor.cache_manager.invalidate(resource.uri)\n end", "def clear_caches\n self.log.debug \"Clearing entry and values caches.\"\n\t\t@entry = nil\n\t\[email protected]\n\tend", "def disable_caching=(_arg0); end", "def instance_cache; end", "def delete\n cache_delete\n super\n end", "def delete\n cache_delete\n super\n end", "def singleton_cache; end", "def clear_cache! *keys\n clear_cache *keys\n ipcm_trigger :clear_cache, *keys\n end", "def free\n cache.clear\n nil\n end", "def cache(data); end" ]
[ "0.8214617", "0.8058668", "0.7711545", "0.77013814", "0.7688198", "0.7676083", "0.76349705", "0.76349705", "0.75374264", "0.75326014", "0.7507888", "0.74924093", "0.74765784", "0.74576277", "0.74576277", "0.74576277", "0.74576277", "0.74576277", "0.74576277", "0.74576277", "0.7445666", "0.743359", "0.74219453", "0.74219453", "0.738", "0.727076", "0.725761", "0.725374", "0.72256535", "0.72206163", "0.721757", "0.71829885", "0.7173331", "0.7149825", "0.71290106", "0.7122982", "0.7115508", "0.709106", "0.706687", "0.70387334", "0.70269096", "0.69707876", "0.6957212", "0.6957212", "0.6957212", "0.6957212", "0.6944272", "0.6942699", "0.69299644", "0.69180727", "0.69131964", "0.687869", "0.6870848", "0.68614477", "0.68614477", "0.6853141", "0.6842175", "0.6838592", "0.68353015", "0.6830364", "0.6815407", "0.6815407", "0.68126076", "0.68105114", "0.68105114", "0.68101865", "0.67962086", "0.6777179", "0.677627", "0.6771036", "0.6762521", "0.6759458", "0.6757582", "0.6757582", "0.67476946", "0.67476946", "0.6746485", "0.67194515", "0.6716965", "0.6712219", "0.6709937", "0.6709937", "0.6707282", "0.6707282", "0.6692435", "0.6679695", "0.6665576", "0.6658111", "0.6657105", "0.6649965", "0.66361773", "0.6634627", "0.6628657", "0.6626746", "0.6610884", "0.6610482", "0.6610482", "0.66099924", "0.6603889", "0.6602552", "0.6601921" ]
0.0
-1
should have the same interface as a standard Action
def setup(stash, point) @stash = stash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def process(action, *args); end", "def process_action(...)\n send_action(...)\n end", "def action\n end", "def _call_action(action)\n send(action)\n end", "def action\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def send_action(*_arg0); end", "def action(&block)\n @action = block\n end", "def process_action(*_arg0); end", "def process_action(*_arg0); end", "def process_action(*_arg0); end", "def perform_action(*args)\n end", "def action=(_arg0); end", "def action _obj, _args\n \"_obj action _args;\" \n end", "def method_for_action(action_name); end", "def action_hook; end", "def actions; end", "def process_action(method_name, *args); end", "def action(value)\n l action: value\n raise NotImplementedError, 'Implement in subclass'\n end", "def receive_action(action)\n self.define_singleton_method(:perform_action, &action)\n end", "def action_run\n end", "def act\n end", "def run_actions; end", "def perform_action(data); end", "def action(unit)\n\tend", "def action(&replacement_action)\n if replacement_action\n @action = replacement_action\n else\n @action\n end\n end", "def to_proc\n @action\n end", "def action\n @action ||= flow.execute\n end", "def default_action; end", "def handle_action(username, actiontype)\n \n end", "def action(value)\n _action(value) or fail ArgumentError, \"Unknown value for action: #{value}\"\n end", "def action(value)\n _action(value) or fail ArgumentError, \"Unknown value for action: #{value}\"\n end", "def _handle_action_missing(*args); end", "def run(*args)\n @action.call(args)\n end", "def run(*args)\n @action.call(args)\n end", "def action\n args.first\n end", "def method_missing(action, *args, &block)\n return nil\n end", "def action\n driver.action\n end", "def action_target()\n \n end", "def action_missing(*)\n end", "def playable_action\n raise NotImplementedError\n end", "def action args = {}\n\t\tend", "def action\n super\n end", "def run_action\n raise \"Action for resource #{self.class} is nil!\" if @action.nil?\n\t\t\tif (self.respond_to? @action)\n\t\t\t\tself.send(@action)\n\t\t\tend\n\t\tend", "def invoke_action(opt = {})\n raise(\"Method not implemented for this class: #{@klass}\")\n end", "def action(&block)\n @actions << block\n end", "def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end", "def exec_action_object(action)\n\t\t\taction.execute\n\t\tend", "def action(name, &blk)\n name = name.to_s\n\n klass = Class.new do\n def initialize(action, name)\n @action, @name = action, name\n end\n\n def control_flow(sym, name, mods, options={})\n @action.control_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def data_flow(sym, name, mods, options={})\n @action.data_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def flyweight(sym, name, mods, options={})\n @action.flyweight(sym, name, mods, options.merge({action: @name}))\n end\n\n def action(name, &blk)\n @action.action(\"#{@name}:#{name}\", &blk)\n end\n end\n\n blk.call klass.new(self, name)\n end", "def define_action_hook; end", "def invokeAction(action, args, &b)\n\t\t\tarty = method(action).arity\n\t\t\tif args.length == arty or arty == -1\n\t\t\t\t__send__(action, *args, &b)\n\t\t\tend\n\t\tend", "def invoke_action(name)\n # used for self-reflection in views\n @action = name\n\n send(name)\n end", "def mco_action\n raise RuntimeError, \"Not implemented\"\n end", "def _my_action_action\n {:text => \"Not used\"}\n end", "def post(action, **args); end", "def action\n _action_obj.to_h\n end", "def action\n @action ||= calculate_action\n end", "def perform(action)\n case action\n when :index, :new then get action\n when :show, :edit then get action, id: 1\n when :update then put :update, id: 1\n when :create then post :create\n when :destroy then delete :destroy, id: 1\n end\n end", "def perform(action, data = T.unsafe(nil)); end", "def action_want_to_perform(arg)\r\n self.class.actions_allowed[arg]\r\n end", "def action &block\n if block.nil?\n raise RuntimeError, 'expected a block but none given'\n end\n @actions << block\n end", "def action\n action_name.to_sym\n end", "def call_action action=nil\n action ||= @action\n invoke{ dispatch action }\n invoke{ handle_status(@response.status) }\n content_type self.class.content_type unless @response[CNT_TYPE]\n @response.finish\n end", "def put(action, **args); end", "def process\n send_request @action\n end", "def local_action(command, id, action)\n super(command,id,ACTION[action])\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def dispatch action\n @action = action\n\n invoke do\n filter(*before_filters_for(action))\n args = action_arguments action\n __send__(action, *args)\n end\n\n rescue => err\n invoke{ handle_error err }\n ensure\n filter(*after_filters_for(action))\n end", "def add_actions; end", "def lookup_action; end", "def action\n self[:action].to_sym if self[:action]\n end", "def action\n self[:action].to_sym if self[:action]\n end", "def action(name)\n nil\n end", "def head(action, **args); end", "def action\n Actions[ self[:action] ]\n end", "def perform_action( position, action, estream, new_branch_info = nil )\n return send( action.specialize_method_name(\"perform\"), position, action, estream, new_branch_info )\n end", "def acquire_action\n case @event['action']\n when 'create'\n 'error'\n when 'resolve'\n 'success'\n end\n end", "def set_action(action)\n @action = action\n end", "def action_name; end", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def perform(action)\n @action_name = action\n begin\n self.send(@action_name)\n rescue\n Skates.logger.error {\n \"#{$!}:\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n self.render\n end", "def _dispatch(action=:index)\n start = Time.now\n if self.class.callable_actions.include?(action.to_s)\n super(action)\n else\n raise ActionNotFound, \"Action '#{action}' was not found in #{self.class}\"\n end\n @_benchmarks[:action_time] = Time.now - start\n end", "def action(klass)\n def_delegator :default, klass.action_name\n define_method klass.action_name do |*args, &block|\n new_action = klass.new self, action\n directives.values.each {|it| it.setup! new_action }\n new_action.setup! *args, &block\n new_action.new_flow\n end\n end", "def _handle_action_missing(*args)\n action_missing(@_action_name, *args)\n end", "def action(a)\n @actions << a\n puts a.msg\n end", "def do_action(action)\n\t\tcase action\n\t\twhen 'list'\n\t\t\tlist()\n\t\twhen 'find'\n\t\t\tputs 'Finding...'\n\t\t\tfind()\n\t\twhen 'sort'\n\t\t\tsort()\n\t\twhen 'add'\n\t\t\tadd()\n\t\twhen 'quit'\n\t\t\treturn :quit\n\t\telse\n\t\t\tputs \"\\nI don't understand that command.\\n\"\n\t\tend\n\tend" ]
[ "0.7629962", "0.7629962", "0.7629962", "0.7629962", "0.7629962", "0.7489624", "0.74622047", "0.74260193", "0.74098307", "0.73540413", "0.73185074", "0.73185074", "0.73170495", "0.73167515", "0.73167515", "0.73167515", "0.73167515", "0.73167515", "0.73167515", "0.73034686", "0.7268571", "0.72574973", "0.72574973", "0.72574973", "0.71972966", "0.71892756", "0.7188535", "0.7174187", "0.71621495", "0.7160051", "0.7121502", "0.71155405", "0.7020636", "0.69516146", "0.6948146", "0.6930976", "0.6915989", "0.6913175", "0.690934", "0.68965894", "0.68860924", "0.68772626", "0.6864624", "0.6848819", "0.68486583", "0.684298", "0.68187237", "0.68187237", "0.68158865", "0.68153167", "0.6793767", "0.6790671", "0.67869055", "0.67778546", "0.6773949", "0.6745717", "0.673913", "0.67365783", "0.67066425", "0.6705746", "0.67021143", "0.67008024", "0.6658998", "0.66574454", "0.66239", "0.6596381", "0.65963507", "0.65813017", "0.657863", "0.65785694", "0.65784115", "0.6577256", "0.65622985", "0.65501446", "0.6524209", "0.64834", "0.64641666", "0.6454496", "0.64529705", "0.64484787", "0.64484787", "0.64484787", "0.6445873", "0.64388686", "0.64329386", "0.6432124", "0.6432124", "0.64275926", "0.6427246", "0.6417408", "0.64133507", "0.64114684", "0.6408578", "0.6395896", "0.6392263", "0.6391475", "0.6376209", "0.6374721", "0.63651556", "0.6353326", "0.63521594" ]
0.0
-1
should have the same interface as a standard Action
def setup(stash, point) @stash = stash # ah, but this assumes that all Entity objects can be created without parameters obj = @klass.new obj[:physics].body.p = point @space.entities.add obj end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def process(action, *args); end", "def process_action(...)\n send_action(...)\n end", "def action\n end", "def _call_action(action)\n send(action)\n end", "def action\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def action\n yield\n end", "def invoke_action(name)\n end", "def send_action(*_arg0); end", "def action(&block)\n @action = block\n end", "def process_action(*_arg0); end", "def process_action(*_arg0); end", "def process_action(*_arg0); end", "def perform_action(*args)\n end", "def action=(_arg0); end", "def action _obj, _args\n \"_obj action _args;\" \n end", "def method_for_action(action_name); end", "def action_hook; end", "def actions; end", "def process_action(method_name, *args); end", "def action(value)\n l action: value\n raise NotImplementedError, 'Implement in subclass'\n end", "def receive_action(action)\n self.define_singleton_method(:perform_action, &action)\n end", "def action_run\n end", "def act\n end", "def run_actions; end", "def perform_action(data); end", "def action(unit)\n\tend", "def action(&replacement_action)\n if replacement_action\n @action = replacement_action\n else\n @action\n end\n end", "def to_proc\n @action\n end", "def action\n @action ||= flow.execute\n end", "def default_action; end", "def handle_action(username, actiontype)\n \n end", "def action(value)\n _action(value) or fail ArgumentError, \"Unknown value for action: #{value}\"\n end", "def action(value)\n _action(value) or fail ArgumentError, \"Unknown value for action: #{value}\"\n end", "def _handle_action_missing(*args); end", "def run(*args)\n @action.call(args)\n end", "def run(*args)\n @action.call(args)\n end", "def method_missing(action, *args, &block)\n return nil\n end", "def action\n args.first\n end", "def action\n driver.action\n end", "def action_target()\n \n end", "def action_missing(*)\n end", "def playable_action\n raise NotImplementedError\n end", "def action args = {}\n\t\tend", "def action\n super\n end", "def run_action\n raise \"Action for resource #{self.class} is nil!\" if @action.nil?\n\t\t\tif (self.respond_to? @action)\n\t\t\t\tself.send(@action)\n\t\t\tend\n\t\tend", "def invoke_action(opt = {})\n raise(\"Method not implemented for this class: #{@klass}\")\n end", "def action(&block)\n @actions << block\n end", "def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end", "def exec_action_object(action)\n\t\t\taction.execute\n\t\tend", "def action(name, &blk)\n name = name.to_s\n\n klass = Class.new do\n def initialize(action, name)\n @action, @name = action, name\n end\n\n def control_flow(sym, name, mods, options={})\n @action.control_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def data_flow(sym, name, mods, options={})\n @action.data_flow(sym, name, mods, options.merge({action: @name}))\n end\n\n def flyweight(sym, name, mods, options={})\n @action.flyweight(sym, name, mods, options.merge({action: @name}))\n end\n\n def action(name, &blk)\n @action.action(\"#{@name}:#{name}\", &blk)\n end\n end\n\n blk.call klass.new(self, name)\n end", "def define_action_hook; end", "def invokeAction(action, args, &b)\n\t\t\tarty = method(action).arity\n\t\t\tif args.length == arty or arty == -1\n\t\t\t\t__send__(action, *args, &b)\n\t\t\tend\n\t\tend", "def invoke_action(name)\n # used for self-reflection in views\n @action = name\n\n send(name)\n end", "def mco_action\n raise RuntimeError, \"Not implemented\"\n end", "def _my_action_action\n {:text => \"Not used\"}\n end", "def post(action, **args); end", "def action\n _action_obj.to_h\n end", "def action\n @action ||= calculate_action\n end", "def perform(action)\n case action\n when :index, :new then get action\n when :show, :edit then get action, id: 1\n when :update then put :update, id: 1\n when :create then post :create\n when :destroy then delete :destroy, id: 1\n end\n end", "def perform(action, data = T.unsafe(nil)); end", "def action_want_to_perform(arg)\r\n self.class.actions_allowed[arg]\r\n end", "def action &block\n if block.nil?\n raise RuntimeError, 'expected a block but none given'\n end\n @actions << block\n end", "def action\n action_name.to_sym\n end", "def call_action action=nil\n action ||= @action\n invoke{ dispatch action }\n invoke{ handle_status(@response.status) }\n content_type self.class.content_type unless @response[CNT_TYPE]\n @response.finish\n end", "def put(action, **args); end", "def local_action(command, id, action)\n super(command,id,ACTION[action])\n end", "def process\n send_request @action\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def dispatch action\n @action = action\n\n invoke do\n filter(*before_filters_for(action))\n args = action_arguments action\n __send__(action, *args)\n end\n\n rescue => err\n invoke{ handle_error err }\n ensure\n filter(*after_filters_for(action))\n end", "def add_actions; end", "def action\n self[:action].to_sym if self[:action]\n end", "def action\n self[:action].to_sym if self[:action]\n end", "def lookup_action; end", "def action(name)\n nil\n end", "def head(action, **args); end", "def action\n Actions[ self[:action] ]\n end", "def acquire_action\n case @event['action']\n when 'create'\n 'error'\n when 'resolve'\n 'success'\n end\n end", "def perform_action( position, action, estream, new_branch_info = nil )\n return send( action.specialize_method_name(\"perform\"), position, action, estream, new_branch_info )\n end", "def set_action(action)\n @action = action\n end", "def action_name; end", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def perform(action)\n @action_name = action\n begin\n self.send(@action_name)\n rescue\n Skates.logger.error {\n \"#{$!}:\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n self.render\n end", "def _dispatch(action=:index)\n start = Time.now\n if self.class.callable_actions.include?(action.to_s)\n super(action)\n else\n raise ActionNotFound, \"Action '#{action}' was not found in #{self.class}\"\n end\n @_benchmarks[:action_time] = Time.now - start\n end", "def action(klass)\n def_delegator :default, klass.action_name\n define_method klass.action_name do |*args, &block|\n new_action = klass.new self, action\n directives.values.each {|it| it.setup! new_action }\n new_action.setup! *args, &block\n new_action.new_flow\n end\n end", "def _handle_action_missing(*args)\n action_missing(@_action_name, *args)\n end", "def run(&action)\n raise \"Must override AsyncHandler#run\"\n end", "def action(a)\n @actions << a\n puts a.msg\n end" ]
[ "0.76286364", "0.76286364", "0.76286364", "0.76286364", "0.76286364", "0.7486982", "0.7459622", "0.7424345", "0.74081314", "0.73525256", "0.7316452", "0.7316452", "0.7315694", "0.7315694", "0.7315694", "0.7315694", "0.7315694", "0.7315694", "0.73149925", "0.7300853", "0.7267931", "0.7254418", "0.7254418", "0.7254418", "0.7194736", "0.71874714", "0.71854746", "0.7173329", "0.7162011", "0.7159461", "0.7119028", "0.711447", "0.7019815", "0.6950759", "0.69475293", "0.693115", "0.6913742", "0.6912035", "0.69084966", "0.689599", "0.68857723", "0.6877089", "0.68628156", "0.684695", "0.6846799", "0.6841785", "0.6815982", "0.6815982", "0.6815881", "0.6813679", "0.6793862", "0.6790161", "0.67877424", "0.6777438", "0.6771402", "0.6745732", "0.6736807", "0.673452", "0.67067087", "0.6705914", "0.6700356", "0.66999847", "0.6659029", "0.6654858", "0.6621412", "0.6596669", "0.6596206", "0.6578998", "0.65782803", "0.65776736", "0.657666", "0.6576094", "0.65611625", "0.6550521", "0.6523957", "0.648144", "0.64616984", "0.6452716", "0.64522034", "0.6448158", "0.6448158", "0.6448158", "0.6444699", "0.6439728", "0.64316994", "0.64316994", "0.64315474", "0.64267856", "0.64264864", "0.64170045", "0.6411359", "0.6410419", "0.6407586", "0.6395794", "0.6393008", "0.6389308", "0.6375584", "0.63752705", "0.6363896", "0.63523287", "0.6351981" ]
0.0
-1
GET /company_dei_fields or /company_dei_fields.json
def index @company_dei_fields = CompanyDeiField.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end", "def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end", "def company_dei_field_params\n params.require(:company_dei_field).permit(:company_id, :dei_field_id)\n end", "def set_company_dei_field\n @company_dei_field = CompanyDeiField.find(params[:id])\n end", "def show_fields(**params)\n get('fields', params)\n end", "def get_company_by_company_part\n @parts = CompaniesController::CompanyService.get_company_by_company_part(params[:param_part])\n if [email protected]?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend", "def flights_fields\n render json: Search.getFlightsFieldInfo()\n end", "def GetFields params = {}\n\n params = params.merge(path: 'ticket_fields.json')\n APICall(params)\n\n end", "def fields\n DatasetService.get_fields dataset_id, api_table_name\n end", "def get_field_list\n return make_request(\"#{self.endpoint}/list/fields\")\n end", "def index\n projects = Project.where(company_id:current_user.company_id)\n @field_data = FieldDatum.where(project: projects)\n end", "def index\n @company_fields = CompanyField.all\n end", "def get_field(key,field)\n request :get, \"#{path_prefix}records/#{ue key}?field=#{ue field}\", :accept_404=>true, :force_encoding => \"ASCII-8BIT\", :raw_response => true\n end", "def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def create\n @company_dei_field = CompanyDeiField.new(company_dei_field_params)\n\n respond_to do |format|\n if @company_dei_field.save\n format.html { redirect_to @company_dei_field, notice: \"Company dei field was successfully created.\" }\n format.json { render :show, status: :created, location: @company_dei_field }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @company_dei_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company_dei_field.update(company_dei_field_params)\n format.html { redirect_to @company_dei_field, notice: \"Company dei field was successfully updated.\" }\n format.json { render :show, status: :ok, location: @company_dei_field }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @company_dei_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def person_field(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"personFields/#{id}\", params)\n end", "def all_person_fields(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'personFields', params)\n end", "def list\n @soils = Soil.where(:field_id => params[:id])\n\t@project_name = Project.find(session[:project_id]).name\n\t@field_name = Field.find(session[:field_id]).field_name\n\n\trespond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fields }\n end\n end", "def show \n render json: @clinic.as_json(:include=>{ :license=>{ :only=>:company_name } })\n end", "def company_information(params)\n get('company-information',params)\n end", "def get_fields\n DatasetService.get_fields self.dataset_id, self.api_table_name\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end", "def get_fields\n cached_response = REDIS.get(FIELDS_CACHE_KEY)\n\n # return the cached response if it's already in redis\n if cached_response != nil\n return JSON.parse(cached_response)\n end\n\n # otherwise, fetch and cache it\n resp = HTTParty.get(FORM_URL_BASE + \"fields.json\", basic_auth: WUFOO_AUTH)\n\n # make sure we got a good response\n throw \"Wufoo response error: #{resp.code}\" if resp.code != 200\n\n # cache the response value and set a long-ish TTL for it\n REDIS.multi do\n REDIS.set(FIELDS_CACHE_KEY, JSON.generate(resp))\n REDIS.expire(FIELDS_CACHE_KEY, 60 * 60 * 3)\n end\n\n resp[\"Fields\"] || []\nend", "def get_folio_data\n netid = params['netid']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n account = CUL::FOLIO::Edge.patron_account(url, tenant, folio_token, { username: netid })\n # Rails.logger.debug(\"mjc12test: Got FOLIO account #{account.inspect}\")\n render json: account\n end", "def department\n @departments = @company.departments\n respond_to do |format|\n format.json { render json: @departments}\n end\n end", "def index\n @api_v1_initiative_fields = Api::V1::InitiativeField.all\n end", "def show\n @company = Company.find(params[:id])\n employees_and_bio_signals\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def get_people_supportedfields()\n @restv9.get_people_supportedfileds()\n end", "def get_filed_returns(companyId, options={}) path = \"/api/v2/companies/#{companyId}/filings/returns/filed\"\n get(path, options, \"22.3.0\") end", "def labor_request_all_fields\n LaborRequest.fields\n end", "def company_country_code_company_id_descriptions_format_get_with_http_info(country_code, company_id, format, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EssentialsApi.company_country_code_company_id_descriptions_format_get ...\"\n end\n # verify the required parameter 'country_code' is set\n if @api_client.config.client_side_validation && country_code.nil?\n fail ArgumentError, \"Missing the required parameter 'country_code' when calling EssentialsApi.company_country_code_company_id_descriptions_format_get\"\n end\n # verify the required parameter 'company_id' is set\n if @api_client.config.client_side_validation && company_id.nil?\n fail ArgumentError, \"Missing the required parameter 'company_id' when calling EssentialsApi.company_country_code_company_id_descriptions_format_get\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling EssentialsApi.company_country_code_company_id_descriptions_format_get\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json\"\n end\n # resource path\n local_var_path = \"/company/{countryCode}/{companyId}/descriptions.{format}\".sub('{' + 'countryCode' + '}', country_code.to_s).sub('{' + 'companyId' + '}', company_id.to_s).sub('{' + 'format' + '}', format.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['UserSecurity']\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 => 'CompanyDescriptionsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EssentialsApi#company_country_code_company_id_descriptions_format_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def deal_field(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"dealFields/#{id}\", params)\n end", "def get_fields\n FIELD_DESCS\n end", "def show\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n @admin_company_address = @admin_company_detail.admin_accounts_addresses\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @admin_company_detail }\n end\n end", "def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end", "def show_address_fields(user, company)\n\n all_fields = [ { name: 'street_address', label: 'street', method: nil },\n { name: 'post_code', label: 'post_code', method: nil },\n { name: 'city', label: 'city', method: nil },\n { name: 'kommun', label: 'kommun', method: 'name' },\n { name: 'region', label: 'region', method: 'name' } ]\n\n if user.admin? || user.is_in_company_numbered?(company.company_number)\n return all_fields, true\n else\n start_index = all_fields.find_index do |field|\n field[:name] == company.address_visibility\n end\n\n if start_index\n return all_fields[start_index..4], false\n else\n return nil, false\n end\n end\n end", "def GetField id\n\n APICall(path: \"ticket_fields/#{id}.json\")\n\n end", "def show\n @breadcrumb = 'read'\n @company = Company.find(params[:id])\n @offices = @company.offices.paginate(:page => params[:page], :per_page => per_page).order(:office_code)\n @notifications = @company.company_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n @accounts = @company.company_bank_accounts.paginate(:page => params[:page], :per_page => per_page).order(:id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def company_field_params\n params.require(:company_field).permit(:company_id, :field_id)\n end", "def get_field_with_http_info(name, field_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_field ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_field\"\n end\n # verify the required parameter 'field_name' is set\n if @api_client.config.client_side_validation && field_name.nil?\n fail ArgumentError, \"Missing the required parameter 'field_name' when calling PdfApi.get_field\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/fields/{fieldName}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'fieldName' + '}', field_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FieldResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_field\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @field = FormulaField.find(params[:id])\n @owner = Project.find(@field.project_id).user_id\n\n recur = params.key?(:recur) ? params[:recur] : false\n\n respond_to do |format|\n format.html { render text: @field.to_json }\n format.json { render json: @field.to_hash(recur) }\n end\n end", "def places_fields\n render json: Search.getPlacesFieldInfo()\n end", "def show\n @invoicefield = Invoicefield.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoicefield }\n end\n end", "def getAllFieldsMap\n @customFieldMap = self.class.get(\"/rest/api/2/field\", :verify => false)\n end", "def contractor_request_all_fields\n ContractorRequest.fields\n end", "def get_custom_fields_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.get_custom_fields ...\"\n end\n # resource path\n local_var_path = \"/contacts/custom_fields/\"\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/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#get_custom_fields\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @company_dei_field.destroy\n respond_to do |format|\n format.html { redirect_to company_dei_fields_url, notice: \"Company dei field was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def reflect_fields\n send_and_receive('admin/luke', params: { fl: '*', 'json.nl' => 'map' })['fields']\n end", "def fields\n preview_json['fields']\n end", "def fetch_fields\n @enumerator ||= Enumerator.new do |collection|\n response = client.call(:do_get_sell_form_fields_ext,\n country_code: client.country_code,\n local_version: 0,\n webapi_key: client.webapi_key)[:do_get_sell_form_fields_ext_response][:sell_form_fields][:item]\n if response.is_a? Array\n response.each {|data| collection << AllegroApi::Field.from_api(data) }\n else\n collection << AllegroApi::Field.from_api(response)\n end\n end.memoizing\n end", "def show\n render json: [*@company]\n end", "def show\n @person = Person.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { render :json => @person.to_json(:include => [:fieldvalues, :address, :city, :province]) }\n end\n end", "def all_deal_fields(**args)\n params = parameters(args) do\n optional_params :start, :limit\n end\n request(:get, 'dealFields', params)\n end", "def show\n @company = current_user.companies.find(params[:company_id])\n @report = @company.labors.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def get_field_deserializers()\n return {\n \"contactEmail\" => lambda {|n| @contact_email = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"statementUrl\" => lambda {|n| @statement_url = n.get_string_value() },\n }\n end", "def get_part_by_company_part\n @parts = PartsController::PartService.get_part_by_company_part(params[:param_part])\n if [email protected]?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend", "def get_field_deserializers()\n return {\n \"costCenter\" => lambda {|n| @cost_center = n.get_string_value() },\n \"division\" => lambda {|n| @division = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_custom_fields(autopilot_contact)\n\t if autopilot_contact.has_key?(\"custom\")\n \t\tautopilot_contact[\"custom\"].each do |key,value|\n\t\t\t#if !cf[\"deleted\"]\n\t\t\t\t#Rails.logger.info \"cutom fieldsssssssssssss\"\n\t\t\t\t#Rails.logger.info \"#{key}\"\n\t\t\t\t#Rails.logger.debug \"#{value}\"\n\t\t\t\tcustom_field_value = value\n\t\t\t\tcustom_field_type, custom_field = key.split(\"--\")\n\t\t\t\t#Rails.logger.debug \"custom field-->#{custom_field}-#{custom_field_value}\"\n\t\t\t\tcase custom_field\n\t\t\t\twhen \"FDADDRESS\"\n\t\t\t\t\t@freshdesk_data[\"address\"] = custom_field_value\n\t\t\t\twhen \"FDACCOUNTID\"\n\t\t\t\t\t@freshdesk_account_id = custom_field_value\n\t\t\t\twhen \"FDCONTACTID\"\n\t\t\t\t\t@freshdesk_contact_id = custom_field_value\n\t\t\t\telse\n\t\t\t\t #@freshdesk_data[\"custom_fields\"][cf[\"kind\"]] = custom_field_value\n\t\t\t\tend\t\n\t\t\t#end\n\t\tend\n \t end\n\tend", "def fields\n Iterable.request(conf, '/users/getFields').get\n end", "def getEntity( entity_id, domain, path, data_filter)\n params = Hash.new\n params['entity_id'] = entity_id\n params['domain'] = domain\n params['path'] = path\n params['data_filter'] = data_filter\n return doCurl(\"get\",\"/entity\",params)\n end", "def index\n @accounts = current_user.companies.find(params[:company_id]).accounts\n if params[:fiscal_year_id].present?\n @fiscal_year = current_user.companies.find(params[:company_id]).fiscal_years.find(params[:fiscal_year_id])\n @accounts = @accounts.joins(:voucher_rows).joins(:vouchers).select(\"accounts.*, (coalesce(sum(voucher_rows.debit), 0) - coalesce(sum(voucher_rows.credit), 0)) AS sum\").where(\"fiscal_year_id = ?\", @fiscal_year.id).group(\"accounts.id\")\n end\n respond_to do |format|\n format.html \n format.json { render_with_protection @accounts }\n end\n end", "def show\n company = Company.find_by_id(params[:id])\n if company.blank?\n render(\n json: {\n error: {\n code: 404,\n message: \"Company not found\",\n errors: {\n message: \"Company not found\"\n }\n }\n })\n return\n end\n\n render json: {\n data: {\n kind: Company.name,\n id: company.id,\n company: company.as_json(include: :industry)\n }\n }\n end", "def show\n render json: @company\n end", "def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend", "def fields\n %i[ position_title employee_type request_type\n contractor_name number_of_months annual_base_pay\n nonop_funds nonop_source justification organization__name unit__name\n review_status__name review_comment user__name created_at updated_at ]\n end", "def edit_facet_fields\n @fields = blacklight_solr.get('admin/luke', params: { fl: '*', 'json.nl' => 'map' })['fields']\n end", "def show\n render json: @company_authority\n end", "def show_field(id)\n get(\"fields/#{id}\")\n end", "def show\n @fields = FormularioField.where \"formulario_id =?\", @formulario.id\n end", "def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def field_options\n [\n ['Do Not Import Field', :none],\n ['Full Name', :full_name],\n ['First Name', :first_name],\n ['Last Name', :last_name],\n ['Email', :email],\n ['Type', :type],\n ['Company', :company],\n ['Street Address', :address1],\n ['City/State/Zipcode', :address2],\n ['City', :city],\n ['State', :state],\n ['ZipCode', :zip],\n ['Source', :source],\n ['Group', :category],\n ['Mobile Phone', :phone_mobile],\n ['Business Phone', :phone_business],\n ['Home Phone', :phone_home],\n ['Fax Number', :fax_number],\n ['Temperature', :temperature],\n ['Birthday', :birthday],\n ['Anniversary', :anniversary],\n ['Spouse', :spouse],\n ['Home Purchase Date', :home_anniversary],\n ['Home Budget Price', :budget],\n ['Notes/Comments', :description]\n ]\n end", "def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end", "def get_field_deserializers()\n return {\n \"countriesBlockedForMinors\" => lambda {|n| @countries_blocked_for_minors = n.get_collection_of_primitive_values(String) },\n \"legalAgeGroupRule\" => lambda {|n| @legal_age_group_rule = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def fetch_fields\n @fields\n end", "def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n end\n end", "def show\n @company = Company.find(params[:id])\n @clients = @company.clients\n @employees = @company.employees\n @drivers = @company.drivers\n @shipments = @company.shipments\n end", "def fields\n %i[ request_model_type position_title employee_type request_type\n contractor_name employee_name annual_cost_or_base_pay\n nonop_source justification organization__name unit__name\n review_status__name review_comment user__name created_at updated_at ]\n end", "def show\n render json: @company_type\n end", "def show\n \t@empresa = Core::Empresa.find(params[:empresa_id])\n @core_porto = Core::Porto.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_porto }\n end\n end", "def describe_company(company)\n signed_get(COMPANIES_PATH, escape(company))\n end", "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def update_offices_textfield_from_company\n\n if params[:id] == \"0\"\n @offices = []\n else\n @offices = Company.find(params[:id]).offices\n end\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @offices }\n end\n end", "def company_country_code_company_id_format_get_with_http_info(country_code, company_id, format, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EssentialsApi.company_country_code_company_id_format_get ...\"\n end\n # verify the required parameter 'country_code' is set\n if @api_client.config.client_side_validation && country_code.nil?\n fail ArgumentError, \"Missing the required parameter 'country_code' when calling EssentialsApi.company_country_code_company_id_format_get\"\n end\n # verify the required parameter 'company_id' is set\n if @api_client.config.client_side_validation && company_id.nil?\n fail ArgumentError, \"Missing the required parameter 'company_id' when calling EssentialsApi.company_country_code_company_id_format_get\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling EssentialsApi.company_country_code_company_id_format_get\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json\"\n end\n # resource path\n local_var_path = \"/company/{countryCode}/{companyId}.{format}\".sub('{' + 'countryCode' + '}', country_code.to_s).sub('{' + 'companyId' + '}', company_id.to_s).sub('{' + 'format' + '}', format.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['UserSecurity']\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 => 'CompanyResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EssentialsApi#company_country_code_company_id_format_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def contact_field_options(contact_field)\n contact_field_definitions[contact_field]\n end", "def index\n @api_v1_select_fields = Api::V1::SelectField.all\n end", "def new\n @admin_company_detail = Admin::CompanyDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @admin_company_detail }\n end\n end", "def doctors_and_cities\n cities_dict, doctor_dict = current_user.dictionaries.where(resource_type: [\"Doctors\", \"Cities\"])\n render json: {doctors: doctor_dict.words.select(:id, :body),\n cities: cities_dict.words.select(:id, :body)}\n end", "def get_field_deserializers()\n return {\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"locale\" => lambda {|n| @locale = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def new\n @invoicefield = Invoicefield.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoicefield }\n end\n end", "def show\n Mongoid.identity_map_enabled = true\n\n @global_company = GlobalCompany.includes(:country, :global_industry, :global_company_profiles).find(params[:id])\n respond_to do |format|\n format.js { render :layout => false }\n format.json { render json: @global_company }\n end\n end", "def show\n cf_get(path: \"/organizations/#{org_id}\")\n end", "def show\n @resource = Resource.find(params[:id])\n @resource_type = ResourceType.find(@resource.resource_type_id)\n @values = ResourceValue.where(resource_id: params[:id])\n @field_types=[]\n @values.each do |value|\n @field_types << value.Field\n end\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end", "def get_company_info_from_fullcontact\n response = HTTParty.get(FULLCONTACT_LOOKUP_API, query: { \"domain\" => fetched_domain,\n \"apiKey\" => FULLCONTACT_API_KEY })\n response = response.success? ? JSON(response.body) : raise(\"Could not get information from FullContact, check rate limit.\")\n raise \"FullContact retry error\" if response[\"status\"] == 202 # FullContact queues for search sometimes.\n response\n end", "def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end", "def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end", "def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend", "def show\n @company_financial = CompanyFinancial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_financial }\n end\n end", "def query_depts\n { 'respDepartment' => Newspilot.configuration.departments }\n end" ]
[ "0.6915584", "0.6612462", "0.6463985", "0.6064799", "0.6005142", "0.59954727", "0.59470457", "0.5917651", "0.5806166", "0.57818156", "0.57804304", "0.57792765", "0.5778234", "0.57095826", "0.5691236", "0.5673233", "0.5663121", "0.56511784", "0.5641612", "0.5613393", "0.56082785", "0.5587589", "0.55780435", "0.5572928", "0.5572074", "0.5559666", "0.5545562", "0.55296326", "0.5501558", "0.5481809", "0.54659003", "0.5461962", "0.54493517", "0.5447289", "0.54324436", "0.5428318", "0.5418435", "0.54167944", "0.5414322", "0.53697854", "0.5349548", "0.53458023", "0.5343948", "0.5328109", "0.5317638", "0.5317541", "0.5302299", "0.5297953", "0.5294787", "0.52918744", "0.5283654", "0.5281009", "0.5279881", "0.52768844", "0.5273027", "0.52716094", "0.5266371", "0.526273", "0.5258352", "0.5249349", "0.5241093", "0.52344626", "0.5233365", "0.52290833", "0.5225113", "0.52221006", "0.52176386", "0.52061677", "0.520472", "0.5178596", "0.51773906", "0.51769584", "0.51747435", "0.51733863", "0.5171134", "0.51639575", "0.5150741", "0.5149696", "0.51486397", "0.5147285", "0.51469105", "0.51456076", "0.5141521", "0.51328003", "0.5128764", "0.512142", "0.5119294", "0.51171696", "0.51170266", "0.5112944", "0.5111634", "0.510905", "0.51085794", "0.50977856", "0.509355", "0.5093188", "0.5093188", "0.5092205", "0.50856274", "0.5083176" ]
0.6918577
0
GET /company_dei_fields/1 or /company_dei_fields/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @company_dei_fields = CompanyDeiField.all\n end", "def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end", "def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end", "def get_company_by_company_part\n @parts = CompaniesController::CompanyService.get_company_by_company_part(params[:param_part])\n if [email protected]?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend", "def company_dei_field_params\n params.require(:company_dei_field).permit(:company_id, :dei_field_id)\n end", "def set_company_dei_field\n @company_dei_field = CompanyDeiField.find(params[:id])\n end", "def get_field(key,field)\n request :get, \"#{path_prefix}records/#{ue key}?field=#{ue field}\", :accept_404=>true, :force_encoding => \"ASCII-8BIT\", :raw_response => true\n end", "def flights_fields\n render json: Search.getFlightsFieldInfo()\n end", "def index\n @company_fields = CompanyField.all\n end", "def update\n respond_to do |format|\n if @company_dei_field.update(company_dei_field_params)\n format.html { redirect_to @company_dei_field, notice: \"Company dei field was successfully updated.\" }\n format.json { render :show, status: :ok, location: @company_dei_field }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @company_dei_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def GetField id\n\n APICall(path: \"ticket_fields/#{id}.json\")\n\n end", "def person_field(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"personFields/#{id}\", params)\n end", "def GetFields params = {}\n\n params = params.merge(path: 'ticket_fields.json')\n APICall(params)\n\n end", "def create\n @company_dei_field = CompanyDeiField.new(company_dei_field_params)\n\n respond_to do |format|\n if @company_dei_field.save\n format.html { redirect_to @company_dei_field, notice: \"Company dei field was successfully created.\" }\n format.json { render :show, status: :created, location: @company_dei_field }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @company_dei_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end", "def get_fields\n cached_response = REDIS.get(FIELDS_CACHE_KEY)\n\n # return the cached response if it's already in redis\n if cached_response != nil\n return JSON.parse(cached_response)\n end\n\n # otherwise, fetch and cache it\n resp = HTTParty.get(FORM_URL_BASE + \"fields.json\", basic_auth: WUFOO_AUTH)\n\n # make sure we got a good response\n throw \"Wufoo response error: #{resp.code}\" if resp.code != 200\n\n # cache the response value and set a long-ish TTL for it\n REDIS.multi do\n REDIS.set(FIELDS_CACHE_KEY, JSON.generate(resp))\n REDIS.expire(FIELDS_CACHE_KEY, 60 * 60 * 3)\n end\n\n resp[\"Fields\"] || []\nend", "def index\n projects = Project.where(company_id:current_user.company_id)\n @field_data = FieldDatum.where(project: projects)\n end", "def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def show_fields(**params)\n get('fields', params)\n end", "def get_field_list\n return make_request(\"#{self.endpoint}/list/fields\")\n end", "def index\n @api_v1_initiative_fields = Api::V1::InitiativeField.all\n end", "def show \n render json: @clinic.as_json(:include=>{ :license=>{ :only=>:company_name } })\n end", "def show\n @company = Company.find(params[:id])\n employees_and_bio_signals\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def fields\n DatasetService.get_fields dataset_id, api_table_name\n end", "def company_country_code_company_id_descriptions_format_get_with_http_info(country_code, company_id, format, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EssentialsApi.company_country_code_company_id_descriptions_format_get ...\"\n end\n # verify the required parameter 'country_code' is set\n if @api_client.config.client_side_validation && country_code.nil?\n fail ArgumentError, \"Missing the required parameter 'country_code' when calling EssentialsApi.company_country_code_company_id_descriptions_format_get\"\n end\n # verify the required parameter 'company_id' is set\n if @api_client.config.client_side_validation && company_id.nil?\n fail ArgumentError, \"Missing the required parameter 'company_id' when calling EssentialsApi.company_country_code_company_id_descriptions_format_get\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling EssentialsApi.company_country_code_company_id_descriptions_format_get\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json\"\n end\n # resource path\n local_var_path = \"/company/{countryCode}/{companyId}/descriptions.{format}\".sub('{' + 'countryCode' + '}', country_code.to_s).sub('{' + 'companyId' + '}', company_id.to_s).sub('{' + 'format' + '}', format.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['UserSecurity']\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 => 'CompanyDescriptionsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EssentialsApi#company_country_code_company_id_descriptions_format_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_field_with_http_info(name, field_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_field ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.get_field\"\n end\n # verify the required parameter 'field_name' is set\n if @api_client.config.client_side_validation && field_name.nil?\n fail ArgumentError, \"Missing the required parameter 'field_name' when calling PdfApi.get_field\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/fields/{fieldName}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'fieldName' + '}', field_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FieldResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_field\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list\n @soils = Soil.where(:field_id => params[:id])\n\t@project_name = Project.find(session[:project_id]).name\n\t@field_name = Field.find(session[:field_id]).field_name\n\n\trespond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fields }\n end\n end", "def get_part_by_company_part\n @parts = PartsController::PartService.get_part_by_company_part(params[:param_part])\n if [email protected]?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend", "def company_information(params)\n get('company-information',params)\n end", "def tl_update_company_textfield_from_office\n office = params[:id]\n @company = 0\n if office != '0'\n @office = Office.find(office)\n @company = @office.blank? ? 0 : @office.company\n end\n render json: @company\n end", "def deal_field(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"dealFields/#{id}\", params)\n end", "def company_field_params\n params.require(:company_field).permit(:company_id, :field_id)\n end", "def show\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n @admin_company_address = @admin_company_detail.admin_accounts_addresses\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @admin_company_detail }\n end\n end", "def show\n @invoicefield = Invoicefield.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoicefield }\n end\n end", "def show\n render json: @company_type\n end", "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def show\n render json: [*@company]\n end", "def show\n @field = FormulaField.find(params[:id])\n @owner = Project.find(@field.project_id).user_id\n\n recur = params.key?(:recur) ? params[:recur] : false\n\n respond_to do |format|\n format.html { render text: @field.to_json }\n format.json { render json: @field.to_hash(recur) }\n end\n end", "def get_fields\n DatasetService.get_fields self.dataset_id, self.api_table_name\n end", "def show\n company = Company.find_by_id(params[:id])\n if company.blank?\n render(\n json: {\n error: {\n code: 404,\n message: \"Company not found\",\n errors: {\n message: \"Company not found\"\n }\n }\n })\n return\n end\n\n render json: {\n data: {\n kind: Company.name,\n id: company.id,\n company: company.as_json(include: :industry)\n }\n }\n end", "def show\n render json: @company\n end", "def department\n @departments = @company.departments\n respond_to do |format|\n format.json { render json: @departments}\n end\n end", "def get_filed_returns(companyId, options={}) path = \"/api/v2/companies/#{companyId}/filings/returns/filed\"\n get(path, options, \"22.3.0\") end", "def get_folio_data\n netid = params['netid']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n account = CUL::FOLIO::Edge.patron_account(url, tenant, folio_token, { username: netid })\n # Rails.logger.debug(\"mjc12test: Got FOLIO account #{account.inspect}\")\n render json: account\n end", "def show\n @breadcrumb = 'read'\n @company = Company.find(params[:id])\n @offices = @company.offices.paginate(:page => params[:page], :per_page => per_page).order(:office_code)\n @notifications = @company.company_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n @accounts = @company.company_bank_accounts.paginate(:page => params[:page], :per_page => per_page).order(:id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n render json: @company_authority\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end", "def show\n @company = current_user.companies.find(params[:company_id])\n @report = @company.labors.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def company_country_code_company_id_format_get_with_http_info(country_code, company_id, format, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EssentialsApi.company_country_code_company_id_format_get ...\"\n end\n # verify the required parameter 'country_code' is set\n if @api_client.config.client_side_validation && country_code.nil?\n fail ArgumentError, \"Missing the required parameter 'country_code' when calling EssentialsApi.company_country_code_company_id_format_get\"\n end\n # verify the required parameter 'company_id' is set\n if @api_client.config.client_side_validation && company_id.nil?\n fail ArgumentError, \"Missing the required parameter 'company_id' when calling EssentialsApi.company_country_code_company_id_format_get\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling EssentialsApi.company_country_code_company_id_format_get\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json\"\n end\n # resource path\n local_var_path = \"/company/{countryCode}/{companyId}.{format}\".sub('{' + 'countryCode' + '}', country_code.to_s).sub('{' + 'companyId' + '}', company_id.to_s).sub('{' + 'format' + '}', format.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['UserSecurity']\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 => 'CompanyResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EssentialsApi#company_country_code_company_id_format_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_company\n @company = Company.find(params[:company_id])\n end", "def update_company_textfield_from_office\n @office = Office.find(params[:id])\n @company = Company.find(@office.company)\n\n respond_to do |format|\n format.html # update_company_textfield_from_office.html.erb does not exist! JSON only\n format.json { render json: @company }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show_field(id)\n get(\"fields/#{id}\")\n end", "def get_custom_fields_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ContactsApi.get_custom_fields ...\"\n end\n # resource path\n local_var_path = \"/contacts/custom_fields/\"\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/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContactsApi#get_custom_fields\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @company_dei_field.destroy\n respond_to do |format|\n format.html { redirect_to company_dei_fields_url, notice: \"Company dei field was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def get_custom_fields(autopilot_contact)\n\t if autopilot_contact.has_key?(\"custom\")\n \t\tautopilot_contact[\"custom\"].each do |key,value|\n\t\t\t#if !cf[\"deleted\"]\n\t\t\t\t#Rails.logger.info \"cutom fieldsssssssssssss\"\n\t\t\t\t#Rails.logger.info \"#{key}\"\n\t\t\t\t#Rails.logger.debug \"#{value}\"\n\t\t\t\tcustom_field_value = value\n\t\t\t\tcustom_field_type, custom_field = key.split(\"--\")\n\t\t\t\t#Rails.logger.debug \"custom field-->#{custom_field}-#{custom_field_value}\"\n\t\t\t\tcase custom_field\n\t\t\t\twhen \"FDADDRESS\"\n\t\t\t\t\t@freshdesk_data[\"address\"] = custom_field_value\n\t\t\t\twhen \"FDACCOUNTID\"\n\t\t\t\t\t@freshdesk_account_id = custom_field_value\n\t\t\t\twhen \"FDCONTACTID\"\n\t\t\t\t\t@freshdesk_contact_id = custom_field_value\n\t\t\t\telse\n\t\t\t\t #@freshdesk_data[\"custom_fields\"][cf[\"kind\"]] = custom_field_value\n\t\t\t\tend\t\n\t\t\t#end\n\t\tend\n \t end\n\tend", "def index_field(list_name, field_name, site_path = '')\n url = computed_web_api_url(site_path)\n easy = ethon_easy_json_requester\n easy.url = uri_escape \"#{url}Lists/GetByTitle('#{odata_escape_single_quote(list_name)}')/Fields/getByTitle('#{field_name}')\"\n easy.perform\n\n parsed_response_body = JSON.parse(easy.response_body)\n return 304 if parsed_response_body['d']['Indexed']\n\n update_object_metadata parsed_response_body['d']['__metadata'], { 'Indexed' => true }, site_path\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def update\n respond_to do |format|\n if @company_field.update(company_field_params)\n format.html { redirect_to @company_field, notice: 'Company field was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_field }\n else\n format.html { render :edit }\n format.json { render json: @company_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @part_company = PartCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @part_company }\n end\n end", "def all_person_fields(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'personFields', params)\n end", "def update_offices_textfield_from_company\n\n if params[:id] == \"0\"\n @offices = []\n else\n @offices = Company.find(params[:id]).offices\n end\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @offices }\n end\n end", "def fields\n preview_json['fields']\n end", "def show\n @biz_company = BizCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @biz_company }\n end\n end", "def new\n @admin_company_detail = Admin::CompanyDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @admin_company_detail }\n end\n end", "def get_company_info_from_fullcontact\n response = HTTParty.get(FULLCONTACT_LOOKUP_API, query: { \"domain\" => fetched_domain,\n \"apiKey\" => FULLCONTACT_API_KEY })\n response = response.success? ? JSON(response.body) : raise(\"Could not get information from FullContact, check rate limit.\")\n raise \"FullContact retry error\" if response[\"status\"] == 202 # FullContact queues for search sometimes.\n response\n end", "def labor_request_all_fields\n LaborRequest.fields\n end", "def new\n @invoicefield = Invoicefield.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoicefield }\n end\n end", "def byId\n @company = Company.find(company_params[:id])\n\n render json: @company\n end", "def show\n @company_financial = CompanyFinancial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_financial }\n end\n end", "def company_country_code_company_id_telephone_numbers_format_get_with_http_info(country_code, company_id, format, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EssentialsApi.company_country_code_company_id_telephone_numbers_format_get ...\"\n end\n # verify the required parameter 'country_code' is set\n if @api_client.config.client_side_validation && country_code.nil?\n fail ArgumentError, \"Missing the required parameter 'country_code' when calling EssentialsApi.company_country_code_company_id_telephone_numbers_format_get\"\n end\n # verify the required parameter 'company_id' is set\n if @api_client.config.client_side_validation && company_id.nil?\n fail ArgumentError, \"Missing the required parameter 'company_id' when calling EssentialsApi.company_country_code_company_id_telephone_numbers_format_get\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling EssentialsApi.company_country_code_company_id_telephone_numbers_format_get\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json\"\n end\n # resource path\n local_var_path = \"/company/{countryCode}/{companyId}/telephone-numbers.{format}\".sub('{' + 'countryCode' + '}', country_code.to_s).sub('{' + 'companyId' + '}', company_id.to_s).sub('{' + 'format' + '}', format.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['UserSecurity']\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 => 'CompanyTelephoneNumbersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EssentialsApi#company_country_code_company_id_telephone_numbers_format_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def getEntity( entity_id, domain, path, data_filter)\n params = Hash.new\n params['entity_id'] = entity_id\n params['domain'] = domain\n params['path'] = path\n params['data_filter'] = data_filter\n return doCurl(\"get\",\"/entity\",params)\n end", "def show\n @resource = Resource.find(params[:id])\n @resource_type = ResourceType.find(@resource.resource_type_id)\n @values = ResourceValue.where(resource_id: params[:id])\n @field_types=[]\n @values.each do |value|\n @field_types << value.Field\n end\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end", "def set_company_field\n @company_field = CompanyField.find(params[:id])\n end", "def fetch_fields\n @enumerator ||= Enumerator.new do |collection|\n response = client.call(:do_get_sell_form_fields_ext,\n country_code: client.country_code,\n local_version: 0,\n webapi_key: client.webapi_key)[:do_get_sell_form_fields_ext_response][:sell_form_fields][:item]\n if response.is_a? Array\n response.each {|data| collection << AllegroApi::Field.from_api(data) }\n else\n collection << AllegroApi::Field.from_api(response)\n end\n end.memoizing\n end", "def places_fields\n render json: Search.getPlacesFieldInfo()\n end", "def show\n response_hash = @company.get_company_detail\n respond_to do |format|\n format.html {}\n format.json {render json: {message: response_hash}, status: 200}\n end\n end", "def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n end\n end", "def show\n render json: Company.find(params[\"id\"])\n end", "def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end", "def filter_fields\n i = -1\n render json: AppConfig['api_field_mappings'].map { |f| [f, i += 1] }.to_h\n end", "def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end", "def show\n @all_field_type = AllFieldType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @all_field_type }\n end\n end", "def index\n @company_clients = CompanyClient.where(company: params[:company]).first\n end", "def show_address_fields(user, company)\n\n all_fields = [ { name: 'street_address', label: 'street', method: nil },\n { name: 'post_code', label: 'post_code', method: nil },\n { name: 'city', label: 'city', method: nil },\n { name: 'kommun', label: 'kommun', method: 'name' },\n { name: 'region', label: 'region', method: 'name' } ]\n\n if user.admin? || user.is_in_company_numbered?(company.company_number)\n return all_fields, true\n else\n start_index = all_fields.find_index do |field|\n field[:name] == company.address_visibility\n end\n\n if start_index\n return all_fields[start_index..4], false\n else\n return nil, false\n end\n end\n end", "def company_country_code_company_id_related_names_format_get_with_http_info(country_code, company_id, format, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EssentialsApi.company_country_code_company_id_related_names_format_get ...\"\n end\n # verify the required parameter 'country_code' is set\n if @api_client.config.client_side_validation && country_code.nil?\n fail ArgumentError, \"Missing the required parameter 'country_code' when calling EssentialsApi.company_country_code_company_id_related_names_format_get\"\n end\n # verify the required parameter 'company_id' is set\n if @api_client.config.client_side_validation && company_id.nil?\n fail ArgumentError, \"Missing the required parameter 'company_id' when calling EssentialsApi.company_country_code_company_id_related_names_format_get\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling EssentialsApi.company_country_code_company_id_related_names_format_get\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json\"\n end\n # resource path\n local_var_path = \"/company/{countryCode}/{companyId}/related-names.{format}\".sub('{' + 'countryCode' + '}', country_code.to_s).sub('{' + 'companyId' + '}', company_id.to_s).sub('{' + 'format' + '}', format.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['UserSecurity']\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 => 'CompanyRelatedNamesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EssentialsApi#company_country_code_company_id_related_names_format_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @company_field = CompanyField.new(company_field_params)\n\n respond_to do |format|\n if @company_field.save\n format.html { redirect_to @company_field, notice: 'Company field was successfully created.' }\n format.json { render :show, status: :created, location: @company_field }\n else\n format.html { render :new }\n format.json { render json: @company_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @airport = Airport.find(params[:id])\n @airlines = Aircompany.where(airport_id: params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @airport }\n end\n end", "def show\n\n \tbegin\n \t@company = Company.find(COMPANY_ID)\n rescue ActiveRecord::RecordNotFound\n \t@company = Company.create({:description => ''})\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end \n end", "def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend", "def show\n @person = Person.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { render :json => @person.to_json(:include => [:fieldvalues, :address, :city, :province]) }\n end\n end", "def show\n @fieldtype = Fieldtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fieldtype }\n end\n end", "def show\n @ins_company = InsCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ins_company }\n end\n end", "def show\n @resource_fields = Field.where(\"resource_type_id = ?\", params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_type }\n end\n end", "def options_field\n load_resource\n\n col = @grid.get_column(params[:field])\n if col\n render :json => col.get_opts_for_select(@resource)\n else\n render :json => { status: \"ERROR\" }, status: :not_found\n end\n end", "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end" ]
[ "0.6785096", "0.67532855", "0.66428226", "0.6371352", "0.6326922", "0.6217147", "0.6013957", "0.59897584", "0.595333", "0.5898151", "0.5890971", "0.58468264", "0.5834416", "0.5816103", "0.580458", "0.5790136", "0.5779247", "0.5774152", "0.57724327", "0.5749261", "0.57450444", "0.57062244", "0.5680931", "0.56453073", "0.5643487", "0.5632975", "0.56257105", "0.56229794", "0.56153035", "0.5599232", "0.5561045", "0.5553957", "0.5552629", "0.5550406", "0.5539243", "0.55321765", "0.5524832", "0.5517133", "0.5514065", "0.5503287", "0.5498235", "0.54975873", "0.54974765", "0.5466635", "0.54628646", "0.54493904", "0.5440343", "0.54232466", "0.54227686", "0.5416546", "0.5413419", "0.54124683", "0.54046375", "0.53978837", "0.53972435", "0.5394211", "0.5394076", "0.53936166", "0.53936166", "0.53936166", "0.53936166", "0.53936166", "0.53936166", "0.5390308", "0.53881276", "0.53876036", "0.53789604", "0.53783214", "0.5377042", "0.53567314", "0.5353586", "0.53511596", "0.5340899", "0.5337823", "0.5328941", "0.53175616", "0.53148794", "0.5311368", "0.53081304", "0.53036696", "0.5286303", "0.52849853", "0.5276812", "0.5272669", "0.5267682", "0.526707", "0.5264996", "0.52598196", "0.5259002", "0.5258445", "0.52578795", "0.52409357", "0.5238541", "0.5237145", "0.523614", "0.5233494", "0.5232895", "0.52298486", "0.5227796", "0.52262366", "0.5222007" ]
0.0
-1
POST /company_dei_fields or /company_dei_fields.json
def create @company_dei_field = CompanyDeiField.new(company_dei_field_params) respond_to do |format| if @company_dei_field.save format.html { redirect_to @company_dei_field, notice: "Company dei field was successfully created." } format.json { render :show, status: :created, location: @company_dei_field } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @company_dei_field.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company_dei_field_params\n params.require(:company_dei_field).permit(:company_id, :dei_field_id)\n end", "def set_company_dei_field\n @company_dei_field = CompanyDeiField.find(params[:id])\n end", "def update\n respond_to do |format|\n if @company_dei_field.update(company_dei_field_params)\n format.html { redirect_to @company_dei_field, notice: \"Company dei field was successfully updated.\" }\n format.json { render :show, status: :ok, location: @company_dei_field }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @company_dei_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def company_field_params\n params.require(:company_field).permit(:company_id, :field_id)\n end", "def index\n @company_dei_fields = CompanyDeiField.all\n end", "def create\n @company_field = CompanyField.new(company_field_params)\n\n respond_to do |format|\n if @company_field.save\n format.html { redirect_to @company_field, notice: 'Company field was successfully created.' }\n format.json { render :show, status: :created, location: @company_field }\n else\n format.html { render :new }\n format.json { render json: @company_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def CreateField params = {}\n \n APICall(path: 'ticket_fields.json',method: 'POST',payload: params.to_json)\n \n end", "def destroy\n @company_dei_field.destroy\n respond_to do |format|\n format.html { redirect_to company_dei_fields_url, notice: \"Company dei field was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def create\n @field = @group.fields.build(field_params)\n\n respond_to do |format|\n if @field.save\n format.html { redirect_to [@company, @form, @group, @field], notice: 'Form field was successfully created.' }\n format.json { render :show, status: :created, location: [@company, @form, @group, @field] }\n else\n format.html { render :new }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_deal_field(**args)\n params = parameters(args) do\n required_params :name, :field_type\n optional_params :name, :field_type, :options\n end\n request(:post, 'dealFields', params)\n end", "def company_params\n params.require(:company).permit(:id, :industryTypeId, :industryTypeId2, :employeeId, :name, :email, :localidad, :partido, :addressDirection, :addressNumber, :cuit, :comment, :suscription, :fantasy_name, :postal_code, :companyType, :tlf, :cellphone, :internal_tlf, :contact, :floor, :departament, :search, :visitqty_min, :visitqty_max, :visit_attributes => [:id, :companyId, :visitTypeId, :frecuencyTypeId, :employeeId, :nextVisit, :visitDate, :aproved, :aprovalDate, :_destroy, :_update, :_save, :_create] )\n end", "def dfield_params\n params.require(:dfield).permit(:field_name, :field_type, :is_required, :is_show_in_list, :is_editable, :api, :brick_id, )\n end", "def company_params\n params.require(:company).permit(:nit, :nombre, :direccion, :telefono1, :telefono2, \n :fax, :contacto, :correo, :regimen, :actividade, :contribuyente, :resolucionCntv, \n :representante, :idciudad, :prefijo, :titulo1, :titulo2, :logo, :usuario)\n end", "def new_company_params\n params.require(:new_company).permit(:company_type, :full_title, :short_title, :english_title, :specialization, :logo, :full_adress, :post_adress, :phone, :faks, :email, :website, :director_name, :director_post, :contact_name, :contacy_phone, :contact_email, :user_id)\n end", "def company_params\n params.require(:company).permit(:number, :name, :email, :website, :logo, :description, :sub_sector_id, :admin_id, :country_id, :upload_logo, photo_companies: [], sub_sectors_attributes: [:sector])\n end", "def field_datum_params\n params.require(:field_datum).permit(:date,:observer,:releve_number,:scale,:location,:latitude_degree,:latitude_minutes,:latitude_seconds,:longitude_degree,:longitude_minutes,:longitude_seconds,:habitat_description,:project_id,:community_id,observations_attributes:[:id,:notes,:species_id,:_destroy,growth_forms_attributes:[:id,:code,:order,:_destroy],plant_covers_attributes:[:id,:code,:_destroy],crown_diameters_attributes:[:id,:code,:_destroy]])\n end", "def fd_cliente_params\n params.require(:fd_cliente).permit(:nome_cliente, :desc_sexo, :desc_celular, :desc_telefone, :desc_email, :desc_cpf, :data_nascimento, :data_inclusao, :fd_empresa_id, fd_endereco_attributes: [ :id, :nome_bairro , :nome_rua, :numr_quadra, :desc_complemento, :desc_pontoreferencia, :numr_cep, :fd_cidade_id])\n end", "def dece_params\n params.require(:dece).permit(:date_dc, :local, :nom, :prenom, :date_nai, :lieu_nai, :sexe, :situ_mat, :profession, :domicil, :nom_prenom_pere, :nom_prenom_mere, :nom_prenom_declare, :domicil_declare, :profession_declare, :date_declare_dece, :nom_prenom_officie, :qualite_officie, :date_officie, :n_volet)\n end", "def fields_params\n #params.require(:subject).permit(:name, :professor_id, :department_id, :descricao)\n params.require(:field).permit(:id, :name, :description)\n end", "def fournisseur_params\n params.require(:fournisseur).permit(:nom_fo, :adresse_fo, :company)\n end", "def create_department\n @department = @company.departments.create(name: params[:department][:name],division_id: params[:division_id])\n \trespond_to do |format|\n format.json { render json: @department }\n end\n end", "def postEntityEmployee( entity_id, title, forename, surname, job_title, description, email, phone_number)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['forename'] = forename\n params['surname'] = surname\n params['job_title'] = job_title\n params['description'] = description\n params['email'] = email\n params['phone_number'] = phone_number\n return doCurl(\"post\",\"/entity/employee\",params)\n end", "def field_rent_params\n params.require(:field_rent).permit(:field_id, :service_id, :fecha, :hora, :descripcion)\n end", "def company_params\n params.require(:company).permit(:company_logo,:manual_company_code, :group_id, :name, :company_type_id, :registration_no, :description, :pan_card_no, :tax_no, :professional_tax_no, :address, :city, :district_id, :country_id, :pin_code, :state_id, :email, :contact_no, :web_site, :starting_date, :ceo_name)\n end", "def company_params\n params.require(:client_company).permit(:company_name, :address, :phone,\n :primary_poc_first_name, :primary_poc_last_name, :poc_email,\n :poc_phone, :status, :client_po_number, :closed_at,\n :country_name, :poc_country, :company_id, :phone_country_code,\n :primary_poc_country_code, :city, :state, :poc_name)\n end", "def create\n @internship = Internship.new(params[:internship])\n @internship.description.strip!\n @internship.owner_hash = cookies[:hash] \n \n fields = params[:fields].split(\",\")\n fields.each do |desc|\n @internship.fields << Field.new(:description => desc.strip)\n end\n\n respond_to do |format|\n if @internship.save\n #format.html { redirect_to @internship }\n format.js\n #format.json { render :json => @internship, :status => :created, :location => @internship }\n else\n format.js {render :action => :create_error }\n #format.html { render :json => @internship.errors, :status => :unprocessable_entity }\n end\n end \n end", "def company_params\n params.require(:company).permit(:name, :company_number, :phone_number,\n :email,\n :website,\n :facebook_url,\n :instagram_url,\n :youtube_url,\n :description,\n :dinkurs_company_id,\n :show_dinkurs_events,\n addresses_attributes: [:id,\n :street_address,\n :post_code,\n :kommun_id,\n :city,\n :region_id,\n :country,\n :visibility])\n end", "def field_diary_params\n params.require(:field_diary).permit(:data, :descricao)\n end", "def create_fields\n create_fields_of(DivaServicesApi::Algorithm.general_information, :general)\n create_fields_of(DivaServicesApi::Algorithm.method_information, :method)\n end", "def devi_params\n params.require(:devi).permit(:decorateur, :nom, :prenom, :email, :telephone, :adresse, :numero, :produit_ids)\n end", "def update_offices_textfield_from_company\n\n if params[:id] == \"0\"\n @offices = []\n else\n @offices = Company.find(params[:id]).offices\n end\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @offices }\n end\n end", "def company_params\n params.require(:company).permit(:name,:email,:nit,:nitimage,:logo,:address,:telephone,:status,:department,:detail,:rubro,:webpage,:contactName,:downed,:requested,:subsidiaries,:downed_reason,:downd_date,:reason,:logoData,:password)\n end", "def formulario_params\n\n params.require(:formulario).permit(:nome, filial_ids: [], formulario_fields_attributes: [:id, :label, :field_type_id, :options, :url, :requirido, :_destroy], contact_group_ids: [])\n\n # if params[:tipo] != nil\n # [params.require(:formulario).permit(:nome),\n # params.require(:tipo).permit!,\n # params.require(:label).permit!,\n # params.require(:rec).permit!]\n # else\n # [params.require(:formulario).permit(:nome),nil,nil,nil]\n # end\n\n end", "def create\n render json: Company.create(params[\"company\"])\n end", "def company_params\n #params.require(:company).permit(:analyst, :states, :conf_level_id, :NDA_id, :country_id, :region_id, :HQcity_id, :HQstate_id, :website, :parentcom_id, :comtype_id, :CEO, :PSL, :no_of_DCS, :DClocation_id)\n end", "def tl_update_company_and_office_textfields_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @companies = @organization.blank? ? companies_dropdown : @organization.companies.order(:name)\n @offices = @organization.blank? ? offices_dropdown : Office.joins(:company).where(companies: { organization_id: organization }).order(:name)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @companies = companies_dropdown\n @offices = offices_dropdown\n @products = products_dropdown\n end\n @offices_dropdown = []\n @offices.each do |i|\n @offices_dropdown = @offices_dropdown << [i.id, i.name, i.company.name]\n end\n @json_data = { \"companies\" => @companies, \"offices\" => @offices_dropdown, \"products\" => @products }\n render json: @json_data\n end", "def company_params\n params.require(:company).permit(:logo, :name, :status, :sector, :taxation_number_first, :taxation_number_second, :memo, :favorite_id, :favorite_cb, :building, :full_address, :address_tag, :telephone, :fax, :email, :web_site, :note_contacts)\n end", "def create_consultation_using_post_with_http_info(cio_consultation_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.create_consultation_using_post ...'\n end\n # verify the required parameter 'cio_consultation_request' is set\n if @api_client.config.client_side_validation && cio_consultation_request.nil?\n fail ArgumentError, \"Missing the required parameter 'cio_consultation_request' when calling SupportApi.create_consultation_using_post\"\n end\n # resource path\n local_var_path = '/consultation'\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(cio_consultation_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Consultation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#create_consultation_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @field_datum = FieldDatum.new(field_datum_params)\n respond_to do |format|\n if @field_datum.save()\n format.html { redirect_to @field_datum, notice: 'Field datum was successfully created.' }\n format.json { render :show, status: :created, location: @field_datum }\n else\n format.html { render :new }\n format.json { render json: @field_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def franchise_params\n params.require(:franchise).permit(\n :name,\n :franchise_number,\n :legal_name,\n :phone,\n :fax,\n :website,\n :general_license,\n :residential_license,\n :commercial_license,\n :mold_remediation_license,\n :adwords_client_id,\n uploads_attributes: [\n :upload_category_id,\n :description,\n uploads: []\n ],\n notes_attributes: [:content],\n work_order_distribution_ids: [],\n scheduling_manager_ids: []\n )\n end", "def company_params\n params.require(:company).permit(:name, :promo, :direct_mail, :outdoor_ads, :radio_ads, :design_services,\n :product_placement, :marketing_research, :install_adv_constructions, :professional_photography,\n :production_promotional_materials, :print_services, :salepoint_ads, :internet_ids,\n :tv_ads, :mass_media, :indoor_ads, :transport_ads, :min_order_price, :description,\n :common_exp, :phone_contact, :address_contact, :email_contact, :slogan, :logo, :expiration_date_of_premium,\n :mobile_phone_contact, :company_site, :date_foundation, :widget_contact_details, :marketing_automation,\n city_ids: [])\n end", "def technical_datum_params\n params.require(:technical_datum).permit(:company_id, :superficie_totale, :superficie_produzione, :superficie_uffici, :superficie_magazzini, :volume_totale, :volume_produzione, :volume_uffici, :volume_magazzini, :dimensione_uffici, :servizi_igenici, :dimensione_piazzale, :presenza_docce, :numero_impiegati, :numero_operai, :descrizione)\n end", "def company_params\n params.require(:company).permit(:account_id, :name, :name_addon, :comments, :zip, :city, :street, :streetno, :country, :gender, :firstname, :lastname, :tel1, :tel2, :fax, :email, :homepage, :logo, :companystatus_id, :companynumber, :vat_number)\n end", "def create_person_field(**args)\n params = parameters(args) do\n required_params :name, :field_type\n optional_params :name, :field_type, :options\n end\n request(:post, 'personFields', params)\n end", "def company_params\n params.require(:company).permit(:submitted, patients_attributes: [\n :id, :name, :insurance_provider, :dob, :therapist, :admit_date, :loc, :company_id, :missing_services,\n daywise_infos_attributes: [:id, :t_date, {status:[]}, :patient_id]\n ])\n end", "def form607_params\n params.require(:form607).permit(:company)\n end", "def company_params\n params.require(:company).permit(:name, :description, :logotype, :url, :adress, :on_map, :phone, :employmentcontracts, :employments, :is_confirmed)\n end", "def company_params\n params.require(:company).permit(:id, :name, :legalForm)\n end", "def company_params\n params.require(:company).permit(:name,\n :bio,\n :slug,\n :company_type,\n :photo,\n :remote_photo_url,\n digital_addresses_attributes: [:id, :name, :address_type, :url],\n address_attributes: [:id, :street_line_1, :street_line_2, :city, :state, :zip])\n end", "def update\n respond_to do |format|\n if @company_field.update(company_field_params)\n format.html { redirect_to @company_field, notice: 'Company field was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_field }\n else\n format.html { render :edit }\n format.json { render json: @company_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end", "def destroy\n @company_field.destroy\n respond_to do |format|\n format.html { redirect_to company_fields_url, notice: 'Company field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def company_params\n params.require(:company).permit(:id, :name, :address, :id_number1, :id_number2, :address, :city, :state, :country, :zip_code, :telephone, :fax, :email, :web, :contact, :initial_cycle, :final_cycle, :plan, :counter, :limit, :note, :date_format, :unit, :separator, :delimiter, :id_number1_label)\n end", "def company_params\n params.require(:company).permit(:companyname, :city ,:user_id, :fieldofbusiness)\n end", "def create\n @intelcompany = IntelCompany.new(intelcompany_params)\n\n if @intelcompany.save\n render json: @intelcompany, status: :created, location: @intelcompany\n else\n render json: @intelcompany.errors, status: :unprocessable_entity\n end\n\n end", "def new\n @invoicefield = Invoicefield.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoicefield }\n end\n end", "def tl_update_company_textfield_from_office\n office = params[:id]\n @company = 0\n if office != '0'\n @office = Office.find(office)\n @company = @office.blank? ? 0 : @office.company\n end\n render json: @company\n end", "def company_params\n params.require(:company).permit(:name, :employee_id, :area_id)\n end", "def company_params\n params.require(:company).permit(:name, :logo, :address, :other_address, :email, :phone, :opening_times, :type, :company_id, :description, :links, :user_id)\n end", "def field_datum_params\n params.fetch(:field_datum, {})\n end", "def department\n @departments = @company.departments\n respond_to do |format|\n format.json { render json: @departments}\n end\n end", "def postEntityFax( entity_id, number, description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['number'] = number\n params['description'] = description\n return doCurl(\"post\",\"/entity/fax\",params)\n end", "def company_params\n params.require(:company).permit(:company_id, :company_name, :company_info)\n end", "def web_datas_params\n params.require(:web_datas).permit(:company_name, :url, :content)\n end", "def companyreg_params\n params.require(:companyreg).permit(:companyid, :, :companyname, :, :testname, :, :testdate, :)\n end", "def create\n @invoicefield = Invoicefield.new(params[:invoicefield])\n \n respond_to do |format|\n if @invoicefield.save\n format.html { redirect_to @invoicefield, notice: 'Invoicefield was successfully created.' }\n format.json { render json: @invoicefield, status: :created, location: @invoicefield }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoicefield.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @fields = Fieldgroup.all\n \n @person.city = City.find_or_create_by_name(params[:city]) if params[:city] != \"\"\n @person.province = Province.find_or_create_by_name(params[:province]) if params[:province] != \"\"\n \n params[:person].each do |index, par|\n if index == \"address_attributes\"\n params[:person][:address_attributes].each do |a_index, a_par|\n params[:person][:address_attributes].delete(a_index) if params[:person][:address_attributes][a_index] == \"\"\n end\n \n params[:person].delete(index) if params[:person][index].count == 0\n \n else\n params[:person].delete(index) if params[:person][index] == \"\"\n end\n end\n \n logger.debug params[:person][:address_attributes]\n \n #save avatar\n if !params[:person][:avatar].nil? && params[:person][:avatar] != \"\"\n uploaded_io = params[:person][:avatar]\n file = Time.now.to_i.to_s + uploaded_io.original_filename\n File.open(Rails.root.join('tmp', file), \"wb\") { |f| f.write(uploaded_io.read) }\n params[:person][:avatar] = file\n end\n \n @person = Person.new(params[:person])\n\n respond_to do |format|\n \t\n if @person.save\n \t\n \tif !params[:field].nil? \t\n \tparams[:field].each do |index, content|\n \t\t\t\t\t@value = Fieldvalue.find_or_create_by_person_id_and_field_id(@person.id, index.to_i)\n \t\t\t\t\[email protected] = content.to_s\n \t\t\t\t\[email protected]\n \t\t\t\tend\n\t end\n \t\n format.html { redirect_to(people_url, :notice => 'Person was successfully created.') }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "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", "def info_contacto_params\n params.require(:info_contacto).permit(:telefono, :nombre_contacto, :parentesco, :fk_id_paciente)\n end", "def edit_pdf_set_form_fields_with_http_info(field_values, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EditPdfApi.edit_pdf_set_form_fields ...'\n end\n # verify the required parameter 'field_values' is set\n if @api_client.config.client_side_validation && field_values.nil?\n fail ArgumentError, \"Missing the required parameter 'field_values' when calling EditPdfApi.edit_pdf_set_form_fields\"\n end\n # resource path\n local_var_path = '/convert/edit/pdf/form/set-fields'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['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(field_values)\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EditPdfApi#edit_pdf_set_form_fields\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @company = Company.new(nested_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @field = Field.new(params[:field])\n @field.user_id = session[:s_user_id]\n if [email protected]_id.nil?\n @farm = Farm.find(@field.farm_id)\n @field.farmname = @farm.farmname\n end\n if @field.land_expense_year.nil?\n @field.land_expense_year = 0\n end\n if @field.percent_harvest_acre.nil?\n @field.percent_harvest_acre = 0\n end\n if @field.fixed_amount_acre.nil?\n @field.fixed_amount_acre = 0\n end\n \n \n respond_to do |format|\n if @field.save\n format.html { redirect_to :action => \"edit\" , :id => @field.id }\n format.xml { render :xml => \"/fieldview\", :status => :created, :location => @field }\n else\n @ownerparties = find_parties_by_role(\"Landlord\")\n @clientparties = find_parties_by_role(\"Client\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @field.errors, :status => :unprocessable_entity }\n end\n end\n end", "def invoced_company_params\n\n params.require(:invoced_company).permit(:name, :address, :city_cp, :country, :phone, :cif)\n\n end", "def departamento_params\n params.require(:departamento).permit(:descripcion, :pais_id)\n end", "def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end", "def sivic_fornecedor_params\r\n params.require(:sivic_fornecedor).permit(:nome_fornecedor, :numr_cnpj, :numr_cpf, :numr_telefone, :nome_responsavel, :desc_fornecedor, :sivic_igreja_id, :user_id, sivic_endereco_attributes: [ :id, :DESC_Bairro, :DESC_Rua, :DESC_Complemento, :DESC_Pontoreferencia, :NUMR_Cep, :sivic_cidade_id ])\r\n end", "def company_params\n params.require(:company).permit(:company_name, :branch_name, :ph_number, :email, :web_site, :vat_number, :cst_number, :trade_license_number, :drug_license_number, :registration_number, :authorized_sign_img, :company_logo_img)\n end", "def daw_comunicado_params\n params.require(:daw_comunicado).permit(:com_nombre, :com_texto, :com_tipocomunicado, :com_estado, :com_fechaenvio)\n end", "def set_company_field\n @company_field = CompanyField.find(params[:id])\n end", "def create\n @api_v1_initiative_field = Api::V1::InitiativeField.new(api_v1_initiative_field_params)\n\n respond_to do |format|\n if @api_v1_initiative_field.save\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_initiative_field }\n else\n format.html { render :new }\n format.json { render json: @api_v1_initiative_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def company_params\n params.require(:company).permit(:user_id, :name, :location_id, :description, :web, :phone)\n end", "def colaborador_params\n params.require(:colaborador).permit(:nome, :cpf, :data_nascimento, :funcao_id, :data_admissao, :data_demissao, :deleted_at, telefones_attributes: [:id, :ddd, :numero, :_destroy])\n end", "def create\n @field_office = FieldOffice.new(field_office_params)\n\n respond_to do |format|\n if @field_office.save\n format.html { redirect_to @field_office, notice: 'Field office was successfully created.' }\n format.json { render :show, status: :created, location: @field_office }\n else\n format.html { render :new }\n format.json { render json: @field_office.errors, status: :unprocessable_entity }\n end\n end\n end", "def ofrece_params\n params.require(:ofrece).permit(:dia, :nombre, :tipo, :descripcion, :precio, :calificasion)\n end", "def company_params\n params.require(:company).permit(:Name, :Address, :NIF, :CreatedBy, :UpdatedBy, :Chat_ID, :user_id)\n end", "def company_create_params\r\n params.require(:company).permit(:company_name, :first_name, :last_name,\r\n :phone, :contract_start, :contract_end, :owner_id)\r\n end", "def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end", "def update_company_textfield_from_office\n @office = Office.find(params[:id])\n @company = Company.find(@office.company)\n\n respond_to do |format|\n format.html # update_company_textfield_from_office.html.erb does not exist! JSON only\n format.json { render json: @company }\n end\n end", "def create_field_options(params)\n post('fieldOption/bulk', fieldOptions: params)\n end", "def departamento_params\n params.require(:departamento).permit(:pais_id, :nombre, :codigo, :usuario_id)\n end", "def test_allow_dynamic_form_fields()\n # Parameters for the API call\n name = 'farhan'\n\n # dictionary for optional form parameters\n optional_form_parameters = {}\n optional_form_parameters['field'] = 'QA'\n\n # Perform the API call through the SDK function\n result = @controller.allow_dynamic_form_fields(name, _field_parameters: optional_form_parameters)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def nested_params\n\n params.require(:company).permit( :name, :credit_terms, :PO_required, :active, :bookkeeping_number, :line_of_business, :url, \n address_attributes: [:addressable_id, :addressable_type, :street_address, :city, :state, :post_code, :map_reference, :longitude, :latitude],\n identifier_attributes: [:id, :identifiable_id, :identifiable_type, :name, :value, :rank]\n )\n #params.require(:portrait_tag).permit(:id, :addressable_id => [])\n #person: [ :id, :people_id ] \n end", "def company_params\n params.require(:company).permit(:company_type, :title, :logo, :specialization, :description, :user, :short_name, :english_name)\n end", "def deal_field(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"dealFields/#{id}\", params)\n end", "def franchisee_params\n params.require(:franchisee).permit!#(:franchisee_type_id, :location, :parent_id, :franchisee_personal=>[:id, :first_name, :middle_name, :last_name, :dob, :age, :occupation, :experience, :no_of_owners], :franchisee_contact=>[:id, :address, :city, :state, :country, :email_id, :contact_no, :land_line], :franchisee_agreement=>[:id, :agreement_date, :duration, :renewal_date, :location, :no_of_centers, :advance_amount_gst, :balance_amount_gst, :no_of_installment, :center_address, :city, :state, :pincode])\n end", "def telefone_fornecedor_params\n params.require(:telefone_fornecedor).permit(:ddd, :telefone, :Fornecedor_id)\n end", "def postEntityName( entity_id, name, formal_name, branch_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['name'] = name\n params['formal_name'] = formal_name\n params['branch_name'] = branch_name\n return doCurl(\"post\",\"/entity/name\",params)\n end", "def company_params\n params.permit(:id, :name, :city, :state, :founded_date, :description)\n end", "def feild_params\n params.require(:feild).permit(:feildName,:departmentId)\n end", "def company_params\n params.require(:company).permit(:company_number, :name, :address_line_1, :address_line_2, :post_code, :city)\n end" ]
[ "0.72969025", "0.6398419", "0.62034774", "0.61678654", "0.6144338", "0.6108145", "0.5874998", "0.5843392", "0.5749435", "0.55539334", "0.5551198", "0.5519737", "0.54990107", "0.54640573", "0.5462716", "0.5446499", "0.5444533", "0.54161596", "0.54046124", "0.5365971", "0.5352776", "0.5350348", "0.53444827", "0.53442353", "0.53394336", "0.53387815", "0.53306496", "0.5324193", "0.53182626", "0.529442", "0.52888596", "0.52826977", "0.5281596", "0.5279782", "0.52756083", "0.5268301", "0.5260935", "0.52596176", "0.5254927", "0.5252819", "0.5248201", "0.5247049", "0.5245091", "0.52440566", "0.52440053", "0.5236195", "0.52326924", "0.52295667", "0.5227369", "0.52189237", "0.5215806", "0.52135193", "0.5206171", "0.52018946", "0.52012986", "0.5194293", "0.518915", "0.51832855", "0.5175632", "0.51744795", "0.5174142", "0.5172461", "0.517156", "0.51698697", "0.5165417", "0.51582795", "0.51512897", "0.5146423", "0.5146411", "0.5145427", "0.51431686", "0.51316786", "0.51234514", "0.5117652", "0.5114675", "0.51118195", "0.5109177", "0.5107128", "0.5101921", "0.510053", "0.50948554", "0.5090863", "0.50867265", "0.50846046", "0.5082901", "0.5081858", "0.5081245", "0.50808126", "0.5078637", "0.5075623", "0.50749755", "0.5067114", "0.5065011", "0.50612056", "0.50583655", "0.50575966", "0.5056572", "0.5053721", "0.5050414", "0.50496256" ]
0.7213538
1
PATCH/PUT /company_dei_fields/1 or /company_dei_fields/1.json
def update respond_to do |format| if @company_dei_field.update(company_dei_field_params) format.html { redirect_to @company_dei_field, notice: "Company dei field was successfully updated." } format.json { render :show, status: :ok, location: @company_dei_field } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @company_dei_field.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @company_field.update(company_field_params)\n format.html { redirect_to @company_field, notice: 'Company field was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_field }\n else\n format.html { render :edit }\n format.json { render json: @company_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_company_textfield_from_office\n @office = Office.find(params[:id])\n @company = Company.find(@office.company)\n\n respond_to do |format|\n format.html # update_company_textfield_from_office.html.erb does not exist! JSON only\n format.json { render json: @company }\n end\n end", "def tl_update_company_textfield_from_office\n office = params[:id]\n @company = 0\n if office != '0'\n @office = Office.find(office)\n @company = @office.blank? ? 0 : @office.company\n end\n render json: @company\n end", "def company_dei_field_params\n params.require(:company_dei_field).permit(:company_id, :dei_field_id)\n end", "def set_company_dei_field\n @company_dei_field = CompanyDeiField.find(params[:id])\n end", "def update_offices_textfield_from_company\n\n if params[:id] == \"0\"\n @offices = []\n else\n @offices = Company.find(params[:id]).offices\n end\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @offices }\n end\n end", "def update\n respond_to do |format|\n if @field.update(form_field_params)\n format.html { redirect_to [@company, @form, @group, @field], notice: 'Form field was successfully updated.' }\n format.json { render :show, status: :ok, location: [@company, @form, @group, @field] }\n else\n format.html { render :edit }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @company = Company.find(params[:id])\n\n @company.infos.each do |i|\n\t i.value = params[i.key]\n\t i.save\n end\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_field\n res = {\n :success => false,\n :msg => '',\n :data => {}\n }\n\n if (params[\"model\"] == nil)\n res[:msg] = 'order/update_field -- no model specified'\n else\n peer = nil\n case params[\"model\"]\n when \"entity\"\n peer = OrderEntity\n when \"company\"\n peer = Company\n when \"order\"\n peer = Order\n when \"order_revenu\"\n peer = OrderRevenu\n else\n res[:msg] = 'Could not locate that model'\n end\n if (peer != nil)\n obj = peer.new # <-- create a dummy instance of peer to check if method exists.\n if (!obj.respond_to?(params[\"field\"].to_a[0][0])) #<-- check the first key of hash only.\n res[:msg] = 'Error: Invalid field'\n else\n model = peer.update(params[:id], params[\"field\"])\n if (!model.errors.empty?)\n res = self.process_error(model.errors, res)\n else\n field = params[\"field\"].to_a\n res[:msg] = 'Updated field'\n res[:data][:field] = field[0][0]\n res[:data][:value] = field[0][1]\n res[:success] = true\n end\n end\n end\n end\n render :json => res, :layout => false\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def UpdateField params = {}\n \n APICall(path: 'ticket_fields.json',method: 'PUT',payload: params.to_json)\n \n end", "def edit\n respond_with(@company)\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_field.update(api_v1_initiative_field_params)\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update(company_params)\n @company.email_format = nil if @company.allow_email_regex == false\n @company.save\n @company.track_company_activity(\" updated the company \")\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_defect fields\n defect = @rally_api.find(:defect) { equal :formatted_i_d,\n fields[:formatted_i_d] }.first\n fields.delete_if { |name, val| val == defect.send(name) }\n defect.update(fields)\n end", "def update\n @company = Company.friendly.find(params[:id])\n\n @company.companytype_id = params[:companytype_id]\n\n\n\n respond_to do |format|\n\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def company_field_params\n params.require(:company_field).permit(:company_id, :field_id)\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n response_hash = @company.get_company_detail\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json {render json: {message: response_hash}, status: 200}\n else\n format.html { render :edit }\n error = @company.errors.keys[0].to_s.capitalize+\" \"[email protected][0][0].to_s\n format.json { render json: {message: error}, status: 422 }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n Rails.logger.info \"******\\n\\n\\nCompany: #{params[:company]}***********\\n\\n\\n\"\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def tl_update_company_and_office_textfields_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @companies = @organization.blank? ? companies_dropdown : @organization.companies.order(:name)\n @offices = @organization.blank? ? offices_dropdown : Office.joins(:company).where(companies: { organization_id: organization }).order(:name)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @companies = companies_dropdown\n @offices = offices_dropdown\n @products = products_dropdown\n end\n @offices_dropdown = []\n @offices.each do |i|\n @offices_dropdown = @offices_dropdown << [i.id, i.name, i.company.name]\n end\n @json_data = { \"companies\" => @companies, \"offices\" => @offices_dropdown, \"products\" => @products }\n render json: @json_data\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: 'Общая информация о компании успешно отредактирована' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_company_field\n @company_field = CompanyField.find(params[:id])\n end", "def update\n @company = Company.find(COMPANY_ID)\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to administration_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n @company = Company.find(params[:id])\n detail = @@data_util.hash_data_to_upper_case(params[:company], ['description'])\n detail[:lastupdateby] = session[:username]\n\n @@request_result[:data] = detail \n @@request_result[:type] = params[:company].class \n if @company.update_attributes(detail)\n @@request_result[:success] = true\n @@request_result[:notice] = 'Company successfully updated.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html {\n redirect_to @company, notice: 'Company was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def update\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n\n respond_to do |format|\n if @admin_company_detail.update_attributes(params[:admin_company_detail])\n format.html { redirect_to @admin_company_detail, :notice => 'Company detail was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @admin_company_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Empresa foi atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @part_company = PartCompany.find(params[:id])\n\n respond_to do |format|\n if @part_company.update_attributes(params[:part_company])\n format.html { redirect_to @part_company, notice: 'Part company was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @part_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n params[:company][:projects_attributes][\"0\"].merge!(:user_id => current_user.id)\n respond_to do |format|\n if @company.update_attributes(params[:company])\n\tformat.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n\tformat.xml { head :ok }\n else\n\tformat.html { render :action => \"edit\" }\n\tformat.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n puts field_params\n respond_to do |format|\n if @field.update(field_params)\n format.html { redirect_to fields_path, notice: 'Field was successfully updated.' }\n format.json { render :show, status: :ok, location: @field }\n else\n format.html { render :edit }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invoicefield = Invoicefield.find(params[:id])\n\n respond_to do |format|\n if @invoicefield.update_attributes(params[:invoicefield])\n format.html { redirect_to @invoicefield, notice: 'Invoicefield was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoicefield.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n if @invoced_company.update(invoced_company_params)\n format.html { redirect_to @invoced_company, notice: t(:successfully_updated_invoced_company) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invoced_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Cliente actualizado con exito' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client_company.update(company_params)\n format.html {redirect_to @client_company, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @client_company}\n else\n format.html {render :edit}\n format.json {render json: @client_company.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\r\n @company = Company.find(params[:id])\r\n \r\n respond_to do |format|\r\n if @company.update_attributes(params[:company])\r\n format.html { redirect_to @company, notice: 'Company 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: @company.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n # authorize @company\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to admin_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company_part.update(company_part_params)\n format.html { redirect_to company_parts_path, notice: 'Company part was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_part }\n else\n format.html { render :edit }\n format.json { render json: @company_part.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update!(nested_params)\n format.html { redirect_to @company, notice: \"#{@company.name} Company has been updated.\" }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @guarantee_company.update(guarantee_company_params)\n format.html { redirect_to @guarantee_company, notice: 'Guarantee company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @guarantee_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to companies_url, notice: @company.name + ' was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intelcompany.update(intelcompany_params)\n format.html { redirect_to @intelcompany, notice: 'Intel company was successfully updated.' }\n format.json { render :show, status: :ok, location: @intelcompany }\n else\n format.html { render :edit }\n format.json { render json: @intelcompany.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contact_company.update(contact_company_params)\n format.html { redirect_to @contact_company, notice: 'Contact company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dev_folio = DevFolio.find(params[:id])\n\n respond_to do |format|\n if @dev_folio.update_attributes(params[:dev_folio])\n format.html { redirect_to @dev_folio, notice: 'Dev folio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dev_folio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rail_company.update(rail_company_params)\n format.html { redirect_to @rail_company, notice: 'Rail company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rail_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Configurações da empresa alteradas com sucesso!' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @field_office.update(field_office_params)\n format.html { redirect_to @field_office, notice: 'Field office was successfully updated.' }\n format.json { render :show, status: :ok, location: @field_office }\n else\n format.html { render :edit }\n format.json { render json: @field_office.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_field\n # byebug\n if @field.update(fields_params)\n render :json => {}\n else\n render :json => @subject.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n #format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n #format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.json { render :show, status: :ok, location: @company }\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @filed.update(field_params)\n format.html { redirect_to @field, notice: 'Successfully updated.' }\n format.json { render :show, status: :ok, location: @field }\n else\n format.html { render :edit }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company_dei_field = CompanyDeiField.new(company_dei_field_params)\n\n respond_to do |format|\n if @company_dei_field.save\n format.html { redirect_to @company_dei_field, notice: \"Company dei field was successfully created.\" }\n format.json { render :show, status: :created, location: @company_dei_field }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @company_dei_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @company }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Bar atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @field = Field.find(params[:id])\n\n respond_to do |format|\n if @field.update_attributes(params[:field])\n format.html { redirect_to @field, notice: 'Field was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @global_company = GlobalCompany.find(params[:id])\n\n respond_to do |format|\n if @global_company.update_attributes(params[:global_company])\n format.html { redirect_to @global_company, notice: 'Global company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @global_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @company = Company.find(params[:id])\n @company.updated_by = current_user.id if !current_user.nil?\n # Should use attachment from drag&drop?\n if !$attachment.avatar.blank? && $attachment.updated_at > @company.updated_at\n @company.logo = $attachment.avatar\n end\n # @company.cache_images\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n $attachment.destroy\n $attachment = nil\n format.html { redirect_to @company,\n notice: (crud_notice('updated', @company) + \"#{undo_link(@company)}\").html_safe }\n format.json { head :no_content }\n else\n @notifications = notifications_dropdown\n @users = users_dropdown\n @classes = bank_account_classes_dropdown\n @zipcodes = zipcodes_dropdown\n @towns = towns_dropdown\n @provinces = provinces_dropdown\n # @countries = countries_dropdown\n # @banks = banks_dropdown\n # @offices = bank_offices_dropdown\n $attachment.destroy\n $attachment = Attachment.new\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resource_type.update_attributes(params[:resource_type])\n if params[:fields]\n params[:fields].each do |param|\n if param[:id]\n @field = Field.find(param[:id])\n @field.update_attributes(\n :name => param[:name], \n :field_type_id => param[:field_type_id],\n :resource_type_id => params[:id],\n :resource_type_reference_id => param[:resource_type_reference_id]\n )\n else\n @field = Field.create(\n :name => param[:name],\n :field_type_id => param[:field_type_id],\n :resource_type_id => params[:id],\n :resource_type_reference_id => param[:resource_type_reference_id]\n )\n end\n if @field.field_validations.any?\n @field.field_validations.each { |v| v.destroy }\n end\n if param[:validator_ids]\n param[:validator_ids].each do |index|\n next if index == \"multiselect-all\"\n @field.field_validations.build(validator_id: index.to_i)\n end\n end \n @field.save\n end\n end \n format.html { redirect_to @resource_type, notice: 'Resource type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:person][:company_name]\n params[:person][:company] = Company.find_or_create_by_name(params[:person][:company_name])\n params[:person].delete(:company_name)\n end\n @person = Person.find(params[:id])\n\n authorize! :edit, @person\n \n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @fields = Fieldgroup.all\n \n @person = Person.find(params[:id])\n \n params[:person].delete(:password) if params[:person][:password] == \"\"\n params[:person].delete(:password_confirmation) if params[:person][:password_confirmation] == \"\"\n \n @person.city = City.find_or_create_by_name(params[:city]) if params[:city] != \"\"\n @person.province = Province.find_or_create_by_name(params[:province]) if params[:province] != \"\"\n \n #save avatar\n if !params[:person][:avatar].nil? && params[:person][:avatar] != \"\"\n uploaded_io = params[:person][:avatar]\n file = Time.now.to_i.to_s + uploaded_io.original_filename\n File.open(Rails.root.join('tmp', file), \"wb\") { |f| f.write(uploaded_io.read) }\n params[:person][:avatar] = file\n end\n \n logger.debug params\n \n respond_to do |format|\n if @person.update_attributes(params[:person])\n \t\n \tif params[:field]\n \t#wir mŸssen fŸr alle checkboxen einen string: \"off\" als value erzeugen, da html-forms den status von leere checkboxen nicht als eigene variable mitschicken\n \tField.all.each do |field|\n \t\tparams[:field][field.id] = \"off\" if field.itype == \"BOOLEAN\" and !params[:field][field.id]\n \tend\n \t\n \tparams[:field].each do |index, content|\n\t \t\t\t\t@value = Fieldvalue.find_or_create_by_person_id_and_field_id(@person.id, index.to_i)\n\t \t \t\t\[email protected] = content.to_s\n\t\t\t \t\[email protected]\n \t\t\t\tend\n \t\t end\n \n format.html { redirect_to(people_url, :notice => 'Person was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @new_company.update(new_company_params)\n format.html { redirect_to @new_company, notice: 'Вы успешно отредактировали компанию' }\n format.json { render :show, status: :ok, location: @new_company }\n else\n format.html { render :edit }\n format.json { render json: @new_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_company_type.update(admin_company_type_params)\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: t(\"updated\") }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_person_field(id:, **args)\n params = parameters(args) do\n required_params :name\n optional_params :name, :options\n end\n request(:put, \"personFields/#{id}\", params)\n end", "def update\n @company_type = CompanyType.find(params[:id])\n\n if @company_type.update(company_type_params)\n head :no_content\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end", "def update\n @ins_company = InsCompany.find(params[:id])\n\n respond_to do |format|\n if @ins_company.update_attributes(params[:ins_company])\n format.html { redirect_to @ins_company, notice: 'Ins company was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ins_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if field_params[:as] =~ /pair/\n @field = CustomFieldPair.update_pair(params).first\n else\n @field = Field.find(params[:id])\n @field.update_attributes(field_params)\n end\n\n respond_with(@field)\n end", "def update\n respond_to do |format|\n if @tyc_company.update(tyc_company_params)\n format.html { redirect_to @tyc_company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @tyc_company }\n else\n format.html { render :edit }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n if @company.update_attributes(params[:company])\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end", "def update_fields(fields)\n\n # Also consider extracting this common code between vendor and item to basic_data\n # instead of going through each attribute on self, iterate through each item in field and update from there\n self.attributes.each do |k, v|\n attributes[k.to_sym] = fields[SYMBOL_TO_STRING[k.to_sym]] || fields[k.to_sym] || attributes[k.to_sym]\n end\n\n attributes[:id] = fields[SYMBOL_TO_STRING[:id]] || attributes[:id]\n self\n end", "def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_deal_field(id:, **args)\n params = parameters(args) do\n required_params :name\n optional_params :name, :options\n end\n request(:put, \"dealFields/#{id}\", params)\n end", "def update_fields(fields)\n @id = fields['id']\n @name = fields['name']\n @description = fields['desc']\n @closed = fields['closed']\n @url = fields['url']\n @organization_id = fields['idOrganization']\n self\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(company_params)\n format.js do\n if params[:update_formats]\n render 'update_formats'\n else\n render 'update'\n end\n end\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.js { render action: \"edit\" }\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company_information.update(company_information_params)\n format.html { redirect_to @company_information, notice: 'Company information was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_information }\n else\n format.html { render :edit }\n format.json { render json: @company_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @account_company.update(account_company_params)\n format.html { redirect_to @account_company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @account_company }\n else\n format.html { render :edit }\n format.json { render json: @account_company.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6994824", "0.6807052", "0.6751275", "0.6700451", "0.6657556", "0.65416217", "0.6488208", "0.62891513", "0.6278091", "0.6248317", "0.62350494", "0.6223402", "0.6213506", "0.62039375", "0.6192445", "0.61765975", "0.6125867", "0.61073005", "0.60739475", "0.6070091", "0.6068281", "0.6050301", "0.60021514", "0.60021514", "0.60018486", "0.59971267", "0.59968907", "0.597558", "0.5964927", "0.59609604", "0.5951918", "0.5951918", "0.5951918", "0.5951918", "0.5951918", "0.5951918", "0.59507567", "0.5931786", "0.5915596", "0.5915039", "0.5903125", "0.5899062", "0.5897827", "0.5882543", "0.58815163", "0.5879078", "0.58719623", "0.58643585", "0.5858836", "0.5857199", "0.5855229", "0.5853865", "0.58482075", "0.5835771", "0.58229405", "0.58215046", "0.58142537", "0.5814067", "0.5798262", "0.579783", "0.579783", "0.579783", "0.579783", "0.579783", "0.579783", "0.579783", "0.579783", "0.579783", "0.579783", "0.579783", "0.579783", "0.57932585", "0.5789931", "0.57875603", "0.57869536", "0.5782019", "0.57805413", "0.5777558", "0.57758176", "0.5774188", "0.5766502", "0.5765504", "0.5753252", "0.5753235", "0.5745448", "0.57381237", "0.57369083", "0.5734879", "0.5731593", "0.5731134", "0.5728913", "0.5728611", "0.57093644", "0.57092094", "0.5708102", "0.57076204", "0.5703569", "0.56936246", "0.5681897", "0.5672267" ]
0.74518
0
DELETE /company_dei_fields/1 or /company_dei_fields/1.json
def destroy @company_dei_field.destroy respond_to do |format| format.html { redirect_to company_dei_fields_url, notice: "Company dei field was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @company_field.destroy\n respond_to do |format|\n format.html { redirect_to company_fields_url, notice: 'Company field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def DeleteField id\n \n APICall(path: \"ticket_fields/#{id}.json\",method: 'DELETE')\n \n end", "def delete_custom_field(custom_field_id)\n url = \"#{@goseg_base_url}/custom_fields/#{custom_field_id}\"\n puts url\n return RestClient.delete(url){|response, request, result| response }\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @field.destroy\n respond_to do |format|\n format.html { redirect_to company_form_group_fields_url(@company, @form, @group), notice: 'Form field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @field = Field.find(params[:id])\n @field.destroy\n\n respond_to do |format|\n format.html { redirect_to fields_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @field = Field.find(params[:id])\n @field.destroy\n\n respond_to do |format|\n format.html { redirect_to fields_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/customFields/#{id}\")\n end", "def destroy\n @invoicefield = Invoicefield.find(params[:id])\n @invoicefield.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicefields_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative_field.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_fields_url, notice: 'Initiative field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_field!(field_name); end", "def delete()\n\n client.delete(\"/custom_fields/#{gid}\") && true\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @field.destroy\n respond_to do |format|\n format.html { redirect_to fields_url, notice: 'Field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_deal_field(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"dealFields/#{id}\", params)\n end", "def delete_person_field(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"personFields/#{id}\", params)\n end", "def destroy\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n @admin_company_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_company_details_url }\n format.json { head :ok }\n end\n end", "def destroy\n @field = FormulaField.find(params[:id])\n @project = Project.find(@field.project_id)\n if can_delete?(@field) && (@project.data_sets.count == 0)\n @field.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n format.html { redirect_to @field.project, notice: 'Field was successfuly deleted.' }\n end\n else\n @errors = []\n if @project.data_sets.count > 0\n @errors.push 'Project Not Empty.'\n end\n if (can_delete?(@field) == false)\n @errors.push 'User Not Authorized.'\n end\n respond_to do |format|\n format.json { render json: { errors: @errors }, status: :forbidden }\n format.html { redirect_to @field.project, alert: 'Field could not be destroyed' }\n end\n end\n end", "def delete_field(id)\n delete(\"fields/#{id}\")\n end", "def destroy\n @field.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to magazine_issue_fields_path , notice: 'Field was successfully deleted.'}\n format.json { head :no_content }\n end\n end", "def destroy\n @field = Field.find(params[:id])\n @field.destroy\n\n respond_with(@field)\n end", "def destroy\n @field_datum.destroy\n respond_to do |format|\n format.html { redirect_to field_data_url, notice: 'Field datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @field = Field.find(params[:id])\n @field.destroy\n respond_with :admin, @field\n end", "def destroy\n @extra_field.destroy\n respond_to do |format|\n format.html { redirect_to extra_fields_url, notice: 'Extra field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_deal_fields(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'dealFields', params)\n end", "def delete_person_fields(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'personFields', params)\n end", "def destroy\n @schema_field = SchemaField.find(params[:id])\n @schema_field.destroy\n\n respond_to do |format|\n format.html { redirect_to schema_fields_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tbl_form_field.destroy\n respond_to do |format|\n format.html { redirect_to tbl_form_fields_url, notice: 'Tbl form field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Cliente eliminado con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @field_office.destroy\n respond_to do |format|\n format.html { redirect_to field_offices_url, notice: 'Field office was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_company_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_company_types_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityEmployee( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/employee\",params)\n end", "def destroy\n @field_definition.destroy\n respond_to do |format|\n format.html { redirect_to field_definitions_url, notice: 'Field definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @all_field_type = AllFieldType.find(params[:id])\n @all_field_type.destroy\n\n respond_to do |format|\n format.html { redirect_to all_field_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fieldtype = Fieldtype.find(params[:id])\n @fieldtype.destroy\n\n respond_to do |format|\n format.html { redirect_to fieldtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact_company.destroy\n respond_to do |format|\n format.html { redirect_to contact_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @form_field.destroy\n respond_to do |format|\n format.html { redirect_to form_fields_url, notice: 'Form field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteEntityFax( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/fax\",params)\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @custom_field.destroy\n respond_to do |format|\n format.html { redirect_to custom_fields_url, notice: 'Custom field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @rail_company.destroy\n respond_to do |format|\n format.html { redirect_to rail_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customfieldcondition.destroy\n respond_to do |format|\n format.html { redirect_to customfieldconditions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_group_field.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_group_fields_url, notice: 'Group field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_client.destroy\n respond_to do |format|\n format.html { redirect_to company_clients_url, notice: 'Клиент был успешно удален' }\n format.json { head :no_content }\n end\n end", "def destroy\n @career_field.destroy\n respond_to do |format|\n format.html { redirect_to career_fields_url, notice: 'Career field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(id_from_params)\n @company.accounts.delete(current_user.account)\n #current_user.companies.delete(@company)\n #@company.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n field_id = params[:id].to_s.split(/_/).last.to_i\n @field = Field.find(field_id)\n\n ActiveRecord::Base.transaction do\n @field.destroy\n end\n\n respond_to do |format|\n format.html # destroy.html.erb\n format.xml { render :xml => @field }\n end\n end", "def destroy\n @global_company = GlobalCompany.find(params[:id])\n @global_company.destroy\n\n respond_to do |format|\n format.html { redirect_to global_companies_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityPhone( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/phone\",params)\n end", "def destroy\n @valuefield = Valuefield.find(params[:id])\n @valuefield.destroy\n\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def destroy\n @field = Field.find(params[:id])\n @field.destroy\n\n respond_to do |format|\n format.html { redirect_to(kind_fields_url(@kind)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @part_company = PartCompany.find(params[:id])\n @part_company.destroy\n\n respond_to do |format|\n format.html { redirect_to part_companies_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ins_company = InsCompany.find(params[:id])\n @ins_company.destroy\n\n respond_to do |format|\n format.html { redirect_to ins_companies_url }\n format.json { head :ok }\n end\n end", "def destroy\n @biz_company = BizCompany.find(params[:id])\n @biz_company.destroy\n\n respond_to do |format|\n format.html { redirect_to biz_companies_url }\n format.json { head :no_content }\n end\n end", "def test_send_delete_body_with_special_field_name()\n # Parameters for the API call\n body = DeleteBody.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"farhan\",\"field\":\"&&&\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.send_delete_body(body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def delete_field_with_http_info(name, field_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.delete_field ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.delete_field\"\n end\n # verify the required parameter 'field_name' is set\n if @api_client.config.client_side_validation && field_name.nil?\n fail ArgumentError, \"Missing the required parameter 'field_name' when calling PdfApi.delete_field\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/fields/{fieldName}\".sub('{' + 'name' + '}', name.to_s).sub('{' + 'fieldName' + '}', field_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#delete_field\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @sp_company_info = SpCompanyInfo.find(params[:id])\n @sp_company_info.destroy\n\n respond_to do |format|\n format.html { redirect_to sp_company_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Bar Deletado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_type.destroy\n\n head :no_content\n end", "def destroy\n @company = set_company\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_path, notice: \"#{@company.name} has been deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n #@company = Company.find_by_slug(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @field = Field.find(params[:id])\n begin\n @field.destroy \n rescue ActiveRecord::DeleteRestrictionError => e\n @field.errors.add(:base, e)\n end \n respond_to do |format|\n\n if e.nil?\n \n format.html { redirect_to(\"/fieldview\", :notice => 'field was successfully deleted.') }\n format.xml { head :ok }\n else \n format.html { render :action => \"edit\" }\n end\n \n \n end\n end", "def destroy\n @guarantee_company.destroy\n respond_to do |format|\n format.html { redirect_to guarantee_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Компания успешно удалена' }\n format.json { head :no_content }\n end\n end", "def destroy\n @equipment_field.destroy\n respond_to do |format|\n format.html { redirect_to equipment_fields_url, notice: 'Equipment field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @company = Company.find(params[:id])\r\n @company.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to companies_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @question_field = QuestionField.find(params[:id])\n @question_field.destroy\n\n respond_to do |format|\n format.html { redirect_to question_fields_url }\n format.json { head :no_content }\n end\n end", "def delete(name)\n fields.delete(name.to_sym)\n end", "def destroy\n @companyreg.destroy\n respond_to do |format|\n format.html { redirect_to companyregs_url, notice: 'Companyreg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @custom_field = CustomField.find(params[:id])\n authorize! :update, @custom_field\n \n\t@custom_field.destroy\n respond_to do |format|\n format.html { redirect_to(custom_fields_url) }\n\tend\n end", "def destroy\n @dynabute_field.destroy\n respond_to do |format|\n format.html { redirect_to dynabute_fields_path(@dynabute_field.target_model), notice: 'Dynabute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_select_field.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_select_fields_url, notice: 'Select field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @doc_ponto_comer.destroy\n respond_to do |format|\n format.html { redirect_to doc_ponto_comers_url }\n format.json { head :no_content }\n end\n end", "def delete_field(name, field_name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = delete_field_with_http_info(name, field_name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = delete_field_with_http_info(name, field_name, opts)\n else\n raise\n end\n return data\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n \t\n @companydocument = Companydocument.find(params[:id])\n @companydocument.destroy\n\n respond_to do |format|\n format.html { redirect_to companydocuments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n\n head :no_content\n end", "def destroy\n Kernel.const_get(params[:model_name]).remove_dynamo_field(params[:field_name])\n redirect_to :controller => \"admin/fields\", :action => \"edit\", :model_name=>params[:model_name]\n end", "def destroy\n\n @company = Company.find(1)\n\n respond_to do |format|\n a = ViaticotbkDetail.find_by(:cout_id=> params[:id])\n if a \n format.html { redirect_to couts_url, notice: 'Compronbante registrado en Caja, no se puede eliminar' }\n format.json { render json: a.errors, status: :unprocessable_entity }\n else \n @cout.destroy\n\n format.html { redirect_to couts_url, notice: 'Comprobante eliminado.' }\n format.json { head :no_content }\n end\n\n end\n\n end", "def destroy\n @company_information.destroy\n respond_to do |format|\n format.html { redirect_to company_informations_url, notice: 'Company information was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_lease_information.destroy\n respond_to do |format|\n format.html { redirect_to company_lease_informations_url, notice: 'Company lease information was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Field.where(unique_id: params[:unique_id]).destroy_all\n respond_to do |format|\n format.html { redirect_to '/dashboard', notice: 'Form was successfully deleted.' }\n end\n end", "def delete(field)\n canonical = downcased(field)\n @headers.delete(canonical) if @headers.key?(canonical)\n end", "def delete(contactname)\n\n end", "def deleteEntityPayment_type( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/payment_type\",params)\n end" ]
[ "0.7297374", "0.6985079", "0.6941637", "0.6892651", "0.68521124", "0.68208", "0.68208", "0.68130654", "0.676764", "0.67555934", "0.6651101", "0.66187036", "0.6572903", "0.6555761", "0.6555592", "0.65225166", "0.6503332", "0.64953595", "0.6486551", "0.64724094", "0.64686763", "0.6467722", "0.64622366", "0.64530027", "0.6430361", "0.63609093", "0.6338888", "0.63338447", "0.63205427", "0.6319089", "0.6313074", "0.6312796", "0.6308003", "0.62994516", "0.62987745", "0.6290893", "0.6288756", "0.62754655", "0.6260943", "0.6260943", "0.6260943", "0.62536126", "0.62520856", "0.62414604", "0.62399244", "0.62375563", "0.62334704", "0.6230758", "0.6215384", "0.6215384", "0.6215384", "0.6215384", "0.6215384", "0.6215384", "0.6215384", "0.6215384", "0.6215384", "0.6215384", "0.6205312", "0.6201346", "0.6199537", "0.6197164", "0.619325", "0.6188197", "0.6184748", "0.6184456", "0.61822766", "0.6168172", "0.61615354", "0.61598366", "0.61591065", "0.6158788", "0.6158782", "0.6158247", "0.61568475", "0.615389", "0.61523366", "0.61504483", "0.61393297", "0.6138013", "0.6131716", "0.6126721", "0.6124112", "0.61175776", "0.6113925", "0.61111265", "0.6106508", "0.6106334", "0.610079", "0.6099252", "0.6093706", "0.6086796", "0.60819244", "0.6079599", "0.6078897", "0.6078285", "0.60757124", "0.60718036", "0.6063565", "0.6062767" ]
0.76108295
0
Use callbacks to share common setup or constraints between actions.
def set_company_dei_field @company_dei_field = CompanyDeiField.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a list of trusted parameters through.
def company_dei_field_params params.require(:company_dei_field).permit(:company_id, :dei_field_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def params(list)\n @declared_params = list\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def safelist; end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.6948629", "0.6813401", "0.68012834", "0.67958814", "0.6745398", "0.67409563", "0.6526744", "0.65207636", "0.6492359", "0.6433316", "0.6433316", "0.6433316", "0.639903", "0.6355392", "0.63544166", "0.63463736", "0.6344045", "0.6337686", "0.632862", "0.632862", "0.632862", "0.6314014", "0.62996835", "0.6265598", "0.62603146", "0.6258867", "0.6236817", "0.622751", "0.6220178", "0.6219078", "0.6209231", "0.6198425", "0.6196297", "0.6172704", "0.61576265", "0.6156285", "0.61538136", "0.6136944", "0.61223155", "0.6110986", "0.6075067", "0.6071598", "0.60598934", "0.60588664", "0.60445637", "0.60346645", "0.60200745", "0.60171115", "0.60157925", "0.6010834", "0.6008955", "0.6007347", "0.60072184", "0.60052294", "0.60052294", "0.6000399", "0.59937483", "0.59922826", "0.59839815", "0.59704787", "0.5969997", "0.5964957", "0.59645265", "0.59611017", "0.5960087", "0.5933499", "0.592835", "0.5921257", "0.5908426", "0.5904086", "0.59013283", "0.58920205", "0.5889987", "0.5881135", "0.5881135", "0.5881135", "0.58720887", "0.5862195", "0.58537245", "0.5844214", "0.5843205", "0.5834702", "0.5831726", "0.583081", "0.58286726", "0.5818497", "0.5815249", "0.58144075", "0.5810788", "0.58015215", "0.58015215", "0.58013266", "0.5795378", "0.5784435", "0.5780104", "0.57775843", "0.57742083", "0.5769766", "0.5767348", "0.5763183", "0.5757318" ]
0.0
-1
Creates a new channel.
def initialize @queue = [] @waiting = [] @mutex = Mutex.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_channel\n AMQP::Channel.new(@amqp_client)\n end", "def create_channel\n Channel.new @grpc_stub_class, endpoint: @endpoint, credentials: @credentials, channel_args: @channel_args,\n interceptors: @interceptors, on_channel_create: @config.on_channel_create\n end", "def create_channel(opts = {})\n data, _status_code, _headers = create_channel_with_http_info(opts)\n data\n end", "def create_channel(data)\n channel = data.is_a?(Discordrb::Channel) ? data : Channel.new(data, self)\n server = channel.server\n\n # Handle normal and private channels separately\n if server\n server.add_channel(channel)\n @channels[channel.id] = channel\n elsif channel.private?\n @pm_channels[channel.recipient.id] = channel\n elsif channel.group?\n @channels[channel.id] = channel\n end\n end", "def create_channel!(name)\n resp = sns.create_topic(name: name)\n Channel.new(nil, resp.topic_arn)\n end", "def create_guild_channel(guild_id, name:, reason: nil, type: nil, topic: nil, bitrate: nil, user_limit: nil,\n rate_limit_per_user: nil, position: nil, permission_overwrites: nil, parent_id: nil,\n nsfw: nil)\n response = request(\n :guilds_gid_channels, guild_id,\n :post,\n \"guilds/#{guild_id}/channels\",\n {name: name, type: type, topic: topic, bitrate: bitrate, user_limit: user_limit,\n rate_limit_per_user: rate_limit_per_user, position: position,\n permission_overwrites: permission_overwrites, parent_id: parent_id, nsfw: nsfw},\n 'X-Audit-Log-Reason': reason,\n )\n Rapture::Channel.from_json(response.body)\n end", "def channel\n # Create new channel if closed\n if @channel.nil? || @channel.closed?\n @channel = connection.create_channel\n end\n @channel\n end", "def create_channel(data)\n channel = Channel.new(data, self)\n server = channel.server\n\n # Handle normal and private channels separately\n if server\n server.channels << channel\n @channels[channel.id] = channel\n else\n @private_channels[channel.id] = channel\n end\n end", "def channel_create(attributes = {}, &block)\n register_event(ChannelCreateEvent, attributes, block)\n end", "def get_channel(name, create)\n channel = @channels[name]\n if not channel and create\n channel = Channel.new(name)\n @channels[name] = channel\n @logger.debug(\"Created channel #{name}\")\n end\n channel\n end", "def channel\n @channel ||= Proletariat.connection.create_channel\n end", "def channel\n @channel ||= Proletariat.connection.create_channel\n end", "def create\n @channel = Channel.new(params[:channel])\n @channel.user = current_user\n flash[:notice] = t('controllers.channels.channel_was_successfully_created') if @channel.save\n\n respond_with @channel\n end", "def channels_create(params = {}, opts = {})\n log.info { \"out_slack: channels_create #{params.dup.tap {|p| p[:token] = '[FILTERED]' if p[:token] }}\" }\n post(channels_create_endpoint, params)\n end", "def create\n channel = Channel.create!(channel_params)\n joined = ChannelJoined.create!(user_id: params[:user_id], channel_id: channel.id)\n json_response(channel)\n end", "def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render json: @channel, status: :created, location: @channel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @channel = Channel.new(channel_params)\r\n\r\n respond_to do |format|\r\n if @channel.save\r\n format.html { redirect_to user_channels_path(current_user)}\r\n else\r\n format.html { render :new, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @channel = Channel.new(channel_params)\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @channel = Channel.new(channel_params)\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @channel = Channel.new(channel_params)\n respond_to do |format|\n if @channel.save\n format.json { render :show, status: :created, location: @channel}\n else\n format.json { render json: @channel.errors, status: :unprocessable_entity}\n end\n end\n end", "def create_facebook_channel(project_id, opts = {})\n post \"projects/#{project_id}/facebookchannels\", opts\n end", "def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n flash[:notice] = 'Channel was successfully created.'\n format.html { redirect_to(@channel) }\n format.xml { render :xml => @channel, :status => :created, :location => @channel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def channel\n return @channel if @channel && [email protected]?\n @channel = connect.create_channel\n rescue Bunny::ChannelAlreadyClosed => e\n reconnect\n end", "def create_level_channel(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/level_channels'\n\t\targs[:query]['Action'] = 'CreateLevelChannel'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :level_channel_setting\n\t\t\targs[:body]['LevelChannelSetting'] = optional[:level_channel_setting]\n\t\tend\n\t\tself.run(args)\n\tend", "def create( params )\n\t\tres = nil\n\n\t\tif( params.tcp? )\n\t\t\tif( params.server? )\n\t\t\t\tres = create_tcp_server_channel( params )\n\t\t\telse\n\t\t\t\tres = create_tcp_client_channel( params )\n\t\t\tend\n\t\telsif( params.udp? )\n\t\t\tres = create_udp_channel( params )\n\t\tend\n\n\t\treturn res\n\tend", "def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n @channel.users << @user\n @channel.save\n flash[:notice] = 'Channel was successfully created.'\n format.html { redirect_to(@channel) }\n format.xml { render :xml => @channel, :status => :created, :location => @channel }\n else\n flash[:warning] = 'Could not create channel'\n logger.debug @channel.errors.full_messages\n format.html { render :action => \"new\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def get_channel(name)\n channel = @channels[name]\n return channel unless channel.nil?\n # If not exists, create it\n logger.debug \"Created channel #{name}\"\n stat_channel_created name # Stats and log\n @channels[name] = Neighborparrot::Channel.new(name, @app_info)\n end", "def new\n @channel = Channel.new\n\n respond_with @channel\n end", "def make_channel chan\n @logger.debug \"In make_channel, got #{chan}\"\n # If we are DMing a user (chan looks like @username), do nothing\n # otherwise, make sure chan starts with a '#', if it doesn't already\n\n # channel names must be lowercase, and not contain spaces or periods\n # I'm going to assume that usernames need the same requirements\n chan.sub(/^(?!#|@)/,'#').downcase.gsub(/ |\\./, '_')\n end", "def initialize(name)\n logger.debug \"Creating channel '#{name}'\"\n @name = name\n @clients = {}\n self.class.register_channel(self)\n end", "def create(params)\n res = nil\n\n if params.tcp?\n if params.server?\n res = create_tcp_server_channel(params)\n else\n res = create_tcp_client_channel(params)\n end\n elsif params.udp?\n res = create_udp_channel(params)\n end\n\n return res\n end", "def create\n if is_number?(params[:name])\n redirect_to :action => \"new\" and flash[:notice] = 'Channel name cannot be a number!'\n elsif params[:name] == \"\"\n redirect_to :action => \"new\" and flash[:notice] = 'Channel name cannot be empty!'\n elsif params[:description] == \"\"\n redirect_to :action => \"new\" and flash[:notice] = 'Channel description cannot be empty!'\n elsif params[:name] == 'create'\n else\n @channel = Channel.new(:name => params[:name], :description => params[:description])\n respond_to do |format|\n if @channel.save\n format.html { redirect_to(@channel)}\n format.xml { render :xml => @channel, :status => :created, :location => @channel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create_tcp_server_channel(params)\n\t\t\treturn SocketSubsystem::TcpServerChannel.open(client, params)\n\tend", "def add_channel(channel_name, stateonly = true, power = 0, *flags)\r\n access = nil\r\n channel_name = channel_name.downcase\r\n if power != 0 || flags.length != 0\r\n access = Access.new(power, *flags)\r\n end\r\n @channels[channel_name] = ChannelUser.new(channel_name, stateonly, access)\r\n end", "def create\n\t\tchannel_sid = params[:channel_sid]\n\t\t@client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])\n\t\t# Add the member\n\t\tservice = @client.chat.v2.services(ENV['service_sid'])\n\t\tchannel = service.channels(channel_sid)\n\t\tmessage = channel.messages.create(body: params[:body])\n\t\tputs message\n\t\tresponse = \"{\\n\\\"message\\\": \\\"Message sent\\\"\\n}\"\n\t\tjson_response(response)\n\tend", "def channel\n\n Thread.current['_boss_amqp_channel'] ||= amqp_connect.create_channel\n end", "def create(label, name, summary, arch, parent)\n @connection.call('channel.software.create', @sid, label, name, summary, arch, parent)\n end", "def create(phone_number_sid: nil)\n data = Twilio::Values.of({'PhoneNumberSid' => phone_number_sid, })\n\n payload = @version.create(\n 'POST',\n @uri,\n data: data\n )\n\n ChannelInstance.new(\n @version,\n payload,\n business_sid: @solution[:business_sid],\n brand_sid: @solution[:brand_sid],\n branded_channel_sid: @solution[:branded_channel_sid],\n )\n end", "def createNotificationChannel(channel_type, content_type, version=1.0)\n url = \"#{@fqdn}#{NOTIFICATION_RESOURCE}\"\n headers = { \n :accept => 'application/json', \n :content_type => \"application/json\",\n }\n body = Webhooks.createChannel(channel_type, content_type, version)\n\n begin\n r = self.post(url, body.to_json, headers)\n rescue RestClient::Exception => e\n raise(ServiceException, e.response || e.message, e.backtrace)\n end\n Model::NotificationChannel.from_response(r)\n end", "def open_channel(type = T.unsafe(nil), *extra, &on_confirm); end", "def create\n @channel_type = ChannelType.new(channel_type_params)\n\n respond_to do |format|\n if @channel_type.save\n format.html { redirect_to channel_types_path, notice: 'Channel type was successfully created.' }\n format.json { render :show, status: :created, location: @channel_type }\n else\n format.html { render :new }\n format.json { render json: @channel_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_channel_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChatChannelsApi.create_channel ...'\n end\n # resource path\n local_var_path = '/chat/users/me/channels'\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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\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 = ['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 => 'InlineResponse2012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ChatChannelsApi#create_channel\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_channels(client_id, channel_symbols, options = {})\n channel_symbols = [channel_symbols] unless channel_symbols.is_a? Array\n channel_symbols.each do |channel_symbol|\n channel_symbol = channel_symbol.to_sym\n if INVALID_CHANNEL_NAMES_FOR_CREATION_AND_DESTRUCTION.include?(channel_symbol)\n notify(:type => :error, :code => 2054, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol})\n next\n end\n if @channels[channel_symbol].nil?\n @channels[channel_symbol] = EM::Channel.new\n notify(:type => :debug, :code => 2040, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol})\n else\n notify(:type => :error, :code => 2053, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol})\n end\n end\n end", "def create\n @universal_channel = UniversalChannel.new(universal_channel_params)\n\n respond_to do |format|\n if @universal_channel.save\n format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully created.' }\n format.json { render :show, status: :created, location: @universal_channel }\n else\n format.html { render :new }\n format.json { render json: @universal_channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @raw_channel = RawChannel.new(params[:raw_channel])\n\n respond_to do |format|\n if @raw_channel.save\n format.html { redirect_to @raw_channel, notice: 'Raw channel was successfully created.' }\n format.json { render json: @raw_channel, status: :created, location: @raw_channel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @raw_channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n conversation = Conversation.new(conversation_params)\n # If the converstation is created and saved, then it will\n # broadcast the channel to the front end\n if conversation.save\n serialized_data = ActiveModelSerializers::Adapter::Json.new(\n ConversationSerializer.new(conversation)\n ).serializable_hash\n ActionCable.server.broadcast 'conversations_channel', serialized_data\n head :ok\n end\n end", "def set_up_channel\n amqp_conn = Bunny.new\n amqp_conn.start\n channel = amqp_conn.create_channel\nend", "def create\n @slack_channel = SlackChannel.new(slack_channel_params)\n\n respond_to do |format|\n if @slack_channel.save\n format.html { redirect_to @slack_channel, notice: 'Slack channel was successfully created.' }\n format.json { render :show, status: :created, location: @slack_channel }\n else\n format.html { render :new }\n format.json { render json: @slack_channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @chatty_crow_channel.save\n flash[:notice] = l(:notice_successful_create)\n redirect_to_plugin_settings\n else\n render action: :new\n end\n end", "def channel(name, options = {})\n raise RuntimeError, %(Channel \"#{name}\" already exists!) if @channels[name]\n new_channel = Channel[options.merge(:name => name)]\n new_channel[:risefall] ||= @risefall\n @channels << new_channel\n end", "def create\n @channel = Channel.new(params[:channel])\n respond_to do |format|\n if @channel.save\n flash[:notice] = 'Canal créé.'\n format.html { redirect_to :action=>:show, :id=>@channel.id }\n format.xml { render :xml => @channel, :status => :created, :location => @channel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new_session_channel(sid)\n\t\tself.session_channels[sid.to_i] = PxSessionChannel.new(sid)\n\tend", "def create_communication_channel(user_id,communication_channel__address__,communication_channel__type__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :communication_channel__address__,\n :communication_channel__type__,\n :skip_confirmation,\n \n ]\n\n # verify existence of params\n raise \"user_id is required\" if user_id.nil?\n raise \"communication_channel__address__ is required\" if communication_channel__address__.nil?\n raise \"communication_channel__type__ is required\" if communication_channel__type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :user_id => user_id,\n :communication_channel__address__ => communication_channel__address__,\n :communication_channel__type__ => communication_channel__type__\n )\n\n # resource path\n path = path_replace(\"/v1/users/{user_id}/communication_channels\",\n :user_id => user_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n CommunicationChannel.new(response)\n end", "def create_default_channels\n private_chan = Channel.new\n private_chan.user_id = self.id\n private_chan.title = \"Private Videos\"\n private_chan.private = true\n private_chan.save\n \n public_chan = Channel.new\n public_chan.user_id = self.id\n public_chan.title = \"Public Videos\"\n public_chan.save\n \n featured_chan = Channel.new\n featured_chan.user_id = self.id\n featured_chan.title = \"Featured Videos\"\n featured_chan.featured = true\n featured_chan.save\n end", "def create\n @channel = Channel.find(params[:channel_id])\n @message = @channel.messages.build(message_params)\n\n respond_to do |format|\n if @message.save\n format.json { render json: @message, status: :created }\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n byebug\n @tv_channel = TvChannel.new(tv_channel_params)\n\n respond_to do |format|\n if @tv_channel.save\n format.html { redirect_to @tv_channel, notice: 'Tv channel was successfully created.' }\n format.json { render :show, status: :created, location: @tv_channel }\n else\n format.html { render :new }\n format.json { render json: @tv_channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @channel_class = ChannelClass.new(channel_class_params)\n\n respond_to do |format|\n if @channel_class.save\n format.html { redirect_to @channel_class, notice: '频道创建成功.' }\n format.json { render :show, status: :created, location: @channel_class }\n else\n format.html { render :new }\n format.json { render json: @channel_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def channel(name, schema=nil, loopback=false)\n define_collection(name)\n @tables[name] = Bud::BudChannel.new(name, self, schema, loopback)\n @channels[name] = @tables[name]\n end", "def channel_create_format\n if private?\n {\n id: @id.to_s,\n is_private: true,\n recipient: @recipient.compact\n }\n else\n {\n guild_id: @server.id.to_s,\n id: @id.to_s,\n is_private: false,\n name: @name,\n permission_overwrites: permission_overwrites_format,\n position: @position,\n topic: @topic,\n type: @type,\n bitrate: @bitrate\n }\n end\n end", "def radioChannelCreate _args\n \"radioChannelCreate _args;\" \n end", "def open_channel( type, extra_data=nil, &on_confirm )\n channel = @factories[:open].call( type, extra_data )\n channel.on_confirm_open(&on_confirm)\n @channel_map[ channel.local_id ] = channel\n end", "def add_channel( channel )\n\t\tserver = @servers[channel.server_name]\n\t\t@channels[channel.name] = channel\n\t\tserver.add_channel( channel )\n\t\tshift_server_pos( server.number, 1 )\n\t\t@length += 1\n\tend", "def to_channel\n self\n end", "def create\n @channel_group = ChannelGroup.new(channel_group_params)\n\n respond_to do |format|\n if @channel_group.save\n format.html { redirect_to @channel_group, notice: 'Channel group was successfully created.' }\n format.json { render :show, status: :created, location: @channel_group }\n else\n format.html { render :new }\n format.json { render json: @channel_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.create(message_params)\n ActionCable.server.broadcast(\"chatting_channel\", {\n data_type: \"message\",\n user_id: @message.user_id, \n content: @message.content,\n created_at: (@message.created_at.strftime(\"%m/%d %H:%M\")),\n }) if @message.present?\n head :ok\n\n end", "def channel=(name)\n @channel = name\n end", "def channels\n build :channels, :using => data_for(:channels)\n end", "def create\n @channel_user = ChannelUser.new(channel_user_params)\n\n respond_to do |format|\n if @channel_user.save\n format.html { redirect_to @channel_user, notice: 'Channel user was successfully created.' }\n format.json { render :show, status: :created, location: @channel_user }\n else\n format.html { render :new }\n format.json { render json: @channel_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_slack_integration_channel(account_name, body, opts = {})\n data, _status_code, _headers = create_slack_integration_channel_with_http_info(account_name, body, opts)\n data\n end", "def create\n @youtube_channel = YoutubeChannel.new(youtube_channel_params)\n\n respond_to do |format|\n if @youtube_channel.save\n format.html { redirect_to youtube_channels_path, notice: 'Youtube channel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @youtube_channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @youtube_channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @channel = Channel.find(params[:channel_id])\n rescue ActiveRecord::RecordNotFound => e\n respond_to do |format|\n format.html { redirect_to :back, notice: I18n.t('general.failed_to_subscribe') }\n format.json { render json: e, status: :unprocessable_entity }\n end\n else\n message = if current_user.max_channels_reached?\n I18n.t('maximum_channels_reached')\n elsif current_user.channels.include?(@channel)\n I18n.t('already_subscribed')\n end\n\n if (!current_user.channels.include?(@channel) && !current_user.max_channels_reached?)\n current_user.channels << @channel\n respond_to do |format|\n format.html { redirect_to @channel, notice: I18n.t('general.subscribed') }\n format.json { render json: @channel, status: :created, location: @channel }\n end\n else\n respond_to do |format|\n format.html { redirect_to @channel, notice: I18n.t('general.unable_to_subscribe') }\n format.json { render json: message, status: :unprocessable_entity }\n end\n end\n end", "def groups_create_child(params = {})\n fail ArgumentError, \"Required arguments 'channel' missing\" if params['channel'].nil?\n response = @session.do_post \"#{SCOPE}.createChild\", params\n Slack.parse_response(response)\n end", "def publish_channel\n @publish_channel ||= ::AMQP::Channel.new(connection)\n end", "def create\n @channel = Channel.new(channel_params)\n @listener = Listener.create(dj: true)\n session[:current_listener_id] = @listener.id\n #gon.dj= @listener.dj\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render :show, status: :created, location: @channel }\n else\n format.html { render :new }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_dm(recipient_id)\n request(Route.new(:POST, '/users/@me/channels'), json: { recipient_id: recipient_id })\n end", "def create_private(token, bot_user_id, user_id)\n request(\n __method__,\n :post,\n \"#{api_base}/users/#{bot_user_id}/channels\",\n { recipient_id: user_id }.to_json,\n Authorization: token,\n content_type: :json\n )\n rescue RestClient::BadRequest\n raise 'Attempted to PM the bot itself!'\n end", "def create_private(token, bot_user_id, user_id)\n request(\n __method__,\n :post,\n \"#{api_base}/users/#{bot_user_id}/channels\",\n { recipient_id: user_id }.to_json,\n Authorization: token,\n content_type: :json\n )\n rescue RestClient::BadRequest\n raise 'Attempted to PM the bot itself!'\n end", "def channel\n Channel.get(@name)\n end", "def add_channel(channel_item_key, async_api_channel_item)\n BunnyChannelProxy.new(self, channel_item_key, async_api_channel_item)\n end", "def create_channel_ctd_log(channel_ctd)\n ChannelCtdLog.create(:channel_ctd_id => channel_ctd.id, :ctd => channel_ctd.ctd)\n end", "def create\n @channel_category = ChannelCategory.new(params[:channel_category])\n\n respond_to do |format|\n if @channel_category.save\n format.html { redirect_to marketing_channel_category_path(@channel_category), notice: 'Channel category was successfully created.' }\n format.json { render json: @channel_category, status: :created, location: @channel_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_distributor(channel)\n sns.create_application_platform()\n end", "def create\n message = msg_params\n @msg = Msg.new(msg_params)\n thesender = @msg.sender\n thesentdate = @msg.sent\n theservertime = DateTime.now\n unless @msg.content.empty? || @msg.sender.empty?\n ActionCable.server.broadcast 'room_channel',\n content: @msg.content,\n sender: thesender,\n servertime: theservertime\n end\n end", "def create_tcp_server_channel(params)\n begin\n return SocketSubsystem::TcpServerChannel.open(client, params)\n rescue ::Rex::Post::Meterpreter::RequestError => e\n case e.code\n when 10048\n raise ::Rex::AddressInUse.new(params.localhost, params.localport)\n when 10000 .. 10100\n raise ::Rex::ConnectionError.new\n end\n raise e\n end\n end", "def new\n @channel = Channel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel }\n end\n end", "def ensure_channel(data, server = nil)\n if @channels.include?(data['id'].to_i)\n @channels[data['id'].to_i]\n else\n @channels[data['id'].to_i] = Channel.new(data, self, server)\n end\n end", "def get_instance(payload)\n ChannelInstance.new(@version, payload)\n end", "def get_instance(payload)\n ChannelInstance.new(@version, payload)\n end", "def git_channel(channel)\n return @channels[channel] if @channels[channel]\n @channels[channel] = Git::Channel.new(@config[channel.server.name][channel.nname])\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n ActionCable.server.broadcast 'room_channel', content: @message.content, user_name: @message.user.name\n # head :ok\n end\n end", "def create\n @channel_customer = ChannelCustomer.new(channel_customer_params)\n\n respond_to do |format|\n if @channel_customer.save\n format.html { redirect_to @channel_customer, notice: 'Channel customer was successfully created.' }\n format.json { render :show, status: :created, location: @channel_customer }\n else\n format.html { render :new }\n format.json { render json: @channel_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_channel\n @channel = ::Channel.find(params[:id])\n end", "def channel_params\n params[:channel].permit(:name, :description)\n end", "def channel_account_for(channel)\n ca = ChannelAccount.new(:user_id => id, :channel_id => channel.id)\n ca.save\n self.channel_accounts << ca\n end", "def create\n message = Message.new(message_params)\n message.user = current_user\n if message.save\n # 'messages' is name of channel we are broadcasting to\n ActionCable.server.broadcast 'messages',\n # Set message and user\n message: message.content,\n user: message.user.first_name\n head :ok\n end\n end", "def set_channel\n @channel = Channel.find_by(:name => params[:name])\n end", "def create_tcp_client_channel(params)\n\t\t\tchannel = SocketSubsystem::TcpClientChannel.open(client, params)\n\t\t\tif( channel != nil )\n\t\t\t\treturn channel.lsock\n\t\t\tend\n\t\t\treturn nil\n\tend", "def create\n @admin_channel = Admin::Channel.new(admin_channel_params)\n @admin_channel.user_id = current_user.id\n @admin_channel.short_title = get_short_title('channel', @admin_channel.title) if @admin_channel.short_title.blank?\n\n respond_to do |format|\n if @admin_channel.save\n update_tag(@admin_channel)\n format.html { redirect_to @admin_channel, notice: '栏目添加成功.' }\n format.json { render action: 'show', status: :created, location: @admin_channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_channel.errors, status: :unprocessable_entity }\n end\n end\n end", "def channel_params\n params.require(:channel).permit(:channel_name, :channel_type, :workspace_id)\n end", "def add_channel(channel)\n return if @attributes[:channels].find { |c| channel.resolve_id == c.resolve_id }\n\n @attributes[:channels] << channel\n end", "def create\n @channel_status = ChannelStatus.new(params[:channel_status])\n\n respond_to do |format|\n if @channel_status.save\n format.html { redirect_to @channel_status, notice: 'Channel status was successfully created.' }\n format.json { render json: @channel_status, status: :created, location: @channel_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel_status.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7874659", "0.7830494", "0.7788502", "0.75793046", "0.75732815", "0.7509736", "0.7465657", "0.74499625", "0.74269646", "0.7154961", "0.71239", "0.71239", "0.704802", "0.7027061", "0.6885507", "0.6869084", "0.68489945", "0.683869", "0.683869", "0.67796487", "0.6772708", "0.66708046", "0.6618158", "0.6593293", "0.6575673", "0.6543179", "0.65382457", "0.6528376", "0.6504183", "0.64724535", "0.64336157", "0.6431829", "0.64183074", "0.6413324", "0.6372361", "0.63367903", "0.63174677", "0.63120633", "0.6260049", "0.6258461", "0.6207116", "0.6196663", "0.6195369", "0.61912346", "0.6172763", "0.61700934", "0.6167613", "0.61078006", "0.61050445", "0.6099483", "0.6096411", "0.6061058", "0.6040409", "0.6004675", "0.59868276", "0.5986123", "0.5975805", "0.5919844", "0.59105897", "0.5883452", "0.5864366", "0.5855669", "0.5778109", "0.57613915", "0.5760151", "0.57503504", "0.572919", "0.56938505", "0.5692507", "0.56871855", "0.5677259", "0.5671909", "0.5666237", "0.5645828", "0.5641304", "0.5631433", "0.5631433", "0.562422", "0.5613429", "0.5612481", "0.5598755", "0.5592877", "0.5583918", "0.5568464", "0.5559416", "0.55585545", "0.5550127", "0.5550127", "0.55437994", "0.5539862", "0.55338234", "0.5525359", "0.55244064", "0.5523156", "0.5521775", "0.55215055", "0.5508044", "0.54853904", "0.5482617", "0.54801273", "0.5479269" ]
0.0
-1
Pushes +obj+ to the queue.
def push(obj) @mutex.synchronize do @queue.push obj begin t = @waiting.shift t.wakeup if t rescue ThreadError retry end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(obj)\n @queue.put(obj)\n end", "def push(obj)\n @q << obj\n @mutex.synchronize { @cv.signal }\n end", "def push(obj)\n @mutex.synchronize{\n @que.push obj\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end", "def push(obj)\n @mutex.synchronize{\n while true\n break if @que.length < @max\n @queue_wait.push Thread.current\n @mutex.sleep\n end\n\n @que.push obj\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end", "def push(obj)\n handle_interrupt do\n @mutex.synchronize do\n @que.push obj\n @cond.signal\n end\n end\n end", "def push(obj)\n if @blocked\n raise \"Nothing can be added to queue. Queue is blocked.\"\n else\n super(obj)\n end\n end", "def push!(obj)\n @objs << obj\n end", "def enqueue_message(obj)\n output_queue << obj\n end", "def push(obj)\n node = Node.new(nil, nil, obj)\n if @tail\n @tail.to = node\n node.from = @tail\n @tail = node\n else\n @head = @tail = node\n end\n @size += 1\n node.obj\n end", "def push(obj, prio)\n @mutex.synchronize{\n while true\n break if @que.length < @max\n @queue_wait.push Thread.current\n @mutex.sleep\n end\n\n @que.insert find_first_of(prio), [ obj, prio ]\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end", "def add_person_to_queue(person_obj)\n @queue.push(person_obj)\n end", "def push(obj, prio)\n @mutex.synchronize{\n @que.insert find_first_of(prio), [ obj, prio ]\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end", "def push(obj)\n raise 'Trying to push in front of an unitialized ZMessage!' if @zmsg.nil?\n\n if obj.is_a? String\n LibCZMQ.zmsg_pushstr(@zmsg, obj)\n elsif obj.is_a? Array\n LibCZMQ.zmsg_pushmem(@zmsg, obj)\n elsif obj.is_a? ZFrame\n LibCZMQ.zmsg_push(@zmsg, obj.__extract__)\n else\n raise ArgumentError, 'Unknown object type!'\n end\n end", "def put(obj)\n # TODO high watermark check\n # NOTE: predicate will call #try_connect\n @work_queue.schedule {\n send(obj)\n }\n \n @work_queue.exclusive {\n # If we're connected, shut down the worker thread, do all the work\n # here.\n check_connection_state\n }\n \n @work_queue.try_work\n end", "def enqueue(obj)\n node = Node.new(obj)\n if @first.nil?\n @first = @last = node\n else\n @last.next = node\n @last = node\n end\n return self\n end", "def push object\n raise QueueDestroyed if destroyed?\n\n begin\n encoded_object = encode(object)\n rescue Resque::EncodeException => e\n Resque.logger.error \"Invalid UTF-8 character in job: #{e.message}\"\n return\n end\n\n synchronize do\n @redis.rpush @redis_name, encoded_object\n end\n end", "def submit_single_object(obj, queue)\n\n queue.submit do \n \n @logger.debug { \"Processing object #{obj.getLabel}\" }\n\n begin\n\n obj.fitPosition(@parameters)\n\n rescue => e\n\n logger.error { \"error while processing object #{obj.label}: #{e.message}\" }\n\n end\n\n end\n\n end", "def add_to_stack(obj)\n stack.push(obj)\n end", "def enqueue(object_)\n result_ = true\n if @push_ptr\n if @pop_ptr == @push_ptr\n if @drop_oldest\n @pop_ptr += 1\n @pop_ptr = 0 if @pop_ptr == @buffer.size\n result_ = false\n else\n return false\n end\n elsif @pop_ptr.nil?\n @pop_ptr = @push_ptr\n end\n @buffer[@push_ptr] = object_\n @push_ptr += 1\n @push_ptr = 0 if @push_ptr == @buffer.size\n else\n @buffer.push(object_)\n end\n result_\n end", "def <<(anObject)\n queue << anObject\n if queue.size >= max_queue_size()\n client << queue.pop()\n end\n end", "def enqueue(obj)\n if @first.nil?\n @last = Node.new(obj)\n @first = @last\n else\n @last.next = Node.new(obj)\n @last = @last.next\n end\n end", "def handle(obj)\n request = Request.new(obj)\n @mutex.synchronize do\n @requests_queue.push(request)\n @cv.wait(@mutex) until request.re?\n request.re\n end\n end", "def push(*obj)\n obj.each {|obj| self << obj }\n self\n end", "def <<(obj)\n if [:id, :message, :trailing].all? {|m| obj.respond_to?(m)}\n enqueue_message(obj)\n else\n raise ArgumentError, \"#<< method requires argument responding to :id, :message, :trailing\"\n end\n end", "def <<(obj)\n stack << obj\n self\n end", "def push(obj, options = nil)\n remove(obj) if members.include?(obj)\n @members << obj\n unless @building or owner.unsaved?\n @owner.send(@insert_proc, obj, options)\n else\n (@building_members ||= []) << obj\n @owner.instance_variable_set '@pending_building_collections', true\n end\n end", "def push(object)\n if @callbacks[:push]\n @callbacks[:push].call(object)\n else\n if $DEBUG\n warn \"Pushed object onto a PBXObjectList that does not have a :push callback from: #{caller.first}\"\n end\n end\n self\n end", "def push(x)\n @queue << x\n end", "def push(obj)\n if @top.nil?\n @top = Node.new(obj)\n else\n old_top = @top\n @top = Node.new(obj)\n @top.next = old_top\n end\n end", "def push(stream, object)\n post stream, object\n end", "def << (obj)\n @objects << obj if obj\n end", "def add_object(obj)\n sym = obj.class.to_s.to_sym\n\n unless @list.has_key?(sym)\n @list[sym] = []\n end\n\n @list[sym].push(obj)\n end", "def <<( obj )\n\n write( obj ) do |target, object|\n if object.respond_to?( :new? ) && object.new?\n @delayed_writes.push( object )\n else\n\n link = { 'rel' => rel_for_object( object ), 'href' => id_for_object( object ) }\n target.push( link ) unless target.include?( link )\n end\n end\n end", "def enqueue_to(queue, klass, *args); end", "def offer(obj, timeout_ms)\n @queue.offer(obj, timeout_ms, TimeUnit::MILLISECONDS)\n end", "def request(object, method, args, options={})\n ResqueHandler.queue = options[:queue] || DEFAULT_QUEUE\n instance, id = instance_identifiers(object)\n ::Resque.enqueue(ResqueHandler, instance, id, method, *args)\n end", "def add(obj)\n @set.addObject obj\n end", "def queue( object, tier_index )\n ensure_tiers( tier_index ) if @extend\n \n @length += 1\n @tiers[tier_index] << object\n end", "def put(obj)\n end", "def push(x)\n @queue.push(x)\n nil\n end", "def add(obj)\n Maglev::PERSISTENT_ROOT[self][obj.__id__] = obj\n end", "def append(obj)\n raise 'Trying to append to an unitialized ZMessage!' if @zmsg.nil?\n\n if obj.is_a? String\n LibCZMQ.zmsg_addstr(@zmsg, obj)\n elsif obj.is_a? ZFrame\n LibCZMQ.zmsg_append(@zmsg, obj.__extract__)\n else\n raise ArgumentError, 'Unknown object type!'\n end\n end", "def process_push\n factory = \"::#{object_type}\".constantize\n local_object = factory.find(object_local_id)\n syncer = factory.synchronizer\n syncer.push_object(local_object)\n \n self.state = 'done'\n self.save\n end", "def push(klass, *args)\n Resque.enqueue klass, args\n end", "def queue(&b)\n @queue << b\n end", "def release(obj)\n @mut.synchronize do\n if @shutdown_block\n @shutdown_block.call(obj)\n else\n @q.push(obj)\n end\n\n @cond.broadcast\n end\n end", "def enqueue(record)\n @queue << record.representation\n end", "def enqueue(item)\n\t\t@queue << item\n\tend", "def set(obj)\n @mutex.synchronize { @obj = obj }\n end", "def push(x)\n @size += 1\n @queue_in.push(x)\n end", "def push(x)\n @size += 1\n @queue_in.push(x)\n end", "def enqueue(payload)\n @queue.publish(JSON.generate(payload), :routing_key => @queue.name)\n end", "def add_to_queue!(user)\n $redis.lpush(self.class.redis_key_for_user(user), to_redis_object)\n end", "def push(x) \n @queue.insert(x)\n self\n end", "def markMarshalledObj( obj, soapObj )\n Thread.current[ :SOAPMarshalDataKey ][ obj.__id__ ] = soapObj\n end", "def push(object, priority)\n @heap.push(priority, object)\n end", "def push(queue, value, args)\n if !defined?(value.queue)\n value.class_eval do \n @queue = queue\n end\n end\n Resque.enqueue value, args\n end", "def send_json label, obj\n # parse before send in case of issues\n message = obj.to_json\n @publisher.send_string label, ZMQ::SNDMORE\n @publisher.send_string message\n end", "def push(p)\n @obj << p\n end", "def enqueue(el)\n @queue.push(el)\n end", "def object=(obj)\n @object = obj\n @body = JSON.generate(@object)\n @size = @body.bytesize\n @payload = [@size, @body].pack(PAYLOAD_FORMAT)\n end", "def put_object(obj, id)\n find_blob(id, true).write_object(id, serialize(obj))\n end", "def add(bucket, obj)\n @buffer[bucket] << obj\n check_and_write bucket\n end", "def enqueue(el)\n @queue << el\n el\n end", "def dispatch(payload)\n queue.push(payload)\n end", "def queue(_); end", "def queue(_); end", "def push(event:)\n super\n\n @queue << event\n end", "def push(o)\n @stack.push o\n @pc += 1\n end", "def broadcast(signal, obj=EMPTY_VALUE)\n if(signal_init(signal, :signal))\n num = waiters[signal][:threads].size\n num = 1 if num < 1\n num.times do\n waiters[signal][:queue].push obj\n end\n true\n else\n false\n end\n end", "def add obj\n\t\t\t@objs2 += [obj] \n\t\tend", "def push(*objects)\n @ary.push(*objects)\n self\n end", "def add_object!(object, objectID = nil, request_options = {})\n res = add_object(object, objectID, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n res\n end", "def enqueue(data)\n @in.push(data)\n end", "def push(context)\n @queue << context\n true\n end", "def replace( obj )\n\n delete( obj )\n\n self.push obj\n end", "def deliver\n @queue << self\n end", "def add_to_cache(obj)\n @cache << obj\n if @t + @interval < Time.now\n @t = Time.now\n flush if @cache.size > 0\n @cache = Array.new\n end\n end", "def add(object)\n @objects << object\n end", "def send_object obj\n data = serializer.dump(obj)\n send_data [data.respond_to?(:bytesize) ? data.bytesize : data.size, data].pack('Na*')\n end", "def enqueue! data\n @q << data\n self\n end", "def add_reference_obj(obj)\n @refs << obj\n end", "def push(x)\n @q << x \n end", "def enqueue(el)\n @queue.push(el)\n true\n end", "def update_queue (queue, movie)\n queue.push(movie)\nend", "def publish(queue_name, object)\n amq = MQ.new\n amq.queue(queue_name).publish(serialize(object))\n end", "def queue; end", "def queue; end", "def push(value, args)\n if !defined?(value.queue)\n value.class_eval do \n @queue = :default\n end\n end\n Resque.enqueue value, args\n end", "def enqueue(payload)\n end", "def push! &put\n ( put || proc {|obj|} ).call @blocks[ @push_at & (@depth-1) ]\n @push_at += 1\n end", "def add(obj)\n return self if self.has_key? name_of(obj)\n\n hook_wrap :add, obj do\n begin\n name = name_of(obj)\n insert_sorted(obj)\n hashed[name] = obj\n obj\n rescue Exception => e\n delete(name)\n raise e\n end\n end\n\n self\n end", "def unpop obj\n was_empty = @q.empty?\n case obj\n when SimultaneousQueueEntries\n case obj.size\n when 0\n was_empty = false # just to prevent the inc\n when 1\n @q.unshift obj.first\n else\n @q.unshift obj\n end\n else\n @q.unshift obj\n end\n @component.inc_queue_ready_count if was_empty\n end", "def enqueue(payload)\n @queue.publish(payload.encode, :persistent => true)\n end", "def synchronizeObjectsAdd _obj, _args\n \"_obj synchronizeObjectsAdd _args;\" \n end", "def send(obj, &block)\n alive_check!\n\n #Sync ID stuff so they dont get mixed up.\n id = nil\n @send_mutex.synchronize do\n id = @send_count\n @send_count += 1\n end\n\n #Parse block.\n if block\n block_proxy_res = self.send(cmd: :spawn_proxy_block, id: block.__id__, answer_id: id)\n block_proxy_res_id = block_proxy_res[:id]\n raise \"No block ID was returned?\" unless block_proxy_res_id\n raise \"Invalid block-ID: '#{block_proxy_res_id}'.\" if block_proxy_res_id.to_i <= 0\n @proxy_objs[block_proxy_res_id] = block\n @proxy_objs_ids[block.__id__] = block_proxy_res_id\n ObjectSpace.define_finalizer(block, method(:proxyobj_finalizer))\n obj[:block] = {\n id: block_proxy_res_id,\n arity: block.arity\n }\n end\n\n flush_finalized unless obj.fetch(:cmd) == :flush_finalized\n\n debug \"Sending(#{id}): #{obj}\\n\" if @debug\n line = Base64.strict_encode64(Marshal.dump(\n id: id,\n type: :send,\n obj: obj\n ))\n\n begin\n @answers[id] = Queue.new\n @io_out.puts(line)\n return answer_read(id)\n ensure\n #Be sure that the answer is actually deleted to avoid memory-leaking.\n @answers.delete(id)\n end\n end", "def to(queue)\n queue.push(pack)\n end", "def <<(obj)\n if obj.is_a?(Integer)\n push_int(obj)\n elsif obj.is_a?(String)\n append_data(obj)\n elsif obj.is_a?(Array)\n obj.each { |o| self.<< o }\n self\n end\n end", "def push(reference)\n if reference\n @lock.synchronize do\n @queue.push(reference)\n end\n end\n end", "def publish(object)\n @channel << object\n end" ]
[ "0.9159362", "0.8241774", "0.8145581", "0.8085834", "0.8066046", "0.7827684", "0.77496", "0.77180564", "0.7461795", "0.743241", "0.73573846", "0.7350464", "0.73243284", "0.7298629", "0.68678147", "0.68641174", "0.6834116", "0.6831325", "0.6815872", "0.6703816", "0.6636854", "0.6635733", "0.6629864", "0.66106945", "0.645994", "0.6452603", "0.6428956", "0.64223164", "0.6380726", "0.63637304", "0.63469565", "0.63437486", "0.63304955", "0.6312059", "0.62180644", "0.61662304", "0.6159344", "0.61533177", "0.6149265", "0.61268055", "0.61095196", "0.60922086", "0.6091406", "0.6081152", "0.6069522", "0.6061674", "0.6047468", "0.60236883", "0.60224545", "0.6021569", "0.60209656", "0.60101056", "0.6007114", "0.6006802", "0.5978475", "0.59765065", "0.59707445", "0.59595805", "0.5936326", "0.5908639", "0.58924633", "0.5873748", "0.586634", "0.5866113", "0.58619493", "0.5832329", "0.5832329", "0.58287835", "0.58188206", "0.5816017", "0.5813206", "0.5809327", "0.57966524", "0.57965255", "0.5775451", "0.5771073", "0.5766751", "0.5762917", "0.575118", "0.57467365", "0.57377213", "0.57358336", "0.5726529", "0.5712453", "0.5709499", "0.57067895", "0.570601", "0.570601", "0.5705039", "0.5703488", "0.5699546", "0.5696073", "0.56943053", "0.5694223", "0.5692605", "0.5688205", "0.5682832", "0.5673679", "0.56586003", "0.5646895" ]
0.83978677
1
Retrieves data from channel. If the channel is empty, the calling thread is suspended until data is pushed onto channel.
def pop @mutex.synchronize do loop do if @queue.empty? @waiting.push Thread.current @mutex.sleep else return @queue.shift end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop!\n @mutex.synchronize do\n loop do\n if @queue.empty?\n raise ThreadError, \"Empty Channel\"\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @queue.shift\n end\n end\n end\n end", "def consume_connection\n return unless @channel\n connection = @channel.connection\n connection.process while connection.reader_ready?\n end", "def gets_data(data)\n script.gets_channel_data(self, data)\n end", "def subscribe(selector)\n channel = self\n @mutex.synchronize do\n loop do\n return selector.result unless selector.waiting?\n if @queue.empty?\n @waiting.push Thread.current\n @mutex.sleep\n else\n selector.mutex.synchronize do\n if selector.waiting?\n result = selector.update_result(channel, @queue.shift)\n yield result\n end\n end\n selector.release_result\n return selector.result\n end\n end\n end\n end", "def read\n if active?\n res = nil\n\n while res.nil?\n @queue_lock.synchronize {\n @queue.each { |item|\n # Find next data\n if item.type == :data and item.seq == @seq_recv.to_s\n res = item\n break\n # No data? Find close\n elsif item.type == :close and res.nil?\n res = item\n end\n }\n\n @queue.delete_if { |item| item == res }\n }\n\n # No data? Wait for next to arrive...\n @pending.wait unless res\n end\n\n if res.type == :data\n @seq_recv += 1\n @seq_recv = 0 if @seq_recv > 65535\n res.data\n elsif res.type == :close\n deactivate\n nil # Closed\n end\n else\n nil\n end\n end", "def retrieve(key)\n unless @queue\n @channel.queue_declare(:queue => key)\n @channel.queue_bind(:queue_name => key)\n bc = channel.basic_consume(:queue => key)\n @queue = client.queue(bc.consumer_tag)\n end\n \n return nil if @queue.empty?\n begin\n # at this point there should be something in the queue but nonetheless we keep a\n # defensive approach and trap a possible empty queue exception. there could be a \n # race condition between the empty? check and the pop.\n message = @queue.pop(non_block = true)\n return Marshal.load(message.content.body)\n rescue\n return nil\n end\n end", "def value\n\t\traise @exception if exception?\n\n\t\treturn @value if delivered?\n\n\t\tmutex.synchronize {\n\t\t\tcond.wait(mutex)\n\t\t}\n\n\t\tif exception?\n\t\t\traise @exception\n\t\telse\n\t\t\t@value\n\t\tend\n\tend", "def receive(channel = mailbox)\n channel.pop_op\n end", "def data_channel_message(data)\n # puts \"Message received! #{data}\"\n if !$$.host\n receiveSync(data)\n end\nend", "def get_data timeout, &block\n @listener.start\n start_time = Time.now\n runner = Thread.new do\n loop do\n @listener.get.each {|data| yield data}\n end\n end\n sleep 1 while Time.now - start_time < timeout\n runner.exit\n @listener.stop\n end", "def read\n data = @handle.availableData\n return data\n end", "def receive\n Rubinius.primitive :channel_receive\n raise PrimitiveFailure, \"Channel#receive primitive failed\"\n end", "def get(*key)\n synchronize do\n val = @data.get(*key)\n return val if !val.nil?\n val = new_cond\n set(*key, val)\n val.wait\n @data.get(*key)\n end\n end", "def _fwd_channel(channel)\n result = channel.fwd_channel\n while result.nil? do\n timeout = 0.001\n debug { \"waiting for fwd hannel \"}\n if @event_loop\n @event_loop.process_only(@fwd_conn,timeout)\n else\n @fwd_conn.process(timeout)\n end\n result = channel.fwd_channel\n end\n return result\n end", "def get_copy_data(async=false, decoder=nil)\n\t\tif async\n\t\t\treturn sync_get_copy_data(async, decoder)\n\t\telse\n\t\t\twhile (res=sync_get_copy_data(true, decoder)) == false\n\t\t\t\tsocket_io.wait_readable\n\t\t\t\tconsume_input\n\t\t\tend\n\t\t\treturn res\n\t\tend\n\tend", "def wait_for_reader\n @reader.wait if @reader\n end", "def try_blocking_receive\n mutex.lock\n if mailbox.empty?\n mutex.unlock\n Thread.stop\n Undefined\n else\n mailbox.shift.tap do\n mutex.unlock\n end\n end\n end", "def value (timeout = nil)\n\t\treturn @value if delivered?\n\n\t\[email protected] {\n\t\t\tcond.wait(@mutex, *timeout)\n\t\t}\n\n\t\treturn @value if delivered?\n\tend", "def one\n rq, answer_chan = @channel.get\n res = yield(rq)\n answer_chan.put res if answer_chan\n end", "def read\n return Log.warn \"[PubSub] Not started...\" unless redis\n @psthread = Thread.new do\n begin\n redis.subscribe('subduino') do |on|\n on.subscribe {|klass, num_subs| Log.info \"[PubSub] Subscribed to #{klass} (#{num_subs} subscriptions)\" }\n on.message do |klass, msg|\n Log.info \"[PubSub] #{klass} - #{msg}\"\n ArdIO.write msg\n # @redis.unsubscribe if msg == 'exit'\n end\n on.unsubscribe {|klass, num_subs| Log.info \"[PubSub] Unsubscribed to #{klass} (#{num_subs} subscriptions)\" }\n end\n rescue => e\n Log.error \"[PubSub] Error #{e}\"\n Log.error e.backtrace.join(\"\\n\")\n exit 1\n end\n\n end\n end", "def receive\n raise \"No subscription to receive messages from\" if (@queue_names.nil? || @queue_names.empty?)\n start = @current_queue\n while true\n @current_queue = ((@current_queue < @queue_names.length-1) ? @current_queue + 1 : 0)\n sleep(@connection_options[:poll_interval]) if (@current_queue == start)\n q = @queues[@queue_names[@current_queue]]\n unless q.nil?\n message = retrieve_message(q)\n return message unless message.nil?\n end\n end\n end", "def subscribe &handler\n input = \"\"\n response = 0\n #wait for message from pull socket\n while true\n response = @pull.recv_string(input)\n if !error?(response)\n input.chomp!\n\n #Message received\n yield input if block_given?\n Communicator::get_logger.info \"Message received: #{input}\"\n end\n end\n end", "def get(id)\n\t\t\tkparams = {}\n\t\t\t# Live channel id\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('livechannel', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def verify_channel\n while ! self.channel\n raise EOFError if ! self.thread.alive?\n ::IO.select(nil, nil, nil, 0.10)\n end\n end", "def do_data( channel, data )\n if @parsed_data\n @parsed_data[:content].append data\n return if @parsed_data[:length] > @parsed_data[:content].length\n\n type = @parsed_data[:type]\n content = @parsed_data[:content]\n @parsed_data = nil\n else\n reader = @buffers.reader( data )\n length = reader.read_long-1\n type = reader.read_byte\n content = reader.remainder_as_buffer\n\n if length > content.length\n @parsed_data = { :length => length,\n :type => type,\n :content => content }\n return\n end\n end\n\n if type == FXP_VERSION\n do_version content\n else\n assert_state :open\n @dispatcher.dispatch channel, type, content\n end\n end", "def get_data(row_num)\n row = @cache[row_num]\n if row.nil? \n @channel << [:get_rows, row_num, FETCH_SIZE]\n end\n row\n end", "def non_blocking_gets\n loop do\n result, _, _ = IO.select( [@socket], nil, nil, 0.2 )\n next unless result\n return result[0].gets\n end\n end", "def data_channel_open\n puts \"Data channel open!\"\n data_channel = $$.data_channel\n # send_message(\"ALIVE\")\nend", "def read( transfer_until: )\n\t\t\tif !@pending_read\n\t\t\t\t@pending_read = true\n\t\t\t\t@transfer_until = transfer_until\n\n\t\t\t\tFiber.schedule do\n\t\t\t\t\tconnect\n\n\t\t\t\t\tbegin\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t# 140 bytes transfer is required to trigger an error in spec \"can cancel a query\", when get_last_error doesn't wait for readability between PQgetResult calls.\n\t\t\t\t\t\t\t# TODO: Make an explicit spec for this case.\n\t\t\t\t\t\t\tread_str = @external_io.read_nonblock(140)\n\t\t\t\t\t\t\tprint_data(\"read-transfer #{read_fds}\", read_str)\n\t\t\t\t\t\t\t@internal_io.write(read_str)\n\t\t\t\t\t\trescue IO::WaitReadable, Errno::EINTR\n\t\t\t\t\t\t\t@external_io.wait_readable\n\t\t\t\t\t\t\tretry\n\t\t\t\t\t\trescue EOFError, Errno::ECONNRESET\n\t\t\t\t\t\t\tputs \"read_eof from #{read_fds}\"\n\t\t\t\t\t\t\t@internal_io.close_write\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend while @transfer_until\n\t\t\t\t\t@pending_read = false\n\t\t\t\tend\n\t\t\telsif transfer_until == :eof\n\t\t\t\t@transfer_until = transfer_until\n\t\t\tend\n\t\tend", "def read()\n data = @sock.recv(8192)\n return data\n end", "def on_any_receive()\n Thread.new() do\n begin\n if self.data_readed.size>0\n buff,self.data_readed=self.data_readed,strempty\n yield(buff)\n end\n loop do\n data=(self.recv(64*1024) rescue nil)\n data && data.size>0 ? yield(data) : break\n end\n rescue Exception => e\n $stdout.puts \"#{e} :\\n #{e.backtrace.join(\"\\n \")}\"\n end\n close rescue nil\n end\n end", "def fetch(length)\n # This callback should be set just once, yielding with the parsed message\n @driver.on(:message) { |msg| yield(msg.data.pack('C*')) } if @driver.listeners(:message).length.zero?\n\n data = @sock.read_nonblock(length) # Read from the socket\n @driver.parse(data) # Parse the incoming data, run the callback from above\n end", "def non_blocking_gets\n loop do\n result, _, _ = IO.select([@socket], nil, nil, 0.2)\n next unless result\n return result[0].gets\n end\n end", "def wait_for_message\r\n Fiber.yield while $game_message.busy?\r\n end", "def read\n tmp = nil\n mutex.synchronize do\n tmp = @buffer.dup\n @buffer.clear\n end\n return tmp unless tmp.empty?\n end", "def run_gets(conn)\n return if not @need_gets\n @log.debug \"run_gets starts\"\n received_count = 0\n conn.get_data_received do |msg|\n received_count += 1\n @log.debug(\"-\" * 20)\n @log.debug \"Message Number #{received_count}:\"\n #\n @log.debug(\"Type: #{msg.class}\")\n @log.debug(\"Command: #{msg.command}\")\n @log.debug(\"Header Information:\")\n msg.header.each {|k,v|\n @log.debug(\"#{k}=#{v}\")\n }\n @log.debug(\"Body:\")\n @log.debug(\"#{msg.body}\")\n end\n @log.debug \"run_gets done\"\n if received_count > 0\n #\n # We are done!\n #\n conn.disconnect()\n EventMachine::stop_event_loop() \n end\n # Otherwise, wait for message arrival.\nend", "def receive_data(data)\n @write_to_channel << data\n end", "def read_worker_loop\n Thread.new do\n begin\n data = {}\n while @running\n upstream_data = @data_source_block.call\n if data_changed?(upstream_data, data[:upstream_data])\n data = wrap_data(upstream_data)\n @current_upstream = data\n if @no_wrap\n @send_queue << [upstream_data]\n else\n @send_queue << data\n end\n end\n sleep(@read_worker_delay)\n end\n rescue => e\n logger.error \"Read worker error:\"\n logger.error e\n end\n end\n end", "def poll\n # can be optimised to swap out the queue \n # will require a mutex \n rval = Queue.new\n while @queue.length > 0 \n begin \n rval.enq @queue.deq(true) \n rescue ThreadError\n break \n end\n end\n rval \n end", "def pop_non_blocking\n yield pop(timeout: 0)\n rescue TimeoutError\n nil\n end", "def wait\n @future.value\n end", "def thread_read(timeout)\n deadline = Time.now + timeout\n raw_last_sample = nil\n while data = raw_read_new # sync call from bg thread\n raw_last_sample = data\n event :raw_data, data\n # TODO just emit raw_data and convert it to ruby\n # if someone is listening to (see PortProxy)\n event(:data) { [Typelib.to_ruby(data)] }\n break if Time.now > deadline\n end\n raw_last_sample\n end", "def pop(non_block=false)\n handle_interrupt do\n @mutex.synchronize do\n while true\n if @que.empty?\n if non_block\n raise ThreadError, \"queue empty\"\n else\n begin\n @num_waiting += 1\n @cond.wait @mutex\n ensure\n @num_waiting -= 1\n end\n end\n else\n return @que.shift\n end\n end\n end\n end\n end", "def consume\n loop do\n work_unit = @queue.pop\n send_requests(work_unit)\n @queue.synchronize do\n @results_unprocessed -= 1\n @all_processed_condition.broadcast\n end\n end\n end", "def value\n @lock.synchronize do\n\n while ! @ready do\n @cond.wait @lock\n end\n\n raise @exception if @exception\n\n @value\n end\n end", "def channel\n return @channel\n end", "def when_channel_polled(channel)\n while input.length > 0\n if @packet_length.nil?\n # make sure we've read enough data to tell how long the packet is\n return unless input.length >= 4\n @packet_length = input.read_long\n end\n\n return unless input.length >= @packet_length\n packet = Net::SFTP::Packet.new(input.read(@packet_length))\n input.consume!\n @packet_length = nil\n\n debug { \"received sftp packet #{packet.type} len #{packet.length}\" }\n\n if packet.type == FXP_VERSION\n do_version(packet)\n else\n dispatch_request(packet)\n end\n end\n end", "def call\n 2.times do\n message = try_blocking_receive\n return message unless message.equal?(Undefined)\n end\n fail ProtocolError\n end", "def cmd_read(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\n\t\t\t\t\"Usage: read channel_id [length]\\n\\n\" +\n\t\t\t\t\"Reads data from the supplied channel.\")\n\t\t\treturn true\n\t\tend\n\n\t\tcid = args[0].to_i\n\t\tlength = (args.length >= 2) ? args[1].to_i : 16384\n\t\tchannel = client.find_channel(cid)\n\n\t\tif (!channel)\n\t\t\tprint_error(\"Channel #{cid} is not valid.\")\n\t\t\treturn true\n\t\tend\n\n\t\tdata = channel.read(length)\n\n\t\tif (data and data.length)\n\t\t\tprint(\"Read #{data.length} bytes from #{cid}:\\n\\n#{data}\\n\")\n\t\telse\n\t\t\tprint_error(\"No data was returned.\")\n\t\tend\n\n\t\treturn true\n\tend", "def pop(non_block=false)\n @mutex.synchronize{\n while true\n if @que.empty?\n raise ThreadError, \"queue empty\" if non_block\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @que.shift\n end\n end\n }\n end", "def send_and_get_data data\n send_data data\n get_data_with_timeout data.size\n end", "def grab(*key)\n synchronize do\n @data.get(*key)\n end\n end", "def pop(non_block=false)\n @mutex.synchronize{\n while true\n if @que.empty?\n raise ThreadError, \"queue empty\" if non_block\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @que.pop[0]\n end\n end\n }\n end", "def wait_action_cable_subscription\n sleep 1\n end", "def dequeue\n loop do\n return nil if @stop\n message = receive_message\n if message\n if message.valid?\n return message\n else\n delete_message(message)\n end\n end\n end\n end", "def blocking_read\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Not connected!\" unless connected?\r\n begin\r\n [email protected](8192)[0]\r\n return nil if data.empty?\r\n data\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Couldn't read from socket! (#{$!})\"\r\n end\r\n end", "def subscribe(channel, *channels, &block); end", "def recv\n @send_mutex.synchronize { @send_cv.wait(@send_mutex) until @send } unless @send\n\n msg = @stream.recv_msg(blocking: true)\n return msg if msg\n raise StopIteration\n rescue GrpcKit::Errors::BadStatus => e\n @reason = e\n raise e\n end", "def wait_for_message\n buffer = type = nil\n\n if @saved_message\n type, buffer = @saved_message\n @logger.debug \"returning saved message: #{type}\" if @logger.debug?\n @saved_message = nil\n else\n loop do\n if @logger.debug?\n @logger.debug \"waiting for packet from server...\"\n end\n\n buffer = @packet_receiver.get\n next unless buffer\n\n type = buffer.read_byte\n @logger.debug \"got packet of type #{type}\" if @logger.debug?\n\n case type\n when DISCONNECT\n reason_code = buffer.read_long\n description = buffer.read_string\n language = buffer.read_string\n raise Net::SSH::Transport::Disconnect,\n \"disconnected: #{description} (#{reason_code})\"\n\n when IGNORE\n # do nothing\n @logger.info \"received IGNORE message \" +\n \"(#{buffer.read_string.inspect})\" if @logger.debug?\n\n when DEBUG\n # do nothing\n @logger.info \"received DEBUG message\" if @logger.debug?\n always_display = buffer.read_bool\n message = buffer.read_string\n language = buffer.read_string\n if always_display\n @logger.warn \"#{message} (#{language})\" if @logger.warn?\n else\n @logger.debug \"#{message} (#{language})\" if @logger.debug?\n end\n\n when KEXINIT\n # unless we're already doing a key-exchange, do key\n # re-exchange\n if !@doing_kexinit\n @logger.info \"re-key requested\" if @logger.info?\n @saved_message = [ type, buffer ]\n kexinit\n else\n break\n end\n\n else\n break\n end\n end\n end\n\n return type, buffer\n end", "def call\n executor.consume\n end", "def wait_for_message\n listen_for_messages\n loop { publish_message(@current_user, gets.strip) }\n end", "def monitor_thread\n Thread.new do\n begin\n while self.fd\n buff = self.fd.get_once(-1, 1.0)\n next if not buff\n store_data(buff)\n end\n rescue ::Exception => e\n self.monitor_thread_error = e\n end\n end\n end", "def process_channel(channel)\n timestamp, action, message, back_channel = channel.get\n response = @worker.process(action, message)\n back_channel.put [timestamp, response] if back_channel\n rescue StandardError => e\n # Always return _something_.\n #\n $stderr.puts \"[Warning] Processing #{channel} in worker #{@worker} failed: #{e.message}\"\n back_channel.put [] if back_channel\n end", "def channel\n # Create new channel if closed\n if @channel.nil? || @channel.closed?\n @channel = connection.create_channel\n end\n @channel\n end", "def get_by_channel(channel, cookie_or_cookies = nil)\n add_cookie_to_http_header(cookie_or_cookies)\n return @client.get(\"#{@resource_uri}/channel/#{channel}\")\n end", "def run\n while true; async.handle_message @socket.read; end\n end", "def wait_for_message\n loop do\n message = gets.strip\n publish_message(@current_user, message)\n end\n end", "def subscribe( channel, &callback )\n fail NotImplementedError\n end", "def receive_data(data)\n log \"<< #{data.size}\"\n @write_to_channel << data\n end", "def read_stream(stream_id)\n data_cb = @stream_callbacks[stream_id]\n\n while true\n data = nil\n begin\n data = @native_channel.read_ex(stream_id, 1000)\n rescue Native::Error::ERROR_EAGAIN\n # When we get an EAGAIN then we're done. Return.\n return\n end\n\n # If we got nil as a return value then there is no more data\n # to read.\n return if data.nil?\n\n # Callback if we have data to send and we have a callback\n data_cb.call(data) if data_cb\n end\n end", "def read\n return if @read_flag\n\n process_reading\n end", "def try_take!\n @mutex.synchronize do\n if unlocked_full?\n value = @value\n @value = EMPTY\n @empty_condition.signal\n apply_deref_options(value)\n else\n EMPTY\n end\n end\n end", "def get(opts={})\n while @work_queue.size > 0\n @work_queue.try_work\n end\n \n check_connection_state\n\n @connection.read(@serializer)\n rescue Errno::ECONNRESET, EOFError\n # Connection reset by peer\n raise ConnectionLost\n end", "def subscription_channel\n @subscription_channel ||= ::AMQP::Channel.new(connection).prefetch(1)\n end", "def wait_until_available\n return unless locked?\n\n @mutex.synchronize {}\n end", "def read()\r\n return @socket.read(1)\r\n end", "def gets\n\t\t\t\tif @buffer.nil?\n\t\t\t\t\treturn read_next\n\t\t\t\telse\n\t\t\t\t\tbuffer = @buffer\n\t\t\t\t\t@buffer = nil\n\t\t\t\t\treturn buffer\n\t\t\t\tend\n\t\t\tend", "def read\n @mutex.synchronize {\n if(!@reading)\n @reading = 1\n begin\n str = @sock.gets\n rescue\n end\n\n @reading = nil\n return str\n else\n return nil\n end\n }\n end", "def read_message\n return @text_queue.shift\n end", "def wait(future,timeout=nil)\n return future.data if future.done? # future was waited before\n # we can have more fine grained synchronization later.\n ## easiest thing to do (later) is use threadsafe hash for @futures and @ready.\n ### But it's actually trickier than\n ### that. Before each @buffer.pop, a thread\n ### has to check again if it sees the result\n ### in @ready.\n self.synchronize do\n timer = nil\n if timeout\n timer = EM.add_timer(timeout) {\n @buffer << [:timeout,future.message_id]\n }\n end\n ready_future = nil\n if @ready.has_key? future.message_id\n @ready.delete future.message_id\n ready_future = future\n else\n while true\n header,payload = @buffer.pop # synchronize. like erlang's mailbox select.\n if header == :timeout # timeout the future we are waiting for.\n message_id = payload\n # if we got a timeout from previous wait. throw it away.\n next if future.message_id != message_id \n future.timeout = true\n future.done!\n @futures.delete future.message_id\n return yield # return the value of timeout block\n end\n data = payload[\"data\"]\n some_future = @futures[header.message_id]\n # If we didn't find the future among the\n # future, it must have timedout. Just\n # throw result away and keep processing.\n next unless some_future\n some_future.timeout = false\n some_future.header = header\n some_future.data = data\n some_future.method = payload[\"method\"]\n some_future.meta = payload[\"meta\"]\n if some_future == future\n # The future we are waiting for\n EM.cancel_timer(timer) if timer\n ready_future = future\n break\n else\n # Ready, but we are not waiting for it. Save for later.\n @ready[some_future.message_id] = some_future\n end\n end\n end\n ready_future.done!\n @futures.delete ready_future.message_id\n return ready_future.data\n end\n \n end", "def listen_to_channel(connection, channel, &block)\n connection.execute(\"LISTEN #{channel}\")\n\n loop do\n connection.raw_connection.wait_for_notify(10) do |event, pid, payload|\n return if yield payload\n end\n end\n ensure\n connection.execute(\"UNLISTEN *\")\n end", "def subscribe_to_channel; end", "def wait_until_available\n return unless @locked\n\n @mutex.lock\n @mutex.unlock\n end", "def get( queue_name, opts = {} )\n opts = opts.merge( :queue_name => queue_name )\n g = KJess::Request::Get.new( opts )\n\n if opts[:wait_for]\n wait_for_in_seconds = Float(opts[:wait_for]) / 1000.0\n else\n wait_for_in_seconds = 0.1\n end\n\n connection.with_additional_read_timeout(wait_for_in_seconds) do\n resp = send_recv( g )\n return resp.data if KJess::Response::Value === resp\n return nil\n end\n end", "def subscribed\n stream_from channel_name\n end", "def start\n Thread.new do\n loop do\n @connection.wait_for_notify do |channel|\n @actions[channel].call\n end\n end\n end\n end", "def start\n channel.prefetch(10)\n queue.subscribe(manual_ack: true, exclusive: false) do |delivery_info, metadata, payload|\n begin\n body = JSON.parse(payload).with_indifferent_access\n status = run(body)\n rescue => e\n status = :error\n end\n\n if status == :ok\n channel.ack(delivery_info.delivery_tag)\n elsif status == :retry\n channel.reject(delivery_info.delivery_tag, true)\n else # :error, nil etc\n channel.reject(delivery_info.delivery_tag, false)\n end\n end\n\n wait_for_threads\n end", "def on_data( channel, data )\n @stdout << data if @state == :open\n end", "def receive_data\n if @socket\n # udp receive\n @socket.recvfrom(1024)\n else\n # tcp receive\n sleep 0.1\n if $received_data\n $received_data.shift\n else\n fail 'no data'\n end\n end\n end", "def dequeue\n synchronize do\n @cond.wait_until{ @array.size > 0 }\n @array.shift\n end\n end", "def pull\n begin\n @map = read_data\n rescue LockMethod::Locked\n sleep 0.5\n pull\n end\n end", "def fetch\n watchdog('Fetcher#fetch died') do\n return if Creeper::Fetcher.done?\n\n begin\n queue = nil\n msg = nil\n job = nil\n conn = nil\n\n conn = Creeper::BeanstalkConnection.create\n\n begin\n job = conn.reserve(TIMEOUT)\n queue, msg = Creeper.load_json(job.body)\n rescue Beanstalk::TimedOut\n logger.debug(\"No message fetched after #{TIMEOUT} seconds\") if $DEBUG\n job.release rescue nil\n conn.close rescue nil\n sleep(TIMEOUT)\n return after(0) { fetch }\n end\n\n if msg\n @mgr.assign!(msg, queue.gsub(/.*queue:/, ''), job, conn)\n else\n after(0) { fetch }\n end\n rescue => ex\n logger.error(\"Error fetching message: #{ex}\")\n logger.error(ex.backtrace.first)\n job.release rescue nil\n conn.close rescue nil\n sleep(TIMEOUT)\n after(0) { fetch }\n end\n end\n end", "def read(refresh = false)\n return if @got && !refresh\n read!\n end", "def polling\n while true do\n publish\n end\n end", "def dispatch_work\n $consumers.each do |pipe|\n next unless pipe.idle? || pipe.dead?\n item = nil\n $mutex.synchronize{item = $buffer.pop}\n return unless item\n pipe.idle = false\n Thread.new{send_data(pipe, item)} \n end\nend", "def consume(&block)\n @queue.consume(&block)\n end", "def test_long_polling_get\n puts \"test_long_polling_get\"\n s = random_string\n t = Thread.new do\n r = pop\n assert_equal(s, r, \"expected #{s}, got #{r}\")\n end\n\n sleep 2\n pr = push(s)\n assert_equal(0, pr, \"expected 0, got #{pr}\")\n t.join\n end", "def get_rx_data\n return self.sendcmd(\"rx.get_data\")\n end", "def wait\n\t\t\t\twrapper = Async::IO::Generic.new(@input)\n\t\t\t\twrapper.read(1)\n\t\t\tensure\n\t\t\t\t# Remove the wrapper from the reactor.\n\t\t\t\twrapper.reactor = nil\n\t\t\tend", "def wait_for_rx\n sleep DATA_REFRESH_RATE + @latency\n end" ]
[ "0.6664893", "0.6316204", "0.6220977", "0.6169028", "0.598539", "0.5882281", "0.5683792", "0.56730545", "0.561577", "0.5589824", "0.5589802", "0.55678767", "0.5525934", "0.5509804", "0.5461527", "0.54573184", "0.5452558", "0.5403358", "0.5378089", "0.53726536", "0.53661245", "0.5365493", "0.53584856", "0.5349386", "0.53379536", "0.530535", "0.5285008", "0.5272291", "0.52673334", "0.5261303", "0.5245777", "0.5245224", "0.5241219", "0.5237797", "0.5204737", "0.520382", "0.51881474", "0.5185557", "0.5181938", "0.5179281", "0.5178454", "0.51737183", "0.5170527", "0.5168341", "0.5158335", "0.51531464", "0.51487005", "0.5145693", "0.51414055", "0.5133521", "0.5132051", "0.51080936", "0.5093708", "0.50803554", "0.50701785", "0.5066652", "0.5065194", "0.5055519", "0.5053653", "0.5043132", "0.5041926", "0.5037873", "0.5030009", "0.5029759", "0.50277036", "0.5023981", "0.5013202", "0.50085115", "0.49983877", "0.49886352", "0.4969306", "0.49674097", "0.4966279", "0.4965376", "0.49601862", "0.49571902", "0.4952444", "0.49455476", "0.49222305", "0.49221778", "0.4921736", "0.49195662", "0.49131805", "0.4910982", "0.49108675", "0.49094033", "0.49087313", "0.49029434", "0.4900327", "0.48928797", "0.48918074", "0.4889234", "0.48846456", "0.48842663", "0.48797822", "0.48794234", "0.48699698", "0.48685116", "0.4867723", "0.48581535" ]
0.51369166
49
Retrieves data from channel like method +pop+, but if thread isn't suspended, and an exception is raised.
def pop! @mutex.synchronize do loop do if @queue.empty? raise ThreadError, "Empty Channel" @waiting.push Thread.current @mutex.sleep else return @queue.shift end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop\n @queue.pop(true)\n rescue ThreadError\n if closed?\n raise ClosedQueue if @raise_exception.true?\n return nil\n else\n sleep\n retry\n end\n end", "def pop_non_blocking\n yield pop(timeout: 0)\n rescue TimeoutError\n nil\n end", "def pop(non_block=false)\n handle_interrupt do\n @mutex.synchronize do\n while true\n if @que.empty?\n if non_block\n raise ThreadError, \"queue empty\"\n else\n begin\n @num_waiting += 1\n @cond.wait @mutex\n ensure\n @num_waiting -= 1\n end\n end\n else\n return @que.shift\n end\n end\n end\n end\n end", "def read\n if active?\n res = nil\n\n while res.nil?\n @queue_lock.synchronize {\n @queue.each { |item|\n # Find next data\n if item.type == :data and item.seq == @seq_recv.to_s\n res = item\n break\n # No data? Find close\n elsif item.type == :close and res.nil?\n res = item\n end\n }\n\n @queue.delete_if { |item| item == res }\n }\n\n # No data? Wait for next to arrive...\n @pending.wait unless res\n end\n\n if res.type == :data\n @seq_recv += 1\n @seq_recv = 0 if @seq_recv > 65535\n res.data\n elsif res.type == :close\n deactivate\n nil # Closed\n end\n else\n nil\n end\n end", "def value\n\t\traise @exception if exception?\n\n\t\treturn @value if delivered?\n\n\t\tmutex.synchronize {\n\t\t\tcond.wait(mutex)\n\t\t}\n\n\t\tif exception?\n\t\t\traise @exception\n\t\telse\n\t\t\t@value\n\t\tend\n\tend", "def try_blocking_receive\n mutex.lock\n if mailbox.empty?\n mutex.unlock\n Thread.stop\n Undefined\n else\n mailbox.shift.tap do\n mutex.unlock\n end\n end\n end", "def call\n 2.times do\n message = try_blocking_receive\n return message unless message.equal?(Undefined)\n end\n fail ProtocolError\n end", "def pop(non_block=false)\n @mutex.synchronize{\n while true\n if @que.empty?\n raise ThreadError, \"queue empty\" if non_block\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @que.shift\n end\n end\n }\n end", "def pop(non_block=false)\n @mutex.synchronize{\n while true\n if @que.empty?\n raise ThreadError, \"queue empty\" if non_block\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @que.pop[0]\n end\n end\n }\n end", "def pop\n @mutex.synchronize do\n loop do\n if @queue.empty?\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @queue.shift\n end\n end\n end\n end", "def pop\n while true\n message = @queue.pop\n return YAML::load(message.to_s) unless message.nil?\n sleep 5\n end\n end", "def pop_with_priority non_block = false\n return pop_without_priority non_block unless is_a_priority_queue?\n synchronize do\n value = Resque::JobFetch.fetch_one_job @redis, @redis_name until non_block || value\n raise ThreadError if non_block && !value\n decode value\n end\n end", "def poll\n # can be optimised to swap out the queue \n # will require a mutex \n rval = Queue.new\n while @queue.length > 0 \n begin \n rval.enq @queue.deq(true) \n rescue ThreadError\n break \n end\n end\n rval \n end", "def pop(*args)\n retval = super\n @mutex.synchronize {\n if @que.length < @max\n begin\n t = @queue_wait.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n end\n }\n retval\n end", "def pop(*args)\n retval = super\n @mutex.synchronize {\n if @que.length < @max\n begin\n t = @queue_wait.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n end\n }\n retval\n end", "def pull\n begin\n @map = read_data\n rescue LockMethod::Locked\n sleep 0.5\n pull\n end\n end", "def retrieve(key)\n unless @queue\n @channel.queue_declare(:queue => key)\n @channel.queue_bind(:queue_name => key)\n bc = channel.basic_consume(:queue => key)\n @queue = client.queue(bc.consumer_tag)\n end\n \n return nil if @queue.empty?\n begin\n # at this point there should be something in the queue but nonetheless we keep a\n # defensive approach and trap a possible empty queue exception. there could be a \n # race condition between the empty? check and the pop.\n message = @queue.pop(non_block = true)\n return Marshal.load(message.content.body)\n rescue\n return nil\n end\n end", "def pop\n entry = queue.pop[:payload]\n if (entry != :queue_empty)\n Marshal.load(entry)\n else\n nil\n end\n end", "def pop()\n res = @pop_queue.shift()\n return res\n end", "def recv\n @send_mutex.synchronize { @send_cv.wait(@send_mutex) until @send } unless @send\n\n msg = @stream.recv_msg(blocking: true)\n return msg if msg\n raise StopIteration\n rescue GrpcKit::Errors::BadStatus => e\n @reason = e\n raise e\n end", "def receive(channel = mailbox)\n channel.pop_op\n end", "def blocking_read\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Not connected!\" unless connected?\r\n begin\r\n [email protected](8192)[0]\r\n return nil if data.empty?\r\n data\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Couldn't read from socket! (#{$!})\"\r\n end\r\n end", "def pop_exception\n exception_queue.shift\n end", "def try_take!\n @mutex.synchronize do\n if unlocked_full?\n value = @value\n @value = EMPTY\n @empty_condition.signal\n apply_deref_options(value)\n else\n EMPTY\n end\n end\n end", "def pop\n raise_future_proof_exception if finished?\n raise_or_value super\n end", "def execute\n queue.get\n rescue Java::JavaLang::Throwable => e\n raise decomposeException(e)\n end", "def pop_interrupt; end", "def pop(blocking = false, &block)\n @driver.pop(blocking, &block)\n end", "def pop(blocking = false, &block)\n @driver.pop(blocking, &block)\n end", "def remote_read\n ops = { RECV_MESSAGE => nil }\n ops[RECV_INITIAL_METADATA] = nil unless @metadata_received\n batch_result = @call.run_batch(ops)\n unless @metadata_received\n @call.metadata = batch_result.metadata\n @metadata_received = true\n end\n get_message_from_batch_result(batch_result)\n rescue GRPC::Core::CallError => e\n GRPC.logger.info(\"remote_read: #{e}\")\n nil\n end", "def read_message\n return @text_queue.shift\n end", "def pop\n @lock.synchronize do\n @queue.pop\n end\n end", "def pop\n if @q.empty?\n raise QueueEmptyError, \"tried to pop empty queue in #{@component.inspect}\"\n end\n obj = @q.shift\n @component.dec_queue_ready_count if @q.empty?\n obj\n end", "def execute\n queue.get\n # Only catch Java exceptions since we already handle most exceptions in Observable#get\n rescue Java::JavaLang::Throwable => e\n raise decomposeException(e)\n end", "def data_channel_message(data)\n # puts \"Message received! #{data}\"\n if !$$.host\n receiveSync(data)\n end\nend", "def fetch\n watchdog('Fetcher#fetch died') do\n return if Creeper::Fetcher.done?\n\n begin\n queue = nil\n msg = nil\n job = nil\n conn = nil\n\n conn = Creeper::BeanstalkConnection.create\n\n begin\n job = conn.reserve(TIMEOUT)\n queue, msg = Creeper.load_json(job.body)\n rescue Beanstalk::TimedOut\n logger.debug(\"No message fetched after #{TIMEOUT} seconds\") if $DEBUG\n job.release rescue nil\n conn.close rescue nil\n sleep(TIMEOUT)\n return after(0) { fetch }\n end\n\n if msg\n @mgr.assign!(msg, queue.gsub(/.*queue:/, ''), job, conn)\n else\n after(0) { fetch }\n end\n rescue => ex\n logger.error(\"Error fetching message: #{ex}\")\n logger.error(ex.backtrace.first)\n job.release rescue nil\n conn.close rescue nil\n sleep(TIMEOUT)\n after(0) { fetch }\n end\n end\n end", "def on_any_receive()\n Thread.new() do\n begin\n if self.data_readed.size>0\n buff,self.data_readed=self.data_readed,strempty\n yield(buff)\n end\n loop do\n data=(self.recv(64*1024) rescue nil)\n data && data.size>0 ? yield(data) : break\n end\n rescue Exception => e\n $stdout.puts \"#{e} :\\n #{e.backtrace.join(\"\\n \")}\"\n end\n close rescue nil\n end\n end", "def get_next\n while next_item = @queue.peek\n if next_item.cancelled?\n @queue.shift\n else\n return next_item\n end\n end\n\n return nil\n end", "def recv_request\n\t\t\treply = @srv_requestq.pop\n\t\t\tif reply.is_a? Exception\n\t\t\t\tself.close\n\t\t\t\traise reply\n\t\t\telse\n\t\t\t\treply\n\t\t\tend\n\t\tend", "def read\n tmp = nil\n mutex.synchronize do\n tmp = @buffer.dup\n @buffer.clear\n end\n return tmp unless tmp.empty?\n end", "def pull_queue_pull\n return nil if self.pull_queue_names.length == 0\n \n puts \"pulling from queues #{self.pull_queue_names.join ', '}\"\n \n elt = nil\n elt = @redis.brpop(self.pull_queue_names, self.queue_wait_seconds) while elt == nil\n \n key = elt[0]\n val = elt[1]\n self.debug_out \"got data from pull queue #{key}\"\n Marshal.load val\n end", "def shift\n @m.synchronize do\n v = @q.shift\n return nil unless v[:alive]\n return v[:data]\n end\n end", "def pop &use\n #Thread.pass while self.empty?\n sleep 0.01 while self.empty?\n self.pop! &use\n end", "def wait_for_message\n buffer = type = nil\n\n if @saved_message\n type, buffer = @saved_message\n @logger.debug \"returning saved message: #{type}\" if @logger.debug?\n @saved_message = nil\n else\n loop do\n if @logger.debug?\n @logger.debug \"waiting for packet from server...\"\n end\n\n buffer = @packet_receiver.get\n next unless buffer\n\n type = buffer.read_byte\n @logger.debug \"got packet of type #{type}\" if @logger.debug?\n\n case type\n when DISCONNECT\n reason_code = buffer.read_long\n description = buffer.read_string\n language = buffer.read_string\n raise Net::SSH::Transport::Disconnect,\n \"disconnected: #{description} (#{reason_code})\"\n\n when IGNORE\n # do nothing\n @logger.info \"received IGNORE message \" +\n \"(#{buffer.read_string.inspect})\" if @logger.debug?\n\n when DEBUG\n # do nothing\n @logger.info \"received DEBUG message\" if @logger.debug?\n always_display = buffer.read_bool\n message = buffer.read_string\n language = buffer.read_string\n if always_display\n @logger.warn \"#{message} (#{language})\" if @logger.warn?\n else\n @logger.debug \"#{message} (#{language})\" if @logger.debug?\n end\n\n when KEXINIT\n # unless we're already doing a key-exchange, do key\n # re-exchange\n if !@doing_kexinit\n @logger.info \"re-key requested\" if @logger.info?\n @saved_message = [ type, buffer ]\n kexinit\n else\n break\n end\n\n else\n break\n end\n end\n end\n\n return type, buffer\n end", "def pop()\n @queue.shift\n end", "def dequeue\n loop do\n return nil if @stop\n message = receive_message\n if message\n if message.valid?\n return message\n else\n delete_message(message)\n end\n end\n end\n end", "def read_nonblock\n begin\n res = @client.recv_nonblock(256)\n rescue IO::WaitReadable\n res = nil\n rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL\n puts \"#{'Error:'.error} Cannot communicate with Drone!\"\n @connected\n end\n end", "def dispatch_work\n $consumers.each do |pipe|\n next unless pipe.idle? || pipe.dead?\n item = nil\n $mutex.synchronize{item = $buffer.pop}\n return unless item\n pipe.idle = false\n Thread.new{send_data(pipe, item)} \n end\nend", "def pop_sync(rc)\n # By default, return what we're given\n return rc\n end", "def value\n @lock.synchronize do\n\n while ! @ready do\n @cond.wait @lock\n end\n\n raise @exception if @exception\n\n @value\n end\n end", "def read\n return Log.warn \"[PubSub] Not started...\" unless redis\n @psthread = Thread.new do\n begin\n redis.subscribe('subduino') do |on|\n on.subscribe {|klass, num_subs| Log.info \"[PubSub] Subscribed to #{klass} (#{num_subs} subscriptions)\" }\n on.message do |klass, msg|\n Log.info \"[PubSub] #{klass} - #{msg}\"\n ArdIO.write msg\n # @redis.unsubscribe if msg == 'exit'\n end\n on.unsubscribe {|klass, num_subs| Log.info \"[PubSub] Unsubscribed to #{klass} (#{num_subs} subscriptions)\" }\n end\n rescue => e\n Log.error \"[PubSub] Error #{e}\"\n Log.error e.backtrace.join(\"\\n\")\n exit 1\n end\n\n end\n end", "def test_long_polling_get\n puts \"test_long_polling_get\"\n s = random_string\n t = Thread.new do\n r = pop\n assert_equal(s, r, \"expected #{s}, got #{r}\")\n end\n\n sleep 2\n pr = push(s)\n assert_equal(0, pr, \"expected 0, got #{pr}\")\n t.join\n end", "def get(opts={})\n while @work_queue.size > 0\n @work_queue.try_work\n end\n \n check_connection_state\n\n @connection.read(@serializer)\n rescue Errno::ECONNRESET, EOFError\n # Connection reset by peer\n raise ConnectionLost\n end", "def _next_element\n unless @got_next_element\n unless @thread\n if @enum\n @thread = @queue._run_enum(@enum.each)\n else\n @thread = @queue._run(&@block)\n end\n end\n @next_element = @queue.pop\n if Exception === @next_element\n raise @next_element\n end\n @got_next_element = true\n end\n @next_element\n end", "def value (timeout = nil)\n\t\treturn @value if delivered?\n\n\t\[email protected] {\n\t\t\tcond.wait(@mutex, *timeout)\n\t\t}\n\n\t\treturn @value if delivered?\n\tend", "def wait\n t = @ractor.take\n yield(self) if block_given?\n t\n rescue Ractor::ClosedError\n raise ErrorTerminated, \"ticker stopped\"\n end", "def read_neverblock(*args)\r\n\t\tres = \"\"\n\t\tbegin\n\t\t\traise Timeout::Error if Fiber.current[:exceeded_timeout]\n\t\t\t@immediate_result = read_nonblock(*args)\n\t\t\tres << @immediate_result\n\t\trescue Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EINTR\n \t\tattach_to_reactor(:read)\n \t\tretry\r\n\t\tend\n\t\tres\r\n end", "def poll()\n return nil if self.heap_container.length == 0\n return self.heap_container.pop() if self.heap_container.length == 1\n \n item = self.heap_container.pop()\n self.heap_container[0] = self.heap_container.pop()\n self.heapify_down()\n return item\n end", "def thread_loop\n loop do\n raise Closed if ! open?\n task = @queue.pop\n result = begin\n case task\n when Proc\n task.call\n else\n @logger.info \"#{self}: Performed #{task.inspect}\"\n end\n end\n @logger.info \"#{self}: Performed #{task.inspect}\"\n end\n end", "def receive\n Rubinius.primitive :channel_receive\n raise PrimitiveFailure, \"Channel#receive primitive failed\"\n end", "def read\n if !@derived_queue.empty?\n p1 = @derived_queue.shift\n return p1\n else\n\n # This is a blocking call to wait for an actual packet to come over the wire\n packet = super()\n\n agg_pkt_map.select do |agg_packet, simple_packet|\n agg_pkt = System.telemetry.packet(target, agg_packet)\n if(agg_pkt.identify?(packet.buffer)) \n process(packet: packet, target: target, agg_packet: agg_packet, simple_packet: simple_packet)\n end\n end\n \n return packet\n end \n end", "def data_channel_closed\n puts \"Data channel closed!\"\nend", "def pop\n raise \"Abstract queue cannot return objects\"\n end", "def resume_read\n messages = []\n rc = read_message_part messages\n #puts \"resume_read: rc1 [#{rc}], more_parts? [#{@raw_socket.more_parts?}]\"\n\n while 0 == rc && @raw_socket.more_parts?\n #puts \"get next part\"\n rc = read_message_part messages\n #puts \"resume_read: rc2 [#{rc}]\"\n end\n #puts \"no more parts, ready to deliver\"\n\n # only deliver the messages when rc is 0; otherwise, we\n # may have gotten EAGAIN and no message was read;\n # don't deliver empty messages\n deliver messages, rc if 0 == rc\n end", "def pop\n raise EMPTY_STACK_ERROR if @data.empty?\n\n @data.pop\n end", "def get_data(row_num)\n row = @cache[row_num]\n if row.nil? \n @channel << [:get_rows, row_num, FETCH_SIZE]\n end\n row\n end", "def pop\n val = []\n @queue_mutex.synchronize do\n val = @memory_queue.pop\n end\n val\n end", "def dequeue\n synchronize do\n @cond.wait_until{ @array.size > 0 }\n @array.shift\n end\n end", "def peek()\n @queue.first\n end", "def read\n\t\t@@character_queue.pop\n\tend", "def fetch_row\n if @row_buffer.empty?\n if @done\n return nil\n else\n fetch_more\n end\n end\n\n @row_buffer.shift\n end", "def read_loop\n read until @driver.state == :closed\n rescue SystemCallError => e\n LOGGER.error { \"(#{e.class.name.split('::').last}) #{e.message}\" }\n rescue EOFError => e\n LOGGER.error { 'EOF in websocket loop' }\n end", "def readData(socket)\n data = socket.read(512)\n if data.nil?\n raise RetryException.new(true), \"transient read error\"\n end\n # .. normal processing\nend", "def get(*key)\n synchronize do\n val = @data.get(*key)\n return val if !val.nil?\n val = new_cond\n set(*key, val)\n val.wait\n @data.get(*key)\n end\n end", "def message_from_queue\n if msg = @connection.pop\n message = msg.body.delete(\"\\n\")\n msg.finish\n message\n end\n end", "def thread_read_callback(data, error)\n if data\n @raw_last_sample = data\n elsif error\n poll_timer.cancel\n self.period = poll_timer.period\n @event_loop.once do\n event :error,error\n end\n end\n end", "def wait_for_reader\n @reader.wait if @reader\n end", "def wait_for_event\n q = @vm.eventQueue()\n while(true)\n event_set = q.remove()\n it = event_set.iterator()\n while(it.hasNext)\n event = it.next\n $DEBUG and puts(\"Received an event: #{event.java_class}\")\n @frame = AndroidDebug::Jpda::Frame.new(event.thread.frame(0), event.location)\n @this = @frame.this\n return(AndroidDebug::Jpda::Event.new(event))\n end \n end\n end", "def monitor_thread\n Thread.new do\n begin\n while self.fd\n buff = self.fd.get_once(-1, 1.0)\n next if not buff\n store_data(buff)\n end\n rescue ::Exception => e\n self.monitor_thread_error = e\n end\n end\n end", "def pop\n alarm = (Time.now + @wait_timeout)\n clnt = nil\n dirty = false\n while !@shutdown\n raise_alarm if (Time.now > alarm)\n @mutex.synchronize do\n begin\n if clnt = @_pool.pop\n dirty = true\n else\n clnt = _fetch_new(&@client_block)\n end\n ensure\n if clnt\n _checkout(clnt)\n @cond.signal\n else\n @reaper.wakeup if @reaper && _dead_clients?\n @cond.wait(@mutex,@wait_timeout)\n end\n end\n end\n break if clnt\n end\n clean_client(clnt) if dirty && clnt\n clnt\n end", "def verify_channel\n while ! self.channel\n raise EOFError if ! self.thread.alive?\n ::IO.select(nil, nil, nil, 0.10)\n end\n end", "def pop()\n @q.shift\n end", "def subscribe(selector)\n channel = self\n @mutex.synchronize do\n loop do\n return selector.result unless selector.waiting?\n if @queue.empty?\n @waiting.push Thread.current\n @mutex.sleep\n else\n selector.mutex.synchronize do\n if selector.waiting?\n result = selector.update_result(channel, @queue.shift)\n yield result\n end\n end\n selector.release_result\n return selector.result\n end\n end\n end\n end", "def consume_connection\n return unless @channel\n connection = @channel.connection\n connection.process while connection.reader_ready?\n end", "def __run__()\n begin\n begin\n @lock.send nil\n @result = @block.call(*@args)\n ensure\n @lock.receive\n unlock_locks\n @joins.each { |join| join.send self }\n end\n rescue Die\n @exception = nil\n rescue Exception => e\n # I don't really get this, but this is MRI's behavior. If we're dying\n # by request, ignore any raised exception.\n @exception = e # unless @dying\n ensure\n @alive = false\n @lock.send nil\n end\n\n if @exception\n if abort_on_exception or Thread.abort_on_exception\n Thread.main.raise @exception\n elsif $DEBUG\n STDERR.puts \"Exception in thread: #{@exception.message} (#{@exception.class})\"\n end\n end\n end", "def read_operation_finished!(retval, resource)\n return unless resource.class.is_protectable?\n Thread.current[:performing_get] = false\n end", "def peek\n raise QueueUnderflow if empty?\n @info[0]\n end", "def pop_blocking\n tag[:blocking_list].rpop\n end", "def interrupt_last\n skip do\n if context = last_context\n return nil unless context.thread.alive?\n context.interrupt\n end\n context\n end\n end", "def wait(future,timeout=nil)\n return future.data if future.done? # future was waited before\n # we can have more fine grained synchronization later.\n ## easiest thing to do (later) is use threadsafe hash for @futures and @ready.\n ### But it's actually trickier than\n ### that. Before each @buffer.pop, a thread\n ### has to check again if it sees the result\n ### in @ready.\n self.synchronize do\n timer = nil\n if timeout\n timer = EM.add_timer(timeout) {\n @buffer << [:timeout,future.message_id]\n }\n end\n ready_future = nil\n if @ready.has_key? future.message_id\n @ready.delete future.message_id\n ready_future = future\n else\n while true\n header,payload = @buffer.pop # synchronize. like erlang's mailbox select.\n if header == :timeout # timeout the future we are waiting for.\n message_id = payload\n # if we got a timeout from previous wait. throw it away.\n next if future.message_id != message_id \n future.timeout = true\n future.done!\n @futures.delete future.message_id\n return yield # return the value of timeout block\n end\n data = payload[\"data\"]\n some_future = @futures[header.message_id]\n # If we didn't find the future among the\n # future, it must have timedout. Just\n # throw result away and keep processing.\n next unless some_future\n some_future.timeout = false\n some_future.header = header\n some_future.data = data\n some_future.method = payload[\"method\"]\n some_future.meta = payload[\"meta\"]\n if some_future == future\n # The future we are waiting for\n EM.cancel_timer(timer) if timer\n ready_future = future\n break\n else\n # Ready, but we are not waiting for it. Save for later.\n @ready[some_future.message_id] = some_future\n end\n end\n end\n ready_future.done!\n @futures.delete ready_future.message_id\n return ready_future.data\n end\n \n end", "def read_blocked\n end", "def fetch queue_name, source_uri\n ReliableMsg::Queue.new(queue_name, :drb_uri => source_uri).get { |m|\n begin\n tx = Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX]\n Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX] = nil\n\n @logger.info { \"message fetched - <#{m.id}>\" }\n yield m\n\n ensure\n Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX] = tx\n end\n }\n end", "def blocking_read\n raise RuntimeError, \"RAWIP: blocking_read: Not connected!\" unless connected?\n begin\n loop do\n data, sender = @rsock.recvfrom(8192)\n port, host = Socket.unpack_sockaddr_in(sender)\n #Assume a 20 byte IP header (yuck!)\n return data[20..-1] if host == @dest # only queue packets from our peer\n end\n rescue\n destroy_connection\n raise RuntimeError, \"RAWIP: blocking_read: Couldn't read from socket! (#{$!})\"\n end\n end", "def pop\r\n ret = peek\r\n @buffer = nil\r\n ret\r\n end", "def read\n until message = @reader.read_message!(@unread, @state)\n bytes = @ios.read\n if bytes and not bytes.empty?\n @unread << bytes\n else\n return nil \n end\n if @unread.size > MAX_RECEIVE_SIZE \n raise \"Maximum message size (#{MAX_RECEIVE_SIZE}) exceeded\"\n end\n end\n\n return message\n end", "def read( transfer_until: )\n\t\t\tif !@pending_read\n\t\t\t\t@pending_read = true\n\t\t\t\t@transfer_until = transfer_until\n\n\t\t\t\tFiber.schedule do\n\t\t\t\t\tconnect\n\n\t\t\t\t\tbegin\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t# 140 bytes transfer is required to trigger an error in spec \"can cancel a query\", when get_last_error doesn't wait for readability between PQgetResult calls.\n\t\t\t\t\t\t\t# TODO: Make an explicit spec for this case.\n\t\t\t\t\t\t\tread_str = @external_io.read_nonblock(140)\n\t\t\t\t\t\t\tprint_data(\"read-transfer #{read_fds}\", read_str)\n\t\t\t\t\t\t\t@internal_io.write(read_str)\n\t\t\t\t\t\trescue IO::WaitReadable, Errno::EINTR\n\t\t\t\t\t\t\t@external_io.wait_readable\n\t\t\t\t\t\t\tretry\n\t\t\t\t\t\trescue EOFError, Errno::ECONNRESET\n\t\t\t\t\t\t\tputs \"read_eof from #{read_fds}\"\n\t\t\t\t\t\t\t@internal_io.close_write\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend while @transfer_until\n\t\t\t\t\t@pending_read = false\n\t\t\t\tend\n\t\t\telsif transfer_until == :eof\n\t\t\t\t@transfer_until = transfer_until\n\t\t\tend\n\t\tend", "def read\n return if @read_flag\n\n process_reading\n end", "def reader(cancellation)\n lambda do |tick|\n next puts('reader interrupted') if cancellation.cancelled?\n\n data = File.read('/dev/urandom', 1024).tap { sleep 0.2 }\n [tick, data]\n end\nend", "def dispatch_in_thread(channel, message)\n callback_id, class_name, method_name, meta_data, *args = message\n method_name = method_name.to_sym\n\n # Get the class\n klass = Object.send(:const_get, class_name)\n\n promise = Promise.new\n\n start_time = Time.now.to_f\n\n # Check that we are calling on a Task class and a method provide at\n # Task or above in the ancestor chain. (so no :send or anything)\n if safe_method?(klass, method_name)\n promise.resolve(nil)\n\n # Init and send the method\n promise = promise.then do\n result = nil\n Timeout.timeout(klass.__timeout || @worker_timeout) do\n Thread.current['meta'] = meta_data\n begin\n result = klass.new(@volt_app, channel, self).send(method_name, *args)\n ensure\n Thread.current['meta'] = nil\n end\n end\n\n result\n end\n\n else\n # Unsafe method\n promise.reject(RuntimeError.new(\"unsafe method: #{method_name}\"))\n end\n\n # Called after task runs or fails\n finish = proc do |error|\n if error.is_a?(Timeout::Error)\n # re-raise with a message\n error = Timeout::Error.new(\"Task Timed Out after #{@worker_timeout} seconds: #{message}\")\n end\n\n run_time = ((Time.now.to_f - start_time) * 1000).round(3)\n Volt.logger.log_dispatch(class_name, method_name, run_time, args, error)\n end\n\n # Run the promise and pass the return value/error back to the client\n promise.then do |result|\n channel.send_message('response', callback_id, result, nil)\n\n finish.call\n end.fail do |error|\n finish.call(error)\n channel.send_message('response', callback_id, nil, error)\n end\n\n end", "def raise_side_channel_error!\n error_write.close\n err = error_read.read\n error_read.close\n begin\n # ArgumentError from Marshal.load indicates no data, which we assume\n # means no error in child process.\n raise Marshal.load(err)\n rescue ArgumentError\n nil\n end\n end" ]
[ "0.65754336", "0.65032303", "0.6019673", "0.5948217", "0.5936031", "0.5904673", "0.5803188", "0.58011866", "0.57122463", "0.5536105", "0.5508935", "0.54989034", "0.54855925", "0.5464009", "0.5464009", "0.5461388", "0.54411006", "0.5415646", "0.5409868", "0.53723055", "0.5350275", "0.53469926", "0.5295964", "0.52837855", "0.5245697", "0.52445966", "0.5202999", "0.51760715", "0.51760715", "0.5157421", "0.51428396", "0.5127534", "0.51112705", "0.51014906", "0.50907445", "0.5084002", "0.5081885", "0.5063809", "0.5050677", "0.5048478", "0.5041529", "0.5026182", "0.50253165", "0.50205487", "0.5014158", "0.49996275", "0.49580956", "0.4954074", "0.49457118", "0.49427855", "0.49397454", "0.49252242", "0.49157462", "0.49151546", "0.4912021", "0.49030092", "0.49002072", "0.4892462", "0.48887408", "0.48857805", "0.4881766", "0.48758295", "0.48731032", "0.48476657", "0.48461983", "0.4844126", "0.48428383", "0.48327455", "0.4825577", "0.48154175", "0.4815296", "0.48150614", "0.4811702", "0.48037693", "0.47998342", "0.47959012", "0.47905946", "0.47829163", "0.477662", "0.47723907", "0.47708583", "0.47692278", "0.47637028", "0.47609273", "0.47546518", "0.47544032", "0.4745962", "0.47366667", "0.47354183", "0.47307235", "0.47303838", "0.47285074", "0.47259766", "0.47236997", "0.47148928", "0.47125396", "0.471151", "0.47106257", "0.47105986", "0.47104353" ]
0.6866766
0
Retrieves all data from channel. If the channel is empty, the calling thread is suspended until data is pushed onto channel.
def flush flushed_queue = nil @mutex.synchronize do flushed_queue = @queue.dup @queue.clear end return flushed_queue end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop!\n @mutex.synchronize do\n loop do\n if @queue.empty?\n raise ThreadError, \"Empty Channel\"\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @queue.shift\n end\n end\n end\n end", "def consume_connection\n return unless @channel\n connection = @channel.connection\n connection.process while connection.reader_ready?\n end", "def subscribe(selector)\n channel = self\n @mutex.synchronize do\n loop do\n return selector.result unless selector.waiting?\n if @queue.empty?\n @waiting.push Thread.current\n @mutex.sleep\n else\n selector.mutex.synchronize do\n if selector.waiting?\n result = selector.update_result(channel, @queue.shift)\n yield result\n end\n end\n selector.release_result\n return selector.result\n end\n end\n end\n end", "def consume\n loop do\n work_unit = @queue.pop\n send_requests(work_unit)\n @queue.synchronize do\n @results_unprocessed -= 1\n @all_processed_condition.broadcast\n end\n end\n end", "def on_any_receive()\n Thread.new() do\n begin\n if self.data_readed.size>0\n buff,self.data_readed=self.data_readed,strempty\n yield(buff)\n end\n loop do\n data=(self.recv(64*1024) rescue nil)\n data && data.size>0 ? yield(data) : break\n end\n rescue Exception => e\n $stdout.puts \"#{e} :\\n #{e.backtrace.join(\"\\n \")}\"\n end\n close rescue nil\n end\n end", "def read\n if active?\n res = nil\n\n while res.nil?\n @queue_lock.synchronize {\n @queue.each { |item|\n # Find next data\n if item.type == :data and item.seq == @seq_recv.to_s\n res = item\n break\n # No data? Find close\n elsif item.type == :close and res.nil?\n res = item\n end\n }\n\n @queue.delete_if { |item| item == res }\n }\n\n # No data? Wait for next to arrive...\n @pending.wait unless res\n end\n\n if res.type == :data\n @seq_recv += 1\n @seq_recv = 0 if @seq_recv > 65535\n res.data\n elsif res.type == :close\n deactivate\n nil # Closed\n end\n else\n nil\n end\n end", "def gets_data(data)\n script.gets_channel_data(self, data)\n end", "def get_data timeout, &block\n @listener.start\n start_time = Time.now\n runner = Thread.new do\n loop do\n @listener.get.each {|data| yield data}\n end\n end\n sleep 1 while Time.now - start_time < timeout\n runner.exit\n @listener.stop\n end", "def each_data &block\n @listener.start\n @run = true\n\n Signal.trap(\"INT\") {@run = false}\n\n runner = Thread.new do\n loop do\n @listener.get.each {|data| yield data}\n end\n end\n\n sleep 1 while(@run)\n runner.exit\n @listener.stop\n end", "def read_worker_loop\n Thread.new do\n begin\n data = {}\n while @running\n upstream_data = @data_source_block.call\n if data_changed?(upstream_data, data[:upstream_data])\n data = wrap_data(upstream_data)\n @current_upstream = data\n if @no_wrap\n @send_queue << [upstream_data]\n else\n @send_queue << data\n end\n end\n sleep(@read_worker_delay)\n end\n rescue => e\n logger.error \"Read worker error:\"\n logger.error e\n end\n end\n end", "def _fwd_channel(channel)\n result = channel.fwd_channel\n while result.nil? do\n timeout = 0.001\n debug { \"waiting for fwd hannel \"}\n if @event_loop\n @event_loop.process_only(@fwd_conn,timeout)\n else\n @fwd_conn.process(timeout)\n end\n result = channel.fwd_channel\n end\n return result\n end", "def poll\n # can be optimised to swap out the queue \n # will require a mutex \n rval = Queue.new\n while @queue.length > 0 \n begin \n rval.enq @queue.deq(true) \n rescue ThreadError\n break \n end\n end\n rval \n end", "def verify_channel\n while ! self.channel\n raise EOFError if ! self.thread.alive?\n ::IO.select(nil, nil, nil, 0.10)\n end\n end", "def call\n executor.consume\n end", "def receive(channel = mailbox)\n channel.pop_op\n end", "def retrieve(key)\n unless @queue\n @channel.queue_declare(:queue => key)\n @channel.queue_bind(:queue_name => key)\n bc = channel.basic_consume(:queue => key)\n @queue = client.queue(bc.consumer_tag)\n end\n \n return nil if @queue.empty?\n begin\n # at this point there should be something in the queue but nonetheless we keep a\n # defensive approach and trap a possible empty queue exception. there could be a \n # race condition between the empty? check and the pop.\n message = @queue.pop(non_block = true)\n return Marshal.load(message.content.body)\n rescue\n return nil\n end\n end", "def flush\n while [email protected]? || @consumer.is_requesting?\n sleep(0.1)\n end\n end", "def run_gets(conn)\n return if not @need_gets\n @log.debug \"run_gets starts\"\n received_count = 0\n conn.get_data_received do |msg|\n received_count += 1\n @log.debug(\"-\" * 20)\n @log.debug \"Message Number #{received_count}:\"\n #\n @log.debug(\"Type: #{msg.class}\")\n @log.debug(\"Command: #{msg.command}\")\n @log.debug(\"Header Information:\")\n msg.header.each {|k,v|\n @log.debug(\"#{k}=#{v}\")\n }\n @log.debug(\"Body:\")\n @log.debug(\"#{msg.body}\")\n end\n @log.debug \"run_gets done\"\n if received_count > 0\n #\n # We are done!\n #\n conn.disconnect()\n EventMachine::stop_event_loop() \n end\n # Otherwise, wait for message arrival.\nend", "def get_copy_data(async=false, decoder=nil)\n\t\tif async\n\t\t\treturn sync_get_copy_data(async, decoder)\n\t\telse\n\t\t\twhile (res=sync_get_copy_data(true, decoder)) == false\n\t\t\t\tsocket_io.wait_readable\n\t\t\t\tconsume_input\n\t\t\tend\n\t\t\treturn res\n\t\tend\n\tend", "def polling\n while true do\n publish\n end\n end", "def dispatch_work\n $consumers.each do |pipe|\n next unless pipe.idle? || pipe.dead?\n item = nil\n $mutex.synchronize{item = $buffer.pop}\n return unless item\n pipe.idle = false\n Thread.new{send_data(pipe, item)} \n end\nend", "def run\n while true; async.handle_message @socket.read; end\n end", "def wait_for_reader\n @reader.wait if @reader\n end", "def start\n channel.prefetch(10)\n queue.subscribe(manual_ack: true, exclusive: false) do |delivery_info, metadata, payload|\n begin\n body = JSON.parse(payload).with_indifferent_access\n status = run(body)\n rescue => e\n status = :error\n end\n\n if status == :ok\n channel.ack(delivery_info.delivery_tag)\n elsif status == :retry\n channel.reject(delivery_info.delivery_tag, true)\n else # :error, nil etc\n channel.reject(delivery_info.delivery_tag, false)\n end\n end\n\n wait_for_threads\n end", "def one\n rq, answer_chan = @channel.get\n res = yield(rq)\n answer_chan.put res if answer_chan\n end", "def push &put\n #Thread.pass while self.full?\n sleep 0.01 while self.full?\n self.push! &put\n end", "def start\n Thread.new do\n loop do\n @connection.wait_for_notify do |channel|\n @actions[channel].call\n end\n end\n end\n end", "def receive\n raise \"No subscription to receive messages from\" if (@queue_names.nil? || @queue_names.empty?)\n start = @current_queue\n while true\n @current_queue = ((@current_queue < @queue_names.length-1) ? @current_queue + 1 : 0)\n sleep(@connection_options[:poll_interval]) if (@current_queue == start)\n q = @queues[@queue_names[@current_queue]]\n unless q.nil?\n message = retrieve_message(q)\n return message unless message.nil?\n end\n end\n end", "def fetch(length)\n # This callback should be set just once, yielding with the parsed message\n @driver.on(:message) { |msg| yield(msg.data.pack('C*')) } if @driver.listeners(:message).length.zero?\n\n data = @sock.read_nonblock(length) # Read from the socket\n @driver.parse(data) # Parse the incoming data, run the callback from above\n end", "def get_channels\n\n\t\t#should return json of the first page of channels as a set of objects\n\t\ti = 1\n\t\tdone = false\n\t\tnew_channels = []\n\n\t\tuntil done do\n\t\t\t# get the first page of data, because we always need that\n\t\t\tcurrent_page = @salsify.get('channels', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t:page => i,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t:per_page => \"50\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t})\n\n\t\t\t#determine the total number of pages\n\t\t\ttotal_pages = @salsify.get_total_pages(current_page)\n\t\t\tputs \"we have #{total_pages} total pages to get through\"\n\n\t\t\t#store the channels on this page\n\t\t\tnew_channels += channels_to_objects(current_page)\n\t\t\tputs \"completed page #{i}\"\n\n\n\t\t\t# if we have no more pages to fetch, we're done!\n\t\t\tif(i >= total_pages)\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\ti += 1\n\t\tend\n\n\t\tnew_channels\n\n\tend", "def channels\n []\n end", "def each(&block)\n return @channels.keys.each(&block)\n end", "def try_blocking_receive\n mutex.lock\n if mailbox.empty?\n mutex.unlock\n Thread.stop\n Undefined\n else\n mailbox.shift.tap do\n mutex.unlock\n end\n end\n end", "def subscribe(channel, *channels, &block); end", "def read_messages\n begin\n uri = MQ_CONFIG[\"mq_uri\"]\n conn = Bunny.new(uri)\n conn.start\n channel = conn.create_channel\n\n if MQ_CONFIG[\"digitisation\"][\"source\"].blank?\n logger.warn \"#{Time.now.to_s} WARN: No digitisation source queue defined -> Not listening\"\n return\n end\n\n source = MQ_CONFIG[\"digitisation\"][\"source\"]\n q = channel.queue(source, :durable => true)\n\n logger.debug \"q.message_count = #{q.message_count}\"\n\n unread_messages = Array.new\n\n while q.message_count > 0 do\n delivery_info, metadata, payload = q.pop\n unread_messages.push(payload)\n end\n conn.close\n logger.debug \"Returning array containing #{unread_messages.length} unread messages\"\n unread_messages\n rescue Exception => e\n logger.error \" #{e.message}\"\n logger.error e.backtrace.join(\"\\n\")\n end\n end", "def wait_action_cable_subscription\n sleep 1\n end", "def fetch_messages\n if !@worker_pool.worker_available? && @state.run?\n @worker_available.wait\n end\n return unless @worker_pool.worker_available? && @state.run?\n\n begin\n args = [self.signals_redis_key, self.queue_redis_keys.shuffle, 0].flatten\n redis_key, encoded_payload = @client.block_dequeue(*args)\n if redis_key != @signals_redis_key\n @worker_pool.push(QueueItem.new(redis_key, encoded_payload))\n end\n rescue RuntimeError => exception\n log \"Error occurred while dequeueing\", :error\n log \"#{exception.class}: #{exception.message}\", :error\n (exception.backtrace || []).each{ |l| log(l, :error) }\n sleep 1\n end\n end", "def read\n data = @handle.availableData\n return data\n end", "def monitor_thread\n Thread.new do\n begin\n while self.fd\n buff = self.fd.get_once(-1, 1.0)\n next if not buff\n store_data(buff)\n end\n rescue ::Exception => e\n self.monitor_thread_error = e\n end\n end\n end", "def get_data(row_num)\n row = @cache[row_num]\n if row.nil? \n @channel << [:get_rows, row_num, FETCH_SIZE]\n end\n row\n end", "def data_channel_message(data)\n # puts \"Message received! #{data}\"\n if !$$.host\n receiveSync(data)\n end\nend", "def recvall(timeout: nil)\n recvn(1 << 63, timeout: timeout)\n rescue ::Pwnlib::Errors::EndOfTubeError, ::Pwnlib::Errors::TimeoutError\n @buffer.get\n end", "def get_messages()\n @@log.debug \"#{self.class} get messages starts\"\n #\n eof_msg_not_received = true\n loop_count = 0\n #\n headers = {\"persistent\" => true, \"client-id\" => @client_id,\n \"ack\" => @runparms.ack}\n #\n # Do this until the EOF message is received.\n #\n while (eof_msg_not_received)\n loop_count += 1\n @@log.debug \"Client loop count: #{loop_count}\"\n #\n client = Stomp::Client.open(@runparms.userid, @runparms.password, \n @runparms.host, @runparms.port)\n @@log.debug \"next subscribe starts\"\n received = nil\n client.subscribe(@queue_name, headers ) do |message|\n #\n lmsg = \"Got Reply: ID=#{message.headers['message-id']} \"\n lmsg += \"BODY=#{message.body} \"\n lmsg += \"on QUEUE #{message.headers['destination']}\"\n @@log.debug \"#{lmsg}\"\n #\n proc_message(message)\n #\n if @runparms.ack == \"client\"\n @@log.debug \"subscribe loop, sending acknowledge\"\n client.acknowledge(message)\n end\n #\n if message.body == Runparms::EOF_MSG\n @@log.debug \"#{self.class} should be done\"\n eof_msg_not_received = false\n break\n end\n received = message\n end # end of subscribe\n @@log.debug \"#{self.class} Starting to sleep\"\n sleep 1.0 until received\n @@log.debug \"#{self.class} Ending sleep, closing client\"\n client.close()\n received = nil\n @@log.debug \"#{self.class} getter client loop ending\"\n end\n @@log.debug \"#{self.class} getter client ending\"\n end", "def get_messages()\n @@log.debug \"getter client starting, thread is: #{Thread.current}\"\n received = nil\n #\n # Note: in the subscribe loop there is actually a separate\n # thread, known as the 'callback listener'!.\n #\n count = 0\n @client.subscribe(@queue_name,\n {\"persistent\" => true, \"client-id\" => @client_id,\n \"ack\" => @ack} ) do |message|\n @@log.debug \"subscribe loop, thread is: #{Thread.current}\"\n lmsg = \"Got Reply: ID=#{message.headers['message-id']} \"\n lmsg += \"BODY=#{message.body} \"\n lmsg += \"on QUEUE #{message.headers['destination']}\"\n @@log.debug \"#{lmsg}\"\n received = message\n count += 1\n if @ack == \"client\"\n @@log.debug \"subscribe loop, sending acknowledge\"\n @client.acknowledge(received)\n end\n end\n #\n # Make sure this sleep time is sufficiently large, but only as large as\n # really required! There must be sufficient time for:\n # 1) The stomp server to dequeue all the messages in the queue\n # 2) The stomp server will then transmit these messages\n # 3) The consumer/getter (this code) then processes the messages received.\n #\n # If this is not done, this consumer/getter will appear to 'lose' messages,\n # because the main thread wakes up, sees 'received', and closes the client\n # connection prematurely.\n #\n # This anomaly is *much* more apparent with stompserver than with AMQ. It\n # appears to me that AMQ enqueues, and dequeues messages much more quickly,\n # which covers this up in many cases.\n #\n # Later note: The above paragraph may not be correct. Caution advised.\n #\n sleep 3 until received\n #\n @client.close\n @@log.debug \"getter client received count: #{count}\"\n @@log.debug \"getter client ending, thread is: #{Thread.current}\"\n end", "def consume(&block)\n @queue.consume(&block)\n end", "def batch_get_channel(body)\n # checks if all required parameters are set\n \n raise ArgumentError, 'Missing required parameter \"body\"' if body.nil?\n \n\n op = NovacastSDK::Client::Operation.new '/channels/batch_get', :POST\n\n # path parameters\n path_params = {}\n op.params = path_params\n\n # header parameters\n header_params = {}\n op.headers = header_params\n\n # query parameters\n query_params = {}\n op.query = query_params\n\n # http body (model)\n \n op.body = body.to_json\n \n\n \n # authentication requirement\n op.auths = [\n { name: 'accessKey', key: 'access_token', in_query: true }\n ]\n \n\n resp = call_api op\n\n \n NovacastSDK::EventV1::Models::ChannelList.from_json resp.body\n \n end", "def subscribe &handler\n input = \"\"\n response = 0\n #wait for message from pull socket\n while true\n response = @pull.recv_string(input)\n if !error?(response)\n input.chomp!\n\n #Message received\n yield input if block_given?\n Communicator::get_logger.info \"Message received: #{input}\"\n end\n end\n end", "def read\n return Log.warn \"[PubSub] Not started...\" unless redis\n @psthread = Thread.new do\n begin\n redis.subscribe('subduino') do |on|\n on.subscribe {|klass, num_subs| Log.info \"[PubSub] Subscribed to #{klass} (#{num_subs} subscriptions)\" }\n on.message do |klass, msg|\n Log.info \"[PubSub] #{klass} - #{msg}\"\n ArdIO.write msg\n # @redis.unsubscribe if msg == 'exit'\n end\n on.unsubscribe {|klass, num_subs| Log.info \"[PubSub] Unsubscribed to #{klass} (#{num_subs} subscriptions)\" }\n end\n rescue => e\n Log.error \"[PubSub] Error #{e}\"\n Log.error e.backtrace.join(\"\\n\")\n exit 1\n end\n\n end\n end", "def flush\n self.channel.flush\n end", "def flush\n self.channel.flush\n end", "def listen\n Thread.new do\n while true\n retrieve_messages\n sleep (0.1)\n end\n end\n end", "def each(&block)\n # If the buffer is closed, there's no reason to block the listening\n # thread, yield all the buffered chunks and return.\n queue = Queue.new\n @mutex.synchronize do\n return @previous.each(&block) if closed?\n @listeners << queue\n end\n\n # race condition: possibly duplicate messages when message comes in between adding listener and this\n @previous.each(&block)\n\n while chunk = queue.pop\n yield chunk\n end\n ensure\n @mutex.synchronize { @listeners.delete(queue) }\n end", "def each_channel(&block); end", "def thread_read(timeout)\n deadline = Time.now + timeout\n raw_last_sample = nil\n while data = raw_read_new # sync call from bg thread\n raw_last_sample = data\n event :raw_data, data\n # TODO just emit raw_data and convert it to ruby\n # if someone is listening to (see PortProxy)\n event(:data) { [Typelib.to_ruby(data)] }\n break if Time.now > deadline\n end\n raw_last_sample\n end", "def read( transfer_until: )\n\t\t\tif !@pending_read\n\t\t\t\t@pending_read = true\n\t\t\t\t@transfer_until = transfer_until\n\n\t\t\t\tFiber.schedule do\n\t\t\t\t\tconnect\n\n\t\t\t\t\tbegin\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t# 140 bytes transfer is required to trigger an error in spec \"can cancel a query\", when get_last_error doesn't wait for readability between PQgetResult calls.\n\t\t\t\t\t\t\t# TODO: Make an explicit spec for this case.\n\t\t\t\t\t\t\tread_str = @external_io.read_nonblock(140)\n\t\t\t\t\t\t\tprint_data(\"read-transfer #{read_fds}\", read_str)\n\t\t\t\t\t\t\t@internal_io.write(read_str)\n\t\t\t\t\t\trescue IO::WaitReadable, Errno::EINTR\n\t\t\t\t\t\t\t@external_io.wait_readable\n\t\t\t\t\t\t\tretry\n\t\t\t\t\t\trescue EOFError, Errno::ECONNRESET\n\t\t\t\t\t\t\tputs \"read_eof from #{read_fds}\"\n\t\t\t\t\t\t\t@internal_io.close_write\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend while @transfer_until\n\t\t\t\t\t@pending_read = false\n\t\t\t\tend\n\t\t\telsif transfer_until == :eof\n\t\t\t\t@transfer_until = transfer_until\n\t\t\tend\n\t\tend", "def channels\r\n return @chanlist\r\n end", "def pop_non_blocking\n yield pop(timeout: 0)\n rescue TimeoutError\n nil\n end", "def get_all_channels\n user_id = current_user.id\n user_channels=Chatbox.uniq.where(:user_id => user_id).pluck(:channel)\n return user_channels \n end", "def non_blocking_gets\n loop do\n result, _, _ = IO.select( [@socket], nil, nil, 0.2 )\n next unless result\n return result[0].gets\n end\n end", "def subscribe(*channels, &block); end", "def non_blocking_gets\n loop do\n result, _, _ = IO.select([@socket], nil, nil, 0.2)\n next unless result\n return result[0].gets\n end\n end", "def wait_for_message\r\n Fiber.yield while $game_message.busy?\r\n end", "def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end", "def read_stream(stream_id)\n data_cb = @stream_callbacks[stream_id]\n\n while true\n data = nil\n begin\n data = @native_channel.read_ex(stream_id, 1000)\n rescue Native::Error::ERROR_EAGAIN\n # When we get an EAGAIN then we're done. Return.\n return\n end\n\n # If we got nil as a return value then there is no more data\n # to read.\n return if data.nil?\n\n # Callback if we have data to send and we have a callback\n data_cb.call(data) if data_cb\n end\n end", "def run\n channels.map { |channel| channel.start }\n end", "def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end", "def wait_all_sent\n verify_not_closed\n @clients.each do |pub|\n pub.wait_all_sent\n end\n end", "def send_and_get_data data\n send_data data\n get_data_with_timeout data.size\n end", "def dequeue\n synchronize do\n @cond.wait_until{ @array.size > 0 }\n @array.shift\n end\n end", "def read_all(into_buffer)\n while (read_bytes(4096, into_buffer))\n # work is in the loop condition.\n end\n return into_buffer\n end", "def get(id)\n\t\t\tkparams = {}\n\t\t\t# Live channel id\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('livechannel', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def receive\n Rubinius.primitive :channel_receive\n raise PrimitiveFailure, \"Channel#receive primitive failed\"\n end", "def channels\r\n return for_context(nil, false) { |c| c.channels }\r\n end", "def receive_data(data)\n log \"<< #{data.size}\"\n @write_to_channel << data\n end", "def subscribed\n stream_from channel_name\n end", "def index\n @channels = Channel.where(:user_id => current_user.id).to_a\n end", "def get_messages()\n @@log.debug(\"get_messages starts\")\n subscribe\n StompHelper::pause(\"After subscribe\") if $DEBUG\n for msgnum in (0..@max_msgs-1) do\n message = @conn.receive\n @@log.debug(\"Received: #{message}\")\n if @ack == \"client\"\n @@log.debug(\"in receive, sending ACK, headers: #{message.headers.inspect}\")\n message_id = message.headers[\"message-id\"]\n @@log.debug(\"in receive, sending ACK, message-id: #{message_id}\")\n @conn.ack(message_id) # ACK this message\n end\n StompHelper::pause(\"After first receive\") if (msgnum == 0 and $DEBUG)\n #\n received = message\n end\n end", "def pull\n begin\n @map = read_data\n rescue LockMethod::Locked\n sleep 0.5\n pull\n end\n end", "def channels \n debug [query[\"channels\"], \" are registered channels\"]\n @channels ||= query[\"channels\"].collect(&:strip).reject(&:empty?) \n @channels[0] ||= nil # Every user should have at last one channel\n @channels\n end", "def get(*key)\n synchronize do\n val = @data.get(*key)\n return val if !val.nil?\n val = new_cond\n set(*key, val)\n val.wait\n @data.get(*key)\n end\n end", "def consumer_thread\n return unless consumer\n thread = Thread.new do\n consumer.each do |m| \n i = RequestReport.new(m.rack_id, m.json)\n item_received i\n end\n end\n thread.abort_on_exception = true\n end", "def wait(future,timeout=nil)\n return future.data if future.done? # future was waited before\n # we can have more fine grained synchronization later.\n ## easiest thing to do (later) is use threadsafe hash for @futures and @ready.\n ### But it's actually trickier than\n ### that. Before each @buffer.pop, a thread\n ### has to check again if it sees the result\n ### in @ready.\n self.synchronize do\n timer = nil\n if timeout\n timer = EM.add_timer(timeout) {\n @buffer << [:timeout,future.message_id]\n }\n end\n ready_future = nil\n if @ready.has_key? future.message_id\n @ready.delete future.message_id\n ready_future = future\n else\n while true\n header,payload = @buffer.pop # synchronize. like erlang's mailbox select.\n if header == :timeout # timeout the future we are waiting for.\n message_id = payload\n # if we got a timeout from previous wait. throw it away.\n next if future.message_id != message_id \n future.timeout = true\n future.done!\n @futures.delete future.message_id\n return yield # return the value of timeout block\n end\n data = payload[\"data\"]\n some_future = @futures[header.message_id]\n # If we didn't find the future among the\n # future, it must have timedout. Just\n # throw result away and keep processing.\n next unless some_future\n some_future.timeout = false\n some_future.header = header\n some_future.data = data\n some_future.method = payload[\"method\"]\n some_future.meta = payload[\"meta\"]\n if some_future == future\n # The future we are waiting for\n EM.cancel_timer(timer) if timer\n ready_future = future\n break\n else\n # Ready, but we are not waiting for it. Save for later.\n @ready[some_future.message_id] = some_future\n end\n end\n end\n ready_future.done!\n @futures.delete ready_future.message_id\n return ready_future.data\n end\n \n end", "def process_queue\n puts \"Waiting for new messages\"\n th = Thread.new do\n Thread.current.abort_on_exception = true\n loop do\n # This will sit around and wait forever.\n key, raw_msg = @redis_client.blpop(@redis_in_key, 0)\n json_msg = Crack::JSON.parse(raw_msg)\n # Send back a random quote\n random_quote = @quotes[rand(@quotes.size)]\n out_msg = {:from => json_msg['from'], :body => random_quote}.to_json\n # Pusing onto the \"out\" list queues up something for the listener to process\n @redis_client.lpush(@redis_out_key, out_msg)\n end\n end \n end", "def part_all()\n @channels.clear()\n end", "def search_channel\n channel = Channel.where(name: params[:name])\n channel.empty? ? Channel.all : channel\n end", "def getChannelsList\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n result = HTTParty.get(broker_url + \"/resources/channels\", :verify => false)\n temp2 = JSON.parse(result.body)\n\n channels_data = temp2[\"resource_response\"][\"resources\"]\n return channels_data\n \n end", "def wait\n\t\t\t\[email protected]\n\t\t\tend", "def data_channel_open\n puts \"Data channel open!\"\n data_channel = $$.data_channel\n # send_message(\"ALIVE\")\nend", "def receive_data(data)\n @write_to_channel << data\n end", "def loop( &block )\n block ||= proc do \n channels = @channel_map.reject {|k,v| v.type == '[email protected]' }\n not channels.empty?\n end\n process while block.call\n end", "def subscribe_to_channel; end", "def pop(non_block=false)\n @mutex.synchronize{\n while true\n if @que.empty?\n raise ThreadError, \"queue empty\" if non_block\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @que.shift\n end\n end\n }\n end", "def on_eof( channel )\n end", "def wait\n @future.value\n end", "def background_read\n @log.debug \"Background read start\"\n begin\n while true\n dat = @socket_srv.gets\n if dat.nil?\n @log.debug \"data nil, terminate read\"\n break\n elsif dat.empty?\n @log.debug \"data empty, try to continue\"\n next\n end \n @log.debug \"<server> #{dat.chomp}\" if @server_msg_aredebugged\n parse_server_message(dat)\n end\n rescue\n @log.warn \"socket read end: (#{$!})\"\n ensure\n @log.debug \"Background read terminated\"\n @socket_srv = nil\n @model_net_data.event_cupe_raised(:ev_client_disconnected)\n end\n end", "def dispatch\n @queue.pop.run while @queue.ready?\n end", "def get_array\n\t\tsynchronize do\n\t\t\[email protected]_until{@array.size > 0}\n\t\t\ta = @array\n\t\t\t@array = []\n\t\t\treturn a\n\t\tend\n\tend", "def index\r\n @channels = current_user.channels.all\r\n end", "def subscribe\n conn = @cluster.connect\n conn.subscribe(ALL)\n conn.subscribe(SHARE)\n conn.subscribe(@channel)\n conn.on(:message) do |channel, message|\n @messages.push([channel, message])\n end\n end", "def get(opts={})\n while @work_queue.size > 0\n @work_queue.try_work\n end\n \n check_connection_state\n\n @connection.read(@serializer)\n rescue Errno::ECONNRESET, EOFError\n # Connection reset by peer\n raise ConnectionLost\n end", "def list_all_channels(channel_name)\n uri = create_api_uri(@@base_uri, channel_name, 'listAllChannles')\n return get(uri)\n end" ]
[ "0.6297687", "0.6189377", "0.59583265", "0.5733964", "0.5612976", "0.5543242", "0.5538771", "0.54548746", "0.5432199", "0.5362863", "0.5339628", "0.5319087", "0.5305985", "0.5293969", "0.5267787", "0.5264247", "0.5242485", "0.52250355", "0.51778543", "0.51728153", "0.5123976", "0.51221985", "0.5121642", "0.51143926", "0.510745", "0.51058686", "0.5104425", "0.509606", "0.5075197", "0.50734687", "0.505813", "0.50553256", "0.5054423", "0.5052818", "0.505005", "0.5044134", "0.50421506", "0.50420463", "0.5035482", "0.50327295", "0.5028018", "0.50278574", "0.5017679", "0.501534", "0.50084156", "0.49993628", "0.49936026", "0.4992751", "0.49892026", "0.49892026", "0.49869186", "0.4980706", "0.49798438", "0.49678558", "0.49615887", "0.4956119", "0.49548548", "0.4946351", "0.4941071", "0.49344316", "0.49268627", "0.49184567", "0.49111137", "0.4904853", "0.49042234", "0.49023122", "0.49008712", "0.48970112", "0.4893958", "0.4885264", "0.48745266", "0.48714232", "0.4866625", "0.48647407", "0.48635226", "0.48608714", "0.4860813", "0.4858741", "0.4856676", "0.48559558", "0.48509786", "0.48485678", "0.48461244", "0.48450938", "0.4838965", "0.48322788", "0.4831614", "0.48289785", "0.4827736", "0.48184273", "0.48180398", "0.48141113", "0.48127574", "0.4812473", "0.4797814", "0.47955608", "0.47946295", "0.47886503", "0.47885892", "0.47885317", "0.47867814" ]
0.0
-1
Redirect signal to other channel
def redirect_to(channel, callback_method=nil, *args) value = self.pop value.send(callback_method, *args) if callback_method yield value if block_given? channel << value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal\n end", "def signal; end", "def signal; end", "def signal\r\n Ragweed::Wrap32::set_event(@h)\r\n end", "def signal(signum = nil)\n handle = Signal.new(@reactor)\n handle.progress &Proc.new if block_given?\n handle.start(signum) if signum\n handle\n end", "def signal\n @sender << PAYLOAD\n nil\n rescue IOError, Errno::EPIPE, Errno::EBADF\n raise DeadWakerError, \"waker is already dead\"\n end", "def signal_received=(_arg0); end", "def signal_received; end", "def signal(value)\n @sinkg.signal(@sinkp,value)\n end", "def send(v)\n self.signal(0,v)\n end", "def signal\n\t\t\t\twrapper = Async::IO::Generic.new(@output)\n\t\t\t\twrapper.write(\".\")\n\t\t\tensure\n\t\t\t\twrapper.reactor = nil\n\t\t\tend", "def signal!(message, dest, opts = {})\n GLogger.error('Signal cannot have a callback. Ignoring!') if block_given?\n publish(message, slot_destination(dest), opts)\n end", "def signal\n @cmd_result.signal\n end", "def send_signal( sig, want_reply=false )\n send_request_string \"signal\", sig, want_reply\n self\n end", "def doge_control_signal\r\n end", "def signal\n @result.signal\n end", "def isolate_signals; end", "def signal\n @condition.signal\n true\n end", "def signal\n @condition.signal\n true\n end", "def trap_signal(signal)\n trap(signal) do\n notice_signal(signal)\n (@callbacks[signal] || []).each(&:call)\n end\n end", "def isolate_signals=(_arg0); end", "def route_signal(*args, deliver_on: nil)\n if MiqEnvironment::Command.is_podified?\n signal(*args)\n else\n queue_signal(*args, :deliver_on => deliver_on)\n end\n end", "def subscribe_to_channel(*)\n synchronize_entrypoint! { super }\n end", "def signal(name)\n send_command(:signal, name)\n read_reply\n end", "def signal(signal = 'TERM')\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:signal]}=#{signal}\"\n self\n end", "def to_channel\n self\n end", "def signal(signum = nil, callback = nil, &block)\n callback ||= block\n handle = Signal.new(@loop)\n handle.progress callback if callback\n handle.start(signum) if signum\n handle\n end", "def signal_queue; end", "def turn_signal(turn)\n if turn == \"left\"\n @signal = \"left\"\n elsif turn == \"right\"\n @signal = \"right\"\n else\n @signal = \"off\"\n end\n end", "def signal=(new_signal)\n disable_trap\n @signal = new_signal\n enable_trap\n end", "def subscribe_to_channel; end", "def disconnect!\n super\n ensure\n if (restart = @restart)\n @restart = nil\n restart.signal\n end\n end", "def notice_signal\n @selfpipe[:writer].write_nonblock( '.' )\n rescue Errno::EAGAIN\n # Ignore writes that would block\n rescue Errno::EINTR\n # Retry if another signal arrived while writing\n retry\n end", "def supervise\n HANDLED_SIGNALS.each { |signal| trap_signal(signal) }\n end", "def signal_child(signal, child)\n log \"Sending #{signal} signal to child #{child}\"\n Process.kill(signal, child)\n end", "def channelBack\n\t\tswap(@currentChannel, @previousChannel)\n\t\tlogStatus @previousChannel, @currentChannel\n\tend", "def subscribed\n \t#stream_from 'demo_chan'\n end", "def signal(s)\n msg = \"signal\"\n if s == \"SIGHUP\" || s == \"SIGTERM\" || s == \"SIGUSR1\" || s == \"SIGUSR2\"\n msg.concat(\" #{s}\")\n @sock.cmd(\"String\" => msg , \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n else\n puts \"openVPNServer Signal Error (Supported: SIGHUP, SIGTERM, SIGUSR1, SIGUSR2)\"\n end\n end", "def to_wires_event; self; end", "def signal_child(signal, child)\n logger.debug \"Sending #{signal} signal to child #{child}\"\n Process.kill(signal, child)\n end", "def on_trap &block\n @socket.callbacks << block\n end", "def forward_signals_to(pid, signals = %w[INT])\n # Set up signal handlers\n logger.debug \"Setting up signal handlers for #{signals.inspect}\"\n signal_count = 0\n signals.each do |signal|\n Signal.trap(signal) do\n Process.kill signal, pid rescue nil\n\n # If this is the second time we've received and forwarded\n # on the signal, make sure next time we just give up.\n reset_handlers_for signals if ++signal_count >= 2\n end\n end\n\n # Run the block now that the signals are being forwarded\n yield\n ensure\n # Always good to make sure we clean up after ourselves\n reset_handlers_for signals\n end", "def arm_signal(target, event, *args)\n target.arm_container.signal(self, event, args)\n arm_publish(event, *args)\n self\n end", "def trap(signal, &block)\n if Signal.list.include?(signal)\n Kernel.trap(signal, &block) unless Merb.disabled?(:signals)\n end\n end", "def signal\n @monitor.mon_check_owner\n @cond.signal\n end", "def handle_signal( signal )\n\t\tself.log.info \"Handling %p signal.\" % [ signal ]\n\t\tcase signal\n\t\twhen :INT, :TERM, :HUP\n\t\t\tself.stop\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend", "def shutdown\n @signal_squash.call\n end", "def signal_queue=(_arg0); end", "def broadcast\n end", "def on_confirm( channel )\n @channel = channel\n\n @channel.on_confirm_failed( &method( :on_confirm_failed ) )\n @channel.on_close( &method( :on_close ) )\n @channel.on_data( &method( :on_data ) )\n @channel.on_eof( &method( :on_eof ) )\n @channel.on_extended_data( &method( :on_extended_data ) )\n @channel.on_request( &method( :on_request ) )\n @channel.on_failure( &method( :on_failure ) )\n @channel.on_success( &method( :on_success ) )\n\n @pty_opts ? request_pty : request_shell\n end", "def on_data( channel, data )\n @stdout << data if @state == :open\n end", "def handle_old_mode\n disable_trap if @mode == Modes::SIGNAL\n end", "def write_to_channel()\n store_button()\n sleep(0.5)\n store_button()\n sleep(0.5)\nend", "def channel_aftertouch( channel, pressure )\n message( CA | channel, pressure )\n end", "def signal(queue='default')\n self.signaller ||= if config.signaller && config.signaller[:connect]\n signaller = JobDispatch::Signaller.new(config.signaller[:connect])\n signaller.connect\n signaller\n else\n Null::Object.instance\n end\n self.signaller.signal(queue)\n end", "def signal_connect(signal, &block)\n __internal_signal_connect(widget, signal, &block)\n end", "def on_close( channel )\n @state = :closed\n end", "def sigHandler\n Signal.trap(\"INT\") { stop }\n Signal.trap(\"TERM\") { stop }\n end", "def notify\n socket.write('x')\n end", "def setup_signal_traps\n @signal_pipe_r, @signal_pipe_w = IO.pipe\n\n %w(TERM USR1).each do |signal_name|\n trap(signal_name) do\n @signal_pipe_w.puts(signal_name)\n end\n end\n @signal_pipe_r\n end", "def send_signal(signal)\n pid = File.read(Config::PID_FILE).to_i\n Process.kill(signal, pid) if pid > 1\n rescue Errno::ESRCH, Errno::ENOENT # process is already dead, cleanup files\n File.delete(Config::TMUX_FILE) if File.exists?(Config::TMUX_FILE)\n File.delete(Config::PID_FILE) if File.exists?(Config::PID_FILE)\n ensure\n true\n end", "def interrupt_handler\n signal_handler(2)\n end", "def trap_signals(signal_hash, write_end)\n Signal.reset\n\n signal_hash.each do |sig_num, signal|\n Signal.trap(signal) do\n write_end.write(sig_num)\n end\n end\n end", "def handle_signal(signal)\n case signal.chop #remove new line in the end\n when SIGNALS[:close] #when user going to close the console\n close_console\n when SIGNALS[:clear] #when user going to clear eval stack\n Console.clear_eval\n :continue\n end\n end", "def handle_signal(signal)\n case signal.chop #remove new line in the end\n when SIGNALS[:close] #when user going to close the console\n close_console\n when SIGNALS[:clear] #when user going to clear eval stack\n Console.clear_eval\n :continue\n end\n end", "def close!(reason)\n @session.chanserv.close(self.name, :on, reason)\n end", "def signal event\n# $stderr.puts \"SIGNAL: #{event} on #{self}\"\n @signalled_actions ||= {}\n @signalled_actions[event] = true\n \n @deferred_actions ||= {}\n \n actions = @deferred_actions[event]\n\n case actions\n\n when :done\n $stderr.puts \"Signalled #{event} again.\"\n\n when nil\n $stderr.puts \"No actions for event '#{event}'\"\n\n else\n until actions.empty?\n actions.shift.call\n end\n end\n\n @deferred_actions[event] = :done\n\n# $stderr.puts \"SIGNAL: #{event} on #{self} --- DONE\"\n return nil\n end", "def signal(port, val)\n # The derived class needs to implement the value method.\n self.activate\n @inputs[port] = val\n newval = self.value\n if newval != @outval then\n @outval = newval\n @outputs.each { | c | c.signal(newval) }\n end\n self.deactivate\n end", "def setup_signal_traps\n @signal_pipe_r, @signal_pipe_w = IO.pipe\n\n %w(TERM USR1).each do |signal_name|\n trap(signal_name) do\n @signal_pipe_w.puts(signal_name)\n end\n end\n end", "def trap_signals\n # kill\n trap('INT') do\n puts('INT received')\n notify_subscribers('INT received')\n stop\n end\n\n # kill\n trap('TERM') do\n puts('TERM received')\n notify_subscribers('TERM received')\n stop\n end\n\n # graceful\n trap('QUIT') do\n puts('QUIT received')\n notify_subscribers('QUIT received')\n stop_soft\n end\n\n # reset things\n trap('HUP') do\n puts('HUP received')\n notify_subscribers('HUP received')\n reset\n end\n end", "def prepare_client(client, channel, type)\n client.extend(Net::SSH::BufferedIo)\n client.extend(Net::SSH::ForwardedBufferedIo)\n client.logger = logger\n\n session.listen_to(client)\n channel[:socket] = client\n\n channel.on_data do |ch, data|\n debug { \"data:#{data.length} on #{type} forwarded channel\" }\n ch[:socket].enqueue(data)\n end\n\n channel.on_eof do |ch|\n debug { \"eof #{type} on #{type} forwarded channel\" }\n begin\n ch[:socket].send_pending\n ch[:socket].shutdown Socket::SHUT_WR\n rescue IOError => e\n if e.message =~ /closed/ then\n debug { \"epipe in on_eof => shallowing exception:#{e}\" }\n else\n raise\n end\n rescue Errno::EPIPE => e\n debug { \"epipe in on_eof => shallowing exception:#{e}\" }\n rescue Errno::ENOTCONN => e\n debug { \"enotconn in on_eof => shallowing exception:#{e}\" }\n end\n end\n\n channel.on_close do |ch|\n debug { \"closing #{type} forwarded channel\" }\n ch[:socket].close if !client.closed?\n session.stop_listening_to(ch[:socket])\n end\n\n channel.on_process do |ch|\n if ch[:socket].closed?\n ch.info { \"#{type} forwarded connection closed\" }\n ch.close\n elsif ch[:socket].available > 0\n data = ch[:socket].read_available(8192)\n ch.debug { \"read #{data.length} bytes from client, sending over #{type} forwarded connection\" }\n ch.send_data(data)\n end\n end\n end", "def arm_emit(event, *args)\n return self if @container.nil? || @container.empty?\n @container.signal(self, event, args)\n self\n end", "def send!\n @_sended = true\n self\n end", "def on_int_signal(&block)\n # trap(:INT)\n warn \"Missing implementation 'on_int_signal'\"\n end", "def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end", "def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end", "def signal?\n @signal\n end", "def emit(signal, *args)\n @listenable ||= {}\n @listenable[signal] ||= []\n @listenable[signal].each { |m| call( m, signal, args ) }\n @listenable[:__all] ||= []\n @listenable[:__all].each { |m| call( m, signal, [signal, *args] ) }\n end", "def stop_broadcast_subscribe\n # The only object for this is clean the clients buffer\n # anything that we send for the channel will send the sign\n Helpers.redis.subscribe('stop-broadcast') do |on|\n on.message do\n begin\n Helpers.log 'Stopping Broadcast'\n\n # send_signal_to_stop_brodcast!\n force_stop_broadcast!\n rescue => e\n Helpers.error 'Stopping Broadcast', e\n end\n end\n end\n end", "def disconnect\r\n\t\[email protected] \"OUT\\r\\n\"\r\n\t\[email protected]\r\n\tend", "def send_others(event, data)\n\t\tEM.next_tick {\n\t\t\[email protected] do |s|\n\t\t\t\ts.send(event, data) if s != self\n\t\t\tend\n\t\t}\n\tend", "def unsubscribe_from_channel; end", "def signal_on(bool, side)\n if bool == true\n if side == \"right\"\n @r_signal = true\n else\n @l_signal = true\n end\n else\n @l_signal = false\n @r_signal = false\n end\n end", "def send_signal(signal, pid_file)\r\n pid = open(pid_file).read.to_i\r\n print \"Send signal #{signal} to AP4R at PID #{pid} ...\"\r\n begin\r\n Process.kill(signal, pid)\r\n rescue Errno::ESRCH\r\n puts \"Process not found.\"\r\n end\r\n puts \"Done.\"\r\n end", "def term_signal\n @options['term_signal'] || 'TERM'\n end", "def fake_sig(sig) # :nodoc:\n old_cb = trap(sig, \"IGNORE\")\n old_cb.call\n ensure\n trap(sig, old_cb)\n end", "def signal_stop\n @stop_requested = true\n end", "def signal\n @device = Device.find(params[:id])\n signal = params.fetch(:signal, 'TERM')\n pid = @device.pid\n\n if signal && pid\n begin\n Process.kill(signal, pid)\n @signalled = { :signal => signal, :pid => pid }\n rescue StandardError => e\n @signalled = { :error => \"Exception: #{e}\" }\n end\n else\n @signalled = { :error => 'Invalid arguments' }\n end\n\n render json: @signalled\n end", "def register_signals\n trap(:INT) { debug \"Recieved INT\"; exit!}\n end", "def signal!(signal, pidfile)\n PidFile.with_pid(pidfile) { |pid| Process.kill(signal, pid) }\n end", "def talkback(server,msg)\n @connector.write(server,msg,true,\n Connector::WRITE_PRIORITY_NONE)\n end", "def channel(val = nil)\n val.nil? ? @state.channel : @state.channel = val\n end", "def trap_signals\n %w(TERM INT).each do |signal|\n trap(signal) { stop }\n end\n end", "def io\n @receiver\n end", "def connect(v)\n port = @inputs.length\n @inputs.push(v)\n c = LinkHandle.new(self, port)\n self.signal(port, v)\n return c\n end", "def handle_interrupt; end", "def signal_stop!\n return unless @thread\n @mutex.synchronize do\n @stop = true\n @cv.broadcast\n end\n end", "def trap_signals\n Signal.trap('INT') do\n say \"\\nQuitting...\", :red\n Kernel.exit\n end\n end", "def event_incoming_client_control(client, peer, cmd, *args)\nend", "def initialize\n @signal = \"\"\n end" ]
[ "0.64359486", "0.6214351", "0.6214351", "0.61760473", "0.60680985", "0.6060385", "0.6035328", "0.6030367", "0.5937584", "0.58149874", "0.5784314", "0.5764498", "0.5740301", "0.5619997", "0.55660635", "0.54933643", "0.5459661", "0.5426095", "0.5426095", "0.53841525", "0.5382353", "0.5333869", "0.53260624", "0.5321053", "0.5317842", "0.53122306", "0.5285361", "0.5276543", "0.5275656", "0.5268138", "0.52563494", "0.5253551", "0.52470195", "0.52322596", "0.52164155", "0.5206877", "0.5204157", "0.51975733", "0.5187191", "0.51779425", "0.5162861", "0.5148239", "0.5146847", "0.51285565", "0.51237965", "0.51167053", "0.5063393", "0.5060369", "0.50527215", "0.5022402", "0.50131285", "0.50126207", "0.501241", "0.50100046", "0.5009738", "0.5007136", "0.5005482", "0.49785453", "0.49690026", "0.49682486", "0.49620768", "0.49601376", "0.4959594", "0.49390247", "0.49390247", "0.4921176", "0.49047405", "0.4899868", "0.48960623", "0.48941624", "0.48892367", "0.48804507", "0.48803172", "0.48761135", "0.4867536", "0.4867536", "0.48623234", "0.4862081", "0.4860126", "0.48596668", "0.4850749", "0.4847424", "0.48464796", "0.48341426", "0.48298377", "0.4827926", "0.48244488", "0.48209473", "0.4809752", "0.48015916", "0.47905344", "0.47854188", "0.47831684", "0.47809485", "0.47784534", "0.4774287", "0.47623965", "0.47570655", "0.47547224", "0.47543073" ]
0.5146787
43
Returns +true+ if the channel is empty.
def empty? @queue.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end", "def empty?\r\n @pack.empty?\r\n end", "def empty?\n @buffer.empty? && stream_is_done?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @buffers.values.all?(&:empty?)\n end", "def empty?\n @queue.empty?\n end", "def is_empty()\n @queue.size == 0\n end", "def empty?\n size.zero?\n end", "def empty?\n @lock.synchronize { @used.size == 0 && @available.size == 0 }\n end", "def empty?\n length.zero?\n end", "def empty?\n @size == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n self.queue_size == 0\n end", "def empty?\n @queue.empty?\n end", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def empty?\n @queued.empty?\n end", "def empty?\n size.zero?\n end", "def empty?\n size == 0\n end", "def empty?\n size == 0\n end", "def empty?\n size == 0\n end", "def is_empty()\n @queue.count { _1 } == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n return @size == 0\n end", "def empty?()\n return @length == 0\n end", "def empty?\n count == 0\n end", "def empty?\n count == 0\n end", "def empty?\n self.count == 0\n end", "def empty?\n self.count == 0\n end", "def empty?\n @is_empty\n end", "def empty?\n\t\[email protected]?\n\tend", "def empty?\n length == 0\n end", "def empty?\n length == 0\n end", "def empty?\n length == 0\n end", "def empty?\n size == 0\n end", "def empty?\n @mutex.synchronize { @value == EMPTY }\n end", "def empty?\n @size == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n count == 0\n end", "def empty?\n count.zero?\n end", "def empty?\n count.zero?\n end", "def empty?\n count.zero?\n end", "def empty?\n return false\n end", "def empty?\n true\n end", "def empty?\n true\n end", "def empty?\n\t\t\tsize == 0\n\t\tend", "def empty?\r\n @length == 0\r\n end", "def empty?\n @size.zero?\n end", "def empty?\n @length == 0\n end", "def empty?\r\n @length == 0\r\n end", "def empty?\r\n @length == 0\r\n end", "def empty?\r\n @length == 0\r\n end", "def empty?\r\n @length == 0\r\n end", "def empty?\n count <= 0\n end", "def empty()\n @queue.size == 0\n end", "def empty?\n size == 0 # Equivalent to (down == self)\n end", "def empty?\n\t\treturn size.zero?\n\tend", "def empty?\n size == 0\n end", "def empty?\n size == 0\n end", "def empty?\n # raise NotImplementedError, \"Not yet implemented\"\n if size > 0\n return false\n end\n return true\n end", "def empty?\n @length == 0\n end", "def empty?\n @count == 0\n end", "def empty?\n @count == 0\n end", "def empty?\n @count == 0\n end", "def empty?\n @count == 0\n end", "def empty?\n self.length == 0\n end", "def empty?\n return self.length == 0\n end", "def empty?\n cardinality == 0\n end", "def is_empty?\n size == 0\n end", "def empty?\n length == 0\n end", "def empty?\n\t\t\[email protected] == 0\n\t\tend", "def empty?\n @type == EMPTY_TYPE\n end", "def is_empty()\n if @length == 0\n true\n else\n false\n end\n end", "def empty?()\n return true if @state == RedXmlResource::STATE_EMPTY\n return false\n end", "def empty?\n if !block_given?\n return @j_del.java_method(:isEmpty, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling empty?()\"\n end", "def empty?\n false\n end", "def empty?\n # Funnily enough, an empty list does *not* make a port empty!\n return false if @structure.instance_of? Array\n @structure.empty?\n end", "def empty?\n @items.count == 0\n end", "def empty?\n none? { true }\n end", "def empty?\n @data.empty?\n end", "def empty?\n @data.empty?\n end", "def empty()\n @queue.empty?\n end", "def empty?\n empty\n end", "def empty()\n return true if @head.nil?\n false\n end", "def empty?\n group.empty?\n end", "def empty?\n # @head and @tail are equal to what they were when the Queue was created\n @head == -1 and @tail == 0\n end", "def empty?\n storage.empty?\n end", "def empty?\n storage.empty?\n end", "def empty?\n count.zero?\n end", "def empty?\n @messages.empty?\n end", "def empty?\n return @fill_count == 0\n end", "def empty?\n\t\t@length == 0\n\tend", "def empty?\n @clients.empty?\n end", "def empty?\n head.data.nil?\n end", "def empty?\n @messages.empty?\n end" ]
[ "0.7453392", "0.7448348", "0.7414016", "0.7358403", "0.7333751", "0.7321187", "0.7308399", "0.7301382", "0.7269911", "0.72513944", "0.7245973", "0.7245973", "0.72450405", "0.72348857", "0.72291565", "0.72291565", "0.72291565", "0.72291565", "0.72275406", "0.72266054", "0.7214139", "0.7214139", "0.7214139", "0.7197671", "0.71893424", "0.71893424", "0.7184874", "0.7184518", "0.71720266", "0.71720266", "0.716926", "0.716926", "0.71672875", "0.71648586", "0.7162589", "0.7162589", "0.7162589", "0.7152159", "0.7140623", "0.71305734", "0.71305734", "0.7129444", "0.7126597", "0.7126597", "0.7126597", "0.7115962", "0.7114329", "0.7114329", "0.7103118", "0.7097576", "0.70963335", "0.70955753", "0.70755994", "0.70755994", "0.70755994", "0.70755994", "0.7069215", "0.7049596", "0.70493025", "0.7048331", "0.7032494", "0.7032494", "0.7029876", "0.7021305", "0.70207924", "0.70207924", "0.70207924", "0.70207924", "0.701888", "0.7009867", "0.6994966", "0.6993189", "0.6969745", "0.6961461", "0.6955977", "0.6953436", "0.69521356", "0.6938259", "0.69303447", "0.6921493", "0.690931", "0.68958056", "0.6879152", "0.6879152", "0.6876101", "0.68655115", "0.6860253", "0.68586165", "0.6845802", "0.6844055", "0.6844055", "0.68401295", "0.6831407", "0.6825749", "0.6823189", "0.68218964", "0.6821798", "0.68213445" ]
0.73459053
5
Removes all objects from the channel.
def clear @queue.clear end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part_all()\n @channels.clear()\n end", "def delete_all\n @objects.each do |o|\n o.delete \n end\n\n @objects.clear\n end", "def clear\n channels = @channels.dup\n @channels.clear\n channels\n end", "def remove_all\n @registry = []\n sync\n end", "def disconnect_all\n @connections.clear\n @readers.clear\n end", "def remove_all()\n @items.clear()\n end", "def reset_all_channels\n @channels = {}\n end", "def remove_all(*classes)\n # Delete by query not supported by queue, so send to server\n session.remove_all(*classes)\n end", "def remove_all!(*classes)\n # Delete by query not supported by queue, so send to server\n session.remove_all!(*classes)\n end", "def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end", "def remove_all\n @owner.transaction do\n self.each { |obj| @owner.send(@remove_proc, obj) }\n end\n @members.clear\n @loaded = false # gmosx: IS this needed?\n end", "def clear()\n @mutex.synchronize {\n each_object &destroy_block\n @idle_list = []\n @active_list = {}\n }\n end", "def remove(*objects, &block)\n if block\n # Delete by query not supported by queue, so send to server\n session.remove(*objects, &block)\n else\n objects.flatten.each do |object|\n client.remove(object)\n end\n end\n end", "def destroy_all\n all.each(&:destroy)\n end", "def destroy_all\n all.each(&:destroy)\n end", "def destroy_all\r\n Message.destroy_all(channel: @channel)\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel), notice: 'Chat erfolgreich geleert.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def clear_objects\n @scene_objects.each_key do |key|\n @scene_objects[key].remove\n @scene_objects.delete(key)\n end\n @collider.remove_all\n end", "def destroy_all\n each(&:destroy_all)\n end", "def clear\n connections.synchronize do\n connections.map(&:last).each(&closer)\n connections.clear\n end\n end", "def delete_all\n @owner.transaction do\n self.each { |obj| obj.delete }\n end\n @members.clear\n end", "def destroy_all\n proxy_target.each { |object| object.destroy }\n end", "def clear\n @object_id_to_object.clear\n registered_exceptions.clear\n manager.clear\n end", "def disconnect_all\n @cache.values.map(&:clear_all_connections!)\n end", "def destroy_all\n all.each do |n|\n n.destroy\n end\n end", "def delete_observers\n @sub_lock.synchronize { subscribers.delete channel }\n end", "def delete_all\n target.clear\n end", "def destroy_all(conditions = nil)\n find_all(conditions).each { |object| object.destroy }\n end", "def destroy_all\n repositories.each {|name, repo| repo.destroy}\n end", "def clear() \n @obj.clear() \n end", "def clear_all\n clear_temporary\n clear_objects\n Window.clear\n end", "def remove!(*objects, &block)\n if block\n # Delete by query not supported by queue, so send to server\n session.remove!(*objects, &block)\n else\n remove(*objects)\n end\n end", "def delete_all_connections!\n @connections.each { |cnx| cnx.parent = nil }\n @connections = []\n end", "def clear_all_connections!\n disconnect_read_pool!\n @original_handler.clear_all_connections!\n end", "def reset\n [topics, queues, subscriptions].each do |resource|\n resource.values.each(&:delete)\n resource.clear\n end\n end", "def clear_bucket\n as_name_array.each { |object_to_delete| remove_data(object_to_delete) }\n end", "def delete_all\n start do |pop3|\n unless pop3.mails.empty?\n pop3.delete_all\n pop3.finish\n end\n end\n end", "def purge\n self.files.each do |f|\n f.destroy\n end\n self.commits.each do |c|\n c.destroy\n end\n end", "def delete_all\n self.destroy\n end", "def clear()\n shutdown()\n @flows = {}\n _clear()\n end", "def clear_all\n NotImplementedError\n end", "def remove_all_images\n self.cover_image.purge if self.cover_image.attached?\n self.images.each {|image| image.purge} if self.images.attached?\n end", "def clear\n queue.clear\n end", "def clear!\n BULK_APIS.keys\n .each { |key| redis.del(redis_key(key)) }\n end", "def delete(*objects)\n objects.each do |object|\n Hammer::Finalizer.remove(object, object_id).call(object.object_id)\n end\n objects\n end", "def clear_all\n data.delete_all\n self\n end", "def destroy_all\n klass.destroy_all(:conditions => selector)\n end", "def delete(channels)\n\treturn if not channels.is_a? Array #meh\n\tcurChannels = readCurrentChannels()\n\tcurChannels.reject! { |e| channels.include? e.downcase }\n\twriteChannels(curChannels)\nend", "def clear_all\n clear\n clear_stored_requests\n end", "def clear_all\n super\n SidekiqUniqueJobs::Digests.new.del(pattern: \"*\", count: 1_000)\n end", "def clear_queues_cache\n channel.queues.clear\n end", "def destroy_content_objects\n content_objects.map { |x| x.destroy } \n end", "def clear\n LOCK.synchronize do\n @queue.each { |_, jes| jes.each(&:close) }\n @queue.clear\n end\n end", "def clear!\n @all = Set.new\n end", "def unwatch_all\n # Remove observers for all entity types.\n @observers.each{ |observed, observer|\n observed.remove_observer(observer)\n }\n @observers.clear\n end", "def delete_all\n # delete individual objects one by one, making sure to delete all accessors as well\n returns = {}\n @_componentable_container.each do |key, val|\n delete!(key)\n returns[key] = val\n end\n returns\n end", "def clear_all_callbacks!\n disconnect!\n clear_callbacks!\n end", "def destroy_all\n ids = self.all.map{|item| item.id}\n bulk_update do\n ids.each do |item|\n find(item).destroy\n end\n end\n # Note collection is not emptied, and next_id is not reset.\n end", "def delete_all\n len = length\n while(len) do\n delete_track(0)\n len -= 1\n end\n end", "def disconnectAllUsers( msg )\n\t\[email protected] {|user|\n\t\t\[email protected]( user.socket )\n\t\t\tuser.disconnect( msg )\n\t\t}\n\t\[email protected]\n\tend", "def clear\n @topics.clear\n @consumer_groups.clear\n @data.clear\n end", "def clean_remote!\n resp = @connection.get_bucket(\n @storage.bucket, prefix: File.dirname(@remote_path)\n )\n keys = resp.body['Contents'].map {|item| item['Key'] }\n\n @connection.delete_multiple_objects(@storage.bucket, keys) unless keys.empty?\n end", "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end", "def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end", "def clear_all()\n User.destroy_all\n Hashtag.destroy_all\n Mention.destroy_all\n Tweet.destroy_all\n Follow.destroy_all\n # Hashtag_tweets.destroy_all\nend", "def clear!\n messages = [ ]\n @messages_mutex.synchronize do\n @messages.size.times do\n messages << @messages.shift(true)\n end\n end\n messages\n end", "def cleanup\n $redis.del key('chat')\n $redis.del key('messages')\n end", "def destroy_all\n ids = self.all.map{|item| item.id}\n bulk_update do\n ids.each do |item|\n find_by_id(item).destroy\n end\n end\n # Note collection is not emptied, and next_id is not reset.\n end", "def remove_all\n @jobs.each do |job|\n job.unschedule\n end\n @@instances.delete self\n end", "def clear\n\t\tmust_be_in_synchronize_block\n\t\[email protected]_value do |server|\n\t\t\tif server.started?\n\t\t\t\tserver.stop\n\t\t\tend\n\t\tend\n\t\[email protected]\n\t\t@next_cleaning_time = nil\n\tend", "def clear\n synchronize do\n @queue.clear\n end\n end", "def clear\n synchronize do\n @queue.clear\n end\n end", "def flush\n self.channel.flush\n end", "def flush\n self.channel.flush\n end", "def destroy_all\n proxy_target.each { |queue| queue.destroy }\n true\n end", "def clear_all_tags()\n puts \"Deleting Tags...\"\n Tag.delete_all()\n puts \"Finished deleting all tags.\"\nend", "def remove_all\n synchronized { @hash = {} }\n end", "def unsubscribe(*channels); end", "def delete_all\n self.store.delete_keys(find_keys)\n end", "def RemoveAll()\r\n ret = _invoke(1610743824, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def RemoveAll()\r\n ret = _invoke(1610743824, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def clear_all!\n @events = {}\n end", "def delete\n @channel_control.delete\n end", "def clear\n synchronize do\n @queue.clear\n end\n end", "def clear!\n registered_items.clear\n end", "def clear!\n registered_items.clear\n end", "def disconnect_all_users( msg )\n\t\[email protected] do |user|\n\t\t\[email protected]( user.socket )\n\t\t\tuser.disconnect( msg )\n\t\tend\n\t\[email protected]\n\tend", "def flush_deletes\n @queued_for_delete.each do |path|\n client.delete_object(path) if client.object_exists?(path)\n end\n @queue_for_delete = []\n end", "def clean_all\n self.clean(@objects.keys)\n end", "def purge_all\n initialize\n end", "def clear_watchers\n clear_all_watchers\n puts \"All watchers removed\"\n end", "def delete_free_iogroup_channels\n @iogroup = Iogroup.find(params[:iogroup_id])\n @iogroup.iogroupcomponents.each do |iogroupcomponent|\n iogroupcomponent.iochannels.each do |channel|\n channel.destroy!\n end\n end\n\n redirect_to iogroups_path, :notice => 'Freie Kanäle wurden gelöscht'\n end", "def clean\n clean_queued\n clean_running\n end", "def purge!\n redis.keys(scope + \"*\").each do |key|\n redis.del key\n end\n end", "def delete_all_reactions_unsafe(rate_limit = 0.25)\n RestClient.delete(\n \"#{Discordrb::API.api_base}/channels/#{self.channel.id}/messages/#{self.id}/reactions\",\n Authorization: @bot.token\n )\n sleep rate_limit\n end", "def delete_all_reactions_unsafe(rate_limit = 0.25)\n RestClient.delete(\n \"#{Discordrb::API.api_base}/channels/#{self.channel.id}/messages/#{self.id}/reactions\",\n Authorization: @bot.token\n )\n sleep rate_limit\n end", "def cleanup\n @channel.close if @channel\n\n nil\n end", "def delete_all\n @configuration = nil\n end", "def delete_all\n @configuration = nil\n end", "def delete_all_reactions_unsafe(rate_limit = 0.25)\r\n RestClient.delete(\r\n \"#{Discordrb::API.api_base}/channels/#{self.channel.id}/messages/#{self.id}/reactions\",\r\n Authorization: @bot.token\r\n )\r\n sleep rate_limit\r\n end", "def delete_all\n\t\t\t@@driver.delete_all\n\t\tend" ]
[ "0.73680043", "0.7194076", "0.70066684", "0.67201596", "0.67042243", "0.6634463", "0.6616158", "0.65271515", "0.65169615", "0.65155435", "0.65082675", "0.64597", "0.6392306", "0.63877296", "0.6368209", "0.63368434", "0.6332407", "0.62921876", "0.6273184", "0.6266815", "0.62538666", "0.6248195", "0.62476116", "0.62361467", "0.6235348", "0.61944884", "0.6188593", "0.61866045", "0.6184296", "0.6155317", "0.61420983", "0.61402535", "0.6107502", "0.60607266", "0.60476685", "0.60399336", "0.60372436", "0.6034425", "0.60281575", "0.60175234", "0.60124916", "0.6009333", "0.60074097", "0.60063887", "0.59963536", "0.5992257", "0.5986664", "0.5981072", "0.5980031", "0.59724075", "0.59411746", "0.59352523", "0.5929733", "0.5928205", "0.5923526", "0.59048235", "0.5896585", "0.5885679", "0.5885422", "0.58822155", "0.5879115", "0.58751196", "0.58751196", "0.5870299", "0.5870083", "0.58690256", "0.58678377", "0.5860777", "0.58544135", "0.58523077", "0.58523077", "0.5851389", "0.5851389", "0.58512557", "0.5849596", "0.58478147", "0.58467144", "0.5845945", "0.5844406", "0.5844406", "0.5844254", "0.58441", "0.5832173", "0.5828047", "0.5828047", "0.58249235", "0.58177364", "0.58099604", "0.5808918", "0.5807437", "0.5792222", "0.57914585", "0.5789018", "0.5784098", "0.5784098", "0.5783406", "0.5777216", "0.5777216", "0.5758847", "0.5758393" ]
0.5931423
52
Returns the length of the channel.
def length @queue.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channels_count\n channels.count\n end", "def length\n @redis.llen @redis_name\n end", "def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end", "def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end", "def length\n Integer(connection.write(\"get_length\", false))\n rescue ArgumentError\n 0\n end", "def length\n do_num_bytes\n end", "def length\n do_num_bytes\n end", "def length\n do_num_bytes\n end", "def length\n @length\n end", "def length\n @length\n end", "def length\n @length\n end", "def length\n @count\n end", "def len()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Run_len(@handle.ptr)\n result\n end", "def length\n @length\n end", "def get_length\n\t\tsynchronized do\n\t\t\[email protected] \"get_length\"\n\t\t\[email protected]_i\n\t\tend\n\tend", "def length\n count\n end", "def length\n size\n end", "def length\n size\n end", "def length\n sync\n io.length\n end", "def length\r\n self.count\r\n end", "def length\n @client.call('length', @name)\n end", "def length\n\t\t@length\n\tend", "def length\n value.length\n end", "def length\n @bin_data.length\n end", "def length\n MSPhysics::Newton::CurvySlider.get_length(@address)\n end", "def length\n MSPhysics::Newton::CurvySlider.get_length(@address)\n end", "def length\n event.length\n end", "def length\n return @interface.GetLength.first\n end", "def length\n return @args[:data].length\n end", "def length\n @length ||= (count.to_f / @per_chunk).ceil\n end", "def length()\n return to_s.size\n end", "def size\n return @buffer.count\n end", "def length\n end", "def length\n @config[:length]\n end", "def length\n end", "def length\n @line.length\n end", "def length\n distance(0, 0, 0)\n end", "def length\n @chars.length\n end", "def length\n to_s.length\n end", "def actual_length\n @transfer[:actual_length]\n end", "def length\n pack.length\n end", "def handLength()\n return @hand.length\n end", "def length\n length = width\n end", "def size\n @redis.llen @key\n end", "def length\n `self.length`\n end", "def length() end", "def length() end", "def length() end", "def length() end", "def length; end", "def length; end", "def length; end", "def length; end", "def length; end", "def length; end", "def length; end", "def length\n @data.length\n end", "def length\n end", "def length\n end", "def length\n end", "def length\n end", "def length\n end", "def length; return @totalFrames; end", "def length\n @duration.length\n end", "def bLength\n self[:bLength]\n end", "def length\n self.to_s.length\n end", "def size\n\t\tlengths.reduce(&:*)\n\tend", "def length\n length = 0\n each{|s| length += s.bytesize}\n length\n end", "def length \n io_index.length\n end", "def length; count end", "def length\n if !block_given?\n return @j_del.java_method(:length, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling length()\"\n end", "def length\n\t\treturn @cards.length\n\tend", "def size\n read.bytesize\n end", "def length\n count = 0 \n return count if @head.nil?\n return length_helper(count, @head)\n end", "def length\n distance\n end", "def size\n @buffer.size\n end", "def size\n @buffer.size\n end", "def size\n @buffer.size\n end", "def len()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.SplitsComponentState_len(@handle.ptr)\n result\n end", "def length()\n obj_len = internal_object_length - 1\n return obj_len\n end", "def length\n @content.length\n end", "def length\n @node[\"length\"]\n end", "def length\n @queue.length\n end", "def hand_length\n return @cards_in_hand.length\n end", "def length\n metadata[:length]\n end", "def length\n return @args[\"data\"].length\n end", "def length\n to_s.length\n end", "def _size\n @allocated.length + @available_connections.length\n end", "def length\n @val.length\n end", "def length\n raise NotImplementedError, \"Please implement length\"\n end", "def length\n @string.length\n end", "def length\n\t\[email protected]\n\tend", "def length\n @config.length\n end", "def length\n `return self.length;`\n end", "def length\n `return self.length;`\n end", "def size\n\t\t@length\n\tend", "def get_length_size\n return false if @data.empty?\n\n # High bits used for length type\n # Low bits used as first bits of length\n \n # 0xxxxxxx = 7 bit length\n # 10xxxxxx = 14 bit length\n # 110xxxxx = 21 bit length\n # 1110xxxx = 28 bit length\n # 11110000 = 32 bit length follows\n\n t = @data.unpack('C').first\n\n return 7 if t & 0b10000000 == 0\n return 14 if t & 0b01000000 == 0\n return 21 if t & 0b00100000 == 0\n return 28 if t & 0b00010000 == 0\n return 32 if t == 0b11110000\n\n raise ArgumentError, \"Invalid length type encoding\"\n end", "def size\r\n self.data.length\r\n end", "def length\n count = 0\n each { count += 1 }\n count\n end", "def size\n length\n end" ]
[ "0.70875275", "0.704053", "0.7013968", "0.7013968", "0.7013968", "0.69790536", "0.69790536", "0.6943149", "0.6862032", "0.6862032", "0.6862032", "0.68152434", "0.678525", "0.6733793", "0.6723566", "0.6700917", "0.6669434", "0.665001", "0.6643052", "0.65751904", "0.6569529", "0.6538271", "0.6533877", "0.6509939", "0.64976877", "0.64976877", "0.6486343", "0.64736784", "0.6472299", "0.64663553", "0.64645106", "0.6444049", "0.6441614", "0.643707", "0.6435882", "0.64265466", "0.64260274", "0.6415421", "0.6412706", "0.6400046", "0.6399154", "0.638542", "0.63668585", "0.6358591", "0.6357733", "0.63570255", "0.63570255", "0.63570255", "0.63570255", "0.6355506", "0.6355506", "0.6355506", "0.6355506", "0.6355506", "0.6355506", "0.6355506", "0.63535243", "0.63498753", "0.63498753", "0.63498753", "0.63498753", "0.63498753", "0.6336606", "0.6331434", "0.6328403", "0.6311244", "0.63066155", "0.63020605", "0.6288761", "0.62699264", "0.6269651", "0.6263218", "0.62541026", "0.62518257", "0.62425596", "0.623565", "0.623565", "0.623565", "0.62351257", "0.6231363", "0.62099624", "0.6209877", "0.62051016", "0.62015694", "0.62000734", "0.6186325", "0.6179089", "0.61716133", "0.61630636", "0.61546385", "0.6134008", "0.6133794", "0.6132976", "0.61257803", "0.61257803", "0.6116151", "0.611504", "0.6111371", "0.61107594", "0.60984415" ]
0.6215591
80
Returns the number of threads waiting on the queue.
def waiting_size @waiting.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_waiting\n @queue.num_waiting\n end", "def num_waiting\n @waiting.size + @queue_wait.size\n end", "def num_waiting\n @waiting.size + @queue_wait.size\n end", "def waiting_threads_count\n @waiting_threads_sleepers.length\n end", "def num_waiting\n @pop_mutex.waiting_threads_count + @waiter.waiting_threads_count\n end", "def waiting_threads_count\n @condition_variable.waiting_threads_count\n end", "def waiting_threads_count\n @condition_variable.waiting_threads_count\n end", "def waitlist_size\n @queue.size\n end", "def queue_count()\n @queue.length\n end", "def queue_count()\n cnt = 0\n @tasks.each_value { |task| cnt += task.queue_count() }\n cnt\n end", "def num_waiting\n @waiting.size\n end", "def num_waiting\n @waiting.size\n end", "def queue_length\n mutex.synchronize { running? ? @queue.length : 666 }\n end", "def work_queue_size()\n @work_queue.size\n end", "def num_waiting\n @num_waiting\n end", "def queue_length\n @executor.getQueue.size\n end", "def queue_count\n @queues.length\n end", "def thread_count\n @worker_threads_count.value\n end", "def num_waiting\n synchronize do\n @num_waiting\n end\n end", "def num_waiting\n synchronize do\n @num_waiting\n end\n end", "def queued_messages\n @queue.length\n end", "def busy_workers\n if @threadsafe\n 0\n else\n @workers.size - @worker_queue.size\n end\n end", "def size\n @mutex.synchronize { @queue.size }\n end", "def get_queue_size\n if @number_of_processes\n @queueSize = @number_of_processes\n else\n @queueSize = DATSauce::PlatformUtils.processor_count * 2\n # get max threads from platform utils\n end\n @queueSize\n end", "def queue_length\n @job_queue.length\n end", "def queue_length\n @queues.inject(0) do |length, (_, queue)|\n length + queue.length\n end\n end", "def queued_messages\n @queue.length\n end", "def num_waiting\n @waiting\n end", "def worker_count()\n @workers.size\n end", "def worker_count()\n @workers.size\n end", "def running_thread_count()\n Thread.list.select {|thread| thread.status == \"run\"}.count\n end", "def num_waiting\n @resources.num_waiting\n end", "def queue_count()\n cnt = 0\n @flows.each_value { |f| cnt += f.queue_count() }\n cnt\n end", "def queue_length\n request_queue.length\n end", "def count\n\t\[email protected]\n\tend", "def queue_count()\n @work_queue.size + super()\n end", "def num_waiting\n end", "def num_waiting\n end", "def num_waiting\n synchronize do\n $DEBUG && warn(@num_waiting.to_s)\n @num_waiting\n end\n end", "def length\n @queue.length\n end", "def size\n\n @queue.size\n end", "def quantity\n @task_worker_lock.synchronize {@task_workers.size}\n end", "def size\n @queue.size\n end", "def queue_size(queue)\n Resque.size(queue)\n end", "def queue_size\n @redis.llen(\"xque:queue:#{@queue_name}\")\n end", "def max_queue_count()\n @max_queue_count\n end", "def size\n @queue.size\n end", "def length\n @queue.length\n end", "def size\n @queue.size\n end", "def max_queue_threads\n 1\n end", "def running_thread_count #borrowed from used Kashyap on Stack Overflow\n\t\tThread.list.select {|thread| thread.status == \"run\"}.count\n\tend", "def size\n @queue.size\n end", "def sub_queue_count\n sub_queue_obj.count\n end", "def gevent_queue_size\r\n return @proc_queue.size\r\n end", "def pending_job_count\n\n @pending_jobs.size\n end", "def pending_size\n @redis.zcard(\"xque:pending:#{@queue_name}\")\n end", "def backlog\n @queue.size\n end", "def num_waiting\n @num_waiting.value\n end", "def method()\n @workers.size\n end", "def njobs\n @pool.njobs\n end", "def message_count\n get_queue_message_count(address)\n end", "def queue_length\n if system.empty?\n 0\n else\n system.length - 1\n end\n end", "def njobs\n @njobs.to_i\n end", "def ready_count(queue)\n collection.find(conditions(queue).merge({\n :attempts => { '$lt' => 5 }, :run_at => { '$lte' => Time.now.utc }, :lock => nil\n })).count\n end", "def user_threads_count\n user_threads_lock.synchronize do\n user_threads.count\n end\n end", "def length\n @executor.getPoolSize\n end", "def size_without_waiters\n clients.inject(0) do |sum, element|\n sum += 1 unless element.waiting?\n sum\n end\n end", "def queued_build_count\n response = get('buildQueue')\n response.count\n end", "def queue_count_key\n \"concurrent.queue_counts\"\n end", "def num_threads\n logger.debug { \"#{self.class}##{__method__}\" }\n if @num_threads.nil?\n @num_threads = 0\n\n threadgroups_threads_count_properties.each do |property_name|\n value = properties_map[property_name]\n logger.debug(\"#{property_name} -> #{value}\")\n\n if serialize_threadgroups?\n @num_threads = value if value > @num_threads\n else\n @num_threads += value\n end\n end\n end\n @num_threads\n end", "def worker_count\n @action == 'run' ? 1 : workers\n end", "def z_queue_size(queue)\n handle_pipeline(@redis.zcount(redis_key_for_queue(queue), 0, Float::INFINITY), &:to_i)\n end", "def worker_threads\n @workers.synchronize { @workers.size }\n end", "def consumer_count\n with_queue_control do |control|\n control.consumer_count\n end\n end", "def size\n\t\t\[email protected] + @queue.size\n\t\tend", "def remaining_capacity\n mutex.synchronize { @max_queue == 0 ? -1 : @max_queue - @queue.length }\n end", "def idle\n @size - @active_threads.value\n end", "def ready_count(queue)\n conditions = [\"#{connection.quote_column_name('run_at')} <= ?\", Time.now.utc]\n unless queue.class_names.empty?\n conditions.first << \" AND #{connection.quote_column_name('record_class_name')} IN (?)\"\n conditions << queue.class_names\n end\n count(:conditions => conditions)\n end", "def pending_tasks_count\n @@pending_tasks.length\n end", "def size\n self.queued.inject(0) { |result, data| result + data.last.size }\n end", "def size\n # This is a a bit racy - we don't update these two queues atomically\n @queue.size + @active.size\n end", "def ready_count(queue)\n conditions = {:run_at.lte => Time.now.utc}\n conditions[:record_class_name] = queue.class_names unless queue.class_names.empty?\n count(conditions)\n end", "def waiting_count\n @map[Constants::TaskStatus::REQUESTED]\n end", "def busy_size\n @busy_grp.list.size\n end", "def workers\n ::Resque.info[:workers].to_i\n end", "def number_requests\r\n return @requests.length\r\n end", "def waiter_count(key)\n fibers = waiters[key]\n fibers ? fibers.count : 0\n end", "def length\n mutex.synchronize { running? ? @pool.length : 0 }\n end", "def task_count()\n @tasks.size\n end", "def scheduled_messages_count\n with_queue_control do |control|\n control.scheduled_count\n end\n end", "def depth\n @queue.depth\n end", "def tasks_pending_count\n count do |task|\n task.pending?\n end\n end", "def tasks_total_count\n tasks.length\n end", "def size\n @que.size\n end", "def queue_size\n _get(\"/system/queue-size\") { |json| json }\n end", "def number_requests\r\n\t\treturn @requests.length\r\n \tend", "def active_client_threads\n # If threaded return a count from the clients list\n return @clients.length if @threaded\n\n # Else return 0 if not threaded\n return 0\n end", "def missing_workers\n @options[:process_count] - @workers.length\n end", "def available_count\n raise_if_closed!\n\n @lock.synchronize do\n @available_connections.length\n end\n end", "def delayed_queue_schedule_size\n redis.zcard(:delayed_queue)\n end" ]
[ "0.8595451", "0.8447729", "0.8447729", "0.82736677", "0.82481676", "0.8178111", "0.8178111", "0.808434", "0.8060422", "0.78676134", "0.78309554", "0.78309554", "0.77566427", "0.7631757", "0.7623891", "0.75829625", "0.75828606", "0.7566508", "0.7421118", "0.7421118", "0.7405988", "0.74009305", "0.7378411", "0.73495054", "0.7346201", "0.7344795", "0.7282155", "0.72761375", "0.72520214", "0.72520214", "0.72439027", "0.7237253", "0.72359234", "0.7228926", "0.72187436", "0.7196089", "0.7184521", "0.7184521", "0.7145025", "0.71387506", "0.7137129", "0.71210754", "0.71125275", "0.7102196", "0.70952237", "0.7089194", "0.70446694", "0.7036276", "0.70304054", "0.7016888", "0.7014882", "0.69971484", "0.6961346", "0.69114643", "0.69093114", "0.6898026", "0.68838555", "0.68758476", "0.6808925", "0.6794061", "0.6764879", "0.6735084", "0.6658913", "0.6656613", "0.6645468", "0.66089803", "0.658211", "0.6576798", "0.6567351", "0.6502319", "0.64971274", "0.649382", "0.64936393", "0.6487827", "0.64754915", "0.64732677", "0.64384747", "0.6434872", "0.6425946", "0.6404838", "0.6398197", "0.6389133", "0.6381047", "0.63684255", "0.6367254", "0.6325665", "0.6320154", "0.63177395", "0.6308394", "0.62785906", "0.6268703", "0.6258388", "0.62530833", "0.6250384", "0.6249232", "0.6246871", "0.6243732", "0.6243732", "0.62385553", "0.62304395" ]
0.7499412
18
Method called only by selector to subscribe listeners, dont use it, unless you understand exactly what you're doing!
def subscribe(selector) channel = self @mutex.synchronize do loop do return selector.result unless selector.waiting? if @queue.empty? @waiting.push Thread.current @mutex.sleep else selector.mutex.synchronize do if selector.waiting? result = selector.update_result(channel, @queue.shift) yield result end end selector.release_result return selector.result end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribed; end", "def listener; end", "def subscribed # :doc:\n # Override in subclasses\n end", "def listeners; end", "def subscriptions; end", "def subscriptions; end", "def subscriptions; end", "def listener=(_arg0); end", "def events=(_); end", "def subscribe!\n # TODO: Implement\n end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def listen\n # TODO\n self\n end", "def listening?; end", "def notifier; end", "def notifier; end", "def event; end", "def event; end", "def event; end", "def subscribe(&onMessage) # block\n end", "def after_subscribe(subscribed)\n # not required\n end", "def listen(p0) end", "def listen(p0) end", "def listen(p0) end", "def subscribe_to_channel; end", "def listen\r\n end", "def event_bus; end", "def event_bus; end", "def unsubscribed; end", "def notifier=(_arg0); end", "def notifier=(_arg0); end", "def send_events; end", "def pubsub; end", "def listen\n raise NotImplementedError.new(\"Implement listen() in your Invoker. \")\n end", "def callbacks; end", "def callbacks; end", "def prePushListener\n end", "def onmessage(&blk); super; end", "def subscriber( name )\n raise NotImplementedError, \"please implement 'subscriber'\"\n end", "def define_listening\n end", "def on_connected\n end", "def prePopListener\n end", "def method_missing(selector, *args, &block); end", "def send_events=(_arg0); end", "def events\n end", "def subscribe\n self.subscribed = true\n end", "def poll(_) end", "def on_ready\n end", "def listen_to(io, &callback); end", "def received\n end", "def on_connection_listener_fetch_loop(event)\n listener = event[:caller]\n debug \"[#{listener.id}] Polling messages...\"\n end", "def subscribe\n \nend", "def signal_received; end", "def on_add(clicker)\n end", "def callback\n end", "def receiver; end", "def receiver; end", "def receiver; end", "def receiver; end", "def receiver; end", "def receiver; end", "def unsubscribed # :doc:\n # Override in subclasses\n end", "def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end", "def IsSubscribed=(arg0)", "def IsSubscribed=(arg0)", "def >(selector); end", "def >(selector); end", "def request_select\n end", "def fires_in; end", "def callback\n\n end", "def selector\n @selector ||= [socket]\n end", "def select; end", "def select; end", "def to_wires_event; self; end", "def on_data_changed; end", "def pubsub_adapter; end", "def subscribe\n @player.subscribe(self)\n end", "def method_added(*) end", "def subscribe(_topic, **)\n raise 'not implemented'\n end", "def run_subscribe(conn, dest)\n return if not @need_subscribe\n @log.debug \"run_subscribe starts\"\n conn.subscribe(dest) # call hook\n @log.debug \"run_subscribe done\"\n @need_subscribe = false\n @need_gets = true\nend", "def listen\n @nodes.each { |node|\n node.listen\n }\n self\n end", "def register_events\n EventReactor.sub(:trade_cleared, &method(:trade_cleared))\n EventReactor.sub(:round_change, &method(:change_round))\n EventReactor.sub(:ask_posted, &method(:ask_posted))\n EventReactor.sub(:bid_posted, &method(:bid_posted))\n end", "def delegate_method; end", "def notify\n @subscribers.each { |ident, (block,obj)| block.call(obj) }\n end", "def isolate_signals; end", "def subscribe(prefix = EVERYTHING)\n ffi_delegate.set_subscribe(prefix)\n end", "def callback=(_arg0); end", "def watcher=(_arg0); end", "def unsubscribed\n end", "def unsubscribed\n end", "def callback\n\tend", "def unsubscribed\n\tend", "def initialize\n @subscribers = []\n end", "def callback &block\n super\n end", "def callback &block\n super\n end" ]
[ "0.7055471", "0.663558", "0.65850717", "0.65158284", "0.63182604", "0.63182604", "0.63182604", "0.630834", "0.6292331", "0.6276158", "0.62591", "0.62591", "0.62591", "0.62591", "0.62591", "0.62591", "0.62591", "0.62591", "0.61430746", "0.6075591", "0.60528743", "0.60528743", "0.60243136", "0.60243136", "0.60243136", "0.60197085", "0.6016398", "0.5992934", "0.5992934", "0.5992934", "0.593346", "0.59330034", "0.5889574", "0.5889574", "0.5875798", "0.5845637", "0.5845637", "0.58336484", "0.58179027", "0.5805352", "0.5744421", "0.5744421", "0.5695693", "0.56605124", "0.56519675", "0.5637324", "0.5597463", "0.55899847", "0.558922", "0.55723953", "0.5550855", "0.5544056", "0.5499633", "0.5475698", "0.5462685", "0.5461413", "0.5445193", "0.54339767", "0.5418474", "0.53832763", "0.53785497", "0.5365048", "0.5365048", "0.5365048", "0.5365048", "0.5365048", "0.5365048", "0.5356493", "0.5353672", "0.534386", "0.534386", "0.5338377", "0.5338377", "0.53294694", "0.5312961", "0.52932197", "0.5291948", "0.52877", "0.52877", "0.5283884", "0.5277454", "0.52644295", "0.5263217", "0.52587384", "0.5257923", "0.52464813", "0.524604", "0.52236146", "0.52199244", "0.52172923", "0.52172565", "0.52134985", "0.52031165", "0.5201252", "0.5200894", "0.5200894", "0.5190928", "0.5188638", "0.51772916", "0.5176779", "0.5176779" ]
0.0
-1
Prepare Solr document hash for the record
def solr_doc_data doc = {} # To support indexing of records of different classes, create a unique id by concatenating # class name (downcased and underscored) and record id (see solr_id below)... doc[:id] = solr_id # ... then record class name and record id as record_type, record_id doc[:record_type] = self.class.to_s.underscore doc[:record_id] = self.id # This will add all attributes that correspond to database columns (make sure these are all in the schema, or modify) attrs = self.class.column_names.map { |n| n.to_sym } attrs.each do |a| if a != :id doc[a] = self[a] end end ###################################################### # Here you can add other elements to the doc as needed # # If you are indexing records from multiple models, it's a good idea to use a case statement here # to specify which fields to index for which model, e.g.: # # case self # when Foo # doc['foo_attribute'] = self.foo_attribute # when Boo # doc['boo_attribute'] = self.boo_attribute # end # ###################################################### # remove nil/empty values doc.delete_if { |k,v| nil_or_empty?(v) } doc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['member_works_count_isi'] = member_works_count\n solr_doc['title_ssort'] = sort_title\n solr_doc['creator_ssort'] = object.creator.first\n solr_doc['generic_type_sim'] = [\"Collection\"]\n solr_doc['banner_path_ss'] = banner_path\n solr_doc['source_collection_title_for_collections_ssim'] = source_collection\n solr_doc['deposit_collection_titles_tesim'] = deposit_collection\n solr_doc['deposit_collection_ids_tesim'] = object.deposit_collection_ids\n end\n end", "def existing_solr_doc_hash(id)\n document_model.new(unique_key => id).to_solr if document_model && id.present?\n end", "def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['top_level_bsi'] = object.in_works_ids.blank?\n solr_doc[Rdr::Index::Fields.in_works_ids] = object.in_works_ids\n end\n end", "def to_solr(solr_doc = Hash.new())\n super(solr_doc) # Run the default solrization behavior\n\n # Extract a creation year field\n if self.origin_info.copyright.any? && !self.origin_info.copyright.first.blank?\n creation_date = self.origin_info.copyright.first\n solr_doc[\"creation_year_sim\"] = [creation_date[/\\d{4}/]]\n # solr_doc[\"date_issued_ssim\"] = [creation_date]\n elsif self.origin_info.date_issued.any? && !self.origin_info.date_issued.first.blank?\n creation_date = self.origin_info.date_issued.first\n solr_doc[\"creation_year_sim\"] = [creation_date[/\\d{4}/]]\n end\n\n\n # Ensure title is set to a title actually associated with this core file.\n solr_doc[\"title_info_title_ssi\"] = self.title_info.title.first\n\n # Extract special subject/topic fields\n authorized_keywords = []\n\n (0..self.subject.length).each do |i|\n if self.subject(i).topic.authority.any?\n authorized_keywords << self.subject(i).topic.first\n end\n end\n\n solr_doc[\"subject_sim\"] = authorized_keywords\n\n #Extract and solrize names divided into first/last parts\n full_names = []\n\n (0..self.personal_name.length).each do |i|\n fn = self.personal_name(i).name_part_given\n ln = self.personal_name(i).name_part_family\n\n if fn.any? && ln.any?\n full_names << \"#{fn.first} #{ln.first}\"\n end\n end\n\n solr_doc[\"personal_creators_tesim\"] = full_names\n solr_doc[\"personal_creators_sim\"] = full_names\n\n # Create an aggregate facet field of all creator information\n personal_names = solr_doc[\"personal_creators_sim\"] || []\n corporate_names = solr_doc[\"corporate_name_name_part_sim\"] || []\n names = solr_doc[\"name_name_part_sim\"] || []\n all_names = personal_names + corporate_names + names\n solr_doc[\"creator_sim\"] = all_names\n solr_doc[\"creator_tesim\"] = all_names\n\n #TODO: Extract dateBegin/dateEnd information ]\n return solr_doc\n end", "def to_solr(solr_doc=Hash.new, opts={})\n solr_doc = super(solr_doc, opts)\n solr_doc.merge!(ActiveFedora::SolrService.solr_name(:event_date_time, :date) => event_date_time,\n ActiveFedora::SolrService.solr_name(:event_type, :symbol) => event_type,\n ActiveFedora::SolrService.solr_name(:event_outcome, :symbol) => event_outcome,\n ActiveFedora::SolrService.solr_name(:event_id_type, :symbol) => event_id_type,\n ActiveFedora::SolrService.solr_name(:event_id_value, :symbol) => event_id_value, \n ActiveFedora::SolrService.solr_name(:linking_object_id_type, :symbol) => linking_object_id_type,\n ActiveFedora::SolrService.solr_name(:linking_object_id_value, :symbol) => linking_object_id_value)\n return solr_doc\n end", "def solr_doc_data\n @doc = {\n id: solr_id,\n record_type: self.class.to_s.underscore,\n record_id: id,\n data: json_data,\n created_at: created_at,\n updated_at: updated_at\n }\n\n case self\n when Order\n add_order_data_to_solr_doc\n when Item\n add_item_data_to_solr_doc\n when User\n add_user_data_to_solr_doc\n when Location\n add_location_data_to_solr_doc\n end\n\n # remove nil/empty values\n @doc.delete_if { |k,v| nil_or_empty?(v) }\n @doc\n end", "def generate_solr_document\n super.tap do |solr_doc|\n \n # other title\n solr_doc[Solrizer.solr_name('other_title', :stored_searchable)] = object.other_title.map { |r| r.title.first }\n solr_doc[Solrizer.solr_name('other_title', :displayable)] = object.other_title.to_json \n\n # work review process\n # solr_doc[Solrizer.solr_name('work_review_process', :stored_searchable)] = object.work_review_process.map{ |r| r.status.first }\n # solr_doc[Solrizer.solr_name('work_review_process', :displayable)] = object.work_review_process.to_json\n\n # reviewers\n solr_doc[Solrizer.solr_name('reviewers', :stored_searchable)] = object.reviewers.map { |r| r.reviewer.first }\n solr_doc[Solrizer.solr_name('reviewers', :displayable)] = object.reviewers.to_json\n\n # identifiers\n solr_doc[Solrizer.solr_name('identifier_nested', :symbol)] = object.identifier_nested.map { |i| i.obj_id.first }\n solr_doc[Solrizer.solr_name('identifier_nested', :displayable)] = object.identifier_nested.to_json\n object.identifier_nested.each do |i|\n unless (i.obj_id_scheme.first.blank? or i.obj_id.first.blank?)\n solr_doc[Solrizer.solr_name(\"identifier_#{i.obj_id_scheme.first.downcase}\", :symbol)] = i.obj_id.reject(&:blank?)\n end\n end\n\n # creator\n creators = object.creator_nested.map { |cr| (cr.name + cr.orcid).reject(&:blank?).join(' ') }\n solr_doc[Solrizer.solr_name('creator_nested', :facetable)] = creators\n solr_doc[Solrizer.solr_name('creator_nested', :stored_searchable)] = creators\n solr_doc[Solrizer.solr_name('creator_nested', :displayable)] = object.creator_nested.to_json\n \n # contributor\n # contributors = object.contributor_nested.map { |cr| (cr.contributor_first_name + cr.contributor_last_name).reject(&:blank?).join(' ') }\n # solr_doc[Solrizer.solr_name('contributor_nested', :facetable)] = contributors\n # solr_doc[Solrizer.solr_name('contributor_nested', :stored_searchable)] = contributors\n # solr_doc[Solrizer.solr_name('contributor_nested', :displayable)] = object.contributor_nested.to_json\n\n # date\n # solr_doc[Solrizer.solr_name('date_nested', :stored_searchable)] = object.date_nested.map { |s| s.date.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('date_nested', :facetable)] = object.date_nested.map { |s| s.date.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('date_nested', :displayable)] = object.date_nested.to_json\n\n # subject\n solr_doc[Solrizer.solr_name('subject_nested', :stored_searchable)] = object.subject_nested.map { |s| s.subject.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('subject_nested', :facetable)] = object.subject_nested.map { |s| s.subject.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('subject_nested', :displayable)] = object.subject_nested.to_json\n \n # #alternate identifier\n # solr_doc[Solrizer.solr_name('alt_identifier_nested', :stored_searchable)] = object.alt_identifier_nested.map { |s| s.alt_identifier.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('alt_identifier_nested', :facetable)] = object.alt_identifier_nested.map { |s| s.alt_identifier.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('alt_identifier_nested', :displayable)] = object.alt_identifier_nested.to_json\n\n #alternate identifier\n solr_doc[Solrizer.solr_name('related_identifier_nested', :stored_searchable)] = object.related_identifier_nested.map { |s| s.related_identifier.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('related_identifier_nested', :facetable)] = object.related_identifier_nested.map { |s| s.related_identifier.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('related_identifier_nested', :displayable)] = object.related_identifier_nested.to_json\n\n # #rights\n # solr_doc[Solrizer.solr_name('rights_nested', :stored_searchable)] = object.rights_nested.map { |s| s.rights.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('rights_nested', :facetable)] = object.rights_nested.map { |s| s.rights.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('rights_nested', :displayable)] = object.rights_nested.to_json\n\n #description\n solr_doc[Solrizer.solr_name('description_nested', :stored_searchable)] = object.description_nested.map { |s| s.description.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('description_nested', :facetable)] = object.description_nested.map { |s| s.description.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('description_nested', :displayable)] = object.description_nested.to_json\n\n #funding\n solr_doc[Solrizer.solr_name('funding_nested', :stored_searchable)] = object.funding_nested.map { |s| s.funding_reference.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('funding_nested', :facetable)] = object.funding_nested.map { |s| s.funding_reference.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('funding_nested', :displayable)] = object.funding_nested.to_json \n\n #geolocation\n solr_doc[Solrizer.solr_name('geolocation_nested', :stored_searchable)] = object.geolocation_nested.map { |s| s.geolocation.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('geolocation_nested', :facetable)] = object.geolocation_nested.map { |s| s.geolocation.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('geolocation_nested', :displayable)] = object.geolocation_nested.to_json\n\n end\n end", "def to_solr(solr_doc = {})\n super(solr_doc)\n solr_doc.merge!(\"object_type_sim\" => \"Book chapter\")\n solr_doc\n end", "def doc_hash\n @doc_hash ||= begin\n doc_hash = GDor::Indexer::SolrDocHash.new id: resource.bare_druid, modsxml: smods_rec.to_xml\n hash_from_mods = doc_hash_from_mods # defined in gdor_mods_fields\n doc_hash.merge!(hash_from_mods) if hash_from_mods\n doc_hash\n end\n end", "def to_solr(solr_doc = Hash.new)\n super(solr_doc)\n\n creator = get_solr_sortable_creator\n unless creator == \"\"\n solr_doc.merge!(\"creator_name_ssort\" => creator )\n end\n solr_doc \n end", "def generate_solr_document\n super.tap do |solr_doc|\n # account\n solr_doc[Solrizer.solr_name('account', :displayable)] = object.account.to_json\n solr_doc[Solrizer.solr_name('account_type', :facetable)] = object.account.map { |a| a.account_type.first }.reject(&:blank?)\n # contact\n solr_doc[Solrizer.solr_name('contact_label', :facetable)] = object.contact.map { |c| c.label.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('contact', :displayable)] = object.contact.to_json\n # template files\n solr_doc['template_path_ss'] = object.members.select {\n |m| m.resource_type.include? ('Data paper template')}.\n map{ |f| Hyrax::Engine.routes.url_helpers.download_path(f.id)\n }\n end\n end", "def convert_doc_attributes(hash)\n converted_hash = hash.inject({}) do |ret, (key, value)|\n if key == \"id\"\n ret[\"id\"] = value.to_s.split(\"/\").last\n else\n ret[reverse_lookup_solr_field(key).to_s] = value\n end\n ret\n end\n self.select_fields.each do |select_field|\n converted_hash[select_field.to_s] = nil if !converted_hash.has_key?(select_field.to_s)\n end\n converted_hash\n end", "def to_solr(solr_doc=Hash.new, *args)\n doc = self.ng_xml\n if doc.root['type']\n shelved_file_count=0\n content_file_count=0\n resource_type_counts={}\n resource_count=0\n preserved_size=0\n first_shelved_image=nil\n add_solr_value(solr_doc, \"content_type\", doc.root['type'], :string, [:facetable])\n doc.xpath('contentMetadata/resource').sort { |a,b| a['sequence'].to_i <=> b['sequence'].to_i }.each do |resource|\n resource_count+=1\n if(resource['type'])\n if resource_type_counts[resource['type']]\n resource_type_counts[resource['type']]+=1 \t\n else\n resource_type_counts[resource['type']]=1\n end\n end\n resource.xpath('file').each do |file|\n content_file_count+=1\n if file['shelve'] == 'yes'\n shelved_file_count+=1\n if first_shelved_image.nil? and file['id'].match(/jp2$/)\n first_shelved_image=file['id']\n end\n end\n if file['preserve'] == 'yes'\n preserved_size += file['size'].to_i\n end\n end\n end\n add_solr_value(solr_doc, \"content_file_count\", content_file_count.to_s, :string, [:searchable, :displayable])\n add_solr_value(solr_doc, \"shelved_content_file_count\", shelved_file_count.to_s, :string, [:searchable, :displayable])\n add_solr_value(solr_doc, \"resource_count\", resource_count.to_s, :string, [:searchable, :displayable])\n add_solr_value(solr_doc, \"preserved_size\", preserved_size.to_s, :string, [:searchable, :displayable])\n resource_type_counts.each do |key, count|\n add_solr_value(solr_doc, key+\"_resource_count\", count.to_s, :string, [:searchable, :displayable])\n end\n if not first_shelved_image.nil?\n add_solr_value(solr_doc, \"first_shelved_image\", first_shelved_image, :string, [:displayable])\n end\n end\n solr_doc\n end", "def new_document()\n # Work out fields to ignore - these will be auto populated by Solr\n copy_fields = []\n @config[\"schema\"][\"copy_fields\"].each do |copy_field|\n copy_fields.push( copy_field[\"dest\"] )\n end\n \n doc = {}\n @config[\"schema\"][\"fields\"].each do |key,detail|\n unless copy_fields.include?(key)\n doc[ key.to_sym ] = []\n end\n end\n return doc\n end", "def to_solr solr_doc = Hash.new\n super(solr_doc)\n Solrizer.insert_field(solr_doc, \"format\", \"Video\", :facetable, :displayable) \n return solr_doc\n end", "def to_solr(solr_doc = {})\n super\n solr_doc['desc_metadata__identifier_tesim'] = self.doi\n solr_doc\n end", "def generate_solr_document\n super.tap do |solr_doc|\n index_suppressed(solr_doc)\n index_workflow_fields(solr_doc)\n end\n end", "def generate_document_structure; build_document_hash end", "def to_solr(solr_doc = {})\n prefix = self.prefix\n solr_doc.merge super({}).each_with_object({}) { |(key, value), new| new[[prefix,key].join] = value }\n end", "def to_solr(doc = {} )\n super(doc)\n\n exemplary_check = Bplmodels::OAIObject.find_with_conditions({\"is_exemplary_image_of_ssim\"=>\"info:fedora/#{self.pid}\"}, rows: '1', fl: 'id' )\n if exemplary_check.present?\n doc['exemplary_image_ssi'] = exemplary_check.first[\"id\"]\n end\n\n doc\n\n end", "def generate_solr_document\n super.tap do |solr_doc|\n # Only do this after the indexer has the file_set\n unless object.file_sets.nil?\n load_elections_xml(object)\n if @noko.nil?\n Rails.logger.warn(\"Couldn't find the Voting Record XML for #{solr_doc['id']}\")\n else\n solr_doc['voting_record_xml_tesi'] = @noko.to_xml\n solr_doc['format_ssim'] = 'Election Record' # solr_doc['format_tesim']\n solr_doc['title_ssi'] = solr_doc['title_tesim'].first # solr_doc['title_tesi']\n\n solr_doc['party_affiliation_sim'] = get_all_vs('//candidate/@affiliation', '//elector/@affiliation')\n solr_doc['party_affiliation_id_ssim'] = get_all_vs('//candidate/@affiliation_id', '//elector/@affiliation_id')\n # solr_doc['party_affiliation_id_ssim'].delete_if { |party_id| Party.find(party_id).nil? }\n\n solr_doc['date_tesim'] = get_all_vs('/election_record/@date')\n solr_doc['date_isi'] = solr_doc['date_tesim'].map(&:to_i).first\n # solr_doc[\"date_sim\"] = date.first[0..3] unless date.first.nil?\n\n solr_doc['office_id_ssim'] = get_v('/election_record/office/@office_id')\n solr_doc['office_role_title_tesim'] = get_all_vs('//role/@title')\n solr_doc['office_name_tesim'] = get_authority_from_nnv(solr_doc['office_id_ssim'], \"office\")\n\n solr_doc['state_name_tesim'] = solr_doc['state_name_sim'] = get_all_vs('//admin_unit[@type=\"State\"]/@name')\n\n solr_doc['election_id_ssim'] = [get_v('/election_record/@election_id')]\n solr_doc['election_type_tesim'] = solr_doc['election_type_sim'] = [get_v('/election_record/@type')]\n\n solr_doc['candidate_id_ssim'] = get_all_vs('//candidate/@name_id')\n solr_doc['candidate_name_tesim'] = get_all_vs('//candidate/@name')\n\n solr_doc['elector_name_tesim'] = get_all_vs(\"//elector/@name\")\n\n solr_doc['jurisdiction_tesim'] = solr_doc['jurisdiction_sim'] = [get_v('/election_record/office/@scope')]\n\n solr_doc['handle_ssi'] = get_v('/election_record/@handle')\n solr_doc['iteration_tesim'] = [get_v('/election_record/@iteration')]\n # solr_doc['page_image_urn_ssim'] = get_all_vs(\"//reference[@type='page_image']/@urn\").uniq\n solr_doc['iiif_page_images_ssim'] = get_iiif_ids(get_all_vs(\"//reference[@type='page_image']/@urn\").uniq)\n\n solr_doc['all_text_timv'] = get_all_text(solr_doc)\n end\n end\n end # End super.tap\n end", "def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['year_iim'] = extract_years(object.date_created)\n end\n end", "def to_solr\n if defined?(super)\n solr_doc = super\n else\n solr_doc = {}\n end\n [:mime_type,:content_type,:file_type,:storage_location_id,:file_size,:file_entity_type,:file_name].each do |method|\n solr_doc[method.to_s+\"_ssi\"] = self.send(method)\n end\n solr_doc\n end", "def initialize solr_doc, solr_result, citations, user_state\n logger.debug \"initializing a mongo DOI record for work w/ resourceTypeGeneral='#{solr_doc['resourceTypeGeneral'] || \"unknown\"}', resourceType='#{solr_doc['resourceType'] || \"unknown\"}', DOI name #{solr_doc['doi']}\"\n logger.debug {solr_doc.ai}\n @doi = solr_doc['doi']\n @type = solr_doc['resourceTypeGeneral']\n @subtype = solr_doc['resourceType']\n @doc = solr_doc\n @score = solr_doc['score']\n @normal_score = ((@score / solr_result['response']['maxScore']) * 100).to_i\n @citations = citations\n @hashed = solr_doc['mongo_id']\n @user_claimed = user_state[:claimed]\n @in_user_profile = user_state[:in_profile]\n @highlights = solr_result['highlighting'] || {}\n @publication = find_value('publisher')\n @title = solr_doc['title'] ? solr_doc['title'].first.strip : nil\n @date = solr_doc['date'] ? solr_doc['date'].last : nil\n @year = find_value('publicationYear')\n @month = solr_doc['month'] ? ENGLISH_MONTHS[solr_doc['month'] - 1] : (@date && @date.size > 6 ? ENGLISH_MONTHS[@date[5..6].to_i - 1] : nil)\n @day = solr_doc['day'] || @date && @date.size > 9 ? @date[8..9].to_i : nil\n # @volume = find_value('hl_volume')\n # @issue = find_value('hl_issue')\n @authors = find_value('creator')\n # @first_page = find_value('hl_first_page')\n # @last_page = find_value('hl_last_page')\n @rights = solr_doc['rights']\n @related = solr_doc['relatedIdentifier']\n @alternate = solr_doc['alternateIdentifier']\n @version = solr_doc['version']\n\n # Insert/update record in MongoDB\n # Hack Alert (possibly)\n MongoData.coll('dois').update({ doi: @doi }, {doi: @doi,\n title: @title,\n type: @type,\n subtype: @subtype,\n publication: @publication,\n contributor: @authors,\n published: {\n year: @year,\n month: @month,\n day: @day } }, \n { :upsert => true })\n end", "def to_solr(solr_doc={}, opts={})\n super(solr_doc, opts)\n solr_doc[Solrizer.solr_name('label')] = self.label\n #index_collection_pids(solr_doc)\n return solr_doc\n end", "def solr_during_indexing\n {\n \"has_model_ssim\" => [\"Collection\"],\n :id => object.id,\n \"title_tesim\" => [object.title.first.to_s],\n \"title_sim\" => [object.title.first.to_s],\n \"collection_type_gid_ssim\" => [object.collection_type_gid],\n \"ark_ssi\" => object.ark,\n \"ursus_id_ssi\" => Californica::IdGenerator.blacklight_id_from_ark(object.ark),\n \"member_ids_ssim\" => [],\n \"object_ids_ssim\" => [],\n \"member_of_collection_ids_ssim\" => [], \"collection_ids_ssim\" => [],\n \"generic_type_sim\" => [\"Collection\"],\n \"bytes_lts\" => 0,\n \"visibility_ssi\" => \"restricted\"\n }\n end", "def map\n solr_docs = []\n solr_docs << create_summary_doc\n solr_docs << create_desc_item('bioghist', 'Biography/History')\n solr_docs << create_desc_item('scopecontent', 'Scope and Content')\n solr_docs << create_desc_item('arrangement', 'Arrangement')\n solr_docs << create_desc_item('fileplan', 'File Plan')\n solr_docs += create_item_docs\n solr_docs.compact!\n solr_docs.collect do |doc|\n # clean all values...\n doc.each_pair do |k,v|\n doc[k] = to_one_line(v)\n if k == :hierarchy\n # elminate sequences of >= 3 :\n doc[k] = v.join('::').gsub(/:{3,}/, '::')\n end\n end\n end\n end", "def initialize(doc_hash = {})\n @fields = []\n doc_hash.each_pair do |field,values|\n # create a new field for each value (multi-valued)\n # put non-array values into an array\n values = [values] unless values.is_a?(Array)\n values.each do |v|\n next if v.to_s.empty?\n @fields << RSolr::Message::Field.new({:name=>field}, v.to_s)\n end\n end\n @attrs={}\n end", "def add_sidecar_fields(solr_hash)\n solr_hash.merge! resource.sidecar.to_solr\n end", "def to_solr(solr_doc={}, opts={})\n super(solr_doc).tap do |solr_doc|\n Solrizer.set_field(solr_doc, 'generic_type', 'Work', :facetable)\n end\n end", "def to_hash\n @document[\"@search.action\"] = \"mergeOrUpload\"\n @document\n end", "def prepare_solr_doc(doc, ns, ts)\n ret_doc = DocumentTransform.translate_doc(filter_doc(doc, ns)).merge({\n SOLR_TS_FIELD => bsonts_to_long(ts),\n SOLR_NS_FIELD => ns\n })\n\n return ret_doc\n end", "def to_solr(_solr_doc = {}, _opts = {})\n indexing_service.generate_solr_document\n end", "def solr_document\n document\n end", "def from_solr(solr_doc)\n #just initialize internal_solr_doc since any value retrieval will be done via lazy loading on this doc on-demand\n @internal_solr_doc = solr_doc\n end", "def generate_solr_field_doc(field_set, field_name, field_value)\n { :id => solr_fragment_id( field_set, field_name ),\n :docType => SearchResult::FRAGMENT_TYPE,\n :entityID => id,\n :entityType => self[:type],\n :entityName => name,\n :fieldSet => field_set, # this seems to map to the \"tab\" variable in an entities profile\n :fieldName => field_name,\n :displayText => html_escape(field_value),\n\n # html_escape, then strip html tags\n :text => html_escape(field_value).gsub(/<\\/?[^>]*>/, \"\"),\n :imageURL => thumb_src,\n \n :type_facet => self.class.to_s.humanize\n }\n end", "def solr_document\n config = Configuration.instance\n\n # add fields required by activemedusa\n doc = {\n config.solr_id_field => self.id,\n config.solr_class_field => self.class.entity_class_uri,\n config.solr_parent_uri_field =>\n self.rdf_graph.any_object('http://fedora.info/definitions/v4/repository#hasParent').to_s,\n }\n\n # add fields corresponding to property statements\n self.class.properties.select{ |p| p.class == self.class }.each do |prop|\n doc[prop.solr_field] = self.send(prop.name)\n end\n\n # add fields corresponding to associations\n self.class.associations.\n select{ |a| a.source_class == self.class and\n a.type == Association::Type::BELONGS_TO }.each do |assoc|\n obj = self.send(assoc.name)\n doc[assoc.solr_field] = obj.repository_url if\n obj.respond_to?(:repository_url)\n end\n\n doc\n end", "def to_solr\n {}.tap do |solr_doc|\n embargo_release_date = embargo_release_date(cocina)\n if embargo_release_date.present?\n solr_doc['embargo_status_ssim'] = ['embargoed']\n solr_doc['embargo_release_dtsim'] = [embargo_release_date.utc.iso8601]\n end\n end\n end", "def to_hash\n @document[\"@search.action\"] = \"upload\"\n @document\n end", "def to_hash\n @document[\"@search.action\"] = \"upload\"\n @document\n end", "def clean_document_cache\n @document_cache_keys.each_key do |cache_key|\n document = get_document(cache_key)\n \n document.each do |index_field,index_values|\n if index_values.size > 0\n document[index_field] = index_values.uniq\n end\n\n # If we have multiple value entries in what should be a single valued \n # field, not the best solution, but just arbitrarily pick the first entry.\n if !@config[\"schema\"][\"fields\"][index_field.to_s][\"multi_valued\"] and index_values.size > 1\n new_array = []\n new_array.push(index_values[0])\n document[index_field] = new_array\n end\n end\n \n set_document( cache_key, document )\n end\n end", "def hash\n return unless doc_value?\n result['doc']['hash']\n end", "def to_hash\n return self.document.to_hash\n end", "def to_solr\n as_index_document\n end", "def document_hash\n {}.tap do |hash|\n if @relationship\n hash.merge!(relationship_hash)\n elsif @data != :no_data\n hash.merge!(data_hash)\n elsif @errors.any?\n hash.merge!(errors_hash)\n end\n hash[:links] = @links if @links.any?\n hash[:meta] = @meta unless @meta.nil?\n hash[:jsonapi] = @jsonapi unless @jsonapi.nil?\n end\n end", "def solr_attributes(prefix = \"\", opts={})\n doc = {}\n return doc if data.nil?\n model.fields.each do |f|\n val = f.sanitize(data[f.to_param])\n if opts[:multivalue]\n f['multivalue'] = true\n end\n if val\n doc[Node.solr_name(f, prefix: prefix)] = val\n doc[Node.solr_name(f, type: 'facet', prefix: prefix)] = val\n end\n end\n doc\n end", "def to_hash\n @document[\"@search.action\"] = \"merge\"\n @document\n end", "def to_solr(solr_doc=Hash.new, opts={})\n\n active_fedora_model_s = solr_doc[\"active_fedora_model_s\"] if solr_doc[\"active_fedora_model_s\"]\n actual_class = active_fedora_model_s.constantize if active_fedora_model_s\n if actual_class && actual_class != self.class && actual_class.superclass == ::FileAsset\n solr_doc\n else\n super(solr_doc,opts)\n end\n end", "def row_to_solr(doc, headers, row)\n headers.each do |column|\n doc.add_child(\"<field name='#{column}'>#{row[column]}</field>\") if row[column]\n end\n return doc\n end", "def get_solr_data(db_entry)\n\n begin\n\n SolrQuery.new.solr_query('id:' + db_entry.entry_id, 'entry_no_tesim, entry_type_tesim, section_type_tesim, continues_on_tesim, summary_tesim, marginalia_tesim, language_tesim, subject_tesim, note_tesim, editorial_note_tesim, is_referenced_by_tesim', 1)['response']['docs'].map do |result|\n\n if result['entry_no_tesim'] != nil\n\n db_entry.id = 1\n\n db_entry.entry_no = result['entry_no_tesim'].join()\n\n entry_type_list = result['entry_type_tesim'];\n\n if entry_type_list != nil\n entry_type_list.each do |tt|\n db_entry_type = DbEntryType.new\n db_entry_type.name = tt\n db_entry.db_entry_types << db_entry_type\n end\n end\n\n section_type_list = result['section_type_tesim'];\n\n if section_type_list != nil\n section_type_list.each do |tt|\n db_section_type = DbSectionType.new\n db_section_type.name = tt\n db_entry.db_section_types << db_section_type\n end\n end\n\n if result['continues_on_tesim'] != nil\n db_entry.continues_on = result['continues_on_tesim'].join()\n end\n\n summary = result['summary_tesim']\n\n if summary != nil\n db_entry.summary = summary.join()\n end\n\n marginalium_list = result['marginalia_tesim'];\n\n if marginalium_list != nil\n marginalium_list.each do |tt|\n db_marginalium = DbMarginalium.new\n db_marginalium.name = tt\n db_entry.db_marginalia << db_marginalium\n end\n end\n\n language_list = result['language_tesim'];\n\n if language_list != nil\n language_list.each do |tt|\n db_language = DbLanguage.new\n db_language.name = tt\n db_entry.db_languages << db_language\n end\n end\n\n subject_list = result['subject_tesim'];\n\n if subject_list != nil\n subject_list.each do |tt|\n db_subject = DbSubject.new\n db_subject.name = tt\n db_entry.db_subjects << db_subject\n end\n end\n\n note_list = result['note_tesim'];\n\n if note_list != nil\n note_list.each do |tt|\n db_note = DbNote.new\n db_note.name = tt\n db_entry.db_notes << db_note\n end\n end\n\n editorial_note_list = result['editorial_note_tesim'];\n\n if editorial_note_list != nil\n editorial_note_list.each do |tt|\n db_editorial_note = DbEditorialNote.new\n db_editorial_note.name = tt\n db_entry.db_editorial_notes << db_editorial_note\n end\n end\n\n is_referenced_by_list = result['is_referenced_by_tesim'];\n\n if is_referenced_by_list != nil\n is_referenced_by_list.each do |tt|\n db_is_referenced_by = DbIsReferencedBy.new\n db_is_referenced_by.name = tt\n db_entry.db_is_referenced_bys << db_is_referenced_by\n end\n end\n\n SolrQuery.new.solr_query('has_model_ssim:EntryDate AND entryDateFor_ssim:' + db_entry.entry_id, 'id, date_role_tesim, date_note_tesim', 100)['response']['docs'].map do |result|\n\n date_id = result['id'];\n\n if date_id != nil\n\n db_entry_date = DbEntryDate.new\n\n db_entry_date.date_id = date_id\n\n db_entry_date.id = 1\n\n SolrQuery.new.solr_query('has_model_ssim:SingleDate AND dateFor_ssim:' + date_id, 'id, date_tesim, date_type_tesim, date_certainty_tesim', 100)['response']['docs'].map do |result2|\n\n single_date_id = result2['id'];\n\n if single_date_id != nil\n\n db_single_date = DbSingleDate.new\n\n db_single_date.single_date_id = single_date_id\n\n db_single_date.id = 1 #single_date_id.gsub(/test:/, '').to_i\n\n date_certainty_list = result2['date_certainty_tesim'];\n\n if date_certainty_list != nil\n date_certainty_list.each do |tt|\n db_date_certainty = DbDateCertainty.new\n db_date_certainty.name = tt\n db_single_date.db_date_certainties << db_date_certainty\n end\n end\n\n date = result2['date_tesim']\n\n if date != nil\n db_single_date.date = date.join()\n end\n\n date_type = result2['date_type_tesim']\n\n if date_type != nil\n db_single_date.date_type = date_type.join()\n end\n\n db_entry_date.db_single_dates << db_single_date\n end\n end\n\n date_role = result['date_role_tesim']\n\n if date_role != nil\n db_entry_date.date_role = date_role.join()\n end\n\n date_note = result['date_note_tesim']\n\n if date_note != nil\n db_entry_date.date_note = date_note.join()\n end\n\n db_entry.db_entry_dates << db_entry_date\n end\n end\n\n SolrQuery.new.solr_query('has_model_ssim:RelatedPlace AND relatedPlaceFor_ssim:\"' + db_entry.entry_id + '\"', 'id, place_same_as_tesim, place_as_written_tesim, place_role_tesim, place_type_tesim, place_note_tesim', 100)['response']['docs'].map do |result|\n\n related_place_id = result['id'];\n\n if related_place_id != nil\n\n db_related_place = DbRelatedPlace.new\n\n db_related_place.place_id = related_place_id\n\n db_related_place.id = 1 #related_place_id.gsub(/test:/, '').to_i\n\n place_same_as = result['place_same_as_tesim']\n\n if place_same_as != nil\n db_related_place.place_same_as = place_same_as.join()\n end\n\n place_as_written_list = result['place_as_written_tesim'];\n\n if place_as_written_list != nil\n place_as_written_list.each do |tt|\n db_place_as_written = DbPlaceAsWritten.new\n db_place_as_written.name = tt\n db_related_place.db_place_as_writtens << db_place_as_written\n end\n end\n\n place_role_list = result['place_role_tesim'];\n\n if place_role_list != nil\n place_role_list.each do |tt|\n db_place_role = DbPlaceRole.new\n db_place_role.name = tt\n db_related_place.db_place_roles << db_place_role\n end\n end\n\n place_type_list = result['place_type_tesim'];\n\n if place_type_list != nil\n place_type_list.each do |tt|\n db_place_type = DbPlaceType.new\n db_place_type.name = tt\n db_related_place.db_place_types << db_place_type\n end\n end\n\n place_note_list = result['place_note_tesim'];\n\n if place_note_list != nil\n place_note_list.each do |tt|\n db_place_note = DbPlaceNote.new\n db_place_note.name = tt\n db_related_place.db_place_notes << db_place_note\n end\n end\n\n db_entry.db_related_places << db_related_place\n end\n end\n\n SolrQuery.new.solr_query('has_model_ssim:RelatedAgent AND relatedAgentFor_ssim:\"' + db_entry.entry_id + '\"', 'id, person_same_as_tesim, person_group_tesim, person_gender_tesim, person_as_written_tesim, person_role_tesim, person_descriptor_tesim, person_descriptor_as_written_tesim, person_note_tesim, person_related_place_tesim, person_related_person_tesim', 100)['response']['docs'].map do |result|\n\n related_agent_id = result['id'];\n\n if related_agent_id != nil\n\n db_related_agent = DbRelatedAgent.new\n\n db_related_agent.person_id = related_agent_id\n\n #related_agent_id.unpack('b*').each do | o | db_related_agent.id = o.to_i(2) end\n db_related_agent.id = 1\n\n person_same_as = result['person_same_as_tesim']\n\n if person_same_as != nil\n db_related_agent.person_same_as = person_same_as.join()\n end\n\n person_group = result['person_group_tesim']\n\n if person_group != nil\n db_related_agent.person_group = person_group.join()\n end\n\n person_gender = result['person_gender_tesim']\n\n if person_gender != nil\n db_related_agent.person_gender = person_gender.join()\n end\n\n person_as_written_list = result['person_as_written_tesim'];\n\n if person_as_written_list != nil\n person_as_written_list.each do |tt|\n db_person_as_written = DbPersonAsWritten.new\n db_person_as_written.name = tt\n db_related_agent.db_person_as_writtens << db_person_as_written\n end\n end\n\n person_role_list = result['person_role_tesim'];\n\n if person_role_list != nil\n person_role_list.each do |tt|\n db_person_role = DbPersonRole.new\n db_person_role.name = tt\n db_related_agent.db_person_roles << db_person_role\n end\n end\n\n person_descriptor_list = result['person_descriptor_tesim'];\n\n if person_descriptor_list != nil\n person_descriptor_list.each do |tt|\n db_person_descriptor = DbPersonDescriptor.new\n db_person_descriptor.name = tt\n db_related_agent.db_person_descriptors << db_person_descriptor\n end\n end\n\n person_descriptor_as_written_list = result['person_descriptor_as_written_tesim'];\n\n if person_descriptor_as_written_list != nil\n person_descriptor_as_written_list.each do |tt|\n db_person_descriptor_as_written = DbPersonDescriptorAsWritten.new\n db_person_descriptor_as_written.name = tt\n db_related_agent.db_person_descriptor_as_writtens << db_person_descriptor_as_written\n end\n end\n\n person_note_list = result['person_note_tesim'];\n\n if person_note_list != nil\n person_note_list.each do |tt|\n db_person_note = DbPersonNote.new\n db_person_note.name = tt\n db_related_agent.db_person_notes << db_person_note\n end\n end\n\n person_related_place_list = result['person_related_place_tesim'];\n\n if person_related_place_list != nil\n person_related_place_list.each do |tt|\n db_person_related_place = DbPersonRelatedPlace.new\n db_person_related_place.name = tt\n db_related_agent.db_person_related_places << db_person_related_place\n end\n end\n\n person_related_person_list = result['person_related_person_tesim'];\n\n if person_related_person_list != nil\n person_related_person_list.each do |tt|\n db_person_related_person = DbPersonRelatedPerson.new\n db_person_related_person.name = tt\n db_related_agent.db_person_related_people << db_person_related_person\n end\n end\n\n db_entry.db_related_agents << db_related_agent\n end\n end\n end\n end\n\n rescue => error\n log_error(__method__, __FILE__, error)\n raise\n end\n\n end", "def build_complex_attributes(document)\n document.identifier = identifier\n document.description = description\n document.access_rights = geo_concern.solr_document.visibility\n end", "def serialize(document)\n super.merge(my_special_key: 'my_special_stuff')\n end", "def to_solr(solr_doc = {}, opts = {})\n super.tap do |doc|\n doc['active_fedora_model_ssi'] = has_model\n end\n end", "def as_index_document()\n doc = {'format'=>'Node', 'title'=> title, 'id' => persistent_id, 'version'=>id, 'model' => model.id, 'model_name' => model.name, 'pool' => pool_id}\n doc.merge!(solr_attributes)\n doc.merge!(solr_associations)\n doc\n end", "def document_hashes(search_args = {})\n return @document_hashes if defined?(@document_hashes)\n @document_hashes = LazySearch.new(@client, @search_definition, search_args)\n end", "def transform_solr\n puts \"transforming #{self.filename}\"\n solr_doc = Nokogiri::XML(\"<add></add>\")\n @csv.each do |row|\n if !row.header_row?\n doc = Nokogiri::XML::Node.new(\"doc\", solr_doc)\n # row_to_solr should return an XML::Node object with children\n doc = row_to_solr(doc, @csv.headers, row)\n solr_doc.at_css(\"add\").add_child(doc)\n end\n end\n # Uncomment to debug\n # puts solr_doc.root.to_xml\n if @options[\"output\"]\n filepath = \"#{@out_solr}/#{self.filename(false)}.xml\"\n # puts \"output #{@out_solr}\"\n File.open(filepath, \"w\") { |f| f.write(solr_doc.root.to_xml) }\n end\n return { \"docs\" => solr_doc.root.to_xml }\n end", "def dissect_to_record_hashes\n end", "def solr_doc_params(id=nil)\n id ||= params[:id]\n # just to be consistent with the other solr param methods:\n {\n :qt => :document,\n :id => id # this assumes the document request handler will map the 'id' param to the unique key field\n }\n end", "def attributes\r\n hash = super\r\n hash.delete('author')\r\n hash.delete('images')\r\n hash[\"document_type\"] = document_type\r\n hash[\"section_name\"] = section_name\r\n hash\r\n end", "def initialize(doc_hash = {})\n @fields = []\n doc_hash.each_pair do |field, values|\n add_field(field, values)\n end\n @attrs={}\n end", "def get_document_details(doc)\n tmp_hash = {}\n tmp_hash[\"id\"] = doc[\"bibid\"]\n tmp_hash[\"location\"] = doc[\"location\"].present? ? doc[\"location\"] : \"\"\n tmp_hash[\"title\"] = doc[\"fulltitle_display\"].present? ? doc[\"fulltitle_display\"] : \"\"\n if doc[\"format\"].present?\n if doc[\"format\"][1].present? and doc[\"format\"][1] == \"Microform\"\n the_format = doc[\"format\"][1]\n else\n the_format = doc[\"format\"][0]\n end\n else\n the_format = \"\"\n end\n # oclc_id and isbn are used to get the images from googlebooks\n oclc_id = doc[\"oclc_id_display\"].present? ? doc[\"oclc_id_display\"][0] : \"\"\n isbn = doc[\"isbn_display\"].present? ? doc[\"isbn_display\"][0].split(\" \")[0] : \"\"\n tmp_hash[\"format\"] = the_format\n tmp_hash[\"pub_date\"] = doc[\"pub_date_display\"].present? ? doc[\"pub_date_display\"] : \"\"\n tmp_hash[\"publisher\"] = doc[\"publisher_display\"].present? ? doc[\"publisher_display\"] : \"\"\n tmp_hash[\"author\"] = doc[\"author_display\"].present? ? doc[\"author_display\"] : \"\"\n tmp_hash[\"availability\"] = doc[\"availability_json\"].present? ? doc[\"availability_json\"] : \"\"\n tmp_hash[\"locations\"] = doc[\"availability_json\"].present? ? process_locations(doc[\"availability_json\"]) : []\n tmp_hash[\"citation\"] = doc[\"cite_preescaped_display\"].present? ? doc[\"cite_preescaped_display\"] : \"\"\n tmp_hash[\"callnumber\"] = doc[\"callnum_display\"].present? ? doc[\"callnum_display\"] : \"\"\n # the difference between these next two: \"internal_class_label\" gets used in the data attribute\n # of some elements, while the \"display_class_label\" gets displayed in the UI and has the added\n # font awesomne html\n classification = doc[\"classification_display\"].present? ? doc[\"classification_display\"] : \"\"\n tmp_hash[\"internal_class_label\"] = build_class_label(classification)\n tmp_hash[\"display_class_label\"] = tmp_hash[\"internal_class_label\"].gsub(' : ','<i class=\"fa fa-caret-right class-caret\"></i>').html_safe\n # tmp_hash[\"img_url\"] = get_googlebooks_image(oclc_isbn[0], oclc_isbn[1], the_format)\n tmp_hash[\"img_url\"] = get_googlebooks_image(oclc_id, isbn, the_format)\n\n return tmp_hash\n end", "def hash\n [searchable_id].hash\n end", "def output_bib_values\n self.truncate_values({\n \"system_id\" => solr_output[\"id\"].first,\n \"title\" => self.title,\n \"creator\" => self.creator,\n \"pub_date\" => self.pub_date,\n \"format\" => self.stacklife_format,\n \"shelfrank\" => self.shelfrank,\n\n \"measurement_page_numeric\" => self.num_pages,\n \"measurement_height_numeric\" => self.height_cm\n })\n end", "def solr_resp_single_doc(doc_id, solr_params = {})\n solr_response(solr_params.merge({'qt'=>'document','id'=>doc_id}))\nend", "def calculate_hash!\n entry_hash = to_hash\n entry_hash['description']=nil\n @hash = entry_hash.hash\n end", "def save_prepared_doc_digest\n d = Hashing.checksum(@prepared_doc)\n set_document_tag(:esignprepdoc, d)\n end", "def solr_unique_doc_query\n \"maxwell_document_id:#{solr_document_id}\"\n end", "def adapt_record(endnote_hash)\n # This will only work with endnote 8\n rec = endnote_hash[:endnote_record]\n\n @id = rec.id\n @title = rec.title\n @alt_title = rec.alt_title\n @pubyear = rec.pubyear\n @abstract = rec.abstract\n @language = rec.language\n @keywords = rec.keywords\n @publisher = rec.publisher\n @place = rec.place\n @patent_applicant = rec.patent_applicant\n @patent_date = rec.patent_date\n @patent_number = rec.patent_number\n @isbn = rec.isbn\n @issn = rec.issn\n @extent = rec.extent\n @sourcetitle = rec.sourcetitle\n @sourcevolume = rec.sourcevolume\n @sourceissue = rec.sourceissue\n @sourcepages = rec.sourcepages\n @article_number = rec.article_number\n @doi = rec.doi\n @doi_url = rec.doi_url\n add_identifier(@doi, 'doi')\n add_identifier(rec.pubmed_id, 'pubmed')\n add_identifier(rec.scopus_id, 'scopus-id')\n add_identifier(rec.extid.split(':').last, 'isi-id')\n add_publication_link(@doi_url, 1)\n @xml = rec.xml\n end", "def to_solr\n @datastreams.each do |key, value|\n if self.respond_to?(\"#{key}_to_solr\")\n self.send(\"#{key}_to_solr\")\n end #if\n end\n \n fulltext_to_solr\n \n return @solr_document\n end", "def hash\n __record_id.hash\n end", "def create!( hash )\n doc = new( hash )\n doc.save!\n end", "def to_object\n doc = {}\n\n doc['isbn'] = record_to_array('020.a')\n doc['issn'] = record_to_array('022.b')\n doc['author'] = record_to_array('100.a')\n doc['edition'] = record_to_array('250.a')\n doc['scale'] = record_to_array('255.a')\n doc['num_pages'] = record_to_array('300.a')\n doc['cite_as'] = record_to_array('524.a')\n doc['add_entry'] = record_to_array('700.a')\n doc['url'] = record_to_array('856.u')\n\n # Publisher, title, series could have multiple fields\n # So just join the arrays together\n\n doc['pub_place'] = record_to_array('260.a') +\n record_to_array('264.a')\n doc['publisher'] = record_to_array('260.b') +\n record_to_array('264.b')\n doc['pub_date'] = record_to_array('260.c') +\n record_to_array('264.c')\n doc['title'] = record_to_array('245.a') +\n record_to_array('245.b')\n doc['series'] = record_to_array('440.a') +\n record_to_array('490.a')\n\n doc\n end", "def build_resource_and_document\n manifest = @resource.iiif_manifests.first # See /models/spotlight/resources/vault_iiif_manifest.rb\n manifest.with_exhibit(@resource.exhibit)\n manifest.with_resource(@resource)\n @resource.data = manifest.manifest_metadata.transform_values { |v| v.first } # We want to index the SolrDocument with a multiple value ({ k => ['v'] }\n end", "def to_mapping\n\n\t\tis_protected_field?\n\n\t\tmapping = nil\n\n\t\t######################### BASIC MAPPING ############################\n\t\tmapping = {\n\t\t\tself.name.to_sym => {\n\t\t\t\t:properties => {\n\t\t \t:content_text => {\n\t\t\t\t\t\t:type => 'text', \n\t\t\t\t\t\t:analyzer => \"standard\",\n\t\t\t\t\t\t:search_analyzer => \"whitespace_analyzer\",\n\t\t\t\t\t\t:copy_to => []\n\t\t\t\t\t},\n\t\t\t\t\t:title_text => {\n\t\t\t\t\t\t:type => 'keyword', \n\t\t\t\t\t\t:fields => {\n\t\t\t\t\t :raw => { \n\t\t\t\t\t \t:type => 'text', \n\t\t\t\t\t\t\t\t:analyzer => \"standard\",\n\t\t\t\t\t\t\t\t:search_analyzer => \"whitespace_analyzer\"\n\t\t\t\t\t }\n\t\t\t\t\t },\n\t\t\t\t\t\t:copy_to => []\n\t\t\t\t\t},\n\t\t\t\t\t:textbook_name => {\n\t\t\t\t\t\t:type => 'keyword', \n\t\t\t\t\t\t:fields => {\n\t\t\t\t\t :raw => { \n\t\t\t\t\t \t:type => 'text', \n\t\t\t\t\t\t\t\t:analyzer => \"standard\",\n\t\t\t\t\t\t\t\t:search_analyzer => \"whitespace_analyzer\"\n\t\t\t\t\t }\n\t\t\t\t\t },\n\t\t\t\t\t\t:copy_to => []\n\t\t\t\t\t}\n\t \t}\n \t}\n\t\t}\n\n\t\t#either you cannot have a field name workup in the components\n\t\t## or whatever. \n\t\t## should raise an error called workup\n\t\t#puts \"mapping becomes first --------------:\"\n\t\t#puts \"commong field mapping ----\"\n\t\t#puts COMMON_FIELD_MAPPING\n\t\t#puts JSON.pretty_generate(mapping) \n\n\t\t######################## MERGE SEARCHABLE AT ROOT DOC ##############\n\t\tmapping[self.name.to_sym][:properties].merge!({\n\t\t\t:searchable => {\n\t\t\t\t:type => \"text\"\n\t\t\t},\n\t\t\t:workup_text => {\n\t\t\t\t:type => \"text\"\n\t\t\t},\n\t\t\t:workup => {\n\t\t\t\t:type => \"keyword\"\n\t\t\t}\n\t\t}) if self.name == \"_doc\"\n\n\t\t#puts \"mapping becomes:\"\n\t\t#puts JSON.pretty_generate(mapping)\n\n\t\t######################## COPY FIELD TO SEARCHABLE IF SEARCHABLE #####\n\t\tunless self.searchable.blank?\n\t\t\t#puts \"this is the mapping\"\n\t\t\t#puts mapping[self.name.to_sym][:properties][:content_text]\n\t\t\tmapping[self.name.to_sym][:properties][:content_text][:copy_to] << \"searchable\"\n\t\tend\n\n\t\t###################### IF CONTAINS_TESTS IS TRUE #####################\n\t\t\t\n\t\tunless self.contains_tests.blank?\n\t\t\t#puts \"name is:#{self.name}, contains tests is: #{self.contains_tests}\"\n\t\t\tif self.contains_tests == true\n\t\t\t\tmapping[self.name.to_sym][:properties][:content_text][:copy_to] << \"workup_text\"\n\t\t\tend\n\t\tend\n\n\t\t####################### SET FIELD TYPE AS NESTED UNLESS ITS ROOT DOC## \n\t\tunless self.name == \"_doc\"\n\t\t\tmapping[self.name.to_sym].merge!(:type => \"nested\") \n\t\tend\n\n\n\t\t###################### CALL PUT MAPPING ON ALL COMPONENTS ############\n\t\tself.components.each do |component|\n\t\t\tmapping[self.name.to_sym][:properties].merge!(component.to_mapping)\n\t\tend\n\n\t\tmapping\n\n\tend", "def solr\n @solr_fields = get_solr_fields\n @solr_info = get_solr_information\n end", "def hash\n [id, url, external_id, first_name, last_name, middle_name, birth_date, gender, language, phone, allow_phone_contact, email, allow_email_contact, notes, date_created, date_modified, ext_date_created, ext_date_modified, doc_type, doc_issuer_info, doc_series, doc_number, department_code, department_name, doc_issue_date, doc_expiration_date, is_closed, merged_to, building_no, city, country_code, country_name, district, flat_no, house_no, region, room_no, settlement_type, street, raw_address, cards, view_url, preferences].hash\n end", "def document_hash\n { :expiration => Time.now.utc + 1.hour,\n :conditions => [\n { :bucket => bucket },\n [ 'starts-with', '$key', storage_dir ],\n { :acl => 'public-read' },\n [ 'starts-with', '$Content-Type', '' ],\n [ 'content-length-range', 0, 524288000 ]\n ]\n }\n end", "def record_fields\n mappings = {}\n\n mappings['identifier'] = self.record.identifier || self.record['identifier']\n mappings['publish'] = self.record['publish']\n mappings['level'] = self.record.level || self.record['level']\n mappings['title'] = strip_mixed_content(self.record['title'])\n mappings['uri'] = self.record.uri || self.record['uri']\n\n resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource\n if resolved_resource\n resource_obj = resolved_resource[self.record['resource']]\n if resource_obj\n mappings['collection_id'] = \"#{resource_obj[0]['id_0']} #{resource_obj[0]['id_1']} #{resource_obj[0]['id_2']} #{resource_obj[0]['id_3']}\".rstrip\n mappings['collection_title'] = resource_obj[0]['title']\n end\n end\n\n resolved_repository = self.record.resolved_repository\n if resolved_repository\n mappings['repo_code'] = resolved_repository['repo_code']\n mappings['repo_name'] = resolved_repository['name']\n end\n\n if record['creators']\n mappings['creators'] = self.record['creators']\n .select { |cr| cr.present? }\n .map { |cr| cr.strip }\n .join(\"; \")\n end\n\n if record.notes\n accessrestrict = record.notes['accessrestrict']\n if accessrestrict\n arSubnotes = accessrestrict['subnotes']\n if arSubnotes\n mappings['accessrestrict'] = arSubnotes\n .select { |arSubnote| arSubnote['content'].present? }\n .map { |arSubnote| arSubnote['content'].strip }\n .join(\"; \")\n end\n end\n end\n\n return mappings\n end", "def set_doc_options_hash\n hash = options_hash :record_id => true\n hash[:type] = :set_doc\n hash[:parameters].select { |p| p[:name] == 'TableName' }.each { |p| p[:name] = 'tableName' }\n hash[:parameters].select { |p| p[:name] == 'RecordID' }.each { |p| p[:name] = 'recordID' }\n hash[:parameters] << {:name => 'docAction'}\n hash\n end", "def base_doc\n @base_doc ||= (\n doc = {\n :format_code_t => 'ead',\n :format_facet => 'Archival Collection Guide',\n :filename_t => @base_filename,\n \n #:unittitle_t => (\n # @xml.at('//archdesc[@level=\"collection\"]/did/unittitle').text rescue\n # @xml.at('//archdesc/did/unittitle').text rescue\n # 'Untitled'\n #),\n \n :institution_t => @xml.at('//publicationstmt/publisher/text()[1]').text.gsub(/\\s+/,\" \").strip,\n :institution_facet => @xml.at('//repository//corpname').children.first.text.gsub(/\\s+/,\" \").strip,\n :language_facet => self.languages,\n :rights_facet => self.rights_facet, \n :rights_t => self.rights_text,\n :hierarchy_scope => self.collection_id,\n :collapse_collection_id => self.collection_id,\n :collection_id => self.collection_id,\n :collection_facet => \"Northwest Digital Archives EAD Guides\",\n :availability_facet => \"Not online. Must visit contributing institution.\",\n :abstract_t => (@xml.at('//archdesc/did/abstract').text rescue nil),\n :text => []\n \n }\n \n # write values to :text to make them searchable\n # NOTE: isn't this already happening via copyField in the solr schema?\n doc[:text] << doc[:title_t] << doc[:institution_t] << doc[:collection_facet]\n \n doc\n )\n end", "def to_db_hash\n super.merge(\n {\n 'text' => @text,\n 'url' => @url\n }\n )\n end", "def scrub_hash(record)\n raise NotImplementedError\n end", "def record_fields\n mappings = {}\n if log_record?\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \"Mapping Record: #{self.record}\" }\n end\n\n mappings['identifier'] = self.record.identifier || self.record['identifier']\n mappings['publish'] = self.record['publish']\n mappings['level'] = self.record.level || self.record['level']\n mappings['title'] = strip_mixed_content(self.record['title'])\n mappings['uri'] = self.record.uri || self.record['uri']\n\n resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource\n if resolved_resource\n resource_obj = resolved_resource[self.record['resource']]\n if resource_obj\n collection_id_components = [\n resource_obj[0]['id_0'],\n resource_obj[0]['id_1'],\n resource_obj[0]['id_2'],\n resource_obj[0]['id_3']\n ]\n\n mappings['collection_id'] = collection_id_components\n .reject {|id_comp| id_comp.blank?}\n .join('-')\n\n mappings['collection_title'] = resource_obj[0]['title']\n end\n end\n\n resolved_repository = self.record.resolved_repository\n if resolved_repository\n mappings['repo_code'] = resolved_repository['repo_code']\n mappings['repo_name'] = resolved_repository['name']\n end\n\n if self.record['creators']\n mappings['creators'] = self.record['creators']\n .select { |cr| cr.present? }\n .map { |cr| cr.strip }\n .join(\"; \")\n end\n\n if self.record.dates\n mappings['date_expression'] = self.record.dates\n .select{ |date| date['date_type'] == 'single' or date['date_type'] == 'inclusive'}\n .map{ |date| date['final_expression'] }\n .join(';')\n end\n\n if (self.record.notes['userestrict'])\n mappings['userestrict'] = self.record.notes['userestrict']\n .map { |note| note['subnotes'] }.flatten\n .select { |subnote| subnote['content'].present? and subnote['publish'] == true }\n .map { |subnote| subnote['content'] }.flatten\n .join(\"; \") \n end\n \n mappings\n end", "def process_result(doc)\n entry = {}\n\n source = {}\n source = doc['_source'] if doc['_source']\n\n @es_fields.each do |field|\n # default empty value\n entry[field] = ''\n\n case field\n when :id\n entry[:id] = doc['_id'] if doc['_id']\n when :lang\n entry[:lang] = source['lang'] if source['lang']\n when :url\n entry[:url] = source['url'] if source['url']\n when :site\n if source['site'] && source['site'].is_a?(Array) \\\n && !source['site'].empty?\n\n # adjust to 2 different 'site' configurations\n if source['site'][0].include?('.')\n entry[:site] = source['site'][0]\n else\n entry[:site] = source['site'].join('.')\n end\n end\n when :keywords\n if source['keywords'] && source['keywords'].is_a?(Array) \\\n && !source['keywords'].empty?\n\n entry[:keywords] = source['keywords'].select{|word| word.size < 30 }\n entry[:keywords] = entry[:keywords].uniq.join(' ')\n end\n when :title\n entry[:title] = source['title'] if source['title']\n when :description\n entry[:description] = source['description'] if source['description']\n when :content\n entry[:content] = source['content'] if source['content']\n when :content_analyzed\n # recover array of [word, stem, pos]\n if source['content_analyzed']\n nlp = source['content_analyzed']\n entry[:content_nlp] = Xi::ML::Tools::Formatter.words_from_nlp(nlp)\n end\n else\n @logger.warn(\"Unknown requested field '#{field}'. \"\\\n 'You should add a new feature to the gem. '\\\n 'Otherwise it will always be empty')\n end\n end\n\n # store only contents of minimum '@min_nchars' characters\n if entry[:content].size < @min_nchars\n entry[:content] = ''\n return entry\n end\n\n # keep a reference content for content duplicate detection\n entry[:raw_content] = entry[:content]\n\n # include words from url, title and keywords into content\n # when present in the es_fields argument\n words = []\n\n if entry[:url] && !entry[:url].nil? && !entry[:url].empty?\n url = Unicode.downcase(entry[:url])\n words.concat(Xi::ML::Tools::Formatter.words_from_url(url).split())\n end\n\n if entry[:title] && !entry[:title].empty?\n title = Unicode.downcase(entry[:title])\n words.concat(title.split())\n end\n\n if entry[:keywords] && !entry[:keywords].empty?\n keywords = Unicode.downcase(entry[:keywords])\n words.concat(keywords.split())\n end\n\n unless words.empty?\n words.uniq!\n entry[:content] << ' ' << words.join(' ')\n end\n\n # replace possible 'new line' characters with a dot\n entry[:content].gsub!(/\\n\\r/, '. ')\n entry[:content].gsub!(/\\n/, '. ')\n\n # return processed entry\n entry\n end", "def save_base_attributes(record)\n self.document_type = record.class.name.underscore\n self.document_id = record.id\n if record.embedded_one?\n base_record = {}\n record.relations.each_value do |relation|\n if relation.macro == :embedded_in\n base_class_name = relation.key\n base_record = record.send base_class_name.to_sym\n end\n end\n self.base_document_type = base_record.class.name.underscore\n self.base_document_id = base_record.id\n end\n # Sets base document_id if this record is the base/parent document\n self.base_document_type ||= self.document_type\n self.base_document_id ||= self.document_id\n end", "def solr_params\n {\n fq: \"collection_code:#{collection_code}\",\n rows: 100\n }\n end", "def add_solr_fields_to_query(solr_params)\n solr_params['qf'] = 'title_tesim'\n solr_params['fl'] = 'id, title_tesim'\n end", "def create_hash\n require 'digest/md5'\n digest_string = [self.id, self.url, self.referrer, self.created_at].join(\"\")\n self.record_hash = Digest::MD5.hexdigest(digest_string)\n end", "def initialize(record)\n @xml = record\n @doc = {}\n @doc[:id] = self.getID\n self.getFormatFacet\n self.getTitle\n self.getDescription\n\n @doc[:collection_facet] = \"City of Pullman Collection\"\n \n self.getImages\n self.getSubjects\n # self.getGeographicSubjects\n self.getPublisherFacet\n self.getLanguageFacet\n # self.storeRecord\n @doc\n end", "def attribute_hash\n build_literals(strip_tsim(solr_document.select do |k, _v|\n k.end_with?(\"tsim\")\n end))\n end", "def solr_id\n \"#{self.class.name}:#{record_id(self)}\"\n end", "def solr_document_id\n \"#{self.class.class_name.underscore.downcase}-#{self.id}\"\n end", "def duplicate_document(source)\r\n dest = {}\r\n source.attribute_names.each do |attribute_name|\r\n next if attribute_name == '_id' # don't duplicate _id\r\n# if duplicate, string must be added. Useful for unique attributes\r\n add_duplicate = params['dup_fields'].to_s.match(attribute_name + ',')\r\n dest[attribute_name] = source[attribute_name]\r\n dest[attribute_name] << ' dup' if add_duplicate\r\n end\r\n# embedded documents\r\n source.embedded_relations.keys.each do |embedded_name|\r\n next if source[embedded_name].nil? # it happens\r\n dest[embedded_name] = []\r\n source[embedded_name].each do |embedded|\r\n dest[embedded_name] << duplicate_embedded(embedded)\r\n end\r\n end\r\n dest\r\nend", "def clean_document(hash)\n hash.delete_if do |_k, v|\n begin\n v.nil? || v.empty?\n rescue\n false\n end\n end\n end", "def set_searchable_fields\n NUMBER_TO_OBJECT_MAP.each do |num, object|\n @searchable_fields[num] = object.column_names - ['id']\n end\n \n @searchable_fields.each do |key, _|\n @searchable_fields[key] += ['_id', 'tags']\n end\n\n @searchable_fields['1'] << 'domain_names'\n end", "def build_document_hash\n # Generate the base version keys for the doc_hash by gobbing all files and folders in the base directory. This means that any folder in the base directory will be treated as a version when being migrated. **You must have at least one version folder**.\n Dir.glob(\"*.*.*\").each {|version| GuidesGenerator::Parser::doc_hash[version] = {};}\n\n # With the version added to the base level of the `doc_hash` now we recursively generate the document structure for each version.\n GuidesGenerator::Parser::doc_hash.each {|version, hash| add_files_and_sections(version, hash);} \n end", "def js_record_data\n record.to_hash(fields).merge(:_meta => meta_field).literalize_keys\n end", "def create\n @document = Document.new(params[:document])\n @document.stuffing_data = []\n @document.user = current_user\n\n #Hack for now - add all column keys to primary keys for search\n @document.stuffing_primary_keys = get_data_colnames(@document.stuffing_data)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "def index_format_info(solr_doc)\n Solrizer.insert_field(solr_doc, 'object_type', object.human_readable_type, :facetable)\n\n\n #Solrizer.insert_field(solr_doc, 'object_type', model_s, :facetable) if model_s\n #Solrizer.insert_field(solr_doc, 'object_type', model_s, :symbol) if model_s\n\n\n # At this point primary classification is complete but there are some outlier cases where we want to\n # Attribute two classifications to one object, now's the time to do that\n ##,\"info:fedora/cm:Audio.OralHistory\",\"info:fedora/afmodel:TuftsAudioText\" -> needs text\n ##,\"info:fedora/cm:Image.HTML\" -->needs text\n #if [\"info:fedora/cm:Audio\",\"info:fedora/afmodel:TuftsAudio\",\"info:fedora/afmodel:TuftsVideo\"].include? model\n # unless self.datastreams['ARCHIVAL_XML'].dsLocation.nil?\n # Solrizer.insert_field(solr_doc, 'object_type', 'Text', :facetable)\n # Solrizer.insert_field(solr_doc, 'object_type', 'Text', :symbol)\n # end\n #end\n end", "def normalize_fields\n new_fields = CICPHash.new\n fields.each do |key, value|\n new_fields[key] = ApeItem.create(key, value).normalize_encodings\n end\n @fields = new_fields\n end" ]
[ "0.7082318", "0.69476336", "0.6747126", "0.6719643", "0.6717518", "0.667712", "0.6670328", "0.6646686", "0.66464996", "0.66441804", "0.6585215", "0.64996094", "0.63885593", "0.6387329", "0.6360765", "0.6356486", "0.6320859", "0.6257694", "0.6251336", "0.6198756", "0.6195765", "0.6163596", "0.6159318", "0.61558765", "0.61065066", "0.6044675", "0.6002498", "0.5950714", "0.5939619", "0.5935706", "0.5894488", "0.58835554", "0.5861285", "0.58363116", "0.57982737", "0.57936805", "0.5785958", "0.57853484", "0.5780891", "0.5780891", "0.57483286", "0.57152426", "0.5668306", "0.56536317", "0.5641657", "0.5640023", "0.56389797", "0.56320906", "0.5620443", "0.5619978", "0.56149316", "0.5570986", "0.5543534", "0.5539382", "0.5534314", "0.55334204", "0.55284", "0.55229604", "0.550166", "0.5487978", "0.54818624", "0.54475147", "0.5441034", "0.5439101", "0.5417473", "0.540965", "0.5401809", "0.53989047", "0.5394593", "0.5385152", "0.53728217", "0.5369876", "0.5335488", "0.5324971", "0.5322046", "0.5313084", "0.5312548", "0.52961224", "0.5281188", "0.5279935", "0.52425605", "0.5226315", "0.521578", "0.5213729", "0.5205157", "0.5201293", "0.51947916", "0.5189161", "0.5185105", "0.5179939", "0.51782656", "0.5169401", "0.5168422", "0.5157743", "0.5150355", "0.5148536", "0.51364446", "0.5133732", "0.5123776", "0.51210576" ]
0.6798209
2
Updates the record in the Solr index
def update_index self.reload SearchIndex.update_record(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_index\n if should_be_in_index?\n mapper.process_with([record]) do |context|\n writer.put(context)\n end\n else\n writer.delete(record.send(Kithe.indexable_settings.solr_id_value_attribute))\n end\n end", "def update_index\n SolrService.add(to_solr, softCommit: true)\n end", "def reindex!\n logger.debug \"Updating #{self.name} (#{self.id}) to Solr directly...\"\n indexed if generate_solr_index\n end", "def update\n respond_to do |format|\n @record.user_email = current_user.email\n if @record.update(record_params)\n add_to_solr(@record)\n #format.html {redirect_to @record, notice: 'Record was successfully updated.'}\n format.html {redirect_to :controller => 'catalog', action: \"show\", id: @record.id}\n format.json {render :show, status: :ok, location: @record}\n else\n format.html {render :edit}\n format.json {render json: @record.errors, status: :unprocessable_entity}\n end\n end\n end", "def save(params={})\n\n user=params[:user] || nil # currently logged in user, needed for some updates\n commit=params[:commit].nil? ? true : params[:commit] # if solr document should be committed immediately, defaults to true\n\n if valid?\n\n updates_for_solr=[] # an array of hashes for the solr updates we will post to solr\n\n unsaved_edits.each do |solr_field_name,value|\n\n old_values=self[solr_field_name]\n\n self.class.blank_value?(value) ? remove_field(solr_field_name,commit) : set_field(solr_field_name,value,commit) # update solr document on server by issuing update queries\n\n # THIS CODE BELOW REPLACES THE LINE ABOVE AND IS THE CODE TO BULK UPDATE A SOLR DOC WITH ALL CHANGES AT ONCE ON SAVE, INSTEAD OF SENDING MANY QUERIES\n # SEE COMMIT d90da58f28b6c815e8eb1c2c92650a585c21ec4a\n # IT SEEMS TO SOMETIMES BE SENDING BLANK DOCS THOUGH, SO I AM REVERTING BACK TO THE OLD WAY FOR NOW\n # SEE THE CALL TO BATCH_UPDATE BELOW, WHICH IS COMMENTED OUT\n # JULY 9, 2015\n # if self.class.blank_value?(value)\n # execute_callbacks(solr_field_name,nil)\n # updates_for_solr << {:field=>solr_field_name,:operation=>'remove'}\n # else\n # execute_callbacks(solr_field_name,self.class.to_array(value))\n # updates_for_solr << {:field=>solr_field_name,:operation=>'set',:new_values=>value}\n # end\n\n self[solr_field_name]=value # update in memory solr document so value is available without reloading solr doc from server\n\n # get the solr field configuration for this field\n solr_field_config=self.class.field_mappings.collect{|key,value| value if value[:field]==solr_field_name.to_s}.reject(&:blank?).first\n\n # update Editstore database too if needed\n if self.class.use_editstore && (solr_field_config[:editstore].nil? || solr_field_config[:editstore] == true)\n\n if self.class.blank_value?(value) && !self.class.blank_value?(old_values) # the new value is blank, and the previous value exists, so send a delete operation\n\n send_delete_to_editstore(solr_field_name,'delete value')\n\n elsif !self.class.blank_value?(value) # there are some new values\n\n new_values=self.class.to_array(value) # ensure we have an array, even if its just one value - this makes the operations below more uniform\n\n if !self.class.blank_value?(old_values) # if a previous value(s) exist for this field, we either need to do an update (single valued), or delete all existing values (multivalued)\n if old_values.class == Array # field is multivalued; delete all old values (this is because bulk does not pinpoint change values, it simply does a full replace of any multivalued field)\n send_delete_to_editstore(solr_field_name,'delete all old values in multivalued field')\n send_creates_to_editstore(new_values,solr_field_name)\n elsif # old value was single-valued, change operation\n send_update_to_editstore(new_values.first,old_values,solr_field_name)\n end\n else # no previous old values, so this must be an add\n send_creates_to_editstore(new_values,solr_field_name)\n end # end check for previous old values\n\n end # end check for new values being blank\n\n end # end send to editstore\n\n end # end loop over all unsaved changes\n\n # send updates to solr\n # THIS IS THE CODE TO BULK UPDATE A SOLR DOC WITH ALL CHANGES AT ONCE ON SAVE, INSTEAD OF SENDING MANY QUERIES\n # IT SEEMS TO SOMETIMES BE SENDING BLANK DOCS THOUGH, SO I AM REVERTING BACK TO THE OLD WAY FOR NOW\n #batch_update(updates_for_solr,commit) if updates_for_solr.size > 0 # check to be sure we actually have some updates to apply\n\n @unsaved_edits={}\n @dirty=false\n return true\n\n else # end check for validity\n\n return false\n\n end\n\n end", "def update\n check_fields\n sql = \"UPDATE #{table} SET #{to_update_record_str} WHERE id=#{@id}\"\n Database.transaction(sql)\n @log.debug \"Record[#{self}] is updated on Table[#{table}]\"\n end", "def update\n save_doc\n end", "def update_record\n record = Query.new(table)\n .index(primary_index[:name])\n .index_segments(primary_index_segments)\n .eq\n\n record.with_write_lock! do\n @dirty_attributes.each do |key, _|\n record.set_field(key, @attributes[key])\n end\n record.write!\n end\n\n @new_record, @dirty_attributes = false, {}\n return true\n end", "def update\n @lesson_learned = LessonLearned.find(params[:id])\n\n respond_to do |format|\n if @lesson_learned.update_attributes(params[:lesson_learned])\n # Now index it in Solr\n @rsolr.add(:id=>@lesson_learned.id,\n :lesson_date=>@lesson_learned.lessonDate.to_s + 'T00:00:00Z',\n :project_reference=>@lesson_learned.projectReference,\n :project_engineer=>@lesson_learned.projectEngineer,\n :project_architect=>@lesson_learned.projectArchitect,\n :project_owner=>@lesson_learned.projectOwner,\n :division=>@lesson_learned.division,\n :text=>@lesson_learned.input)\n @rsolr.commit\n\n format.html { redirect_to @lesson_learned, notice: 'Lesson learned was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lesson_learned.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(record)\n result = self.class.put(worksheet_url + \"/\" + record.id,\n :body => { \"fields\" => record.fields_for_update }.to_json,\n :headers => { \"Content-type\" => \"application/json\" }).parsed_response\n if result.present? && result[\"id\"].present?\n record.override_attributes!(result_attributes(result))\n record\n else # failed\n false\n end\n end", "def _update_record(options = {})\n super\n update_index if update_needs_index? && options.fetch(:update_index, true)\n true\n end", "def immediate_update(field_name,new_value,params={})\n ignore_editstore=params[:ignore_editstore] || false\n if self.class.blank_value?(new_value)\n immediate_remove(field_name)\n else\n update_solr(field_name,'set',new_value)\n send_update_to_editstore(new_value,self[field_name],field_name) if (self.class.use_editstore && !ignore_editstore)\n self[field_name]=new_value\n end\n end", "def update_solr_score\n Geomonitor.update_by_id id: name, score: recent_status_score\n end", "def update\r\n end", "def update\n\t\t\n\t\tend", "def reindex!\n indexed if generate_solr_index\n end", "def update\n\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end", "def update_document(*args, request_record: nil)\n # defined in ActiverecordReindex::ReflectionReindex\n update_document_hook(request_record)\n\n original_update_document(*args)\n end", "def update_record(table, values, org_key = nil)\n update table_update_query(table, values, org_key)\n end", "def update!(**args)\n @field_name = args[:field_name] if args.key?(:field_name)\n @index = args[:index] if args.key?(:index)\n end", "def update\n\n end", "def update\n put :update\n end", "def update \n end", "def update!(**args)\n @record = args[:record] if args.key?(:record)\n end", "def update\n\t\tend", "def update\n\t\tend", "def update\n puts \"Updating the following URL in the index: #{url}\".yellow\n keywords = nil\n title = nil\n update_attributes!(:title => title,\n :keywords => keywords,\n :updated_at => Time.now)\n\n end", "def update_field(key,field,value)\n request :put, \"#{path_prefix}records/#{ue key}?field=#{ue field}\",\n :body => value,\n :content_type => \"application/octet-stream\"\n end", "def post_to_solr(params,commit=true)\n url=\"#{Blacklight.default_index.connection.options[:url]}/update?commit=#{commit}\"\n RestClient.post url, params,:content_type => :json, :accept=>:json\n end", "def update_status\n doc_id = params[:id]\n new_status = params[:new_status]\n doc = Typewright::Document.find_by_id(doc_id)\n old_status = doc.status\n doc.status = new_status\n if !doc.save\n render :text => doc.errors, :status => :error\n return\n end\n\n # need special behavior to handle documents that are complete\n # kick off new logic to grab corrected text, and send it to catalog for\n # re-indexing\n if new_status == 'complete'\n # grab corrected text\n fulltext = Typewright::Overview.retrieve_doc(doc.uri, \"text\")\n\n # get the solr object for this document\n solr = Catalog.factory_create(false)\n solr_document = solr.get_object(doc.uri)\n\n # update the important bits\n solr_document['text'] = fulltext\n solr_document['has_full_text'] = \"true\"\n json_data = ActiveSupport::JSON.encode( solr_document )\n\n # POST the corrected full text to the catalog so it will be\n # stored there and the results reproducable on the next reindex\n catalog_url = \"#{URI.parse(Setup.solr_url())}/corrections\"\n private_token = SITE_SPECIFIC['catalog']['private_token']\n\n begin\n resp = RestClient.post catalog_url, json_data, :'private_token' => private_token, :content_type => \"application/json\"\n Catalog.reset_cached_data()\n render :text => \"OK\", :status => :ok\n rescue RestClient::Exception => rest_error\n puts rest_error.response\n doc.status = old_status\n doc.save\n render :text => rest_error.response, :status => rest_error.http_code\n rescue Exception => e\n puts rest_error.response\n doc.status = old_status\n doc.save\n render :text => e, :status => :internal_server_error\n end\n else\n render :text => \"OK\", :status => :ok\n end\n end", "def update\r\n\r\n end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update_document(fields, safe = false)\n collection.update({\"_id\" => self.id}, fields, :safe => safe)\n reload\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update_solr(field_name,operation,new_values,commit=true)\n params=\"[{\\\"id\\\":\\\"#{id}\\\",\\\"#{field_name}\\\":\"\n if operation == 'add'\n params+=\"{\\\"add\\\":\\\"#{new_values.gsub('\"','\\\"')}\\\"}}]\"\n elsif operation == 'remove'\n params+=\"{\\\"set\\\":null}}]\"\n else\n new_values=[new_values] unless new_values.class==Array\n new_values = new_values.map {|s| s.to_s.gsub(\"\\\\\",\"\\\\\\\\\\\\\").gsub('\"','\\\"').strip} # strip leading/trailing spaces and escape quotes for each value\n params+=\"{\\\"set\\\":[\\\"#{new_values.join('\",\"')}\\\"]}}]\"\n end\n post_to_solr(params,commit)\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update ; end", "def update \n end", "def reindex\n Sunspot.index!\n # puts 'reindexed'\n end", "def update\n \n end", "def update!(**args)\n @indexed = args[:indexed] if args.key?(:indexed)\n @submitted = args[:submitted] if args.key?(:submitted)\n @type = args[:type] if args.key?(:type)\n end", "def update\n fail_on_type_mismatch(data_params[:type])\n\n assign_record_attributes(queried_record, permitted_params_for(:update), data_params)\n\n execute_before_update_callbacks(queried_record)\n execute_before_save_callbacks(queried_record)\n\n fail RecordInvalidError.new(queried_record, engaged_field_aliases) if queried_record.errors.any?\n\n queried_record.save!\n\n execute_after_update_callbacks(queried_record)\n execute_after_save_callbacks(queried_record)\n\n render(\n json: queried_record,\n fields: query_params[:fields],\n include: query_params[:include]\n )\n end", "def add_doc_to_ix(solr_input_doc, id)\n unless solr_input_doc.nil?\n begin\n @streaming_update_server.add(solr_input_doc)\n @logger.info(\"updating Solr document #{id}\") \n rescue org.apache.solr.common.SolrException => e \n @logger.error(\"SolrException while indexing document #{id}\")\n @logger.error(\"#{e.message}\")\n @logger.error(\"#{e.backtrace}\")\n end\n end\n end", "def update\n record.assign_attributes(data)\n record.save! if record.changed?\n end", "def update\n\n\tend" ]
[ "0.7390287", "0.73272127", "0.7111259", "0.6950299", "0.68402314", "0.6805661", "0.6727868", "0.6717224", "0.6645422", "0.6588524", "0.65406764", "0.6476195", "0.6440991", "0.64143896", "0.638688", "0.6378034", "0.63408524", "0.6333589", "0.6333589", "0.6333589", "0.6333589", "0.63291883", "0.6316088", "0.6294692", "0.62822115", "0.6260091", "0.62598926", "0.62596685", "0.62573385", "0.62573385", "0.6253306", "0.62473255", "0.6221522", "0.62165356", "0.6210054", "0.6209454", "0.6209454", "0.6209454", "0.6209454", "0.6209454", "0.6209454", "0.6209454", "0.6209454", "0.6205698", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6202798", "0.6201331", "0.62002575", "0.62002575", "0.62002575", "0.62002575", "0.62002575", "0.62002575", "0.62002575", "0.62002575", "0.62002575", "0.62002575", "0.62002575", "0.61932045", "0.6188953", "0.61684674", "0.61598426", "0.6158179", "0.61527246", "0.61510056", "0.6142486", "0.6140504" ]
0.6466994
13
Remove the record from the Solr index
def delete_from_index SearchIndex.delete_record(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n remove_from_solr(@record.id)\n @record.destroy\n respond_to do |format|\n format.html {redirect_to records_url, notice: 'Record was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def immediate_remove(field_name,params={})\n ignore_editstore=params[:ignore_editstore] || false\n update_solr(field_name,'remove',nil)\n send_delete_to_editstore(field_name) if (self.class.use_editstore && !ignore_editstore)\n self[field_name]=nil\n end", "def remove_record(record)\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record,record.id)\n\n @storage.remove(atoms)\n end", "def remove_record(record)\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record,record.id)\n\n @storage.remove(atoms)\n end", "def unindex(obj)\n XapianDb.database.delete_doc_with_unique_term(obj.xapian_id)\n XapianDb.database.commit\n end", "def remove_record(record)\n atoms = condense_record(record)\n load_atoms(atoms)\n atoms.each do |a|\n @atoms[a].remove_record(record.id) if @atoms.has_key?(a)\n @records_size -= 1\n #p \"removing #{record.id} from #{a}\"\n end\n end", "def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end", "def update_index\n if should_be_in_index?\n mapper.process_with([record]) do |context|\n writer.put(context)\n end\n else\n writer.delete(record.send(Kithe.indexable_settings.solr_id_value_attribute))\n end\n end", "def destroy\n @lesson_learned = LessonLearned.find(params[:id])\n @lesson_learned.destroy\n\n # Now remove it from Solr\n @rsolr.delete_by_id(@lesson_learned.id)\n @rsolr.commit\n\n respond_to do |format|\n format.html { redirect_to lesson_learneds_url }\n format.json { head :no_content }\n end\n end", "def delete\n RecordsSearch.where(search_id:self[:id]).delete\n super\n end", "def rm_index(entity, field, value)\n return false unless index?(field)\n #return value.each {|x| rm_index(entity, field, x)} if value.respond_to?(:each)\n index_for_field(field).remove(entity, field, value)\n end", "def solr_delete(solr_id)\n Solarize::Post.execute(Solr::Request::Delete.new(:id => solr_id))\n end", "def remove\n \n \n Document.destroy(self.document_id)\n self.destroy\n \n end", "def remove doc_id\n # Get the id if passes a Document object\n doc_id = doc_id.doc_id if doc_id.respond_to? :doc_id\n ensure_connection!\n resp = connection.delete_doc index_id, doc_id\n return true if resp.success?\n fail ApiError.from_response(resp)\n end", "def delete_from_cloud_search\n self.class.cloud_search_delete_document(\n self.cloud_search_document\n )\n end", "def delete(record)\n record.del\n end", "def remove_field(field_name,commit=true)\n update_solr(field_name,'remove',nil,commit)\n execute_callbacks(field_name,nil)\n end", "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", "def delete_from_index\n begin\n __elasticsearch__.delete_document\n rescue Elasticsearch::Transport::Transport::Errors::NotFound\n nil\n end\n\n index_dependent_models.map(&:update_in_index)\n end", "def remove(remove_me)\n @index_driver.remove(remove_me)\n end", "def delete_record!(record)\n record.public_send(inventory_collection.delete_method)\n inventory_collection.store_deleted_records(record)\n end", "def delete record\n db_name = database_name_for(record)\n coll_name = collection_name_for(record)\n case\n when id = id_for(record)\n pointer = \"/#{db_name}/#{coll_name}/#{id}\"\n res = collection_for(record).remove({:_id => id})\n if res[\"err\"]\n log.error(res[\"err\"])\n else\n log.debug(\"Deleted #{pointer}\")\n end\n when query = delete_query_for(record)\n pointer = \"/#{db_name}/#{coll_name}\"\n res = collection_for(record).remove(query)\n if res[\"err\"]\n log.error(res[\"err\"])\n else\n log.debug(\"Deleted #{res['n']} records from #{pointer}\")\n end\n end\n end", "def delete_from_index\n mapping_name = self.class.instance_variable_get(:@_mapping_name)\n\n ElasticMapper.index.type(mapping_name).delete(self.id)\n end", "def remove\n @object = find_or_goto_index(GlossaryTerm, params[:id].to_s)\n return unless @object\n\n return if check_permission!(@object)\n\n redirect_with_query(glossary_term_path(@object.id))\n end", "def destory_search_term\n \t\tcurrent_user.searches.and({:search_term =>params[:searchterm]},{:type=>\"question\"}).first.destroy\n \tend", "def cloud_search_delete_document(doc)\n doc.version += 1\n self.cloud_search_batcher_command(:delete_document, doc)\n end", "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def delete_current\n @deleted_entries.set(@record_index)\n end", "def remove_record(record_id)\n @records.delete(record_id)\n end", "def destroy\n\t\t@student = Student.find(params[:id])\n#\t\tredirect_to(@student, :notice => 'NOTICE: During initial testing, the deletion of students has been turned off.')\n#\t\treturn\n\t\tBrowse.student_changed(nil, @student)\n\t\tsolr().remove_object(@student.to_solr())\n\t\[email protected]_references()\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to({:controller => 'admin', :action => 'index'}) }\n\t\tend\n\tend", "def delete\n self.store -= self\n end", "def delete_all\n solr.delete_by_query('*:*')\n solr.commit\n end", "def rm_index(*fields)\n @rm_indexed_field = fields\n end", "def remove\n if @raw\n @raw.remove(:force => true) if @raw.exist?(@raw.id)\n end\n end", "def destroy\n result = database.delete_doc self\n if result['ok']\n self['_rev'] = nil\n self['_id'] = nil\n end\n result['ok']\n end", "def remove_document(doc)\n @documents.delete_if{|document| document == doc }\n end", "def remove\r\n self.update(deleted: true)\r\n end", "def remove(*vars)\n return unless instance.flex_indexable?\n Flex.remove(metainfo, *vars)\n end", "def remove\n valid = parse_valid(params)\n # puts valid\n choose = $db.search(\"//book[\"+valid+\"]\").remove\n size = 0\n for i in choose\n size += 1\n end\n $file = open PATH, \"w\"\n $file.write $db\n $file.close\n render :soap => \"<result>\"+size.to_s+\"</result>\"\n end", "def remove(index)\n end", "def remove\n __flag__ :remove\n end", "def remove_page\n @page = Page.find(params[:id])\n @document = @page.document\n\n @page.move_to_new_document\n\n end", "def deleteRecord(position, searchTerm)\n # add code here to delete a line from the csv file\n readFile # call the method to read the content of the file\n holder = @fileContent.find{|person| person[position] =~/#{searchTerm}/} # locate the record in the csv file\n @fileContent.delete(holder) # remove the identified record from the @fileContent array\n writeFile # write the content of @fileContent array back to the csv file\n end", "def remove(entry); end", "def remove\n\t\t\tself.make_request!({uri: self.to_uri, method: :delete})\n\t\tend", "def remove!\n self.results.each{ |r| r.remove! }\n self.metadata.remove!\n end", "def remove_page\n\n @page = Page.find(params[:id])\n @[email protected]\n\n @page.move_to_new_document\n\n end", "def remove_search search\n search = normalize search\n @searches.delete search.to_s\n @search_objects.delete search.to_s\n end", "def delete_row lb # {{{\n index = lb.current_index\n id = lb.list[lb.current_index].first\n lb.list().delete_at(index)\n lb.touch\n ret = @db.execute(\"UPDATE #{@tablename} SET status = ? WHERE rowid = ?\", [ \"x\", id ])\nend", "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", "def delete(id)\n logger.debug(\"#{self.class.name}: Sending delete to Solr for #{id}\")\n\n json_package = {delete: id}\n resp = @http_client.post solr_update_url_with_query(@solr_update_args), JSON.generate(json_package), \"Content-type\" => \"application/json\"\n if resp.status != 200\n raise RuntimeError.new(\"Could not delete #{id.inspect}, http response #{resp.status}: #{resp.body}\")\n end\n end", "def remove\t\n\t\t\tbegin\t\t\t\t\t\t\t\n\t\t\t\tdatatoremove = Datastore.new\t\t\t\n\t\t\t\tdatatoremove.delete(params[:key])\n\t\t\t\trender :status => 200,\n\t \t\t:json => { :response => \"success\",\n\t \t :status => 200,\n\t \t :info => \"Successfully removed\", \n\t \t :data => {} }\n\t\t\trescue Exception => e\n\t\t\t\trender :status => :unprocessable_entity,\n\t \t :json => { :response => \"fail\",\n\t \t :status => 401,\n\t :info => e.message }\n\t\t\tend\n\t\tend", "def remove\n @object = find_or_goto_index(Observation, params[:id].to_s)\n return unless @object\n\n return if check_permission!(@object)\n\n redirect_with_query(permanent_observation_path(@object.id))\n end", "def remove(record, zone)\n record_fqdn = record.fqdn.sub(/\\.$/, '')\n\n existing_record = client.record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type\n )\n return if existing_record.nil?\n\n pruned_answers = existing_record['answers']\n .map { |answer| symbolize_keys(answer) }\n .reject { |answer| answer[:answer] == build_api_answer_from_record(record) }\n\n if pruned_answers.empty?\n client.delete_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type\n )\n return\n end\n\n client.modify_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: { answers: pruned_answers }\n )\n end", "def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end", "def remove!; end", "def delete(thing)\n if thing.is_a? Integer\n @index = @index.delete_if {|idx| idx.r_id == thing }\n @records = @records.delete_if {|idx, data| idx == thing }\n else\n if thing.respond_to?(:r_id)\n r_id = thing.r_id\n @index = @index.delete_if {|idx| idx.r_id == r_id }\n @records = @records.delete_if {|idx, data| data == thing}\n end\n end\n res_index = @header.resource_index\n res_index.number_of_records = @index.length\n @header.resource_index = res_index\n end", "def destroy\n result = nil\n obj = self.inst_strip_braces(self.object)\n if obj\n # first delete the record from viewable list\n result = Rhom::RhomDbAdapter::delete_from_table(Rhom::TABLE_NAME,\n {\"object\"=>obj})\n # now add delete operation\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"update_type\"=>'delete'})\n end\n result\n end", "def clear(_options = nil)\n # TODO: Support namespaces\n @client.delete_by_query index: @index_name, type: 'entry', body: { query: { match_all: {} } }\n end", "def delete_record(rec_label)\n record = records.find { |r| r.label == rec_label }\n return unless record\n\n File.delete(record.path)\n records.delete(record)\n end", "def delete_search_index(name)\n @data[:search_indexes].delete(name)\n true\n end", "def delete key\n rv = self[key]\n self.removeField key\n return rv\n end", "def remove\n conf = {:path=>\"#{RAILS_ROOT}/index/#{RAILS_ENV}/rip\"}\n index = Ferret::Index::Index.new(conf)\n\n mrokhashs = params[:parts][:part].collect {|p| p[:mrokhash]}\n parts = Part.find_all_by_mrokhash(mrokhashs)\n logged_in_user.parts.delete(parts)\n parts.each do |part|\n update_user_in_field(:index => index, :part => part, :remove => true)\n remove_cache_pages(part.rip_id) if part.rip_id\n end\n head :ok\n end", "def remove_resource(index)\n self.contentMetadata.remove_resource(index)\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete_record *rid\n db.delete_record rid\n end", "def remove_record(value)\n @children['record'][:value].delete(value)\n end", "def remove_record(value)\n @children['record'][:value].delete(value)\n end", "def clear_index!\n search_backend.clear_index!\n end", "def delete_doc_with_unique_term(term)\n writer.delete_document(\"Q#{term}\")\n true\n end", "def delete\n super do\n @strands.each do |strand|\n Cluster.redis.hdel LOOKUP, strand.id\n end\n Cluster.redis.hdel TOPICS, @id\n end\n end", "def removeResource(index) \n @obj.removeResource(index)\n end", "def destory_search_term\n searchterm = current_user.searches.and({:search_term =>params[:searchterm]},{:type=>\"case\"}).first\n # check condition for searchterm is destroy or not.\n if searchterm.destroy\n # response to the JSON\n render json: { success: true,message: \"Search Term Successfully Deleted.\" },:status=>200\n else\n render :json=> { success: false, message: searchterm.errors },:status=> 203\n end\n end", "def delete_field!(field_name); end", "def delete_index\n dataset.delete_index\n end", "def srch_destroy(opts={})\n\t\t\t\tsrch_client.destroy_document(opts)\n\t\t\tend", "def del\n delete\n end", "def remove\n @store.shift\n end", "def exist_index_remove_item(index_no)\n index_no -= 1\n @r_item = @items[index_no].description\n @items.delete_at(index_no)\n conf_message(@r_item, \"removed\")\n end", "def delete\n # TODO: implement delete\n end", "def destroy\n execute_before_destroy_callbacks(queried_record)\n queried_record.destroy!\n execute_after_destroy_callbacks(queried_record)\n\n head :no_content\n end", "def delete(index_value)\n index.delete(index_value)\n end", "def remove_id(object_id)\n\t\ti = @docs.index { |doc| doc.object_id == object_id }\n\t\tdestroy_tab(i) if @docs[i].try_to_save()\n\t\t # remove_tab(i) #if not i.nil?\n\tend", "def remove(data = nil, options = {})\n if data\n GRel::Debugger.debug \"REMMOVING\"\n GRel::Debugger.debug QL.to_turtle(data)\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, QL.to_turtle(data), nil, \"text/turtle\")\n else\n args = {:describe => true}\n args = {:accept => \"application/rdf+xml\"}\n\n sparql = @last_query_context.to_sparql_describe\n triples = @connection.query(@db_name,sparql, args).body\n\n @connection.remove(@db_name, triples, nil, \"application/rdf+xml\")\n end\n self\n end", "def remove\n elem = \"entry\" << params[:id]\n # must also remove login-user\n entry = JournalEntry.find(params[:id])\n entry.remove_login!\n \n if entry.destroy\n render :update do |page|\n page.remove elem\n end\n end\n end", "def remove\n @site = Site.find(params[:id])\n @study.sites.delete(@site)\n\n respond_to do |format|\n format.xml { head :ok }\n format.js\n end\n end", "def destroy\n result = database.delete self\n if result['ok']\n self['_rev'] = nil\n self['_id'] = nil\n end\n result['ok']\n end", "def delete_pose_index\n self.pose_words.clear if Pose.perform_search?\n end", "def destroy\n @record = Location.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(path)\n exec { index.delete(path) }\n end", "def unindex(symbol)\n @index.delete symbol.digram rescue nil\n end", "def destroy\n @record = FeaturedEntry.where('id = ?',params[:id]).take\n if @record.present?\n @record.update_attribute('removed', true)\n respond_with :blog, :v1, @record\n else\n render :json => {errors: @record.errors}, :status => 424\n end\n end", "def clear_index\n @index = nil\n end", "def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end", "def remove_item(index_no)\n index_exist(index_no)? exist_index_remove_item(index_no) : conf_message(index_no, \"does not exist\")\n end", "def delete_at_index(index)\n \n end" ]
[ "0.7578597", "0.71721876", "0.70539045", "0.70539045", "0.7009655", "0.6925817", "0.6883", "0.6850654", "0.6721093", "0.66939723", "0.65985906", "0.65911096", "0.65450454", "0.65390813", "0.6448471", "0.64478683", "0.6439756", "0.64228123", "0.64186037", "0.63828284", "0.6353995", "0.6343148", "0.63394076", "0.63353807", "0.63302654", "0.6269928", "0.6266167", "0.6266167", "0.6266167", "0.6266167", "0.6264032", "0.62543666", "0.62257093", "0.61890215", "0.6186346", "0.61783063", "0.61748844", "0.6172741", "0.6169703", "0.6112978", "0.61075884", "0.61028236", "0.60957605", "0.60832", "0.60760665", "0.6071979", "0.6065566", "0.60590357", "0.60528356", "0.6048116", "0.6044852", "0.6040744", "0.6037153", "0.60266984", "0.60209244", "0.60207725", "0.6019294", "0.6011968", "0.60090476", "0.60089344", "0.60007745", "0.59935105", "0.5993339", "0.5993013", "0.5978906", "0.5957897", "0.59434366", "0.5937518", "0.59368384", "0.59309244", "0.59309244", "0.5927633", "0.59270805", "0.59209263", "0.59179825", "0.59154093", "0.5907688", "0.5897445", "0.588219", "0.58727837", "0.5868219", "0.58561915", "0.5851597", "0.58496886", "0.5845732", "0.5838337", "0.58372724", "0.5833923", "0.58334535", "0.5829958", "0.5821387", "0.5813213", "0.5810113", "0.5803237", "0.58030826", "0.58015716", "0.57968855", "0.5791347", "0.57836485" ]
0.75075793
2
Returns a string containing the header bytes for a bmp header with a dib header of size 40, i.e. a "BITMAPINFOHEADER".
def print_header header = "" Imgrb::BmpMethods::add_bmp_bytes(header, file_size, 4) #Reserved, depends on application. Safe to set to 0s header << 0.chr*4 #Offset. 40 (from DIB) + 14 (from header) Imgrb::BmpMethods::add_bmp_bytes(header, 54, 4) #Size of DIB-header Imgrb::BmpMethods::add_bmp_bytes(header, 40, 4) Imgrb::BmpMethods::add_bmp_bytes(header, @width, 4) Imgrb::BmpMethods::add_bmp_bytes(header, @height, 4) #Color planes, must be set to 1 Imgrb::BmpMethods::add_bmp_bytes(header, 1, 2) #Bits per pixel. Always write 24-bit bmps. Imgrb::BmpMethods::add_bmp_bytes(header, 24, 2) #No compression Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4) #Image size. Can be 0 for compression method 0. Imgrb::BmpMethods::add_bmp_bytes(header, image_size, 4) Imgrb::BmpMethods::add_bmp_bytes(header, @horizontal_res, 4) Imgrb::BmpMethods::add_bmp_bytes(header, @vertical_res, 4) #Default color palette Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4) #All colors important Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bmp_header\n BmpHeader.new(@width, @height, 24, 0, 40, 1)\n end", "def to_bmp_header\n self\n end", "def header_fields\n IO.binread(@path, HEADER_SIZE, 0).unpack(\"N5C1\")\n end", "def get_header_info\n @data.rewind\n \n #column_count_offset = 33, record_count_offset = 24, record_length_offset = 36\n @record_count, @data_offset, @record_length = data.read(HEADER_LENGTH).unpack(\"@24 I x4 I I\")\n @column_count = (@data_offset-400)/200\n end", "def read_header(fp)\n tags = Support::HexString.from_bin(fp.read(1)).ord\n type = (tags & 0x70) >> 4\n size = tags & 0xF\n shift = 4\n while tags & 0x80 > 0\n tags = Support::HexString.from_bin(fp.read(1)).ord\n size += (tags & 0x7F) << shift\n shift += 7\n end\n [type, size]\n end", "def png_header\n return @png_header unless @png_header.nil?\n _pos = @_io.pos\n @_io.seek(ofs_img)\n @png_header = @_io.read_bytes(8)\n @_io.seek(_pos)\n @png_header\n end", "def get_header_string(io)\n chunk_size = 2**12\n loc = 0\n string = ''\n while chunk = @io.read(chunk_size)\n string << chunk\n start_looking = ((loc-20) < 0) ? 0 : (loc-20)\n break if string[start_looking..-1] =~ /<(spectrum|chromatogram)/\n loc += chunk_size\n end\n string\n end", "def inspect #:nodoc:\n s = \"#<#{self.class}:0x#{(self.object_id*2).to_s(16)} \"\n @header_object.each_pair do |k,v|\n s += \"(#{k.upcase} size=#{v[1]} offset=#{v[2]}) \" unless k == \"ASF_Header_Object\"\n end\n s += \"\\b>\"\n end", "def size_fil_header\n 4 + 4 + 4 + 4 + 8 + 2 + 8 + 4\n end", "def header_size\n 12\n end", "def write_dib_header(file)\n file << [DIB_HEADER_SIZE, @width, @height, 1, BITS_PER_PIXEL,\n 0, pixel_array_size, PIXELS_PER_METER, PIXELS_PER_METER, \n 0, 0].pack(\"V3v2V6\")\n end", "def header\n @version, @flags, @numStrikes = @bytes[0, 8].unpack('nnN')\n\n @strikeOffset = (0...@numStrikes).map do |n|\n start = 8 + n * 4\n @bytes[start, 4].unpack('N')[0]\n end\n end", "def to_png_header(header)\n h = header\n Imgrb::Headers::PngHeader.new(@width, @height, h.bit_depth, 0,\n h.image_type, 0, 0)\n end", "def b2h\n hex = self.unpack(\"H*\")[0]\n hex.scan(/.{,32}/).map{|s|\n s.scan(/../) * \" \"\n } * \"\\n\"\n end", "def infer_header\n dir = FileUtils.pwd\n dir = dir.split(File::SEPARATOR).last\n dir =~ /(.+)\\.(.+)\\.(.+)/\n width = $1.to_i\n height = $2.to_i\n format = $3.to_i\n [width, height, format]\nend", "def header\n @sfntVersion, @numTables, *rest = @bytes[0, 4 + 2 + 2 + 2 + 2].unpack('Nnnnn')\n end", "def header_for_id(id)\n raise 'Id must be 4 bytes' unless id.gsub(' ', '').length == 4*2\n # header is really \"B1 96 B1 D3 ED AE 5F 92 #{id}\"\n # however we're chopping off one byte to fit within 12 bytes in the search code.\n\n # the byte after item id changes. maybe 06 or 02 depending on the item.\n \"B1 96 B1 D3 ED AE 5F 92 #{id}\".gsub(' ', '')\n end", "def header(buf)\n peek = buf.readbyte(0)\n\n header = {}\n header[:type], type = HEADREP.find do |_t, desc|\n mask = (peek >> desc[:prefix]) << desc[:prefix]\n mask == desc[:pattern]\n end\n\n fail CompressionError unless header[:type]\n\n header[:name] = integer(buf, type[:prefix])\n\n case header[:type]\n when :indexed\n fail CompressionError if (header[:name]).zero?\n header[:name] -= 1\n when :changetablesize\n header[:value] = header[:name]\n else\n if (header[:name]).zero?\n header[:name] = string(buf)\n else\n header[:name] -= 1\n end\n header[:value] = string(buf)\n end\n\n header\n end", "def inspect\n if fil_header\n \"#<%s: size=%i, space_id=%i, offset=%i, type=%s, prev=%s, next=%s, checksum_valid?=%s (%s), torn?=%s, misplaced?=%s>\" % [\n self.class,\n size,\n fil_header[:space_id],\n fil_header[:offset],\n fil_header[:type],\n fil_header[:prev] || \"nil\",\n fil_header[:next] || \"nil\",\n checksum_valid?,\n checksum_type ? checksum_type : \"unknown\",\n torn?,\n misplaced?,\n ]\n else\n \"#<#{self.class}>\"\n end\n end", "def header_for_string string\n header = string.length << 1 # make room for a low bit of 1\n header = header | 1 # set the low bit to 1\n pack_int header\n end", "def header_to_s # :nodoc:\n if (header)\n pad = \" \" * headeri\n\n return pad + header + \"\\n\" + pad + \"=\" * header.length + \"\\n\\n\"\n end\n\n return ''\n end", "def generate_header_info\n magic = FileMagic.new\n @header_info = magic.file(@file_name)\n magic.close\n\n @header_info\n end", "def header_len\n (@binhdr[12, 1].unpack(\"C\").pop >> 4) << 2\n end", "def size_header\n 2 + 2 + 1\n end", "def pos_fsp_header\n pos_fil_header + size_fil_header\n end", "def to_png_header\n self\n end", "def inspect\n out = \"\"\n self.each_pair do |k ,v|\n out << \"%-40s\" % k.to_s.yellow unless [:header, :item, :magic].include? k\n case k\n when :image_format then out << \"0x%03x\\n\" % v\n when :header\n v.each_pair do |i, j|\n out << \"%-40s%s\\n\" % [i.to_s.yellow, j] if i == :item_count\n out << \"%-40s%d MB\\n\" % [i.to_s.yellow, j>> 20] if i == :len_low\n # out \"res:\" << reserved.inspect if i == :reserved\n end\n when :item\n out << \"Items\\n\".light_blue\n v.each { |it| out << it.inspect << \"\\n\" }\n end\n end\n out\n end", "def header\n MAGIC + [VERSION].pack('n')\n end", "def fil_header\n @fil_header ||= cursor(pos_fil_header).name(\"fil_header\") do |c|\n {\n :checksum => c.name(\"checksum\") { c.get_uint32 },\n :offset => c.name(\"offset\") { c.get_uint32 },\n :prev => c.name(\"prev\") {\n Innodb::Page.maybe_undefined(c.get_uint32)\n },\n :next => c.name(\"next\") {\n Innodb::Page.maybe_undefined(c.get_uint32)\n },\n :lsn => c.name(\"lsn\") { c.get_uint64 },\n :type => c.name(\"type\") { PAGE_TYPE_BY_VALUE[c.get_uint16] },\n :flush_lsn => c.name(\"flush_lsn\") { c.get_uint64 },\n :space_id => c.name(\"space_id\") { c.get_uint32 },\n }\n end\n end", "def get_header\n begin\n size = @out.read(33)\n size = size[0..-2]\n\n # Sanity check the size\n if not size_check(size)\n @log.error \"[#{Time.now.iso8601}] Size returned from mentos.py invalid.\"\n stop \"Size returned from mentos.py invalid.\"\n raise MentosError, \"Size returned from mentos.py invalid.\"\n end\n\n # Read the amount of bytes we should be expecting. We first\n # convert the string of bits into an integer.\n header_bytes = size.to_s.to_i(2) + 1\n @log.info \"[#{Time.now.iso8601}] Size in: #{size.to_s} (#{header_bytes.to_s})\"\n @out.read(header_bytes)\n rescue\n @log.error \"[#{Time.now.iso8601}] Failed to get header.\"\n stop \"Failed to get header.\"\n raise MentosError, \"Failed to get header.\"\n end\n end", "def header(buf)\n peek = buf.getbyte\n buf.seek(-1, IO::SEEK_CUR)\n\n header = {}\n header[:type], type = HEADREP.select do |t, desc|\n mask = (peek >> desc[:prefix]) << desc[:prefix]\n mask == desc[:pattern]\n end.first\n\n header[:name] = integer(buf, type[:prefix])\n if header[:type] != :indexed\n header[:name] -= 1\n\n if header[:name] == -1\n header[:name] = string(buf)\n end\n\n if header[:type] == :substitution\n header[:index] = integer(buf, 0)\n end\n\n header[:value] = string(buf)\n end\n\n header\n end", "def packed()\n header = self.version.chr + \n @type.chr + \n @seq_no.chr + \n @flags.chr + \n TacacsPlus.pack_int_net(@session_id,4) + \n TacacsPlus.pack_int_net(@length,4)\n return(header)\n end", "def header_posicao_047_a_076\n\t\t\t\t\t''.adjust_size_to(30)\n\t\t\t\tend", "def size_partial_page_header\n size_fil_header - 4 - 8 - 4\n end", "def led_frame_hdr(brightness)\n (brightness & 0b00011111) | 0b11100000\n end", "def header\n chunk_header = nil\n File.open(@file_name) do |file|\n file.seek(@offset + 4 + @size_length, IO::SEEK_CUR)\n chunk_header = file.read(@header_size)\n end\n chunk_header\n end", "def header_length() 3 end", "def read_header\n @height = next_uint16 + 1\n puts \"Height: #{@height}\" if @verbose\n\n @width = next_uint16 + 1\n puts \"Width: #{@width}\" if @verbose\n\n @yoffset = next_uint16\n @xoffset = next_uint16\n puts \"Offsets: #{@xoffset}, #{@yoffset}\" if @verbose\n\n @xstart = next_int32\n @ystart = next_int32\n puts \"Start: #{@xstart}, #{@ystart}\" if @verbose\n\n @xend = next_int32\n @yend = next_int32\n\n puts \"End: #{@xend}, #{@yend}\" if @verbose\n end", "def btInfoHash\n result = nil\n @params['xt'].each do |topic|\n if topic =~ /urn:btih:(.*)/\n hash = $1\n if hash.length == 40\n # Hex-encoded info hash. Convert to binary.\n result = [hash].pack \"H*\" \n else\n # Base32 encoded\n result = Base32.decode hash\n end\n break\n end\n end\n result\n end", "def header(buf)\n peek = buf.readbyte(0)\n\n header = {}\n header[:type], type = HEADREP.select do |t, desc|\n mask = (peek >> desc[:prefix]) << desc[:prefix]\n mask == desc[:pattern]\n end.first\n\n header[:name] = integer(buf, type[:prefix])\n if header[:type] != :indexed\n header[:name] -= 1\n\n if header[:name] == -1\n header[:name] = string(buf)\n end\n\n if header[:type] == :substitution\n header[:index] = integer(buf, 0)\n end\n\n header[:value] = string(buf)\n end\n\n header\n end", "def getHeader()\n header = \"\"\n\n appendStr(header, \"time\")\n appendStr(header, \"seqno\")\n $cmd_list.each do | name, cmd, type |\n appendStr(header, name)\n end\n return header\nend", "def to_png_header\n PngHeader.new(@width, @height, @bit_depth, 0, @image_type, 0, 0)\n end", "def win_size\n @binhdr[14, 2].unpack(\"n\").pop\n end", "def header_size(header)\n header.unpack(\"N\").first\n end", "def header_size\n FFI::Type::ULONG.size + FFI::Type::USHORT.size + FFI::Type::USHORT.size\n end", "def header_str\n \"\"\n end", "def read_header\n\t@bytes_to_be_read = 0\n\tread_mt_header_string(MThd_BYTE_ARRAY, @skip_init) # \"MThd\"\n\n\t@bytes_to_be_read = read32()\n\tformat = read16()\n\tntrks = read16()\n\tdivision = read16()\n\n\theader(format, ntrks, division)\n\n\t# Flush any extra stuff, in case the length of the header is not 6\n\tif @bytes_to_be_read > 0\n get_bytes(@bytes_to_be_read)\n @bytes_to_be_read = 0\n\tend\n\n\treturn ntrks\n end", "def header_for_array array\n header = array.length << 1 # make room for a low bit of 1\n header = header | 1 # set the low bit to 1\n pack_int header\n end", "def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n else\n nil\n end\n }.compact.join(' ')\n end", "def make_header\n\t\t\theader = nil\n\t\t\tlength = self.payload.size\n\n\t\t\tself.log.debug \"Making wire protocol header for payload of %d bytes\" % [ length ]\n\n\t\t\t# Pack the frame according to its size\n\t\t\tif length >= 2**16\n\t\t\t\tself.log.debug \" giant size, using 8-byte (64-bit int) length field\"\n\t\t\t\theader = [ self.flags, 127, length ].pack( 'c2q>' )\n\t\t\telsif length > 125\n\t\t\t\tself.log.debug \" big size, using 2-byte (16-bit int) length field\"\n\t\t\t\theader = [ self.flags, 126, length ].pack( 'c2n' )\n\t\t\telse\n\t\t\t\tself.log.debug \" small size, using payload length field\"\n\t\t\t\theader = [ self.flags, length ].pack( 'c2' )\n\t\t\tend\n\n\t\t\tself.log.debug \" header is: 0: %02x %02x\" % header.unpack('C*')\n\t\t\treturn header\n\t\tend", "def id_to_header(id)\n id.to_s(16)\n end", "def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end", "def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end", "def getHdr()\n\t\treturn @hdr\n\tend", "def _brands_header\n\t$report_file.puts \" _ _ \"\n\t$report_file.puts \"| | | | \"\n\t$report_file.puts \"| |__ _ __ __ _ _ __ __| |___ \"\n\t$report_file.puts \"| '_ \\\\| '__/ _` | '_ \\\\ / _` / __|\"\n\t$report_file.puts \"| |_) | | | (_| | | | | (_| \\\\__ \\\\\"\n\t$report_file.puts \"|_.__/|_| \\\\__,_|_| |_|\\\\__,_|___/\"\n\t$report_file.puts\n\t$report_file.puts \"--------------------------------------------------------------------\"\n\t$report_file.puts\nend", "def to_s\n [@header_data, @region_code, @start_ip, @filter].pack('c2Z*Z*')\n end", "def header_udp package_number, file_size, signaze\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end", "def uncompressed_size\n @header.size\n end", "def header_size\n TYPE_SIZE\n end", "def image_hwstring(width, height)\n out = ''\n if width\n out += 'width=\"' + width.to_i.to_s + '\" '\n end\n if height\n out += 'height=\"' + height.to_i.to_s + '\" '\n end\n out\n end", "def getHeader() @header1 end", "def rhdr\n b = rbyte\n code, value = b & 7, b >> 3\n case value\n when 0..22\n return code, value\n when 23...31\n return code, rlongint(value-22)\n else\n n = renc\n return code, rlongint(n)\n end\n end", "def size_index_header\n 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 8 + 2 + 8\n end", "def functional_group_header\n gs_elements = []\n gs_elements << 'GS'\n gs_elements << 'HP'\n gs_elements << payer_id \n gs_elements << '1000000'\n gs_elements << Time.now().strftime(\"%Y%m%d\") \n gs_elements << Time.now().strftime(\"%H%M\")\n gs_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record) \n gs_elements << 'X'\n gs_elements << ((!@output_version || @output_version == '4010') ? '004010X091A1' : '005010X221A1')\n gs_elements.join(@element_seperator)\n end", "def toString()\n @header[LENGTH - 1] = checksum()\n return @header + @message\n end", "def header\n header = \"%FDF-1.2\\n\\n1 0 obj\\n<<\\n/FDF << /Fields 2 0 R\"\n # /F\n header << \"/F (#{options[:file]})\" if options[:file]\n # /UF\n header << \"/UF (#{options[:ufile]})\" if options[:ufile]\n # /ID\n header << \"/ID[\" << options[:id].join << \"]\" if options[:id]\n header << \">>\\n>>\\nendobj\\n2 0 obj\\n[\"\n return header\n end", "def header(h, buffer = Buffer.new)\n rep = HEADREP[h[:type]]\n\n case h[:type]\n when :indexed\n buffer << integer(h[:name] + 1, rep[:prefix])\n when :changetablesize\n buffer << integer(h[:value], rep[:prefix])\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name] + 1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n buffer << string(h[:value])\n end\n\n # set header representation pattern on first byte\n fb = buffer.ord | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end", "def inspect #:nodoc:\n s = \"#<#{self.class}:0x#{(self.object_id*2).to_s(16)} \"\n @metadata_blocks.each do |blk|\n s += \"(#{blk[0].upcase} size=#{blk[4]} offset=#{blk[3]}) \"\n end\n s += \"\\b>\"\n end", "def information_header\n info_table_src = TTY::Table.new\n @defaults.label_value_pairs.each {|pair| info_table_src << pair}\n info_table_src << [\"Disposition Columns:\", MmMovie.dispositions.join(', ')]\n info_table_src << [\"Transcode File Location:\", self.tempfile ? tempfile&.path : 'n/a']\n\n info_table = C.bold(\"Looking for file(s) and processing them with the following options:\\n\").dup\n info_table << info_table_src.render(:basic) do |renderer|\n a = @defaults.label_value_pairs.map {|p| p[0].length }.max + 1\n b = OutputHelper.console_width - a - 2\n renderer.alignments = [:right, :left]\n renderer.multiline = true\n renderer.column_widths = [a,b]\n end << \"\\n\\n\"\n end", "def show_elf_h_size\n\t\t\tputs \" Size of this header: #{@elf_h_size} (bytes)\"\n\t\tend", "def build_block_header(type, size, last)\n begin\n bit_string = sprintf(\"%b%7b\", last, type).gsub(\" \",\"0\")\n block_header_s = [bit_string].pack(\"B*\")\n block_header_s += [size].pack(\"VX\").reverse # size is 3 bytes\n rescue\n raise FlacInfoWriteError, \"error building block header\"\n end\n end", "def header_height\n 0\n end", "def monta_header\n # CAMPO TAMANHO VALOR\n # tipo do registro [1] 0\n # operacao [1] 1\n # literal remessa [7] REMESSA\n # brancos [16]\n # info. conta [20]\n # empresa mae [30]\n # cod. banco [3]\n # nome banco [15]\n # data geracao [6] formato DDMMAA\n # complemento registro [294]\n # num. sequencial [6] 000001\n \"01REMESSA #{info_conta}#{empresa_mae.format_size(30)}#{cod_banco}#{nome_banco}#{data_geracao}#{complemento}000001\"\n end", "def PcbElementHeader(flags, desc, name, value, mx, my, tx, ty, tdir, tscale, tflags)\n _SFlags = %Q(\"#{flags}\")\n _Desc = %Q(\"#{desc}\")\n _Name = %Q(\"#{name}\")\n _Value = %Q(\"#{value}\")\n _MX = mx.round\n _MY = my.round\n _TX = tx.round\n _TY = ty.round\n _TDir = tdir.round\n _TScale = tscale.round\n _TSFlags = %Q(\"#{tflags}\")\n %Q(Element[#{_SFlags} #{_Desc} #{_Name} #{_Value} #{_MX} #{_MY} #{_TX} #{_TY} #{_TDir} #{_TScale} #{_TSFlags}]\\n)\nend", "def to_s\n [0xFF, 0xFF, 0xFF, 0xFF, @header_data, @content_data.string].pack('c5a*')\n end", "def monta_header\n # CAMPO TAMANHO VALOR\n # tipo do registro [1] 0\n # operacao [1] 1\n # literal remessa [7] REMESSA\n # Código do serviço [2] 01\n # cod. servico [15] COBRANCA\n # info. conta [20]\n # empresa mae [30]\n # cod. banco [3]\n # nome banco [15]\n # data geracao [6] formato DDMMAA\n # complemento registro [294]\n # num. sequencial [6] 000001\n \"01REMESSA01COBRANCA #{info_conta}#{empresa_mae.format_size(30).remove_accents}#{cod_banco}#{nome_banco}#{data_geracao}#{versao_layout}#{complemento}000001\"\n end", "def search_for_header(header_id)\n raise \"Header is nil\" unless header_id\n expected_len = 12 * 2\n raise \"Invalid header length #{header_id.length} != #{expected_len}\\n#{header_id}\" unless header_id.length == expected_len\n header_id = header_id.upcase\n result = []\n result << \"8001000C #{header_id[0...8]}\"\n result << \"#{header_id[8...16]} #{header_id[16...24]}\"\n end", "def header_fields\n header.fields\n end", "def pos_fil_header\n 0\n end", "def size_data_dictionary_header\n ((8 * 3) + (4 * 7) + 4 + Innodb::FsegEntry::SIZE)\n end", "def image_string_creator\r\n n = []\r\n n << \"src:\".ljust(TO_S_SIZE) + self.src.to_s\r\n n << \"file date:\".ljust(TO_S_SIZE) + self.fileCreatedDate.to_s\r\n n << \"file size:\".ljust(TO_S_SIZE) + self.fileSize.to_s\r\n n << \"width:\".ljust(TO_S_SIZE) + self.width.to_s\r\n n << \"height:\".ljust(TO_S_SIZE) + self.height.to_s\r\n n << \"alt:\".ljust(TO_S_SIZE) + self.alt.to_s\r\n return n\r\n end", "def big_header(string)\n outstring = \"$ *********************************************************\\n$ ** **\\n$ ** #{string} \\n$ ** **\\n$ *********************************************************\\n\"\n return outstring\n end", "def bmp_filename\n 'hall_of_fame/type_window'\n end", "def bmp_filename\n 'hall_of_fame/type_window'\n end", "def inspect\n \"%-40s @ 0x%08x [%d kB] => %s\" % [self.path.yellow, off_len_low, data_len_low>>10, main_type]\n end", "def inspect\n \"%-40s @ 0x%08x [%d kB] => %s\" % [self.path.yellow, off_len_low, data_len_low>>10, main_type]\n end", "def len_header\n return @len_header unless @len_header.nil?\n _pos = @_io.pos\n @_io.seek(88)\n @len_header = @_io.read_u8le\n @_io.seek(_pos)\n @len_header\n end", "def header_size\n 0\n end", "def header(h, buffer = Buffer.new)\n rep = HEADREP[h[:type]]\n\n if h[:type] == :indexed\n buffer << integer(h[:name], rep[:prefix])\n\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name]+1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n if h[:type] == :substitution\n buffer << integer(h[:index], 0)\n end\n\n if h[:value].is_a? Integer\n buffer << integer(h[:value], 0)\n else\n buffer << string(h[:value])\n end\n end\n\n # set header representation pattern on first byte\n fb = buffer[0].unpack(\"C\").first | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end", "def header(h, buffer = \"\")\n rep = HEADREP[h[:type]]\n\n if h[:type] == :indexed\n buffer << integer(h[:name], rep[:prefix])\n\n else\n if h[:name].is_a? Integer\n buffer << integer(h[:name]+1, rep[:prefix])\n else\n buffer << integer(0, rep[:prefix])\n buffer << string(h[:name])\n end\n\n if h[:type] == :substitution\n buffer << integer(h[:index], 0)\n end\n\n if h[:value].is_a? Integer\n buffer << integer(h[:value], 0)\n else\n buffer << string(h[:value])\n end\n end\n\n # set header representation pattern on first byte\n fb = buffer[0].unpack(\"C\").first | rep[:pattern]\n buffer.setbyte(0, fb)\n\n buffer\n end", "def header_length\n @header_length ||= DBF_HEADER_SIZE + columns.size * 32 + 1\n end", "def print_header\n printf(\"%18sBATTLE\\n\", \"\")\n puts \"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\"\nend", "def summary\n [hexdigest, @buffer.size]\n end", "def calculate_header\n headers = []\n height = 0\n @current_groups.each do |field, current_value|\n identifier_field = @sections[:groups][field.to_sym][:settings][:identifier_field] || nil\n value = ([email protected]_on_association(field).nil? and !identifier_field.nil?) ? @record.send(field.to_sym).send(identifier_field) : @record.send(field)\n\n if value != current_value\n reset_groups_values field\n\n headers << field.to_sym\n height += @sections[:groups][field.to_sym][:settings][:height] + @sections[:groups][field.to_sym][:settings][:posY]\n\n @current_groups[field] = value\n end\n end unless @current_groups.empty?\n\n [headers, height]\n end", "def read_header_file_name\n std = nil\n if !buffer_empty?\n return nil, std\n end\n\n skip_space!\n p = get_pos(0)\n if next?('\"')\n std = false\n close = '\"'\n elsif next?('<')\n std = true\n close = '>'\n else\n return nil, std\n end\n b = \"\"\n while !next?(close)\n c = readc\n if c.nil? || c == '\\n'\n raise \"#{p}: premature end of header name\"\n # errorp(p, \"premature end of header name\");\n end\n b << c\n end\n if b.size == 0\n raise \"#{p}: header name should not be empty\"\n # errorp(p, \"header name should not be empty\");\n end\n\n return b, std\n end", "def header_length\n self[:ip_vhl] & 0x0f\n end", "def fh\n return hex_side_length + 2 * th\n end", "def pack_size_names\n return @pack_size_names if @pack_size_names\n names = @lines.inject([]) { |arr, l| arr << l[:pack_size] }.uniq.sort!\n @pack_size_names = place_blank_to_last(names)\n end", "def header\n @message.header\n end", "def get_byte_str(byt, byte_size=nil)\n byt_str = \"\"\n\n # case byt.class.name\n # when \"Fixnum\"\n\n # byt_str = byt.to_s(16)\n # byte_size = 1 if !byte_size && byt <= 0xf\n # when \"String\"\n\n byt.reverse!\n byt_str = byt.unpack('H*h*').collect {|x| x.to_s}.join\n #end\n\n #Pad 0s upto byte_size\n byt_str = byt_str.rjust(byte_size*2, \"0\") if byte_size\n\n #Prefix with hex string '0x'\n byt_str = HEX_PREFIX + byt_str\n\n byt_str\n end" ]
[ "0.7177002", "0.70123804", "0.65706635", "0.6172991", "0.61083895", "0.6083339", "0.60741735", "0.60494256", "0.59915286", "0.59731185", "0.59386057", "0.58676624", "0.583522", "0.5761205", "0.5745232", "0.57157063", "0.5712869", "0.56481534", "0.5647333", "0.56419295", "0.5613438", "0.5603296", "0.5566199", "0.55482394", "0.5545145", "0.55431", "0.5542759", "0.5538067", "0.552795", "0.5516845", "0.549473", "0.54697067", "0.54643655", "0.54635596", "0.546147", "0.5460451", "0.54530436", "0.5450333", "0.54421043", "0.5428202", "0.5407799", "0.53938293", "0.5390906", "0.53858536", "0.5368183", "0.5350596", "0.5347348", "0.533215", "0.5332031", "0.52966595", "0.52917594", "0.52842283", "0.52842283", "0.52821577", "0.52820283", "0.5280861", "0.5277852", "0.52755696", "0.5271036", "0.52640295", "0.52615416", "0.5255886", "0.52382976", "0.52359957", "0.5232141", "0.522781", "0.5218701", "0.5217614", "0.5217469", "0.5215889", "0.521083", "0.5207246", "0.5205667", "0.5197495", "0.51952857", "0.5174918", "0.51699597", "0.51673096", "0.51453155", "0.51273537", "0.5119283", "0.5114448", "0.5110709", "0.5110709", "0.5109848", "0.5109848", "0.5107467", "0.5097528", "0.5096188", "0.5095219", "0.5091101", "0.5086847", "0.5080655", "0.5067809", "0.50615007", "0.50529724", "0.5051318", "0.50502515", "0.50453585", "0.5037503" ]
0.73300576
0
Ensure that refs can't be deleted
def check_deleted(newrev) if newrev == "0000000000000000000000000000000000000000" puts "[POLICY} You can not delete objects" exit 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_deletion_fixes \n # TO DO\n end", "def ensure_not_referenced_by_any_user\n raise \"Cannot delete user '#{name}'. There are users referencing this user as manager.\" unless users.empty?\n end", "def deref\n @_references_mutex.synchronize {\n if ((@_references -= 1) == 0)\n cleanup\n\n true\n else\n false\n end\n }\n end", "def deref\n\t\t@_references_mutex.synchronize {\n\t\t\tif ((@_references -= 1) == 0)\n\t\t\t\tcleanup\n\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\t}\n\tend", "def with_corrupted_loose_reference_fix\n tries ||= []\n yield\n rescue Rugged::ReferenceError\n relative_path = $!.message[/Corrupted loose reference file: (.*)/, 1]\n raise unless relative_path\n path = connection.path + relative_path\n raise if tries.member?(path)\n raise unless File.exists?(path) && File.size(path).zero?\n\n tries.push(path)\n File.delete(path)\n retry\n end", "def ensure_not_referenced_by_any_company\n raise \"Cannot delete currency '#{name}'. There are companies referencing this currency.\" unless companies.empty?\n end", "def heal_associated_docs\n bad_keys = []\n @document.doc_refs do |key, value|\n if DocumentRepository.find key == nil\n bad_keys << key\n end\n end\n bad_keys.each do |key|\n @document.doc_refs.delete(key)\n end\n DocumentRepository.update @document\n end", "def ensure_not_referenced_by_any_expense\n raise \"Cannot delete user '#{name}'. There are expenses referencing this user.\" unless expenses.empty?\n end", "def ensure_not_referenced_by_any_expense_detail\n raise \"Cannot delete currency '#{name}'. There are expens details referencing this currency.\" unless expense_details.empty?\n end", "def invalidate!\r\n fail_if_invalid()\r\n # Unlink this entity from any other objects.\r\n for type, entities in @links\r\n for entity in entities\r\n next if entity.deleted?\r\n if used_by?( entity )\r\n entity.unlink( self )\r\n end\r\n end\r\n end\r\n # Release any reference to other objects.\r\n @parent = nil\r\n @links = {}\r\n # The entity is then flagged as invalid.\r\n @valid = false\r\n nil\r\n end", "def unresolved_refs\r\n @unresolved_refs ||= collect_unresolved_refs\r\n if @removed_urefs\r\n @unresolved_refs -= @removed_urefs\r\n @removed_urefs = nil\r\n end\r\n @unresolved_refs\r\n end", "def ensure_not_referenced_by_any_product\n unless products.empty?\n errors.add(:base, 'Cannot destroy - products present for this sector')\n throw :abort\n end\n end", "def ensure_not_referenced_by_any_item\n\t\tunless items.empty?\n\t\t\terrors.add(:base, 'Na stanie są sztuki tego produktu')\n\t\t\tthrow :abort\n\t\tend\n\tend", "def ensure_not_referenced_by_any_dog_owner\n\n\t\t# Check for a link to an owner\n\t\t@record = DogOwner.find_by(dog_id: id)\n\t\tif @record\n\t\t\terrors.add(:base, 'Dog owner present')\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "def referenced?; end", "def cleanup\n delete!\n return true\n rescue PoolNode::Conflict\n # still in use\n return false\n end", "def check_allocation\n if marked_for_destruction? and !candidates.count.zero?\n errors.add(:base, \"CANNOT DELETE BATCH\")\n end\n end", "def remove_references_before_destroy\n return if self.id.nil?\n\n substitute = User.anonymous\n Attachment.update_all ['author_id = ?', substitute.id], ['author_id = ?', id]\n Comment.update_all ['author_id = ?', substitute.id], ['author_id = ?', id]\n Issue.update_all ['author_id = ?', substitute.id], ['author_id = ?', id]\n Issue.update_all 'assigned_to_id = NULL', ['assigned_to_id = ?', id]\n Journal.update_all ['user_id = ?', substitute.id], ['user_id = ?', id]\n JournalDetail.update_all ['old_value = ?', substitute.id.to_s], [\"property = 'attr' AND prop_key = 'assigned_to_id' AND old_value = ?\", id.to_s]\n JournalDetail.update_all ['value = ?', substitute.id.to_s], [\"property = 'attr' AND prop_key = 'assigned_to_id' AND value = ?\", id.to_s]\n Message.update_all ['author_id = ?', substitute.id], ['author_id = ?', id]\n News.update_all ['author_id = ?', substitute.id], ['author_id = ?', id]\n # Remove private queries and keep public ones\n Query.delete_all ['user_id = ? AND is_public = ?', id, false]\n Query.update_all ['user_id = ?', substitute.id], ['user_id = ?', id]\n TimeEntry.update_all ['user_id = ?', substitute.id], ['user_id = ?', id]\n Token.delete_all ['user_id = ?', id]\n Watcher.delete_all ['user_id = ?', id]\n WikiContent.update_all ['author_id = ?', substitute.id], ['author_id = ?', id]\n WikiContent::Version.update_all ['author_id = ?', substitute.id], ['author_id = ?', id]\n end", "def prevent_add_reference\n res = can_add_reference?\n !(res.nil? ? can_edit? : res)\n end", "def ensure_not_referenced_by_any_line_item #in this case before destroy a row in the database\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Itens present')\n return false\n end\n end", "def referenced; end", "def ensure_not_referenced_by_any_line_items\n if line_items.empty?\n return true\n else\n errors.add(:base, \"Cannot delete because line items are present\")\n return false\n end\n end", "def check_destroy\n valid=true\n msg=\"\"\n if grades.count > 0\n valid=false\n msg+=\" There are #{grades.count} grades references\"\n end\n if teachers.count > 0\n valid=false\n msg+=\" There are #{teachers.count} grades references\"\n end\n if teacher_matters.count > 0\n valid=false\n msg+=\" There are #{teacher_matters.count} teacher_matters references\"\n end\n self.errors.add(:base, \"Matter can't be destroyed:#{msg}\") unless valid\n valid\n end", "def check_for_invalid_external_references(record, logical_urls)\n if record.respond_to?(:to_array)\n record.each {|e| check_for_invalid_external_references(e, logical_urls)}\n elsif record.respond_to?(:each)\n record.each do |k, v|\n if k == 'ref' && !logical_urls.has_key?(v)\n URIResolver.ensure_reference_is_valid(v, RequestContext.get(:repo_id))\n elsif k != '_resolved'\n check_for_invalid_external_references(v, logical_urls)\n end\n end\n end\n end", "def update_attachment_references\n return if attachment_references.empty?\n\n ids = attachment_reference_ids_removed\n attachment_references.each do |attachment_reference|\n attachment_reference.mark_for_destruction if ids.include?(attachment_reference.id)\n end\n end", "def restrict_when_referenced\n return false if nodes.count > 0\n end", "def invalid?\n @ref.invalid?\n end", "def remove_references(options)\n \t# just got to remove the assigned_pics Tree hash\n \tPictureandmeta.delete_event(self)\n end", "def revoke!\n self.used = true\n self.save\n end", "def ref_cleanup(xmldoc)\n xmldoc.xpath(\"//p/ref\").each do |r|\n parent = r.parent\n parent.previous = r.remove\n end\n end", "def safe_destroy\n destroy if taggings.empty? && expressions.empty? && dependent_lists.empty?\n end", "def remove_or_decrement_ref(*nodes); end", "def ensure_not_referenced_by_any_recipe\n unless recipes.empty?\n errors.add(:base, ' - recipes present for this ingredient')\n throw :abort\n end\n end", "def delete_if\n super { |r| yield(r) && orphan_resource(r) }\n end", "def validate_ref(repo, ref)\n ref_valid = true\n cmd = \"git ls-remote --tags --exit-code #{repo} #{ref} >/dev/null\"\n system(cmd)\n if $?.exitstatus != 0\n ref_valid = false\n end\n ref_valid\n end", "def check_destroy\n valid=true\n msg=\"\"\n if grades.count > 0\n valid=false\n msg+=\" There are #{grades.count} teachings references\"\n end\n self.errors.add(:base, \"Grade context can't be destroyed:#{msg}\") unless valid\n valid\n end", "def delete_dependencies\n raise 'Not implemented'\n end", "def destroy_obsolete_git_files\n return unless git_repository.valid?\n website_git_files.find_each do |git_file|\n dependency = git_file.about\n # Here, dependency can be nil (object was previously destroyed)\n is_obsolete = dependency.nil? || !dependency.in?(recursive_dependencies_syncable_following_direct)\n if is_obsolete\n Communication::Website::GitFile.mark_for_destruction(self, git_file)\n end\n end\n self.git_repository.sync!\n end", "def link_dead!; @dead = true end", "def unlinked\n reject(&:linked?)\n end", "def unresolve_refs(rrefs)\r\n # make sure any removed_urefs have been removed, \r\n # otherwise they will be removed later even if this method actually re-added them\r\n unresolved_refs\r\n rrefs.each do |rr|\r\n ur = rr.uref\r\n refs = ur.element.getGeneric(ur.feature_name)\r\n if refs.is_a?(Array)\r\n index = refs.index(rr.target)\r\n ur.element.removeGeneric(ur.feature_name, rr.target)\r\n ur.element.addGeneric(ur.feature_name, ur.proxy, index)\r\n else\r\n ur.element.setGeneric(ur.feature_name, ur.proxy)\r\n end\r\n @unresolved_refs << ur\r\n end\r\n end", "def before_destroy; raise ActiveRecord::ReadOnlyRecord; end", "def remove_invalid_reference_symbols_from(symbols)\n valid_referenced_symbols = []\n symbols.each do |s|\n if s\n valid_referenced_symbols << s\n else\n valid_referenced_symbols.pop\n valid_referenced_symbols << \"null\"\n end\n end\n valid_referenced_symbols\n end", "def no_circular_reference\n\n end", "def ensure_not_referenced_by_any_line_item\n\t\t\tunless line_items.empty?\n\t\t\t\terrors.add(:base, 'Line items reference this product')\n\t\t\t\tthrow :abort\n\t\t\tend\n\t\tend", "def ensure_not_referenced_by_any_articulo\n unless articulos_agregados.empty?\n errors.add(:base, 'Articulo agregado en carrito')\n throw :abort\n end\n end", "def destroy_if_orphaned\n destroy unless has_bookmarks?\n end", "def validate_buried\n if buried\n if units.where.not(buried: true).count > 0\n errors.add(:base, \"This unit cannot be deleted, as it contains at \"\\\n \"least one child unit.\")\n throw(:abort)\n elsif collections.where.not(buried: true).count > 0\n errors.add(:base, \"This unit cannot be deleted, as it contains at \"\\\n \"least one collection.\")\n throw(:abort)\n end\n end\n end", "def can_be_destroyed?\n false\n end", "def delRef(typ,origAddr)\n if hasRef(typ,origAddr)\n $book.delRef(typ,origAddr)\n end\n end", "def refinit\n return if defined?(@_references)\n\n @_references = 1\n @_references_mutex = Mutex.new\n\n self\n end", "def references?\n [email protected]?\n end", "def ensure_not_referenced_by_quotes\n unless quotes.empty?\n errors.add(:base, 'Quotes for this vehicle')\n throw :abort\n end\n end", "def ensure_not_referenced_by_any_line_item\n return if line_items.empty?\n\n errors.add(:base, \"Line Items present\")\n throw :abort\n end", "def keepRef(obj,typ=nil,origAddr=nil)\n if hasRef?(typ,origAddr)\n # ADDRESS already in refs\n if not typ.nil?\n if origAddr.nil?\n origAddr='None'\n else\n origAddr = origAddr.to_s(16)\n end\n log.warning('references already in cache %s/%s'%[typ,origAddr])\n end\n return # OUT\n end\n $book.addRef(obj,typ,origAddr)\n end", "def ensure_not_referenced_by_any_line_item\n\t\tunless line_items.empty?\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\tthrow :abort\n\t\tend\n\tend", "def check_if_deleted\n raise ActiveRecord::ReadOnlyRecord unless deleted?\n end", "def check_tp_ref_count\n update_tp_ref_count\n check('link reference count of terminal-point') do |messages|\n all_termination_points do |tp, node, nw|\n next if tp.regular_ref_count?\n\n path = [nw.name, node.name, tp.name].join('__')\n msg = \"irregular ref_count:#{tp.ref_count}\"\n messages.push(message(:warn, path, msg))\n end\n end\n end", "def ensure_not_referenced\n errors[:base] << \"Student has bookings\" if !bookings.count.zero?\n errors[:base] << \"Student has marks\" if !marks.count.zero?\n\n if errors[:base].length > 0\n return false\n else\n return true\n end\n end", "def ensure_not_referenced_by_any_line_item\n\t\tunless line_items.empty?\n\t\t\terrors.add(:base, 'Line Items Presents')\n\t\t\tthrow :abort\n\t\tend\n\tend", "def validate_references\n if datasets.count == 1\n []\n else\n x = datasets.reduce([]) { |a, e| e.anchor? ? a << [e.name, e.anchor[:name]] : a }\n refs = datasets.reduce([]) do |a, e|\n a.concat(e.references)\n end\n refs.reduce([]) do |a, e|\n x.include?([e[:dataset], e[:reference]]) ? a : a.concat([e])\n end\n end\n end", "def unref\n UV.unref(@handle)\n end", "def disable_referential_integrity\n yield\n end", "def disable_referential_integrity\n yield\n end", "def disable_referential_integrity\n yield\n end", "def disable_referential_integrity\n yield\n end", "def reclaim(refs, options)\n a = []\n i = 0 # Pointer to references hash, which is already sorted with oldest first\n s = 0 # Largest contiguous size in the array of considered numbers\n p = 0 # Pointer to start of a suitable contiguous section in the array\n while s < options[:size] && i < refs.size\n a << refs.keys[i].to_i\n a.sort!\n s, p = largest_contiguous_section(a)\n i += 1\n end\n a[p]\n end", "def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors[:base] << \"Line Items Prsent\"\n\t\t\treturn false\n\t\tend\n\tend", "def delete(key)\n ref = @references.delete(key)\n if ref\n keys_to_id = @references_to_keys_map[ref.referenced_object_id]\n if keys_to_id\n keys_to_id.delete(key)\n @references_to_keys_map.delete(ref.referenced_object_id) if keys_to_id.empty?\n end\n ref.object\n else\n nil\n end\n end", "def ensure_ref_fetched\n @merge_request.ensure_ref_fetched\n end", "def disable_referential_integrity(&block)\n yield\n end", "def commit_if_delete_dirty\n # no op\n end", "def ensure_not_referenced_by_any_item\n if items.empty?\n return true\n else\n errors.add(:base, ' Items present')\n return false\n end\n end", "def check_associations\n to_check = [:assignments, :responses, :forms, :report_reports, :questions, :broadcasts]\n to_check.each{|a| raise DeletionError.new(:cant_delete_if_assoc) unless self.send(a).empty?}\n end", "def _delete\n marked_for_destruction?\n end", "def deleted?(name, options = T.unsafe(nil)); end", "def validate_refspec\n begin\n valid_git_refspec_path?(explicit_refspec)\n rescue => e\n errors.add(:explicit_refspec, e.message)\n end\n end", "def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end", "def unify_references(ref1, ref2, ctx)\n return ctx.succeeded! if ref1.name == ref2.name\n\n if ref1.unbound?(ctx) || ref2.unbound?(ctx)\n ctx.fuse([ref1.name, ref2.name])\n ctx.succeeded!\n elsif ref1.floating?(ctx) && ref2.floating?(ctx)\n raise StandarrError if ctx.associations_for(ref1.name).size > 1\n val1 = ctx.associations_for(ref1.name)[0].value\n raise StandarrError if ctx.associations_for(ref2.name).size > 1 \n val2 = ctx.associations_for(ref2.name)[0].value\n unification(val1, val2, ctx)\n ctx.fuse([ref1.name, ref2.name]) if ctx.success?\n else\n raise NotImplementedError\n end\n # if both refs are fresh, fuse them\n # if one ref is fresh & the other one isn't then bind fresh one (occurs check)\n # More cases...\n\n ctx\n end", "def can_delete?(obj)\n can_do?(:delete, obj)\n end", "def unfold_references_helper(entity, array_of_refs, organization)\n ref = array_of_refs.shift\n field = entity[ref]\n\n # Unfold the id\n if array_of_refs.empty? && field\n return entity.delete(ref) if field.is_a?(String) # ~retro-compatibility to ease transition aroud Connec! idmaps rework. Should be removed eventually.\n\n id_hash = field.find { |id| id[:provider] == organization.oauth_provider && id[:realm] == organization.oauth_uid }\n if id_hash\n entity[ref] = id_hash['id']\n elsif field.find { |id| id[:provider] == 'connec' } # Should always be true as ids will always contain a connec id\n # We may enqueue a fetch on the endpoint of the missing association, followed by a re-fetch on this one.\n # However it's expected to be an edge case, so for now we rely on the fact that the webhooks should be relativly in order.\n # Worst case it'll be done on following sync\n entity.delete(ref)\n return nil\n end\n true\n\n # Follow embedment path\n else\n return true if field.blank?\n\n case field\n when Array\n bool = true\n field.each do |f|\n bool &= unfold_references_helper(f, array_of_refs.dup, organization)\n end\n bool\n when Hash\n unfold_references_helper(entity[ref], array_of_refs, organization)\n end\n end\n end", "def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end", "def check_and_fix_link(record, link, record_identifier)\n error = check_linked_value(record, link, record_identifier)\n if error\n @report << error\n @report << \"\\t#{link} (#{link_value(record, link)}) deleted (changed to nil).\\n\"\n delete_bad_link(record,link)\n end \n end", "def before_destroy\n raise ActiveRecord::ReadOnlyRecord\n end", "def before_destroy\n raise ActiveRecord::ReadOnlyRecord\n end", "def destroy\n @ref.destroy\n respond_to do |format|\n format.html { redirect_to refs_url, notice: 'Ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def references; end", "def references; end", "def orphan?\n false\n end", "def delete(obj) ; end", "def remove!; end", "def run_on_deletion(paths)\n end", "def run_on_deletion(paths)\n end", "def ensure_not_referenced_by_any_line_item\r\n\t\tunless line_items.empty?\r\n\t\t\terrors.add(:base, 'Line Items Present')\r\n\t\t throw :abort\r\n\t\tend\r\n\t\r\n\tend", "def reject\n @arguments_references.each { |argument_reference| @connection.objects.reject_reference(argument_reference) }\n end", "def _References\n while true\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_Reference)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_SkipBlock)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n set_failed_rule :_References unless _tmp\n return _tmp\n end", "def clear\n @lock.synchronize do\n @references.clear\n @references_to_keys_map.clear\n end\n end", "def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, \"Line Items present\")\n throw :abort\n end\n end", "def objects_with_references\n end", "def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end", "def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end" ]
[ "0.6657176", "0.664143", "0.6636281", "0.6568882", "0.6500159", "0.6490205", "0.6276947", "0.62178034", "0.6126645", "0.60913014", "0.6020338", "0.6014881", "0.60116506", "0.59670717", "0.594832", "0.5933965", "0.5860417", "0.57997817", "0.5787514", "0.5780437", "0.57633364", "0.5750466", "0.57443506", "0.5712318", "0.5711551", "0.56978995", "0.5679451", "0.5672397", "0.56618845", "0.5599362", "0.5576033", "0.5572143", "0.5569485", "0.55568624", "0.55563176", "0.5556118", "0.5547214", "0.552782", "0.5520217", "0.5510786", "0.5507946", "0.54969144", "0.549308", "0.5472833", "0.54702324", "0.546987", "0.5463249", "0.541814", "0.54094267", "0.53977555", "0.5388456", "0.53658813", "0.5362649", "0.5361683", "0.53596646", "0.5351678", "0.53478545", "0.5346439", "0.53425455", "0.5338298", "0.53368384", "0.5336039", "0.5329185", "0.5329185", "0.5329185", "0.5329185", "0.53221667", "0.5312408", "0.53113276", "0.5301554", "0.5301124", "0.5298038", "0.52917606", "0.5287793", "0.52862203", "0.52861553", "0.52849424", "0.5282824", "0.528178", "0.52812886", "0.5262839", "0.52616733", "0.52573735", "0.52498144", "0.52498144", "0.52433246", "0.5236843", "0.5236843", "0.52366537", "0.52347916", "0.52340764", "0.5232958", "0.5232958", "0.5232921", "0.52312136", "0.52161103", "0.5215666", "0.5212651", "0.5203579", "0.52035207", "0.52035207" ]
0.0
-1
enforced custom commit message format
def check_message_format(regex, oldrev, newrev) missed_revs = `git rev-list #{oldrev}..#{newrev}`.split("\n") bad_commits = "" auth_fail = 0 missed_revs.each do |rev| message = `git cat-file commit #{rev} | sed '1,/^$/d'` if !regex.match(message) then bad_commits += "#{rev}\n" else # Increment fail counter on failure auth_fail += verify_authcode(msg) end end if auth_fail > 0 or bad_commits.split("\n").nitems.to_i > 0 then puts "[POLICY] Please ensure that your commit messages contain ticket or a current authorization numbers" puts "The list of commits you sent were: " puts bad_commits exit 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_format_rules(line_number, line)\n conventional_commit_conventions = [ 'feat(.*): ', 'fix(.*): ', 'chore(.*): ', 'install(.*): ', 'improvement(.*): ', 'ci(.*): ', 'ui(.*): ', 'style(.*): ' ] \n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n errors = []\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n return errors << \"Error : Your commit message seems like not following conventional commit rules, please check your commit's convention\"\n end\n end\n errors << \"Error : Your commit message contains #{line.length} characters. Commit message should be less than 72 characters in length.\" if line.length > 72\n errors << \"Error : Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(':')[1].length > 50\n errors << \"Error : Commit message subject should start in Capital.\" if line.split(':')[1].lstrip[0] == line.split(':')[1].lstrip[0].downcase\n return errors\nend", "def check_message_format\n missed_revs = `git rev-list #{$oldrev}..#{$newrev}`.split(\"\\n\")\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !$regex.match(message)\n puts \"[POLICY] Your message is not formatted correctly\"\n puts \"\\n\\tRefused message: #{message}\"\n puts \"\\nYour commit message should absolutely reference the issue number in redmine\"\n puts \"\\n\\tYou should use one of the below referencing keywords or fixing keywords\"\n puts \"\\n\\tReferencing keywords:\"\n puts \"\\t\\trefs #XXX\"\n puts \"\\t\\treferences #XXX\"\n puts \"\\t\\tIssueID #XXX\"\n puts \"\\n\\tFixing keywords:\"\n puts \"\\t\\tfixes #XXX\"\n puts \"\\t\\tcloses #XXX\"\n puts \"\\n\\treplace XXX with the issue's number.\"\n puts \"\\n\\tN.B: If the current commit is not related to any issue (which is usually a bad idea)\"\n puts \"\\tYou can use the MISC: keyword to bypass referencing an issue as follows.\"\n puts \"\\n\\t\\tMISC: Commit message\"\n puts \"\\n\\tN.B: There's a whitespace between MISC: and the commit message.\"\n puts \"\"\n exit 1\n end\n end\nend", "def check_format_rules(line_number, line)\n errors = []\n unless line_number > 0\n conventions = ['feat', 'fix', 'build', 'chore', 'ci', 'docs', 'style', 'refactor', 'perf', 'test']\n conventional_commit_conventions = conventions.map{|x| Regexp.new '(^' + x + ')' + '(\\(.*\\))?!?: [\\w+\\D\\-\\d+]'}\n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n errors << \"\\tError: Your custom commit doesn't seem like following conventional commit rules.\"\n errors << \"\\tCheck https://www.conventionalcommits.org\"\n end\n end\n errors << \"\\tError: Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(']')[1]&.length.to_i > 50\n errors << \"\\tError: Commit message subject should start in Capital.\" if line.split(']')[1] && line.split(']')[1].lstrip[0] == line.split(']')[1].lstrip[0].downcase\n end\n return errors\nend", "def breaking_change?(commit)\n !commit.fetch(\"message\").match(/^[a-z]*!/).nil?\nend", "def commit_message(no_commit_msg = false)\n publish_emojis = [':boom:', ':rocket:', ':metal:', ':bulb:', ':zap:',\n ':sailboat:', ':gift:', ':ship:', ':shipit:', ':sparkles:', ':rainbow:']\n default_message = \"P U B L I S H #{publish_emojis.sample}\"\n\n unless no_commit_msg\n print \"Enter a commit message (default: '#{default_message}'): \"\n STDOUT.flush\n mesg = STDIN.gets.chomp.strip\n end\n\n mesg = default_message if mesg.nil? || mesg == ''\n mesg.gsub(/'/, '') # Allow this to be handed off via -m '#{message}'\nend", "def commit_message\n @commit.sub '%.%.%', @after_version\n end", "def commit_message\n commit_message_lines.join\n end", "def format_message\n return @format_message if @format_message\n\n @format_message = self.message.dup\n\n if self.line\n @format_message << \" near line #{self.line}\"\n end\n\n if self.code\n @format_message << \": #{format_code}\"\n end\n\n @format_message\n end", "def generate_commit_message\n [\n \"[fastlane]\",\n \"Updated\",\n self.type,\n \"and platform\",\n self.platform\n ].join(\" \")\n end", "def commit_message\n user_name = user ? user.login : \"anonymous\"\n \n if revisions.empty?\n \"initial #{user_name}\"\n elsif @rollback\n \"rollback #{self.log.first} #{user_name}\"\n else\n \"edit #{self.log.first} #{user_name}\"\n end\n end", "def repo_commit(msg)\n git :add => '-u'\n git :add => '.'\n git :commit => \"-m \\\"#{msg}\\\"\" \n end", "def create_commit_msg(commit_msg_path, for_commit)\n File.open(commit_msg_path, 'w') do |file|\n file.puts(\"Automatic documentation update\\n\")\n file.puts(\"- Generated for #{for_commit}.\")\n end\n end", "def format_commit_info timestamp, time_desc, ref, short_ref, message, ref_name\n [\n \"#{timestamp.strftime(\"%y %b %d\")}, #{timestamp.strftime(\"%l:%M%p\").downcase}\",\n \"(#{time_desc})\",\n ref,\n short_ref,\n message,\n ref_name\n ]\nend", "def message(str)\n @commit_msg = str\n end", "def format_message(*args)\n old_format_message(*args)\n end", "def parse_commit_message!(message)\n match = message.match(/ \\(#(?<pr_number>[0-9]*)\\)?$/)\n {\n \"pr_number\" => match && match[:pr_number] ? match[:pr_number].to_i : nil\n }\nend", "def commit(message, opts = {})\n arr_opts = ['-m', message]\n arr_opts << '-a' if opts[:add_all]\n arr_opts << '--amend' if opts[:amend]\n arr_opts << '--allow-empty' if opts[:allow_empty]\n arr_opts << \"--author\" << opts[:author] if opts[:author]\n command('commit', arr_opts)\n end", "def message\n @commit.message\n end", "def git_commit(message=\"\")\n %x( git commit -m=#{message} )\n end", "def git_commit(message)\n yield\n git add: '.'\n git commit: %{ -m #{message.inspect} }\n end", "def cmd_commit(msg)\n comment = msg[2].tr('\"', '')\n run_cmd(\"cd /etc;git add . && git commit -a -m \\\"#{comment}\\\"\")\n end", "def commit_message\n msg = (params[:message].nil? or params[:message].empty?) ? \"[no message]\" : params[:message]\n commit_message = { :message => msg }\n author_parameters = session['gollum.author']\n commit_message.merge! author_parameters unless author_parameters.nil?\n commit_message\n end", "def commit!(message)\n git \"commit -m \\\"#{message}\\\"\"\n end", "def get_commit_text(text=nil, opts={})\n user = opts.delete :user\n \n unless opts[:empty_ok] || (text && !text.empty?)\n edit_text = to_templated_s :added => added, :updated => modified,\n :removed => removed, :template_type => :commit\n text = UI::edit edit_text, user\n end\n \n lines = text.rstrip.split(\"\\n\").map {|r| r.rstrip }.reject {|l| l.empty? }\n raise abort(\"empty commit message\") if lines.empty? && opts[:use_dirstate]\n lines.join(\"\\n\")\n end", "def format(payload)\n if(payload.get(:data, :nellie, :result))\n payload.set(:data, :github_kit, :commit_comment,\n Smash.new(\n :repository => [\n payload.get(:data, :code_fetcher, :info, :owner),\n payload.get(:data, :code_fetcher, :info, :name)\n ].join('/'),\n :reference => payload.get(:data, :code_fetcher, :info, :commit_sha)\n )\n )\n if(payload.get(:data, :nellie, :result, :complete))\n payload.set(:data, :github_kit, :commit_comment, :message, success_message(payload))\n else\n payload.set(:data, :github_kit, :commit_comment, :message, failure_message(payload))\n end\n end\n end", "def format_message(message) # :nodoc:\n msg = message.gsub(/(\\r|\\n|\\r\\n)/, '<br>')\n msg.gsub(/[{}\\\\\"]/, \"\\\\\\\\\\\\0\") # oh dear\n end", "def message\n version = extract_version\n msg = Release.commit_message || \"Changed version number to #{version}\"\n msg = msg.call(version) if Proc === msg\n msg\n end", "def message\n version = extract_version\n msg = Release.commit_message || \"Changed version number to #{version}\"\n msg = msg.call(version) if Proc === msg\n msg\n end", "def type\n 'interesting_commit'\n end", "def cmd\n c = ['git commit']\n c << '-a' if all?\n c << %(-m \"#{options.message}\") if message?\n c << %(-m \"#{message}\") unless story_ids.empty?\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(' ')\n end", "def reserve_format\n Pwfmt::Context.reserve_format('message_content', @message.content) if @message.respond_to?(:content)\n end", "def format_editor issue = nil\n message = ERB.new(<<EOF).result binding\n\nPlease explain the issue. The first line will become the title. Trailing\nmarkdown comments (like these) will be ignored, and empty messages will\nnot be submitted. Issues are formatted with GitHub Flavored Markdown (GFM):\n\n http://github.github.com/github-flavored-markdown\n\nOn <%= repo %>\n\n<%= no_color { format_issue issue, columns - 2 if issue } %>\nEOF\n message.rstrip!\n message.gsub!(/(?!\\A)^.*$/) { |line| line.rstrip }\n max_line_len = message.gsub(/(?!\\A)^.*$/).max_by(&:length).length\n message.gsub!(/(?!\\A)^.*$/) { |line| \"<!-- #{line.ljust(max_line_len)} -->\" }\n # Adding an extra newline for formatting\n message.insert 0, \"\\n\"\n message.insert 0, [\n issue['title'] || issue[:title], issue['body'] || issue[:body]\n ].compact.join(\"\\n\\n\") if issue\n message\n end", "def prepend!\n return if description.empty?\n\n message = open(commit_message_file).read\n open(commit_message_file, 'w') do |f|\n f.puts \"#{description} #{message}\"\n end\n end", "def git_commit(message, &block)\n yield if block_given?\n git :add => '.'\n git :commit => \"--quiet --message '#{message}'\"\nend", "def update_commit_message(message)\n ::File.open(commit_message_file, 'w') do |file|\n file.write(message)\n end\n end", "def git_commit_all message\n system \"git add --all .\"\n return false unless $?\n system \"git commit -q -m '#{message.gsub(/'/, \"\\'\")}'\"\n return $?\nend", "def commit!\n git add: \".\"\n git commit: \"-m '#{config.dig('commit_msg')}'\"\n end", "def release_commit_message(release_name)\n \"#{RELEASE_COMMIT_PREFIX}#{release_name}\"\n end", "def commit_all(_message)\n puts 'TODO: Implement Git.commit_all'\n end", "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", "def format_message(severity, datetime, progname, msg)\n if String === msg then\n msg.inject('') { |s, line| s << super(severity, datetime, progname, line.chomp) }\n else\n super\n end\n end", "def save message\n raise NothingToCommitError if nothing_to_commit?\n @git.index.add_all\n @git.index.write\n usr = {name: @git.config['user.name'],\n email: @git.config['user.email'],\n time: Time.now}\n opt = {}\n opt[:tree] = @git.index.write_tree\n opt[:author] = usr\n opt[:committer] = usr\n opt[:message] = message\n opt[:parents] = unless @git.empty?\n begin\n [@git.head.target].compact\n rescue Rugged::ReferenceError\n []\n end\n else [] end\n opt[:update_ref] = 'HEAD'\n Rugged::Commit.create(@git, opt)\n end", "def normal_commit?\n !ARGV[1] || ARGV[1] == 'message'\n end", "def parse_commit(commit)\n regex = /!(#{labels.join('|')})(.+?)(?=(?:!(?:#{labels.join('|')})|\\z))/m\n\n commit.commit.message.scan(regex) do |match|\n label, entry = match\n\n entries[label][:entries].push(\n body: entry,\n author: commit.commit.author.name || commit.author.login,\n profile: commit.author.html_url,\n internal: org_members.include?(commit.author.login)\n )\n end\n end", "def normalize_commit(commit = {})\n commit[:name] = default_committer_name if commit[:name].to_s.empty?\n commit[:email] = default_committer_email if commit[:email].to_s.empty?\n commit\n end", "def valid?(message)\n super do |payload|\n payload.get(:data, :github_kit, :commit_comment) ||\n payload.get(:data, :github_kit, :status)\n end\n end", "def format_message(message)\n format = log_format\n puts format % message\n\n puts \" #{message[:reason]}\" if message[:kind] == :ignored && !message[:reason].nil?\n end", "def printable_commit_data(task)\n str = <<eos\n\nHere's the log of the last commit for this task:\n\ncommit: %s\ndate: %s\ncommitted by: You\n\n %s\neos\n last_commit = task[:commits].last\n sprintf( str, last_commit[:sha], last_commit[:date], last_commit[:message] )\n end", "def format_commiturl(data)\n Git.io.generate data[\"compare\"]\n end", "def format_message(severity, msg, *msg_args)\n\n # create new string for working copy\n message = String.new(@msg_pattern.to_s)\n\n # check severity and substitute (linear form)\n message = message.sub(GRFormatter::SEVERITY_TAG.to_s, severity.to_s) if message.include? GRFormatter::SEVERITY_TAG\n\n # check caller and substitute (extended form)\n if(message.include?(GRFormatter::CALLER_TAG) )then\n callers = caller()[1].to_s\n\n callers = callers[0, (callers.index(':in'))]\n \n message = message.sub(GRFormatter::CALLER_TAG, callers)\n end\n\n # check message\n if(message.include?(GRFormatter::MSG_TAG) )then\n\n # have some parameters\n if(msg_args != nil && msg_args.size() > 0)\n # iterator\n index = -1\n\n # substitute with\n message = msg.gsub(\"%s\") {|w| w = msg_args[index+=1] }\n else\n\n # replace only the message\n message = message.sub(GRFormatter::MSG_TAG, msg)\n end\n end\n\n message\n end", "def complete\n # 'Completed' is a bad commit message\n end\n\n def tests\n # 'Tests' is also a bad message\n end\n\n def rename_variable\n # 'Rename variable' is also a bad message\n end\n\n def style_cops\n # you get the idea\n end\nend", "def try_freeze(msg, allow_empty=false)\n @git.add_all\n @git.execute(%Q[commit -m \"#{msg}\"#{allow_empty ? \" --allow-empty\" : \"\"}])\n @git.head_sha\n end", "def forced_commit(mails,body)\n subject 'Forced commit realized'\n from 'svnadmin@ithol'\n recipients mails\n content_type 'text/html'\n body body\n end", "def local_git_commit\n ErrorEmittingExecutor.execute(\"git commit -m '#{COMMIT_DESCRIPTION}' Gemfile.lock\")\nend", "def msg(message)\n FileUtils.cd(@git_dir_path)\n\t# via http://ozmm.org/posts/git_msg.html\n # --allow-empty means git won't require a changed file; it will just store a\n # commit message.\n `git commit --allow-empty -m \"#{message}\" &>/dev/null`\n # Use sed to extract SHA1 hash from most recent log message\n hash = `git log master~1..master | sed -n '/commit/s/commit //p'`.chomp\n # Push to Github\n `git push origin master &>/dev/null`\n return hash\n end", "def format_msg_with_context(msg)\n msg\n end", "def commit_all(message)\n yield if block_given?\n\n git add: '.'\n git commit: %(-aqm \"#{message}\")\nend", "def short_commit() (commit || \"\")[0..6] end", "def write_commit_info(tree, parents, message)\n contents = []\n contents << ['tree', tree].join(' ')\n parents.each do |p|\n contents << ['parent', p].join(' ') if p \n end\n\n name = config_get('user.name')\n email = config_get('user.email')\n author_string = \"#{name} <#{email}> #{Time.now.to_i} #{formatted_offset}\"\n contents << ['author', author_string].join(' ')\n contents << ['committer', author_string].join(' ')\n contents << ''\n contents << message\n \n get_raw_repo.put_raw_object(contents.join(\"\\n\"), 'commit') \n end", "def formatted_message(message)\n \"#{timestamp}#{message}\\n\".freeze if message\n end", "def formatted_message\n \"#{@message} (#{@code})\"\n end", "def format(text); end", "def add_commit(commit)\n\t\tpattern = ChangelogFilter.pattern\n\t\tfiltered_text = Git.get_filtered_message(commit, pattern)\n\t\tif filtered_text\n\t\t\tfiltered_lines = filtered_text.split(\"\\n\").uniq\n\t\t\tif @changelog\n\t\t\t\t@changelog = @changelog.concat(filtered_lines).uniq\n\t\t\telse\n\t\t\t\t@changelog = filtered_lines\n\t\t\tend\n\t\tend\n\tend", "def commit( commit_msg )\n\n log.info(x) { \"[git] commit msg => #{commit_msg}\" }\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_commit_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} commit -m \\\"#{commit_msg}\\\";\"\n log.info(x) { \"[git] commit command => #{git_commit_cmd}\" }\n %x[#{git_commit_cmd}];\n log.info(x) { \"[git] has committed resources into the local repository.\" }\n\n end", "def title\n return \"All commits\" if [repos, branches, authors, paths, messages].all?(&:nil?)\n if !repos.nil? && [authors, branches, paths, messages].all?(&:nil?)\n return \"All commits for the #{comma_separated_list(repos_list)} \" +\n \"#{english_quantity(\"repo\", repos_list.size)}\"\n end\n\n message = [\"Commits\"]\n author_list = self.authors_list\n message << \"by #{comma_separated_list(map_authors_names(authors_list))}\" unless authors_list.empty?\n message << \"in #{comma_separated_list(paths_list)}\" unless paths_list.empty?\n message << \"on #{comma_separated_list(branches_list)}\" unless branches_list.empty?\n unless repos_list.empty?\n message << \"in the #{comma_separated_list(repos_list)} #{english_quantity(\"repo\", repos_list.size)}\"\n end\n message.join(\" \")\n end", "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", "def commit(m)\n git(:add => '.')\n git(:commit => \"-a -m 'Rails Template Commit: #{m}'\")\nend", "def message(message) end", "def git_commit_push(message)\n\t\t \t\tshell_command(\"git commit -a -m #{message}\")\n\t\t \t\tshell_command(\"git commit\")\n\t\t \tend", "def git_commit(message, fail_on_error = true)\n begin\n mysystem(\"git commit -m \\\"#{message}\\\" 2> /dev/null > /dev/null\")\n return true\n rescue Exception => e\n raise e if fail_on_error\n return false\n end\n end", "def title\n \"Interesting commit: #{commit.title}\"\n end", "def formatted_message\n case @text_align\n when :center\n align_center\n when :left\n @message\n when :right\n align_right\n end\n end", "def build_message(no_jira = [], invalid_jira= [])\n description = @options[\"intro\"] || \"\"\n description.concat <<DESCRIPTION\nThis notice is to remind you that you need to include valid Jira ticket\nnumbers in all of your Git commits!\n\nWe encountered the following problems in your recent commits.\n\nDESCRIPTION\n if no_jira.size > 0\n description.concat <<DESCRIPTION\nCommits with no reference to any jira tickets:\n\n #{no_jira.join(\"\\n--\\n \")}\n-----\nDESCRIPTION\n end\n\n if invalid_jira.size > 0\n description.concat <<DESCRIPTION\nCommits which reference invalid Jira ticket numbers\nthat don't exist or have already been closed:\n\n #{invalid_jira.join(\"\\n--\\n \")}\n-----\nDESCRIPTION\n end\n\n description.concat @options[\"conclusion\"] if @options[\"conclusion\"]\n\n description\n end", "def format!; end", "def send_force_commit_mail(body)\n mail = Emailer.create_foced_commit(config.force_commit_mails,body)\n Emailer.deliver(mail)\nend", "def commit(message)\n p4 'submit', '-d', message\n end", "def commit args = {}\n action = :deleted if self.deleted?\n action ||= self.is_new? ? :added : (self.is_changed? ? :updated : :nothing_to_commit) \n args[:skip_part_data] ||= false\n \n unless action.eql?(:nothing_to_commit)\n message = \"#{action} #{name}\"\n message = args[:m] if args[:m] \n if action.eql?(:deleted)\n repo.remove(self.file_name)\n self.history_count += 1\n else\n repo.add(self.file_name)\n end\n\n active_message = self.commit_messages[:most_recent]\n message = \"#{active_message.gsub(message,\"\")}\" unless self.deleted? || active_message.blank? || active_message.eql?(message)\n self.remove_message_from_temp_store(:most_recent) unless active_message.blank?\n \n repo.commit(message)\n self.last_commit = repo.log(self.local_path, :limit => 1).first.to_s\n end\n unless action.eql?(:deleted) \n self.part_count = parts.count\n self.part_count ||= 0 \n update_part_data unless args[:skip_part_data]\n\n self.history_count = self.history.size\n self.history_count = 1 if self.history_count.eql?(0) \n end\n self.save if self.changed?\n \n synchronize unless args[:dont_sync] || self.attributes[\"sync\"].blank? #rather than calling sync.blank? to skip the JSON parsing step.\n return action\n end", "def rugged_commit_options(author, repo, message)\n {\n author: author,\n committer: author,\n tree: repo.index.write_tree(repo),\n update_ref: 'HEAD',\n message: message,\n parents: repo.empty? ? [] : [repo.head.target].compact\n }\n end", "def rugged_commit_options(author, repo, message)\n {\n author: author,\n committer: author,\n tree: repo.index.write_tree(repo),\n update_ref: 'HEAD',\n message: message,\n parents: repo.empty? ? [] : [repo.head.target].compact\n }\n end", "def format(hash ={})\n # Create a Message Data where all hash keys become methods for convenient interpolation\n # in issue text.\n msgdata = MessageData.new(*arg_names)\n begin\n # Evaluate the message block in the msg data's binding\n msgdata.format(hash, &message_block)\n rescue StandardError => e\n raise RuntimeError, \"Error while reporting issue: #{issue_code}. #{e.message}\", caller\n end\n end", "def fail_commit(commit, message)\n fail(\"#{commit.sha}: #{message}\") # rubocop:disable Style/SignalException\nend", "def commit(name, message)\n git = git(name)\n\n git.config('user.name', GIT_AUTHOR[:name])\n git.config('user.email', GIT_AUTHOR[:email])\n\n git.add(all: true)\n git.commit(message)\n end", "def _process_format(format); end", "def _process_format(format); end", "def commit_sha commit_message\n output_of \"git log --grep='#{commit_message}' --format='%h' -1\"\nend", "def format_flake_comment(prefix, flake_config, team_ids)\n flake_label = flake_config['label']\n flake_repo = flake_config['repo']\n org_repo = \"#{Properties['github_user']}/#{flake_repo}\"\n flake_label_query = CGI.escape(\"label:#{flake_label}\")\n issue_link = \"https://github.com/#{org_repo}/issues?q=#{flake_label_query}\"\n new_issue_link = \"https://github.com/#{org_repo}/issues/new\"\n\n \"\n#{prefix}\n - If the proposed changes in this pull request caused the job to fail, update this pull request with new code to fix the issue(s).\n - If flaky tests caused the job to fail, leave a comment with links to the GitHub issue(s) in the `#{org_repo}` repository with the [`#{flake_label}` label](#{issue_link}) that are tracking the flakes. If no issue already exists for the flake you encountered, [create one](#{new_issue_link}).\n - If something else like CI system downtime or maintenance caused the job to fail, contact a member of #{format_teams(team_ids)} to trigger the job again.\n \"\n end", "def process\n filename = \"index.markdown\"\n markdowns = {filename => []} \n state = :message\n message = [\"\\n\"]\n patch = []\n commit = nil\n (@gitlogp.split(\"\\n\")+[\"DONE\"]).each { |line|\n words=line.split\n if line.slice(0,1)==\" \" || words.length==0\n # commit messages start with 4 spaces, diff contents with 1 space\n if state==:message\n if words[0]==\"OUTPUT_FILE:\"\n filename = words[1]\n markdowns[filename] ||= []\n else\n message << \"#{line.slice(4..-1)}\"\n end\n else\n patch << \" #{line}\" if state==:patch\n end\n elsif words[0]==\"commit\" or words[0]==\"DONE\"\n if !commit.nil?\n # replace the short description line with a named link\n shortlog = message[2]\n message[2] = \"<a name='#{shortlog}'> </a>\"\n markdowns[filename] += message.map {|l|\n if l==\"SHOW_PATCH\"\n (patch+[\"{: .diff}\\n\"]).join(\"\\n\")\n else\n l\n end\n }\n series = tags[commit].slice(-2..-1)\n markdowns[filename] << \"\\n#{tags[commit]}: [view on github](#{@commit_link_base}#{commit}), [download #{series}-#{shortlog}.patch](#{@patch_link_base}/#{series}-#{shortlog}.patch)\\n{: .commit}\\n\"\n end\n \n message=[\"\\n\"]\n patch=[]\n\n commit = words[1]\n state = :message\n elsif [\"Author:\", \"Date:\", \"new\", \"index\", \"---\", \"+++\", '\\\\'].include?(words[0])\n # chomp\n elsif words[0]==\"diff\"\n state = :patch\n left = words[2].slice(2..-1)\n right = words[3].slice(2..-1)\n if left==right\n patch << \" ::: #{right}\"\n else\n patch << \" ::: #{left} -> #{right}\"\n end\n elsif words[0]==\"@@\"\n # git tries to put the function or class name after @@. This\n # works great for C diffs, but it only finds the class name in\n # Ruby, which is usually similar to the file name, Therefore\n # it's distracting cruft. Toss it.\n patch << \" #{words.slice(0,4).join(\" \")}\"\n else\n message << \"#{line.slice(4..-1)}\" if state==:message\n patch << \" #{line}\" if state==:patch \n end\n }\n output = {}\n markdowns.each do |fn, markdown|\n output[fn] = markdown.join(\"\\n\")\n Rails.logger.info(output[fn]) if respond_to? :Rails\n end\n return output\n end", "def regex_process_commit(arr)\n message = \"\"\n filepaths = {}\n end_message_index = 0\n hash = Hash.new\n in_files = false # Have we gotten to the file portion yet? After the ;;; delimiter\n\n #index 5 should be the start\n #of the message\n (5..arr.size-1).each do |i|\n #add lines to message string if they are not identifers of lines we want to get later\n if not arr.fetch(i) =~ (/^git-svn-id:/) and\n not arr.fetch(i) =~ (/^Review URL:/) and\n not arr.fetch(i) =~ (/^BUG/) and\n not arr.fetch(i) =~ (/^R=/)\n\n #concat the message into 1\n #string\n message = message + \" \" + arr.fetch(i)\n else\n #get the last index of the \n #message, is it multiple\n #lines\n end_message_index = i\n break\n end\n end\n\n hash[:message] = message\n arr[5] = message\n\n #remove the multi line message since we condensed it\n (6..end_message_index).each do |i| \n arr.delete(i) \n end\n\n arr.each do |element|\n if fast_match(element, /^Review URL:/)\n @reviews_to_update[element[/(\\d)+/].to_i] = arr[0].strip\n\n elsif fast_match(element, /^BUG=/)\n hash[:bug] = element.strip.sub(\"BUG=\", \"\")\n\n elsif fast_match(element, /^;;;/)\n in_files = true\n\n elsif in_files and element.include?('|') # stats output needs to have a pipe\n # collect the filepath and churn count, store in the filepath hash\n split = element.split('|')\n filepaths[split[0].strip] = split[1].to_i\n \n end#if\n\n end#arr.each\n hash[\"filepaths\"] = filepaths\n \n\n return arr, hash\n\n end", "def new_commit(commit)\n puts cyan(\"Found new commit: #{commit}\")\n end", "def vcs_commit(evt)\n sel = @tblChanges.selection_model.selected_items\n msg = @cmbCommitMsg.value\n if sel.length == 0\n fx_alert_error \"Cannot commit on empty changes selection. Please select at least a file from the table above.\", \"No Files Selected\", main_stage\n elsif (msg.nil? or msg.empty?)\n fx_alert_error \"Commit message must be present.\", \"Empty Commit Message\", main_stage\n else\n commit_changes(sel, msg)\n if not @msgHistory.include?(msg)\n @cmbCommitMsg.items.add(msg)\n @msgHistory << msg\n end\n refresh_tab_state\n end\n end", "def format(message, colour = nil, style = nil)\n c = @map[:colour][colour.to_sym] unless colour.nil?\n\n if style.nil?\n t = 0\n else\n t = @map[:style][style.to_sym]\n end\n\n \"\\e[#{t};#{c}m#{message}\\e[0m\"\n end", "def commit_changes\n @message = \"commiting changes for #{@issue_key}\"\n begin\n ui.info \"Commiting changes...\"\n @git.commit_all(@user_message.empty? ? @message : @user_message)\n rescue Git::GitExecuteError => e\n error_message = e.message.split(':').last\n ui.info error_message\n unless error_message =~ /nothing to commit/\n exit 1\n end\n end\n push_changes\n end", "def format_issue(issue, repo)\n splitter = /^[# ]*release note.*/i\n underlines = /^[=\\-#]+$/\n heading_prefix = repo.match('-') ? \"#{drop_prefix(repo)}: \" : ''\n\n # Start polishing the issue body into release note text\n issue_body = issue['body']&.gsub(/\\r\\n/, \"\\n\")&.strip || ' '\n\n # Attempt to split release notes from the body with the splitter\n release_note = issue_body.split(splitter, 2).last.strip\n\n # Attempt header & further content extraction, if there was no splitter\n if release_note == issue_body\n # Discard everything before the first heading\n release_note = issue_body.split(/^#/, 2).last\n # Re-add the first \"#\", if the header split worked\n release_note = \"##{release_note}\" unless release_note == issue_body\n end\n\n # Remove extraneous lines, like ==== ---- ####\n release_note.sub!(/^.*$/, '').strip! if release_note.split(\"\\n\").first&.match(underlines)\n\n # Handle underline-style headings at the top; converting to ATX-stle\n release_note.sub!(/^(.*)$\\n^.*$/, '## \\1') if release_note.split(\"\\n\")[1]&.match(underlines)\n\n # Prepend an issue title when a heading wasn't extracted\n issue_title = release_note&.match(/^#/) ? '' : \"## #{heading_prefix}#{issue['title']}\\n\\n\"\n\n puts issue.to_yaml if @options.debug\n\n state_info = if @options.preview\n state = issue['state']\n if state == 'open'\n alert = 'warn'\n included = '(will not be included) '\n merged = 'OPEN'\n else\n alert = 'note'\n included = ''\n merged = 'merged'\n end\n url = issue['html_url']\n \"State: **#{merged}** #{included}@ <#{url}>\\n{:.#{alert}}\\n\\n\"\n else\n ''\n end\n\n full_note = \"#{issue_title}#{release_note.strip}\"\n # Normalize headings to H2\n .sub(/^#+/, '##')\n .sub(/\\n\\n/, \"\\n\\n#{state_info}\")\n\n process_images(full_note)\nend", "def test_format_build\n version = VMLib::Version.new\n\n # Test that an emtpy build corresponds to an empty string\n version.build = ''\n assert_equal '', version.format('%b')\n\n # Test that a custom build prints exactly as entered\n version.build = '001'\n assert_equal '+001', version.format('%b')\n\n version.build = '20130313144700'\n assert_equal '+20130313144700', version.format('%b')\n\n version.build = 'exp.sha.5114f85'\n assert_equal '+exp.sha.5114f85', version.format('%b')\n end", "def commit(message = nil, oneline = nil)\n commit_message = oneline || \"Committing changeset #{repository.commits.size + 1}\"\n commit_message << \"\\n\\n\" << message unless message.nil?\n self.repository.commit_all commit_message\n end", "def commit!(message, options={})\n now = Time.now\n \n sha = options.delete(:tree) || tree.write_to(self).at(1)\n parents = options.delete(:parents) || (head ? [head] : [])\n author = options[:author] || self.author\n authored_date = options[:authored_date] || now\n committer = options[:committer] || author\n committed_date = options[:committed_date] || now\n\n # commit format:\n #---------------------------------------------------\n # tree sha\n # parent sha\n # author name <email> time_as_int zone_offset\n # committer name <email> time_as_int zone_offset\n # \n # messsage\n # \n #---------------------------------------------------\n # Note there is a trailing newline after the message.\n #\n lines = []\n lines << \"tree #{sha}\"\n parents.each do |parent|\n lines << \"parent #{parent}\"\n end\n lines << \"author #{author.name} <#{author.email}> #{authored_date.strftime(\"%s %z\")}\"\n lines << \"committer #{committer.name} <#{committer.email}> #{committed_date.strftime(\"%s %z\")}\"\n lines << \"\"\n lines << message\n lines << \"\"\n \n @head = set('commit', lines.join(\"\\n\"))\n grit.update_ref(branch, head)\n \n head\n end", "def format_msg_with_context(msg)\n if @context_hash.keys.length > 0\n msg_context = '['\n @context_hash.each do |k, v|\n msg_context += \"#{k}=#{v} \"\n end\n msg_context += '] '\n msg = msg.prepend(msg_context)\n end\n msg\n end", "def commit_changes(description)\n git :add => '-A'\n git :commit => %Q(-qm \"thegarage-template: [#{@current_recipe}] #{description}\")\nend", "def commit\n @git = YMDP::GitHelper.new\n @git.do_commit(@message)\n @git_hash = git.get_hash(options[:branch]) \n end", "def check_commit_change_for_untagged_version\n return unless spec\n return unless spec.version == Version.new('0.0.1')\n ref_spec = related_specifications.find { |s| s.version != '0.0.1' }\n return unless ref_spec\n unless ref_spec.source[:commit] == spec.source[:commit]\n error \"Attempt to rewrite the commit of 0.0.1 version.\"\n end\n end" ]
[ "0.6867213", "0.67891467", "0.6486706", "0.6485641", "0.6407927", "0.6364972", "0.6337242", "0.6312838", "0.62945247", "0.62935954", "0.6290685", "0.6275102", "0.62616163", "0.61702865", "0.61460716", "0.6100219", "0.60596275", "0.60529584", "0.6014856", "0.6007999", "0.5964363", "0.59527034", "0.59465814", "0.5894405", "0.5889039", "0.578937", "0.5778598", "0.5778598", "0.57415926", "0.5740787", "0.57362694", "0.56913793", "0.56445056", "0.5637278", "0.5609392", "0.5598861", "0.55881345", "0.55829734", "0.5573219", "0.55560994", "0.5552803", "0.5546566", "0.5542521", "0.553308", "0.5505141", "0.550445", "0.54931086", "0.5475411", "0.543044", "0.54245406", "0.5421983", "0.54035354", "0.5397068", "0.53956354", "0.5378959", "0.5373658", "0.5353208", "0.5352156", "0.53462744", "0.5340135", "0.5316068", "0.5302794", "0.5289033", "0.5288987", "0.5287457", "0.5286348", "0.52831775", "0.5280585", "0.5278889", "0.5246834", "0.5238386", "0.5233314", "0.52156407", "0.5208148", "0.5200551", "0.51950014", "0.5177396", "0.51670027", "0.51670027", "0.51608115", "0.5157498", "0.5156867", "0.51492417", "0.51492417", "0.5148919", "0.51398647", "0.5132772", "0.5130342", "0.5120714", "0.5119971", "0.5118004", "0.51054204", "0.50946045", "0.5092259", "0.50884604", "0.5084062", "0.50705796", "0.506424", "0.5061041", "0.5060565" ]
0.63859576
5
UTILITY FUNCTIONS Heavily borrowed from
def puts_red(str) puts " \e[00;31m#{str}\e[00m" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def terpene; end", "def stderrs; end", "def berlioz; end", "def identify; end", "def user_os_complex\r\n end", "def schubert; end", "def rassoc(p0) end", "def anchored; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def trd; end", "def file_utils; end", "def ibu; end", "def ext; end", "def ext; end", "def formation; end", "def operations; end", "def operations; end", "def all_by_magic(io); end", "def getc() end", "def getc() end", "def getc() end", "def parts; end", "def parts; end", "def parts; end", "def malts; end", "def weber; end", "def loc; end", "def loc; end", "def loc; end", "def gounod; end", "def verdi; end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def suivre; end", "def tiny; end", "def tld; end", "def tld; end", "def blg; end", "def test_inspect\n\t\t# normalize, as instance_variables order is undefined\n\t\tnormalize = proc { |s| s[/ (.*)>$/, 1].split(', ').sort.join(', ') }\n\t\tassert_match %r{blocks=2.*ftype=file.*size=72}, normalize[@ole.file.stat('file1').inspect]\n\tend", "def hiss; end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def by_magic(io); end", "def diff2; end", "def sld; end", "def who_we_are\r\n end", "def bs; end", "def strings; end", "def common\n \n end", "def villian; end", "def file_utils=(_arg0); end", "def probers=(_arg0); end", "def dh; end", "def NL43_locator(seq=\"\",temp_dir=File.dirname($0))\n hxb2_ref = \"TGGAAGGGCTAATTTGGTCCCAAAAAAGACAAGAGATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGATCAGATATCCACTGACCTTTGGATGGTGCTTCAAGTTAGTACCAGTTGAACCAGAGCAAGTAGAAGAGGCCAAATAAGGAGAGAAGAACAGCTTGTTACACCCTATGAGCCAGCATGGGATGGAGGACCCGGAGGGAGAAGTATTAGTGTGGAAGTTTGACAGCCTCCTAGCATTTCGTCACATGGCCCGAGAGCTGCATCCGGAGTACTACAAAGACTGCTGACATCGAGCTTTCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGTGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTACATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTCAAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACTTGAAAGCGAAAGTAAAGCCAGAGGAGATCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGGCGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCGTCGGTATTAAGCGGGGGAGAATTAGATAAATGGGAAAAAATTCGGTTAAGGCCAGGGGGAAAGAAACAATATAAACTAAAACATATAGTATGGGCAAGCAGGGAGCTAGAACGATTCGCAGTTAATCCTGGCCTTTTAGAGACATCAGAAGGCTGTAGACAAATACTGGGACAGCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAGATCATTATATAATACAATAGCAGTCCTCTATTGTGTGCATCAAAGGATAGATGTAAAAGACACCAAGGAAGCCTTAGATAAGATAGAGGAAGAGCAAAACAAAAGTAAGAAAAAGGCACAGCAAGCAGCAGCTGACACAGGAAACAACAGCCAGGTCAGCCAAAATTACCCTATAGTGCAGAACCTCCAGGGGCAAATGGTACATCAGGCCATATCACCTAGAACTTTAAATGCATGGGTAAAAGTAGTAGAAGAGAAGGCTTTCAGCCCAGAAGTAATACCCATGTTTTCAGCATTATCAGAAGGAGCCACCCCACAAGATTTAAATACCATGCTAAACACAGTGGGGGGACATCAAGCAGCCATGCAAATGTTAAAAGAGACCATCAATGAGGAAGCTGCAGAATGGGATAGATTGCATCCAGTGCATGCAGGGCCTATTGCACCAGGCCAGATGAGAGAACCAAGGGGAAGTGACATAGCAGGAACTACTAGTACCCTTCAGGAACAAATAGGATGGATGACACATAATCCACCTATCCCAGTAGGAGAAATCTATAAAAGATGGATAATCCTGGGATTAAATAAAATAGTAAGAATGTATAGCCCTACCAGCATTCTGGACATAAGACAAGGACCAAAGGAACCCTTTAGAGACTATGTAGACCGATTCTATAAAACTCTAAGAGCCGAGCAAGCTTCACAAGAGGTAAAAAATTGGATGACAGAAACCTTGTTGGTCCAAAATGCGAACCCAGATTGTAAGACTATTTTAAAAGCATTGGGACCAGGAGCGACACTAGAAGAAATGATGACAGCATGTCAGGGAGTGGGGGGACCCGGCCATAAAGCAAGAGTTTTGGCTGAAGCAATGAGCCAAGTAACAAATCCAGCTACCATAATGATACAGAAAGGCAATTTTAGGAACCAAAGAAAGACTGTTAAGTGTTTCAATTGTGGCAAAGAAGGGCACATAGCCAAAAATTGCAGGGCCCCTAGGAAAAAGGGCTGTTGGAAATGTGGAAAGGAAGGACACCAAATGAAAGATTGTACTGAGAGACAGGCTAATTTTTTAGGGAAGATCTGGCCTTCCCACAAGGGAAGGCCAGGGAATTTTCTTCAGAGCAGACCAGAGCCAACAGCCCCACCAGAAGAGAGCTTCAGGTTTGGGGAAGAGACAACAACTCCCTCTCAGAAGCAGGAGCCGATAGACAAGGAACTGTATCCTTTAGCTTCCCTCAGATCACTCTTTGGCAGCGACCCCTCGTCACAATAAAGATAGGGGGGCAATTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGAAATGAATTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGATCAGATACTCATAGAAATCTGCGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTGACTCAGATTGGCTGCACTTTAAATTTTCCCATTAGTCCTATTGAGACTGTACCAGTAAAATTAAAGCCAGGAATGGATGGCCCAAAAGTTAAACAATGGCCATTGACAGAAGAAAAAATAAAAGCATTAGTAGAAATTTGTACAGAAATGGAAAAGGAAGGAAAAATTTCAAAAATTGGGCCTGAAAATCCATACAATACTCCAGTATTTGCCATAAAGAAAAAAGACAGTACTAAATGGAGAAAATTAGTAGATTTCAGAGAACTTAATAAGAGAACTCAAGATTTCTGGGAAGTTCAATTAGGAATACCACATCCTGCAGGGTTAAAACAGAAAAAATCAGTAACAGTACTGGATGTGGGCGATGCATATTTTTCAGTTCCCTTAGATAAAGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCACAGGGATGGAAAGGATCACCAGCAATATTCCAGTGTAGCATGACAAAAATCTTAGAGCCTTTTAGAAAACAAAATCCAGACATAGTCATCTATCAATACATGGATGATTTGTATGTAGGATCTGACTTAGAAATAGGGCAGCATAGAACAAAAATAGAGGAACTGAGACAACATCTGTTGAGGTGGGGATTTACCACACCAGACAAAAAACATCAGAAAGAACCTCCATTCCTTTGGATGGGTTATGAACTCCATCCTGATAAATGGACAGTACAGCCTATAGTGCTGCCAGAAAAGGACAGCTGGACTGTCAATGACATACAGAAATTAGTGGGAAAATTGAATTGGGCAAGTCAGATTTATGCAGGGATTAAAGTAAGGCAATTATGTAAACTTCTTAGGGGAACCAAAGCACTAACAGAAGTAGTACCACTAACAGAAGAAGCAGAGCTAGAACTGGCAGAAAACAGGGAGATTCTAAAAGAACCGGTACATGGAGTGTATTATGACCCATCAAAAGACTTAATAGCAGAAATACAGAAGCAGGGGCAAGGCCAATGGACATATCAAATTTATCAAGAGCCATTTAAAAATCTGAAAACAGGAAAATATGCAAGAATGAAGGGTGCCCACACTAATGATGTGAAACAATTAACAGAGGCAGTACAAAAAATAGCCACAGAAAGCATAGTAATATGGGGAAAGACTCCTAAATTTAAATTACCCATACAAAAGGAAACATGGGAAGCATGGTGGACAGAGTATTGGCAAGCCACCTGGATTCCTGAGTGGGAGTTTGTCAATACCCCTCCCTTAGTGAAGTTATGGTACCAGTTAGAGAAAGAACCCATAATAGGAGCAGAAACTTTCTATGTAGATGGGGCAGCCAATAGGGAAACTAAATTAGGAAAAGCAGGATATGTAACTGACAGAGGAAGACAAAAAGTTGTCCCCCTAACGGACACAACAAATCAGAAGACTGAGTTACAAGCAATTCATCTAGCTTTGCAGGATTCGGGATTAGAAGTAAACATAGTGACAGACTCACAATATGCATTGGGAATCATTCAAGCACAACCAGATAAGAGTGAATCAGAGTTAGTCAGTCAAATAATAGAGCAGTTAATAAAAAAGGAAAAAGTCTACCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATGGGTTGGTCAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGATAAGGCCCAAGAAGAACATGAGAAATATCACAGTAATTGGAGAGCAATGGCTAGTGATTTTAACCTACCACCTGTAGTAGCAAAAGAAATAGTAGCCAGCTGTGATAAATGTCAGCTAAAAGGGGAAGCCATGCATGGACAAGTAGACTGTAGCCCAGGAATATGGCAGCTAGATTGTACACATTTAGAAGGAAAAGTTATCTTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTAATTCCAGCAGAGACAGGGCAAGAAACAGCATACTTCCTCTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAGTACATACAGACAATGGCAGCAATTTCACCAGTACTACAGTTAAGGCCGCCTGTTGGTGGGCGGGGATCAAGCAGGAATTTGGCATTCCCTACAATCCCCAAAGTCAAGGAGTAATAGAATCTATGAATAAAGAATTAAAGAAAATTATAGGACAGGTAAGAGATCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATCCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAGTAGACATAATAGCAACAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAAATTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAGATCCAGTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATAGTGACATAAAAGTAGTGCCAAGAAGAAAAGCAAAGATCATCAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAAGTAGACAGGATGAGGATTAACACATGGAAAAGATTAGTAAAACACCATATGTATATTTCAAGGAAAGCTAAGGACTGGTTTTATAGACATCACTATGAAAGTACTAATCCAAAAATAAGTTCAGAAGTACACATCCCACTAGGGGATGCTAAATTAGTAATAACAACATATTGGGGTCTGCATACAGGAGAAAGAGACTGGCATTTGGGTCAGGGAGTCTCCATAGAATGGAGGAAAAAGAGATATAGCACACAAGTAGACCCTGACCTAGCAGACCAACTAATTCATCTGCACTATTTTGATTGTTTTTCAGAATCTGCTATAAGAAATACCATATTAGGACGTATAGTTAGTCCTAGGTGTGAATATCAAGCAGGACATAACAAGGTAGGATCTCTACAGTACTTGGCACTAGCAGCATTAATAAAACCAAAACAGATAAAGCCACCTTTGCCTAGTGTTAGGAAACTGACAGAGGACAGATGGAACAAGCCCCAGAAGACCAAGGGCCACAGAGGGAGCCATACAATGAATGGACACTAGAGCTTTTAGAGGAACTTAAGAGTGAAGCTGTTAGACATTTTCCTAGGATATGGCTCCATAACTTAGGACAACATATCTATGAAACTTACGGGGATACTTGGGCAGGAGTGGAAGCCATAATAAGAATTCTGCAACAACTGCTGTTTATCCATTTCAGAATTGGGTGTCGACATAGCAGAATAGGCGTTACTCGACAGAGGAGAGCAAGAAATGGAGCCAGTAGATCCTAGACTAGAGCCCTGGAAGCATCCAGGAAGTCAGCCTAAAACTGCTTGTACCAATTGCTATTGTAAAAAGTGTTGCTTTCATTGCCAAGTTTGTTTCATGACAAAAGCCTTAGGCATCTCCTATGGCAGGAAGAAGCGGAGACAGCGACGAAGAGCTCATCAGAACAGTCAGACTCATCAAGCTTCTCTATCAAAGCAGTAAGTAGTACATGTAATGCAACCTATAATAGTAGCAATAGTAGCATTAGTAGTAGCAATAATAATAGCAATAGTTGTGTGGTCCATAGTAATCATAGAATATAGGAAAATATTAAGACAAAGAAAAATAGACAGGTTAATTGATAGACTAATAGAAAGAGCAGAAGACAGTGGCAATGAGAGTGAAGGAGAAGTATCAGCACTTGTGGAGATGGGGGTGGAAATGGGGCACCATGCTCCTTGGGATATTGATGATCTGTAGTGCTACAGAAAAATTGTGGGTCACAGTCTATTATGGGGTACCTGTGTGGAAGGAAGCAACCACCACTCTATTTTGTGCATCAGATGCTAAAGCATATGATACAGAGGTACATAATGTTTGGGCCACACATGCCTGTGTACCCACAGACCCCAACCCACAAGAAGTAGTATTGGTAAATGTGACAGAAAATTTTAACATGTGGAAAAATGACATGGTAGAACAGATGCATGAGGATATAATCAGTTTATGGGATCAAAGCCTAAAGCCATGTGTAAAATTAACCCCACTCTGTGTTAGTTTAAAGTGCACTGATTTGAAGAATGATACTAATACCAATAGTAGTAGCGGGAGAATGATAATGGAGAAAGGAGAGATAAAAAACTGCTCTTTCAATATCAGCACAAGCATAAGAGATAAGGTGCAGAAAGAATATGCATTCTTTTATAAACTTGATATAGTACCAATAGATAATACCAGCTATAGGTTGATAAGTTGTAACACCTCAGTCATTACACAGGCCTGTCCAAAGGTATCCTTTGAGCCAATTCCCATACATTATTGTGCCCCGGCTGGTTTTGCGATTCTAAAATGTAATAATAAGACGTTCAATGGAACAGGACCATGTACAAATGTCAGCACAGTACAATGTACACATGGAATCAGGCCAGTAGTATCAACTCAACTGCTGTTAAATGGCAGTCTAGCAGAAGAAGATGTAGTAATTAGATCTGCCAATTTCACAGACAATGCTAAAACCATAATAGTACAGCTGAACACATCTGTAGAAATTAATTGTACAAGACCCAACAACAATACAAGAAAAAGTATCCGTATCCAGAGGGGACCAGGGAGAGCATTTGTTACAATAGGAAAAATAGGAAATATGAGACAAGCACATTGTAACATTAGTAGAGCAAAATGGAATGCCACTTTAAAACAGATAGCTAGCAAATTAAGAGAACAATTTGGAAATAATAAAACAATAATCTTTAAGCAATCCTCAGGAGGGGACCCAGAAATTGTAACGCACAGTTTTAATTGTGGAGGGGAATTTTTCTACTGTAATTCAACACAACTGTTTAATAGTACTTGGTTTAATAGTACTTGGAGTACTGAAGGGTCAAATAACACTGAAGGAAGTGACACAATCACACTCCCATGCAGAATAAAACAATTTATAAACATGTGGCAGGAAGTAGGAAAAGCAATGTATGCCCCTCCCATCAGTGGACAAATTAGATGTTCATCAAATATTACTGGGCTGCTATTAACAAGAGATGGTGGTAATAACAACAATGGGTCCGAGATCTTCAGACCTGGAGGAGGCGATATGAGGGACAATTGGAGAAGTGAATTATATAAATATAAAGTAGTAAAAATTGAACCATTAGGAGTAGCACCCACCAAGGCAAAGAGAAGAGTGGTGCAGAGAGAAAAAAGAGCAGTGGGAATAGGAGCTTTGTTCCTTGGGTTCTTGGGAGCAGCAGGAAGCACTATGGGCTGCACGTCAATGACGCTGACGGTACAGGCCAGACAATTATTGTCTGATATAGTGCAGCAGCAGAACAATTTGCTGAGGGCTATTGAGGCGCAACAGCATCTGTTGCAACTCACAGTCTGGGGCATCAAACAGCTCCAGGCAAGAATCCTGGCTGTGGAAAGATACCTAAAGGATCAACAGCTCCTGGGGATTTGGGGTTGCTCTGGAAAACTCATTTGCACCACTGCTGTGCCTTGGAATGCTAGTTGGAGTAATAAATCTCTGGAACAGATTTGGAATAACATGACCTGGATGGAGTGGGACAGAGAAATTAACAATTACACAAGCTTAATACACTCCTTAATTGAAGAATCGCAAAACCAGCAAGAAAAGAATGAACAAGAATTATTGGAATTAGATAAATGGGCAAGTTTGTGGAATTGGTTTAACATAACAAATTGGCTGTGGTATATAAAATTATTCATAATGATAGTAGGAGGCTTGGTAGGTTTAAGAATAGTTTTTGCTGTACTTTCTATAGTGAATAGAGTTAGGCAGGGATATTCACCATTATCGTTTCAGACCCACCTCCCAATCCCGAGGGGACCCGACAGGCCCGAAGGAATAGAAGAAGAAGGTGGAGAGAGAGACAGAGACAGATCCATTCGATTAGTGAACGGATCCTTAGCACTTATCTGGGACGATCTGCGGAGCCTGTGCCTCTTCAGCTACCACCGCTTGAGAGACTTACTCTTGATTGTAACGAGGATTGTGGAACTTCTGGGACGCAGGGGGTGGGAAGCCCTCAAATATTGGTGGAATCTCCTACAGTATTGGAGTCAGGAACTAAAGAATAGTGCTGTTAACTTGCTCAATGCCACAGCCATAGCAGTAGCTGAGGGGACAGATAGGGTTATAGAAGTATTACAAGCAGCTTATAGAGCTATTCGCCACATACCTAGAAGAATAAGACAGGGCTTGGAAAGGATTTTGCTATAAGATGGGTGGCAAGTGGTCAAAAAGTAGTGTGATTGGATGGCCTGCTGTAAGGGAAAGAATGAGACGAGCTGAGCCAGCAGCAGATGGGGTGGGAGCAGTATCTCGAGACCTAGAAAAACATGGAGCAATCACAAGTAGCAATACAGCAGCTAACAATGCTGCTTGTGCCTGGCTAGAAGCACAAGAGGAGGAAGAGGTGGGTTTTCCAGTCACACCTCAGGTACCTTTAAGACCAATGACTTACAAGGCAGCTGTAGATCTTAGCCACTTTTTAAAAGAAAAGGGGGGACTGGAAGGGCTAATTCACTCCCAAAGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGGTCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGATAAGGTAGAAGAGGCCAATAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGAATGGATGACCCTGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACGTGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCACCCAGGAGGTAGAGGTTGCAGTGAGCCAAGATCGCGCCACTGCATTCCAGCCTGGGCAAGAAAACAAGACTGTCTAAAATAATAATAATAAGTTAAGGGTATTAAATATATTTATACATGGAGGTCATAAAAATATATATATTTGGGCTGGGCGCAGTGGCTCACACCTGCGCCCGGCCCTTTGGGAGGCCGAGGCAGGTGGATCACCTGAGTTTGGGAGTTCCAGACCAGCCTGACCAACATGGAGAAACCCCTTCTCTGTGTATTTTTAGTAGATTTTATTTTATGTGTATTTTATTCACAGGTATTTCTGGAAAACTGAAACTGTTTTTCCTCTACTCTGATACCACAAGAATCATCAGCACAGAGGAAGACTTCTGTGATCAAATGTGGTGGGAGAGGGAGGTTTTCACCAGCACATGAGCAGTCAGTTCTGCCGCAGACTCGGCGGGTGTCCTTCGGTTCAGTTCCAACACCGCCTGCCTGGAGAGAGGTCAGACCACAGGGTGAGGGCTCAGTCCCCAAGACATAAACACCCAAGACATAAACACCCAACAGGTCCACCCCGCCTGCTGCCCAGGCAGAGCCGATTCACCAAGACGGGAATTAGGATAGAGAAAGAGTAAGTCACACAGAGCCGGCTGTGCGGGAGAACGGAGTTCTATTATGACTCAAATCAGTCTCCCCAAGCATTCGGGGATCAGAGTTTTTAAGGATAACTTAGTGTGTAGGGGGCCAGTGAGTTGGAGATGAAAGCGTAGGGAGTCGAAGGTGTCCTTTTGCGCCGAGTCAGTTCCTGGGTGGGGGCCACAAGATCGGATGAGCCAGTTTATCAATCCGGGGGTGCCAGCTGATCCATGGAGTGCAGGGTCTGCAAAATATCTCAAGCACTGATTGATCTTAGGTTTTACAATAGTGATGTTACCCCAGGAACAATTTGGGGAAGGTCAGAATCTTGTAGCCTGTAGCTGCATGACTCCTAAACCATAATTTCTTTTTTGTTTTTTTTTTTTTATTTTTGAGACAGGGTCTCACTCTGTCACCTAGGCTGGAGTGCAGTGGTGCAATCACAGCTCACTGCAGCCTCAACGTCGTAAGCTCAAGCGATCCTCCCACCTCAGCCTGCCTGGTAGCTGAGACTACAAGCGACGCCCCAGTTAATTTTTGTATTTTTGGTAGAGGCAGCGTTTTGCCGTGTGGCCCTGGCTGGTCTCGAACTCCTGGGCTCAAGTGATCCAGCCTCAGCCTCCCAAAGTGCTGGGACAACCGGGCCCAGTCACTGCACCTGGCCCTAAACCATAATTTCTAATCTTTTGGCTAATTTGTTAGTCCTACAAAGGCAGTCTAGTCCCCAGCAAAAAGGGGGTTTGTTTCGGGAAAGGGCTGTTACTGTCTTTGTTTCAAACTATAAACTAAGTTCCTCCTAAACTTAGTTCGGCCTACACCCAGGAATGAACAAGGAGAGCTTGGAGGTTAGAAGCACGATGGAATTGGTTAGGTCAGATCTCTTTCACTGTCTGAGTTATAATTTTGCAATGGTGGTTCAAAGACTGCCCGCTTCTGACACCAGTCGCTGCATTAATGAATCGGCCAACGCGCGGGGAGAGGCGGTTTGCGTATTGGGCGCTCTTCCGCTTCCTCGCTCACTGACTCGCTGCGCTCGGTCGTTCGGCTGCGGCGAGCGGTATCAGCTCACTCAAAGGCGGTAATACGGTTATCCACAGAATCAGGGGATAACGCAGGAAAGAACATGTGAGCAAAAGGCCAGCAAAAGGCCAGGAACCGTAAAAAGGCCGCGTTGCTGGCGTTTTTCCATAGGCTCCGCCCCCCTGACGAGCATCACAAAAATCGACGCTCAAGTCAGAGGTGGCGAAACCCGACAGGACTATAAAGATACCAGGCGTTTCCCCCTGGAAGCTCCCTCGTGCGCTCTCCTGTTCCGACCCTGCCGCTTACCGGATACCTGTCCGCCTTTCTCCCTTCGGGAAGCGTGGCGCTTTCTCATAGCTCACGCTGTAGGTATCTCAGTTCGGTGTAGGTCGTTCGCTCCAAGCTGGGCTGTGTGCACGAACCCCCCGTTCAGCCCGACCGCTGCGCCTTATCCGGTAACTATCGTCTTGAGTCCAACCCGGTAAGACACGACTTATCGCCACTGGCAGCAGCCACTGGTAACAGGATTAGCAGAGCGAGGTATGTAGGCGGTGCTACAGAGTTCTTGAAGTGGTGGCCTAACTACGGCTACACTAGAAGGACAGTATTTGGTATCTGCGCTCTGCTGAAGCCAGTTACCTTCGGAAAAAGAGTTGGTAGCTCTTGATCCGGCAAACAAACCACCGCTGGTAGCGGTGGTTTTTTTGTTTGCAAGCAGCAGATTACGCGCAGAAAAAAAGGATCTCAAGAAGATCCTTTGATCTTTTCTACGGGGTCTGACGCTCAGTGGAACGAAAACTCACGTTAAGGGATTTTGGTCATGAGATTATCAAAAAGGATCTTCACCTAGATCCTTTTAAATTAAAAATGAAGTTTTAAATCAATCTAAAGTATATATGAGTAAACTTGGTCTGACAGTTACCAATGCTTAATCAGTGAGGCACCTATCTCAGCGATCTGTCTATTTCGTTCATCCATAGTTGCCTGACTCCCCGTCGTGTAGATAACTACGATACGGGAGGGCTTACCATCTGGCCCCAGTGCTGCAATGATACCGCGAGACCCACGCTCACCGGCTCCAGATTTATCAGCAATAAACCAGCCAGCCGGAAGGGCCGAGCGCAGAAGTGGTCCTGCAACTTTATCCGCCTCCATCCAGTCTATTAATTGTTGCCGGGAAGCTAGAGTAAGTAGTTCGCCAGTTAATAGTTTGCGCAACGTTGTTGCCATTGCTACAGGCATCGTGGTGTCACGCTCGTCGTTTGGTATGGCTTCATTCAGCTCCGGTTCCCAACGATCAAGGCGAGTTACATGATCCCCCATGTTGTGCAAAAAAGCGGTTAGCTCCTTCGGTCCTCCGATCGTTGTCAGAAGTAAGTTGGCCGCAGTGTTATCACTCATGGTTATGGCAGCACTGCATAATTCTCTTACTGTCATGCCATCCGTAAGATGCTTTTCTGTGACTGGTGAGTACTCAACCAAGTCATTCTGAGAATAGTGTATGCGGCGACCGAGTTGCTCTTGCCCGGCGTCAATACGGGATAATACCGCGCCACATAGCAGAACTTTAAAAGTGCTCATCATTGGAAAACGTTCTTCGGGGCGAAAACTCTCAAGGATCTTACCGCTGTTGAGATCCAGTTCGATGTAACCCACTCGTGCACCCAACTGATCTTCAGCATCTTTTACTTTCACCAGCGTTTCTGGGTGAGCAAAAACAGGAAGGCAAAATGCCGCAAAAAAGGGAATAAGGGCGACACGGAAATGTTGAATACTCATACTCTTCCTTTTTCAATATTATTGAAGCATTTATCAGGGTTATTGTCTCATGAGCGGATACATATTTGAATGTATTTAGAAAAATAAACAAATAGGGGTTCCGCGCACATTTCCCCGAAAAGTGCCACCTGACGTCTAAGAAACCATTATTATCATGACATTAACCTATAAAAATAGGCGTATCACGAGGCCCTTTCGTCTCGCGCGTTTCGGTGATGACGGTGAAAACCTCTGACACATGCAGCTCCCGGAGACGGTCACAGCTTGTCTGTAAGCGGATGCCGGGAGCAGACAAGCCCGTCAGGGCGCGTCAGCGGGTGTTGGCGGGTGTCGGGGCTGGCTTAACTATGCGGCATCAGAGCAGATTGTACTGAGAGTGCACCATATGCGGTGTGAAATACCGCACAGATGCGTAAGGAGAAAATACCGCATCAGGCGCCATTCGCCATTCAGGCTGCGCAACTGTTGGGAAGGGCGATCGGTGCGGGCCTCTTCGCTATTACGCCAGGGGAGGCAGAGATTGCAGTAAGCTGAGATCGCAGCACTGCACTCCAGCCTGGGCGACAGAGTAAGACTCTGTCTCAAAAATAAAATAAATAAATCAATCAGATATTCCAATCTTTTCCTTTATTTATTTATTTATTTTCTATTTTGGAAACACAGTCCTTCCTTATTCCAGAATTACACATATATTCTATTTTTCTTTATATGCTCCAGTTTTTTTTAGACCTTCACCTGAAATGTGTGTATACAAAATCTAGGCCAGTCCAGCAGAGCCTAAAGGTAAAAAATAAAATAATAAAAAATAAATAAAATCTAGCTCACTCCTTCACATCAAAATGGAGATACAGCTGTTAGCATTAAATACCAAATAACCCATCTTGTCCTCAATAATTTTAAGCGCCTCTCTCCACCACATCTAACTCCTGTCAAAGGCATGTGCCCCTTCCGGGCGCTCTGCTGTGCTGCCAACCAACTGGCATGTGGACTCTGCAGGGTCCCTAACTGCCAAGCCCCACAGTGTGCCCTGAGGCTGCCCCTTCCTTCTAGCGGCTGCCCCCACTCGGCTTTGCTTTCCCTAGTTTCAGTTACTTGCGTTCAGCCAAGGTCTGAAACTAGGTGCGCACAGAGCGGTAAGACTGCGAGAGAAAGAGACCAGCTTTACAGGGGGTTTATCACAGTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACATTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACAGTGCACCCTTACAATCATTCCATTTGATTCACAATTTTTTTAGTCTCTACTGTGCCTAACTTGTAAGTTAAATTTGATCAGAGGTGTGTTCCCAGAGGGGAAAACAGTATATACAGGGTTCAGTACTATCGCATTTCAGGCCTCCACCTGGGTCTTGGAATGTGTCCCCCGAGGGGTGATGACTACCTCAGTTGGATCTCCACAGGTCACAGTGACACAAGATAACCAAGACACCTCCCAAGGCTACCACAATGGGCCGCCCTCCACGTGCACATGGCCGGAGGAACTGCCATGTCGGAGGTGCAAGCACACCTGCGCATCAGAGTCCTTGGTGTGGAGGGAGGGACCAGCGCAGCTTCCAGCCATCCACCTGATGAACAGAACCTAGGGAAAGCCCCAGTTCTACTTACACCAGGAAAGGC\"\n hxb2_l = hxb2_ref.size\n head = \"\"\n 8.times {head << (65 + rand(25)).chr}\n temp_file = temp_dir + \"/temp\"\n temp_aln = temp_dir + \"/temp_aln\"\n\n l1 = 0\n l2 = 0\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts hxb2_ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n if ref_size > 1.3*(seq.size)\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n max_seq = aln_test2.scan(/[ACGT]+/).max_by(&:length)\n aln_test2 =~ /#{max_seq}/\n before_aln_seq = $`\n before_aln = $`.size\n post_aln_seq = $'\n post_aln = $'.size\n before_aln_seq_size = before_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b1 = (1.3 * before_aln_seq_size).to_i\n post_aln_seq_size = post_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b2 = (1.3 * post_aln_seq_size).to_i\n if (before_aln > seq.size) and (post_aln <= seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1)]\n l1 = l1 + (before_aln - b1)\n elsif (post_aln > seq.size) and (before_aln <= seq.size)\n ref = ref[before_aln..(ref_size - post_aln - 1 + b2)]\n l2 = l2 + post_aln - b2\n elsif (post_aln > seq.size) and (before_aln > seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1 + b2)]\n l1 = l1 + (before_aln - b1)\n l2 = l2 + (post_aln - b2)\n end\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n end\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n\n if g1 == g2 and (s1 + g1 + s2) == ref.size\n if s1 > s2 and g2 > 2*s2\n ref = ref[0..(-g2-1)]\n repeat = 1\n l2 = l2 + g2\n elsif s1 < s2 and g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n else\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n\n while repeat == 1\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n #refine alignment\n\n if ref =~ /^(\\-+)/\n l1 = l1 - $1.size\n elsif ref =~ /(\\-+)$/\n l2 = l2 + $1.size\n end\n l1 = 0 if l1 < 0\n if (hxb2_l - l2 - 1) >= l1\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n ref_size = ref.size\n sim_count = 0\n (0..(ref_size-1)).each do |n|\n ref_base = ref[n]\n test_base = aln_test[n]\n sim_count += 1 if ref_base == test_base\n end\n similarity = (sim_count/ref_size.to_f*100).round(1)\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n loc_p1 = l1 + 1\n loc_p2 = hxb2_l - l2\n if seq.size != (loc_p2 - loc_p1 + 1)\n indel = true\n elsif aln_test.include?(\"-\")\n indel = true\n end\n return [loc_p1,loc_p2,similarity,indel,aln_test,ref]\n else\n return [0,0,0,0,0,0,0]\n end\nrescue\n return [0,0,0,0,\"N\",\"N\"]\nend", "def lsi; end", "def ismn; end", "def wrapper; end", "def cops; end", "def cops; end", "def cops; end", "def string() end", "def transformations; end", "def stat() end", "def offences_by; end", "def intensifier; end", "def romeo_and_juliet; end", "def issn; end", "def r; end", "def r; end", "def jack_handey; end", "def from; end", "def from; end", "def from; end", "def from; end", "def beautify; end", "def beautify; end", "def tr_s(p0, p1) end", "def rest_positionals; end", "def custom; end", "def custom; end", "def herald; end", "def pos() end", "def pos() end", "def pos() end", "def pos() end", "def hd\n \n end", "def split; end", "def helpers; end", "def helpers; end", "def helpers; end", "def spice; end", "def same; end", "def pos; end" ]
[ "0.60074234", "0.57682276", "0.56206393", "0.5608972", "0.55583733", "0.5440724", "0.54285514", "0.54233104", "0.5403705", "0.5403448", "0.5337924", "0.5337924", "0.5337924", "0.5337924", "0.5324698", "0.5244067", "0.5216036", "0.51666224", "0.51666224", "0.51649314", "0.5157625", "0.5157625", "0.5157501", "0.51548284", "0.51548284", "0.51548284", "0.51076025", "0.51076025", "0.51076025", "0.5104352", "0.5083547", "0.50710756", "0.50710756", "0.50710756", "0.5068554", "0.50572616", "0.504268", "0.504268", "0.504268", "0.503678", "0.50272375", "0.50265133", "0.50265133", "0.50235283", "0.5015459", "0.5013373", "0.500817", "0.500817", "0.500817", "0.500817", "0.50018257", "0.49792063", "0.49737307", "0.49660447", "0.49624476", "0.4955925", "0.49467227", "0.49437183", "0.49244508", "0.4920179", "0.49119633", "0.49039736", "0.48965514", "0.48892683", "0.4888642", "0.4879103", "0.4879103", "0.4879103", "0.48746905", "0.48711312", "0.48705658", "0.48668906", "0.48618624", "0.4856153", "0.48470736", "0.4843752", "0.4843752", "0.48428926", "0.48415545", "0.48415545", "0.48415545", "0.48415545", "0.48401368", "0.48401368", "0.4837602", "0.48369828", "0.48352054", "0.48352054", "0.4833976", "0.48300824", "0.48300824", "0.48300824", "0.48300824", "0.48298836", "0.4822587", "0.48165092", "0.48165092", "0.48165092", "0.4798972", "0.47975186", "0.47965786" ]
0.0
-1
Detect if this is a mac
def mac? RUBY_PLATFORM =~ /darwin/i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mac?\n @mac ||= is? /mac|darwin/\n end", "def mac?\n !!(ua =~ /Mac OS X/ && !ios?)\n end", "def not_a_mac\n if mac?\n return false\n else\n puts I18n.t(:mac_only)\n return true\n end\n end", "def mac?\n Config::CONFIG[\"host_os\"] =~ /darwin/i ? true : false\n end", "def mac?\n mac_internal?\n end", "def mac?\n kind_of? Mac::Platform rescue false\n end", "def mac?\n (/darwin/ =~ ruby_platform) != nil\n end", "def mac?\n (/darwin/ =~ RUBY_PLATFORM) != nil\n end", "def mac?\n Config::CONFIG['target_os'] == \"darwin\"\n end", "def mac?(req)\n user_agent_match(req, /(Macintosh)/)\n end", "def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end", "def mac?\n @mac\n end", "def is_macos?\n !!(@name =~ /^macos-.*$/ || @name =~ /^osx-.*$/)\n end", "def mac\n config[\"mac\"]\n end", "def is_darwin?\n Sprout.current_system.is_a?(Sprout::System::OSXSystem)\n end", "def os_x?\n RUBY_PLATFORM.match(/darwin/)\n end", "def mac_mri?; end", "def darwin?\n /darwin/.match(RUBY_PLATFORM)\n end", "def darwin?\n platform =~ /darwin/\n end", "def mac\n options[:mac]\n end", "def macys?\n ExecutionEnvironment.macys?\n end", "def mac_os_onboarded\n return @mac_os_onboarded\n end", "def linux?\n unix? and not mac?\n end", "def is_os_x?\n RbConfig::CONFIG[\"host_os\"] =~ /darwin/\n end", "def linux?\n unix? and not mac?\n end", "def darwin?\n RUBY_PLATFORM.include?('darwin')\n end", "def macos_platform?(node = __getnode)\n node[\"platform\"] == \"mac_os_x\"\n end", "def linux?\n !darwin?\n end", "def mac\n File.open(\"/sys/class/net/#{@name}/address\") do |f|\n f.read.chomp\n end\n end", "def osx?(platform = nil)\n get_platform(platform) == :MACOS\n end", "def macos?(node = __getnode)\n node ? node[\"platform_family\"] == \"mac_os_x\" : macos_ruby?\n end", "def looks_like_rackspace? \n has_rackspace_mac?\nend", "def mac\n @attributes.fetch('mac', nil)\n end", "def detect_os\r\n user_agent = request.env['HTTP_USER_AGENT']\r\n if user_agent =~ /(Windows|Mac)/\r\n return $1\r\n end\r\n return 'Unknow OS'\r\n end", "def macos_ruby?\n !!(RUBY_PLATFORM =~ /darwin/)\n end", "def has_openstack_mac?\n !!(Facter.value(:macaddress) =~ %r{^02:16:3[eE]})\n end", "def has_euca_mac?\n !!(Facter.value(:macaddress) =~ %r{^[dD]0:0[dD]:})\n end", "def client_os? system\n detect_os == system.to_sym\n end", "def os_s\n\t\tif(os == 'iPad' || os == 'BlackBerry' || os == 'iPhone' || os == 'Android')\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def from_osx?\n @from_osx ||= begin\n p = `#{binary} -c \"import sys; print(sys.prefix)\"`.strip\n p.start_with?(\"/System/Library/Frameworks/Python.framework\")\n end\n end", "def docker_for_mac_or_win?\n ::Docker.info(::Docker::Connection.new(config[:docker_host_url], {}))['Name'] == 'moby'\n rescue\n false\n end", "def manufacturer\n Mac.manufacturer(mac)\n end", "def host_os\n name = `uname`.split(' ').first.downcase.to_sym\n case name\n when :linux\n :linux\n when :darwin\n :macosx\n else\n :unknown\n end\n end", "def getMAC\n tmpmac = \"\"\n if Stage.initial\n tmpmac = Convert.to_string(SCR.Read(path(\".etc.install_inf.HWAddr\")))\n end\n cleanmac = Builtins.deletechars(tmpmac != nil ? tmpmac : \"\", \":\")\n cleanmac\n end", "def is_osx?\n VanagonLogger.info \"is_osx? is a deprecated method, please use #is_macos? instead.\"\n is_macos?\n end", "def correct_mac_address?\n Mac.addr.list.include?(self[:mac_address]) || self[:mac_address] == OPEN_MAC_ADDRESS\n end", "def ios? ; RUBY_PLATFORM =~ /arm-darwin/i end", "def for_desktop?\n for_terminal == TerminalEnum.desktop\n end", "def has_rackspace_mac? \n network[:interfaces].values.each do |iface|\n unless iface[:arp].nil?\n return true if iface[:arp].value?(\"00:00:0c:07:ac:01\")\n end\n end\n false\nend", "def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend", "def fix_mac!\n if self =~ /\\bMac[A-Za-z]{2,}[^acizj]\\b/ || self =~ /\\bMc/\n gsub!(/\\b(Ma?c)([A-Za-z]+)/) { |_| Regexp.last_match[1] + Regexp.last_match[2].capitalize }\n\n # Fix Mac exceptions\n %w[\n MacEdo MacEvicius MacHado MacHar MacHin MacHlin MacIas MacIulis MacKie\n MacKle MacKlin MacKmin MacKmurdo MacQuarie MacLise MacKenzie\n ].each { |mac_name| substitute!(/\\b#{mac_name}/, mac_name.capitalize) }\n end\n\n self # Allows chaining\n end", "def os_osx\n\t\t\t\t\twhere(\"os LIKE '%Mac OS X%'\")\n\t\t\t\tend", "def macys?(url = nil)\n\n if mobile? or (ENV['SITE'])\n ENV['SITE'].upcase == 'MCOM'\n else\n url ||= self.url\n environment_name(url).match(/mcom|macys|mockmacys/i) ? true : false\n\n end\n end", "def detect_os(compare_os = nil)\n return case request.user_agent.downcase\n when /windows/i\n :windows\n when /macintosh/i\n :mac\n else\n :unknown\n end\n end", "def supported_platform?\n linux? || darwin?\n end", "def ios?\n platform_name.to_s.upcase == IOS\n end", "def os\n return `uname -s`.chomp\n end", "def user_os_simple\r\n ua = request.env['HTTP_USER_AGENT'].downcase\r\n return \"Windows\" if ua.index('win')\r\n return \"Linux\" if ua.index('Linux')\r\n return \"Macintosh\" if ua.index('Macintosh')\r\n return \"unknown\"\r\n end", "def osx?(platform = T.unsafe(nil)); end", "def tap_mac\n\t\[email protected]_address.to_sockaddr[-6,6]\n\tend", "def tap_mac\n\t\[email protected]_address.to_sockaddr[-6,6]\n\tend", "def os\n app = app_with_comments\n return app.comment[0] if app && app.comment[0]\n\n app = detect_product(DARWIN)\n [IOS, OperatingSystems::Darwin::IOS[app.version.to_s]].compact.join(' ') if app\n end", "def tap_mac\n @sock.local_address.to_sockaddr[-6, 6]\n end", "def mac_address_given?\n if new_resource.mac_address\n raise \"new_resource.mac_address was given and is invalid\" unless valid_mac?(new_resource.mac_address)\n end\n if valid_mac?(new_resource.name)\n return \"name\" if name_and_mac_both_given_and_match?\n elsif new_resource.mac_address\n return \"mac_addr\"\n else\n return false\n end\n end", "def platform_version_mac_os_x(arg)\n arg.match(/^[0-9]+\\.[0-9]+/).to_s\n end", "def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end", "def installer_appdmg?\n installer_type == \"appdmg\"\n end", "def is_unix?\n return [email protected](/^(solaris|aix|osx)-.*$/)\n end", "def host_os; end", "def host_os; end", "def win_or_mac\r\n os = RUBY_PLATFORM\r\n if os.include? 'darwin'\r\n puts \"+ <lib><webdriver_helper> OS: Mac OSX\"\r\n return 'mac'\r\n elsif os.include? 'mingw32'\r\n puts \"+ <lib><webdriver_helper> OS: Windows\"\r\n return 'win'\r\n else\r\n puts \"+ <lib><webdriver_helper> Sorry, we do not support your Operating-System right now\"\r\n end\r\n end", "def chrome_os?\n !!(ua =~ /CrOS/)\n end", "def require_mac_version\n raise \"Safari requires a Mac\" unless OS.mac?\n raise \"Selenium only works with Safari on Sierra or newer\" unless valid_mac_version?\n end", "def require_mac_version\n raise \"Safari requires a Mac\" unless OS.mac?\n raise \"Selenium only works with Safari on Sierra or newer\" unless valid_mac_version?\n end", "def mac\n @mac || REXML::XPath.first(@definition, \"//domain/devices/interface/mac/@address\").value\n end", "def linux?\n !!(ua =~ /Linux/)\n end", "def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end", "def myOs\n if OS.windows?\n \"Windows\"\n elsif OS.linux?\n \"Linux\"\n elsif OS.mac?\n \"Osx\"\n else\n \"Não consegui indentificar!\"\n end\nend", "def host_os_family; end", "def os\n app = app_with_comments\n if app\n if IDEVICES.include?(app.comment[0]) && app.comment[1]\n return OperatingSystems.normalize_os(app.comment[1])\n elsif matches = OSX_VERSION_REGEX.match(app.comment[0])\n return [MAC_OS, matches[:version]].compact.join(' ') if matches[:version]\n end\n end\n\n app = detect_product(DARWIN)\n if app\n if X86_64_REGEX.match?(to_s)\n [MAC_OS, OperatingSystems::Darwin::MAC_OS[app.version.to_s]].compact.join(' ')\n else\n [IOS, OperatingSystems::Darwin::IOS[app.version.to_s]].compact.join(' ')\n end\n end\n end", "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "def mac_address\n if NicView.empty_mac?(self[\"CurrentMACAddress\"])\n self[\"PermanentMACAddress\"]\n elsif self[\"PermanentMACAddress\"]\n self[\"CurrentMACAddress\"]\n end\n end", "def get_os\n line = Cocaine::CommandLine.new('uname')\n output = line.run\n\n output.chomp.downcase.intern\n end", "def is_os? os\n Os.is_os? request.user_agent, os\n end", "def node_mac(name)\n %x{grep 'mac address' /etc/libvirt/qemu/#{name}.xml 2>/dev/null}.match(/((..:){5}..)/).to_s\nend", "def os\n app = detect_product(DARWIN)\n return [IOS, UserAgent::OperatingSystems::Darwin::IOS[app.version.to_s]].compact.join(' ') if app\n\n app = app_with_comments\n return OperatingSystems.normalize_os(app.comment.join) if app\n end", "def os\n darwin = detect_product(DARWIN)\n version = if darwin\n UserAgent::OperatingSystems::Darwin::WATCH_OS[darwin.version.to_s]\n else\n match = detect_comment_match(/watchOS\\s(?<version>[\\.\\d]+)/)\n match.named_captures['version'] if match\n end\n\n [WATCH_OS, version].compact.join(' ')\n end", "def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def check_fusion_vm_mac(options)\n if options['mac'].gsub(/:/,\"\").match(/^08/)\n handle_output(options,\"Warning:\\tInvalid MAC address: #{options['mac']}\")\n options['vm'] = \"fusion\"\n options['mac'] = generate_mac_address(options['vm'])\n handle_output(options,\"Information:\\tGenerated new MAC address: #{options['mac']}\")\n end\n return options['mac']\nend", "def installed?\n MacOS.dev_tools_path == Pathname.new(\"/usr/bin\")\n end", "def mac_address\n mac = nil\n\n ovf.xpath(\"//*[local-name()='Machine']/*[local-name()='Hardware']/*[local-name()='Network']/*[local-name()='Adapter']\").each do |net|\n if net.attribute(\"enabled\").value == \"true\"\n mac = net.attribute(\"MACAddress\").value\n break\n end\n end\n\n if mac\n return mac\n else\n fail Errors::BoxAttributeError, error_message: 'Could not determine mac address'\n end\n end", "def mac_address\n mac = nil\n\n ovf.elements.each(\"//vbox:Machine/Hardware//Adapter\") do |ele|\n if ele.attributes['enabled'] == 'true'\n mac = ele.attributes['MACAddress']\n break\n end\n end\n\n if mac\n return mac\n else\n raise Errors::BoxAttributeError, :error_message => 'Could not determine mac address'\n end\n end", "def has_euca_mac?\n network[:interfaces].each_value do |iface|\n mac = get_mac_address(iface[:addresses])\n if MAC_MATCH.match?(mac)\n logger.trace(\"Plugin Eucalyptus: has_euca_mac? == true (#{mac})\")\n return true\n end\n end\n\n logger.trace(\"Plugin Eucalyptus: has_euca_mac? == false\")\n false\n end", "def osx_version\n @osx_version ||= `sw_vers | grep ProductVersion | cut -f 2 -d ':' | awk ' { print $1; } '`.strip rescue ''\n end", "def osx_version\n @osx_version ||= `sw_vers | grep ProductVersion | cut -f 2 -d ':' | awk ' { print $1; } '`.strip rescue ''\n end", "def has_openstack_mac?\n Facter.warnonce(\"#{self}.#{__method__} is deprecated; see the Facter::EC2 classes instead\")\n !!(Facter.value(:macaddress) =~ %r{^(02|[fF][aA]):16:3[eE]})\n end", "def has_euca_mac?\n Facter.warnonce(\"#{self}.#{__method__} is deprecated; see the Facter::EC2 classes instead\")\n !!(Facter.value(:macaddress) =~ %r{^[dD]0:0[dD]:})\n end", "def is_windows?\n return [email protected](/^windows.*$/)\n end", "def os\n Agent.os_for_user_agent string\n end" ]
[ "0.85978335", "0.8535805", "0.8425359", "0.83924925", "0.8218638", "0.81557995", "0.81468344", "0.8109626", "0.8014554", "0.8002375", "0.7950483", "0.79282886", "0.7722649", "0.73446965", "0.7280965", "0.7272204", "0.7223733", "0.72038984", "0.71829784", "0.7152258", "0.7148419", "0.7095284", "0.7084311", "0.7062879", "0.70496", "0.6967414", "0.68760794", "0.68187207", "0.6773686", "0.67658114", "0.6750592", "0.67164487", "0.66687965", "0.6593453", "0.65820247", "0.6573243", "0.65524924", "0.64916575", "0.64734364", "0.647066", "0.6434923", "0.6425574", "0.64064807", "0.6394919", "0.63705945", "0.6365007", "0.6340786", "0.6320232", "0.630476", "0.62845886", "0.62672335", "0.6265089", "0.6256633", "0.62361836", "0.6172788", "0.6171159", "0.61349756", "0.61252105", "0.61206996", "0.6118811", "0.6118811", "0.6118249", "0.6088283", "0.60757524", "0.6074462", "0.60648954", "0.6054788", "0.6053166", "0.60469604", "0.60469604", "0.60442084", "0.60395044", "0.6034385", "0.6034385", "0.6006427", "0.5991097", "0.59730405", "0.5954595", "0.5943188", "0.5935631", "0.5933416", "0.5933416", "0.593291", "0.59275246", "0.5913645", "0.5895858", "0.5884527", "0.5865782", "0.5831634", "0.58158344", "0.57967156", "0.57958525", "0.5783431", "0.5782769", "0.57585615", "0.57585615", "0.57580084", "0.575751", "0.574457", "0.57343143" ]
0.7643965
13
Detect if this is linux
def linux? RUBY_PLATFORM =~ /linux/i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linux?\n !!(ua =~ /Linux/)\n end", "def linux?\n /linux/.match(RUBY_PLATFORM)\n end", "def linux?\n linux_internal?\n end", "def linux?\n RUBY_PLATFORM.match(/linux/)\n end", "def linux?\n RUBY_PLATFORM =~ /linux/\n end", "def linux?\n @linux\n end", "def linux?\n unix? and not mac?\n end", "def linux?\n kind_of? Unix::Platform rescue false\n end", "def linux?\n unix? and not mac?\n end", "def is_linux?\n return (!is_windows? && !is_unix?)\n end", "def linux?\n has_os? && !!os_image_type.match(/suse|redhat|ubuntu|debian|centos|fedora/i)\n end", "def linux? ; RUBY_PLATFORM =~ /linux/i end", "def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend", "def linux?\n @linux ||= is? /linux|cygwin/\n end", "def linux?\n !darwin?\n end", "def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend", "def linux?\n %w(debian redhat ubuntu).include?(os[:family])\nend", "def linux?(platform = nil)\n get_platform(platform) == :LINUX\n end", "def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end", "def linux_type\n redhat_linux_type || suse_linux_type || unknown_linux_type\n end", "def is_unix?\n return [email protected](/^(solaris|aix|osx)-.*$/)\n end", "def determine_os\n @os = 'linux'\n end", "def supported_platform?\n linux? || darwin?\n end", "def determine_os\n @os = \"linux\"\n end", "def is_cross_compiled_linux?\n return (is_cross_compiled? && is_linux?)\n end", "def unix?\n kind_of? Unix::Platform rescue false\n end", "def unix?\n not windows? and not java?\n end", "def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def determine_os\n scp(:source => Provision::Bootstrapper.determine_os_script, :destination => \"/tmp\")\n o = run(\"chmod +x /tmp/determine_os.sh; /bin/sh /tmp/determine_os.sh\").chomp\n o.empty? ? :ubuntu : o\n end", "def ubuntu_platform?(node = __getnode)\n node[\"platform\"] == \"ubuntu\"\n end", "def unix?\n !windows?\n end", "def client_os? system\n detect_os == system.to_sym\n end", "def linux_version\n case ENV['MACHTYPE']\n when \"s390x-suse-linux\"\n :sles_zlnx\n when /^i[356]86/\n if File.exist? \"/etc/fedora-release\"\n :linux_ia32_cell\n else\n :linux_ia32\n end\n else\n if File.exist? \"/etc/rhel-release\"\n :rhel\n elsif File.exist? \"/etc/redhat-release\"\n `awk '/release 5/||/release 4.9/{v=5};/release 4/{v=4}; END {print \"rhel\" v}' /etc/redhad-release`.to_sym\n elsif File.exist? \"/etc/SuSE-release\"\n `awk '$1==\"VERSION\" { v=$3}; END { print \"sles\" v}' /etc/SuSE-release`.to_sym\n elsif File.exist? \"/etc/yellowdog-release\"\n :yhpc\n else\n :rhel\n end\n end\nend", "def oracle_linux?(node)\n node['platform'] == 'oracle'\n end", "def is_nix_os?\n RbConfig::CONFIG[\"host_os\"] =~ /linux|freebsd|darwin|unix/\n end", "def is_ubuntu?\n return [email protected](/^ubuntu-.*$/)\n end", "def linux\n raise PlatformError.new(\"Only available under Linux\") unless linux?\n require_linux\n return Linux.new\n end", "def ubuntu?(node)\n node['platform'] == 'ubuntu'\n end", "def host_os\n name = `uname`.split(' ').first.downcase.to_sym\n case name\n when :linux\n :linux\n when :darwin\n :macosx\n else\n :unknown\n end\n end", "def posix?\n !windows?\n end", "def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end", "def linux_mint?(node)\n node['platform'] == 'linuxmint'\n end", "def os\n return `uname -s`.chomp\n end", "def unknown_linux_type\n if @unknown_linux_type.nil?\n version = @platform.exec(\"uname\", \"-r\").chomp\n version = \"unknown\" if version.blank?\n @unknown_linux_type = \"unknown-linux-%s\" % version\n end\n \n @unknown_linux_type\n end", "def linuxmint_platform?(node = __getnode)\n node[\"platform\"] == \"linuxmint\"\n end", "def ubuntu12x?\n platform_family?('debian') && node['platform_version'][/^12/]\n end", "def ubuntu12x?\n platform_family?('debian') && node['platform_version'][/^12/]\n end", "def suse_linux_type\n if @suse_linux_type.nil?\n out = nil\n text = FilePath.new(\"/etc/SuSE-release\").suck_file\n unless text.nil?\n if text =~ /suse/i\n out = \"sl\"\n out += \"es\" if text =~ /enterprise\\s*server/i\n out += \"%s\" % $1 if text =~ /^[^\\d]+(\\d+)/i\n end\n end\n \n @suse_linux_type = out\n end\n \n @suse_linux_type\n end", "def detect_os\r\n user_agent = request.env['HTTP_USER_AGENT']\r\n if user_agent =~ /(Windows|Mac)/\r\n return $1\r\n end\r\n return 'Unknow OS'\r\n end", "def user_os_simple\r\n ua = request.env['HTTP_USER_AGENT'].downcase\r\n return \"Windows\" if ua.index('win')\r\n return \"Linux\" if ua.index('Linux')\r\n return \"Macintosh\" if ua.index('Macintosh')\r\n return \"unknown\"\r\n end", "def os_type\n\n if @ostype\n return @ostype\n end\n\n res = :invalid\n\n Rouster.os_files.each_pair do |os, f|\n [ f ].flatten.each do |candidate|\n if self.is_file?(candidate)\n next if candidate.eql?('/etc/os-release') and ! self.is_in_file?(candidate, os.to_s, 'i') # CentOS detection\n @logger.debug(sprintf('determined OS to be[%s] via[%s]', os, candidate))\n res = os\n end\n end\n break unless res.eql?(:invalid)\n end\n\n @logger.error(sprintf('unable to determine OS, looking for[%s]', Rouster.os_files)) if res.eql?(:invalid)\n\n @ostype = res\n res\n end", "def amazon_linux?(node)\n node['platform'] == 'amazon'\n end", "def redhat_enterprise_linux?(node)\n node['platform'] == 'enterprise'\n end", "def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end", "def host_os; end", "def host_os; end", "def fetch_linux_os_version\n `lsb_release -rs`.strip\nend", "def ubuntu?\n @flavor =~ /ubuntu/\n end", "def sys\n return `uname -n`.chomp\n end", "def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end", "def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end", "def windows?\n ruby_platform?(:windows)\nend", "def debian?\n platform_family?('debian')\n end", "def debian?\n platform_family?('debian')\n end", "def get_os\n line = Cocaine::CommandLine.new('uname')\n output = line.run\n\n output.chomp.downcase.intern\n end", "def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end", "def sys_uname_osname\n uname = `uname`\n if uname.include? 'Darwin' # macOS\n :macos\n elsif uname.include? 'Linux'\n :linux\n elsif uname.include? 'MINGW'\n :windows\n elsif uname.include? 'OpenBSD'\n :openbsd\n end\n end", "def is_cisco_wrlinux?\n return [email protected](/^cisco-wrlinux-.*$/)\n end", "def debian_platform?(node = __getnode)\n node[\"platform\"] == \"debian\"\n end", "def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end", "def ubuntu16x?\n platform_family?('debian') && node['platform_version'][/^16/]\n end", "def kernel_hardware\n uname('-m')\n end", "def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end", "def get_os\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n return :Windows\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n return :Mac\n elsif RbConfig::CONFIG['host_os'] =~ /linux/\n return :Linux\n elsif RbConfig::CONFIG['host_os'] =~ /bsd/\n return :BSD\n else\n return :unknown_os\n end\nend", "def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end", "def raspbian_platform?(node = __getnode)\n node[\"platform\"] == \"raspbian\"\n end", "def centos_platform?(node = __getnode)\n node[\"platform\"] == \"centos\"\n end", "def centos?\n File.exist?('/etc/centos-release')\nend", "def centos?(node)\n node['platform'] == 'centos'\n end", "def openbsd_platform?(node = __getnode)\n node[\"platform\"] == \"openbsd\"\n end", "def osver\n return `uname -r`.chomp\n end", "def detect_os(compare_os = nil)\n return case request.user_agent.downcase\n when /windows/i\n :windows\n when /macintosh/i\n :mac\n else\n :unknown\n end\n end", "def is_a_program( s )\n case ARCH\n when 'w32'\n nil\n else\n ( system \"which #{s} >/dev/null 2>&1\" ) ? 1 : nil\n end\nend", "def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end", "def os_x?\n RUBY_PLATFORM.match(/darwin/)\n end", "def netbsd_platform?(node = __getnode)\n node[\"platform\"] == \"netbsd\"\n end", "def os\n Facter.value(:operatingsystem)\n end", "def is_yum_platform\n node[:platform_family] == \"rhel\"\nend", "def windows?\n\tRbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend", "def os_platform\n return @parsed_ua.os ? @parsed_ua.os : 'Unknown'\n end", "def supported_by_platform?\n right_platform = RightScale::Platform.linux?\n right_platform && user_exists?('rightscale') # avoid calling user_exists? on unsupported platform(s)\n end", "def host_os_family; end", "def detect_os\n @@os_features ||= nil\n return @@os_features if @@os_features\n @@os_features ||= {}\n\n # Mac Miner\n mac_miner = lambda do\n version = `sw_vers -productVersion`.match(/\\d+\\.\\d+(?:\\.\\d+)?/)[0]\n @@os_features.merge!({\n :platform => \"darwin\",\n :os_distro => \"Mac OSX\",\n :os_version => version,\n :os_nickname => case version.split(\".\")[0..1].join(\".\")\n when \"10.0\"; \"Cheetah\"\n when \"10.1\"; \"Puma\"\n when \"10.2\"; \"Jaguar\"\n when \"10.3\"; \"Panther\"\n when \"10.4\"; \"Tiger\"\n when \"10.5\"; \"Leopard\"\n when \"10.6\"; \"Snow Leopard\"\n when \"10.7\"; \"Lion\"\n when \"10.8\"; \"Mountain Lion\"\n when \"10.9\"; \"Mavericks\"\n when \"10.10\"; \"Yosemite\"\n else; \"Unknown Version of OSX\"\n end,\n :install_method => \"install\",\n :hostname => `hostname`.chomp,\n })\n if Pathname.which(\"brew\")\n @@os_features[:install_cmd] = \"brew install\"\n elsif Pathname.which(\"port\")\n @@os_features[:install_cmd] = \"port install\"\n else\n @@os_features[:install_method] = \"build\"\n end\n @@os_features\n end\n\n # Linux Miner\n linux_miner = lambda do\n # Ensure LSB is installed\n if not Pathname.which(\"lsb_release\")\n pkg_mgrs = {\n \"apt-get\" => \"install -y lsb\", # Debian/Ubuntu/Linux Mint/PCLinuxOS\n \"up2date\" => \"-i lsb\", # RHEL/Oracle\n \"yum\" => \"install -y lsb\", # CentOS/Fedora/RHEL/Oracle\n \"zypper\" => \"--non-interactive install lsb\", # OpenSUSE/SLES\n \"pacman\" => \"-S --noconfirm lsb-release\", # ArchLinux\n \"urpmi\" => \"--auto lsb-release\", # Mandriva/Mageia\n \"emerge\" => \"lsb_release\", # Gentoo\n \"slackpkg\" => \"\", # Slackware NOTE - doesn't have lsb\n }\n ret = false\n pkg_mgrs.each do |mgr,args|\n if Pathname.which(mgr)\n if mgr == \"slackpkg\" && File.exists?(\"/etc/slackware-version\")\n ret = true\n else\n ret = system(\"sudo #{mgr} #{args}\")\n end\n break if ret\n end\n end\n end\n\n arch_family = `arch 2> /dev/null`.chomp\n pkg_arch = arch_family\n install_method = \"install\"\n if File.exists?(\"/etc/slackware-version\") || Pathname.which(\"slackpkg\")\n # Slackware\n nickname = File.read(\"/etc/slackware-version\").strip\n version = nickname.split[1..-1].join(\" \")\n major_release = version.to_i\n distro = \"Slackware\"\n pkg_fmt = major_release < 13 ? \"tgz\" : \"txz\"\n install = \"slackpkg -batch=on -default_answer=y install\"\n local_install = \"installpkg\"\n elsif File.exists?(\"/etc/oracle-release\") || File.exists?(\"/etc/enterprise-release\")\n if File.exists?(\"/etc/oracle-release\")\n nickname = File.read(\"/etc/oracle-release\").strip\n else\n nickname = File.read(\"/etc/enterprise-release\").strip\n end\n version = nickname.match(/\\d+(\\.\\d+)?/)[0]\n major_release = version.to_i\n distro, pkg_fmt, install, local_install = \"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"\n else\n version = `lsb_release -r 2> /dev/null`.strip.split[1..-1].join(\" \")\n major_release = version.to_i\n nickname = `lsb_release -c 2> /dev/null`.strip.split[1..-1].join(\" \")\n lsb_release_output = `lsb_release -a 2> /dev/null`.chomp\n distro, pkg_fmt, install, local_install = case lsb_release_output\n when /(debian|ubuntu|mint)/i\n pkg_arch = \"amd64\" if arch_family == \"x86_64\"\n [$1, \"deb\", \"apt-get install -y\", \"dpkg -i\"]\n when /(centos|fedora)/i\n [$1, \"rpm\", \"yum install -y\", \"yum localinstall -y\"]\n when /oracle/i\n [\"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /redhat|rhel/i\n [\"RHEL\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /open\\s*suse/i\n [\"OpenSUSE\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /suse.*enterprise/i\n [\"SLES\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /archlinux/i\n [\"ArchLinux\", \"pkg.tar.xz\", \"pacman -S --noconfirm\", \"pacman -U --noconfirm\"]\n when /(mandriva|mageia)/i\n [$1, \"rpm\", \"urpmi --auto \", \"rpm -Uvh\"]\n when /pc\\s*linux\\s*os/i\n [\"PCLinuxOS\", \"rpm\", \"apt-get install -y\", \"rpm -Uvh\"]\n when /gentoo/i\n [\"Gentoo\", \"tgz\", \"emerge\", \"\"]\n else\n install_method = \"build\"\n [`lsb_release -d 2> /dev/null`.strip.split[1..-1].join(\" \")]\n end\n end\n ret = {\n :platform => \"linux\",\n :os_distro => distro,\n :pkg_format => pkg_fmt,\n :pkg_arch => pkg_arch,\n :os_version => version,\n :install_method => install_method,\n :install_cmd => install,\n :local_install_cmd => local_install,\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n # Solaris Miner\n solaris_miner = lambda do\n distro = `uname -a`.match(/(open\\s*)?(solaris)/i)[1..-1].compact.map { |s| s.capitalize }.join\n version = `uname -r`.strip\n nickname = \"#{distro} #{version.split('.')[-1]}\"\n if distro == \"OpenSolaris\"\n nickname = File.read(\"/etc/release\").match(/OpenSolaris [a-zA-Z0-9.]\\+/i)[0].strip\n end\n @@os_features.merge!({\n :platform => \"solaris\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg install\",\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n })\n end\n\n # *BSD Miner\n bsd_miner = lambda do\n distro = `uname -s`.strip\n version = `uname -r`.strip\n @@os_features.merge!({\n :platform => \"bsd\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg_add -r\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # BeOS Miner\n beos_miner = lambda do\n version = `uname -r`.strip\n distro = `uname -s`.strip\n @@os_features.merge!({\n :platform => \"beos\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"build\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # Windows Miner\n windows_miner = lambda do\n sysinfo = `reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\"`.chomp\n\n hostname = `reg query \"HKEY_LOCAL_MACHINE\\\\System\\\\CurrentControlSet\\\\Control\\\\ComputerName\\\\ComputerName\"`.chomp\n hostname = hostname.match(/^\\s*ComputerName\\s+\\w+\\s+(.*)/i)[1].strip\n\n version = sysinfo.match(/^\\s*CurrentVersion\\s+\\w+\\s+(.*)/i)[1].strip << \".\"\n version << sysinfo.match(/^\\s*CurrentBuildNumber\\s+\\w+\\s+(.*)/i)[1].strip\n\n nickname = sysinfo.match(/^\\s*ProductName\\s+\\w+\\s+(.*)/i)[1].strip\n nickname = \"Microsoft #{nickname}\" unless nickname =~ /^Microsoft/\n\n try_boot_ini = `type C:\\\\boot.ini 2> nul | findstr /C:\"WINDOWS=\"`.chomp\n unless try_boot_ini.empty?\n nickname = try_boot_ini.match(/WINDOWS=\"([^\"]+)\"/i)[1].strip\n end\n\n install_method, install_cmd = case ::RbConfig::CONFIG['host_os'].downcase\n when /mingw/; [\"build\", nil]\n when /mswin/; [\"install\", \"install\"]\n when /cygwin/; [\"install\", \"setup.exe -q -D -P\"] # TODO - Does this detect cygwin properly?\n end\n ret = {\n :os_distro => nickname.split(/\\s+/).reject { |s| s =~ /microsoft|windows/i }.join(\" \"),\n :hostname => hostname,\n :os_nickname => nickname,\n :os_version => version,\n :platform => \"windows\", # TODO - Cygwin / MinGW\n :install_method => install_method,\n :install_cmd => install_cmd,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n case ::RbConfig::CONFIG['host_os'].downcase\n when /darwin/; mac_miner[]\n when /mswin|mingw/; windows_miner[]\n when /linux/; linux_miner[]\n when /bsd/; bsd_miner[]\n when /solaris/; solaris_miner[]\n else\n case `uname -s`.chomp.downcase\n when /linux/; linux_miner[]\n when /darwin/; mac_miner[]\n when /solaris/; solaris_miner[]\n when /bsd/; bsd_miner[]\n when /dragonfly/; bsd_miner[]\n when /haiku/; beos_miner[]\n when /beos/; beos_miner[]\n end\n end\n\n @@os_features.freeze\n end", "def myOs\n if OS.windows?\n \"Windows\"\n elsif OS.linux?\n \"Linux\"\n elsif OS.mac?\n \"Osx\"\n else\n \"Não consegui indentificar!\"\n end\nend", "def freebsd_platform?(node = __getnode)\n node[\"platform\"] == \"freebsd\"\n end", "def is_debian?\n return [email protected](/^debian-.*$/)\n end", "def os_family\n case os_type(:nice)\n when /Linux|Solaris|OSX/i then 'Generic'\n when /Windows/i then 'Windows'\n else 'Unknown'\n end\n end", "def redhat_linux_type\n if @redhat_linux_type.nil?\n out = nil\n text = FilePath.new(\"/etc/redhat-release\").suck_file\n unless text.nil?\n if text =~ /red\\s*hat/i\n out = \"rh\"\n out += \"el\" if text =~ /enterprise/i\n out += \"es\" if text =~ /\\s+ES\\s+/i\n out += \"%s\" % $1 if text =~ /release\\s+(\\d+)/i\n out += \"-update-%s\" % $1 if text =~ /update\\s+(\\d+)/i\n end\n end\n \n @redhat_linux_type = out\n end\n \n @redhat_linux_type\n end", "def systemctl?\n systemctl.present?\n end", "def systemctl?\n systemctl.present?\n end" ]
[ "0.86334854", "0.85851496", "0.8558185", "0.84766424", "0.8427694", "0.8426505", "0.84171027", "0.8415084", "0.83394355", "0.82977027", "0.8236633", "0.8225342", "0.809217", "0.80748117", "0.79796696", "0.78579587", "0.783056", "0.77966577", "0.76531976", "0.76133955", "0.758668", "0.7506049", "0.7460398", "0.7412303", "0.7380108", "0.7245068", "0.7230762", "0.7230015", "0.7178742", "0.71297437", "0.7129046", "0.7086557", "0.7056547", "0.7055591", "0.7020709", "0.70064825", "0.69562995", "0.6945412", "0.69337016", "0.69273573", "0.69235796", "0.68702024", "0.6867686", "0.68293625", "0.6807525", "0.6794224", "0.6794224", "0.678966", "0.67308193", "0.67287815", "0.67248565", "0.671847", "0.6710645", "0.67079514", "0.66845274", "0.66845274", "0.66736555", "0.6647628", "0.664403", "0.6638644", "0.6638644", "0.66054744", "0.6603476", "0.6603476", "0.6589657", "0.65799445", "0.6572622", "0.65657586", "0.6565432", "0.65608233", "0.65602136", "0.65595794", "0.65592176", "0.65556943", "0.65556735", "0.65494394", "0.6536491", "0.6533273", "0.65169746", "0.65144986", "0.65031433", "0.6501214", "0.6497408", "0.6494233", "0.6493122", "0.6490872", "0.648965", "0.64881986", "0.6484244", "0.64828116", "0.6479146", "0.6466635", "0.6466272", "0.64514554", "0.6448807", "0.6442572", "0.6434518", "0.6434403", "0.6426165", "0.6426165" ]
0.80588955
14
Create a symlink in the user's home directory from the files in ./home src file name of a file in .home/ dest name of the symlink to create in $HOME
def symlink_home(src, dest) home_dir = ENV['HOME'] if( !File.exists?(File.join(home_dir, dest)) || File.symlink?(File.join(home_dir, dest)) ) # FileUtils.ln_sf was making odd nested links, and this works. FileUtils.rm(File.join(home_dir, dest)) if File.symlink?(File.join(home_dir, dest)) FileUtils.ln_s(File.join(File.dirname(__FILE__), src), File.join(home_dir, dest)) puts_green " #{dest} -> #{src}" else puts_red " Unable to symlink #{dest} because it exists and is not a symlink" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_symlink(dest_path); end", "def make_symlink( old ) File.symlink( old, expand_tilde ) end", "def symlink(source, target=\".#{source}\")\n puts \"Symlinking #{dotfiles(source)} -> #{home(target)}\"\n if File.exist?(home(target))\n if user_confirms?(\"Overwrite\", home(target))\n FileUtils.ln_sf dotfiles(source), home(target) unless dry_run?\n else\n puts \"Skipping #{source}\"\n end\n else\n FileUtils.ln_sf dotfiles(source), home(target) unless dry_run?\n end\n end", "def make_link( old ) File.link( old, expand_tilde ) end", "def symlinking_files\n linkables = Dir.glob('*/**{.symlink}')\n\n skip_all = false\n overwrite_all = false\n backup_all = false\n\n linkables.each do |linkable|\n overwrite = false\n backup = false\n\n file = File.basename(linkable).split('.')[0...-1].join('.')\n source = \"#{ENV[\"PWD\"]}/#{linkable}\"\n target = \"#{ENV[\"HOME\"]}/.#{file}\"\n\n puts \"======================#{file}==============================\"\n puts \"Source: #{source}\"\n puts \"Target: #{target}\"\n\n if File.exists?(target) || File.symlink?(target)\n unless skip_all || overwrite_all || backup_all\n puts \"File already exists: #{target}, what do you want to do? [s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all\"\n case STDIN.gets.chomp\n when 'o' then overwrite = true\n when 'b' then backup = true\n when 'O' then overwrite_all = true\n when 'B' then backup_all = true\n when 'S' then skip_all = true\n end\n end\n FileUtils.rm_rf(target) if overwrite || overwrite_all\n # run %{ mv HOME/.#{file}\" \"$HOME/.#{file}.backup } if backup || backup_all\n `mv \"$HOME/.#{file}\" \"$HOME/.#{file}.backup\"` if backup || backup_all\n end\n #run %{ ln -nfs \"#{source}\" \"#{target}\" }\n `ln -s \"$PWD/#{linkable}\" \"#{target}\"`\n puts \"==========================================================\"\n puts\n end\nend", "def make_symlink(old) File.symlink(old, path) end", "def set_symlink(source,target)\n fail \"Original path doesn't exist or isn't a directory.\" unless File.directory?(source)\n fail \"Target already exists.\" unless File.directory?(target) == false\n puts \"creating a symlink from #{source} => #{target}.\"\n FileUtils.ln_s(source,target,:verbose => true)\n end", "def make_symlink\n if not self.data['old-slug'].nil?\n path = File.join(CGI.unescape(self.url)).gsub(/^\\//, '')\n path = File.join(path, \"index.html\") if template[/\\.html$/].nil?\n path = File.join(site.dest, path)\n old_slug = File.join(site.dest, self.data['old-slug'])\n old_slug_dir = File.dirname(old_slug)\n path = (Pathname.new path).relative_path_from(Pathname.new old_slug_dir)\n\n # We write the symlink directly on the site destination\n FileUtils.mkdir_p(old_slug_dir)\n File.symlink(path, old_slug)\n end\n end", "def link_to(dest)\n dir = File.dirname(dest)\n FileUtils.makedirs(dir) unless Dir.exist?(dir)\n FileUtils.symlink(@path, dest)\n end", "def create_symlink(source = nil, dest = nil)\n end", "def make_link(old) File.link(old, path) end", "def symlink(old_name, new_name); end", "def symlink( *args )\n lnk, opts = self.destination_and_options( args )\n \n if opts[:absolute]\n lnk = lnk.fwf_filepath.expand\n else\n lnk = lnk.fwf_filepath\n end\n \n FileUtils.ln_s( self, lnk, ** Utils::Opts.narrow_file_utils_options( opts, :ln_s ) )\n lnk.fwf_filepath\n end", "def link( src, dest )\n if ( win? )\n FileUtils.cp_r( src, dest )\n else\n File.symlink( src, dest )\n end\n end", "def install_symlink\n FileUtils.mkdir_p File.dirname(destination_path)\n FileUtils.symlink source_path, destination_path, force: true\n end", "def create_symlink(old_name, new_name)\n File.symlink(old_name, new_name)\n end", "def create_symlink(old_name, new_name)\n File.symlink(old_name, new_name)\n end", "def link *args\n self.destination_and_options( args ) do |lnk, opts|\n symlink_requested = self.directory? || opts[:symbolic] || opts[:sym] || opts[:soft]\n \n if symlink_requested\n self.symlink lnk, opts\n else\n FileUtils.ln self, lnk, ** Utils::Opts.narrow_file_utils_options( opts, :ln )\n end\n \n lnk.fwf_filepath\n end\n end", "def symlink_files(wildcard, dest_dir)\n for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }\n end", "def symlink_files(wildcard, dest_dir)\n for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }\n end", "def link_file( src, dest )\n if File.symlink?( dest )\n puts \"#{dest} is already a symlink, ignoring\"\n else\n puts \"ln -s #{src} #{dest} \"\n File.symlink( src, dest )\n end\nend", "def create_symlinks(original_locations, new_locations)\n original_locations.each do |key, value|\n old = value\n new = new_locations[key]\n\n if can_symlink?(new)\n File.symlink(old, new)\n puts \"#{ old } -> #{ new } symlink created.\"\n else\n puts \"#{ new } already exists. Continuing...\"\n end\n end\nend", "def conditional_link(source, target = source)\n source_dir = @onabase + \"/www/local/plugins/cfg_archive/bin/\"\n target_dir = @onabase + \"/bin/\"\n\n source_file = source_dir + source\n target_link = target_dir + target\n\n FileUtils.ln_sf(source_file, target_link)\nend", "def symlinked_file(filepath)\n link_file = file(filepath)\n # /etc/letsencrypt/live/findwork.co/fullchain.pem ->\n # /etc/letsencrypt/live/findwork.co + / + ../../archive/fullchain1.pem\n return file(File.dirname(filepath) + File::SEPARATOR + link_file.link_target)\nend", "def atomic_symlink(src, dest)\n raise ArgumentError.new(\"#{src} is not a directory\") unless File.directory?(src)\n say_status :symlink, \"from #{src} to #{dest}\"\n tmp = \"#{dest}-new-#{rand(2**32)}\"\n # Make a temporary symlink\n File.symlink(src, tmp)\n # Atomically rename the symlink, possibly overwriting an existing symlink\n File.rename(tmp, dest)\n end", "def generate_web_symlink(jpg_output)\n t = Time.new\n subdir = \"#{t.year}.#{t.month}.#{t.day}\"\n abs_path = FailureIsolation::WebDirectory+\"/\"+subdir\n FileUtils.mkdir_p(abs_path)\n basename = File.basename(jpg_output)\n File.symlink(jpg_output, abs_path+\"/#{basename}\")\n \"http://revtr.cs.washington.edu/isolation_graphs/#{subdir}/#{basename}\"\n end", "def home_path\n result = tmp_path.join(\"home\")\n FileUtils.mkdir_p(result)\n result\n end", "def symlink_to_output(spec_path, destination_dir)\n spec_name = Pathname.new(spec_path).basename.to_s\n destination_spec_path = File.join(destination_dir, spec_name)\n FileUtils.symlink(File.expand_path(spec_path), destination_spec_path, force: true)\n end", "def link_file(file, target = File.join(ENV['HOME'], \".#{file.sub(/\\.erb$/, '')}\"))\n if file =~ /.erb$/\n LOGGER.info \"generating #{target.replace_home}\".blue\n File.open(target, 'w') do |new_file|\n new_file.write ERB.new(File.read(file)).result(binding)\n end\n else\n LOGGER.info \"linking #{target.replace_home}\".blue\n File.symlink(File.join(Dir.pwd, file), target)\n end\nend", "def follow_symlinks=(_arg0); end", "def link\n display_change\n begin\n File.symlink(@real_path, new_path)\n rescue NotImplemented\n puts \"Error: cannot create symlinks\"\n end\n end", "def make_home_directory( username, skeldir=SKELDIR )\n\t\tself.log.info \"Making home directory for %p, cloned from %s\" % [ username, skeldir ]\n\t\thomedir = HOMEDIR_BASE + username\n\t\traise \"%s: already exists\" % [ homedir ] if homedir.exist?\n\t\traise \"%s: already has an archived homedir\" % [ username ] if\n\t\t\t( ARCHIVE_BASE + username ).exist?\n\n\t\tFileUtils.cp_r( skeldir.to_s, homedir )\n\t\tFileUtils.chown_R( username, nil, homedir )\n\n\t\treturn homedir.to_s\n\tend", "def create_symlinks(original_locations, new_locations)\n (0..original_locations.count - 1).each do |index|\n old = original_locations[ original_locations.keys[index] ]\n new = new_locations[ new_locations.keys[index] ]\n\n if can_symlink?(new)\n File.symlink(old, new)\n puts \"#{ old } -> #{ new } symlink created.\"\n else\n puts \"#{ new } already exists. Continuing...\"\n end\n end\nend", "def create_symlinks(original_locations, new_locations)\n (0..original_locations.count - 1).each do |index|\n old = original_locations[ original_locations.keys[index] ]\n new = new_locations[ new_locations.keys[index] ]\n\n if can_symlink?(new)\n File.symlink(old, new)\n puts \"#{ old } -> #{ new } symlink created.\"\n else\n puts \"#{ new } already exists. Continuing...\"\n end\n end\nend", "def follow_symlinks; end", "def create_symlink\n unless File.exist? opt_dir\n success = true\n if !File.writable?( sys_root )\n puts \"Cannot write to #{sys_root}. Please ensure #{opt_torquebox} points to your torquebox installation.\"\n success = false\n else\n puts \"Creating #{opt_dir}\"\n Dir.new( opt_dir )\n end\n end\n\n unless File.exist?( opt_torquebox )\n if File.writable?( opt_dir )\n puts \"Linking #{opt_torquebox} to #{torquebox_home}\"\n File.symlink( torquebox_home, opt_torquebox )\n else\n puts \"Cannot link #{opt_torquebox} to #{torquebox_home}\"\n success = false\n end\n end\n success\n end", "def linkables\n linkables = Dir.glob('**/*.symlink')\n linkables.each do |linkable|\n file = linkable.split('/').last.split('.symlink').last\n target = \"#{ENV[\"HOME\"]}/.#{file}\"\n puts \"#{file}\"\n yield linkable, file, target if block_given?\n end\nend", "def link\n Dir.mkdir @target unless Dir.exists? @target\n \n # When we find a directory, create it in the target area\n create_directory = lambda do |path|\n directory = \"#{@target}/#{path}\"\n Dir.mkdir directory unless Dir.exists? directory\n end\n \n # When we find a file, symlink it in the target area\n create_symlink = lambda do |path|\n source = \"#{@source}/#{path}\"\n target = \"#{@target}/#{path}\"\n if File.exists?(target)\n if File.symlink?(target)\n if File.readlink(target) == source\n return\n end\n else\n message = \"#{target} exists and is not a symlink\"\n puts message if @args[:verbose]\n raise message if @raise\n return\n end\n end\n puts \"Creating #{target} -> #{source}\" if @args[:verbose]\n File.unlink(target) if File.exists?(target)\n File.symlink(source, target)\n end\n \n Xo::Directory::Walk.new(@source, dir_cb: create_directory, file_cb: create_symlink).process\n end", "def before_run\n Dir.chdir('source') do\n `ln -s nonexisting.txt link1.txt`\n end\nend", "def symlink(dest, options = {})\n FileUtils.symlink(@path, dest, options)\n end", "def symlink(existing_name, new_name)\n #windows mklink syntax is reverse of unix ln -s\n #windows mklink is built into cmd.exe\n _stdin, _stdout, _stderr, wait_thr =\n Open3.popen3('cmd.exe', \"/c mklink /d #{new_name.tr('/','\\\\')} #{existing_name.tr('/','\\\\')}\")\n wait_thr.value.exitstatus\n end", "def link(from, to)\n if File.directory?(from)\n FileUtils.ln_s(from, to)\n else\n FileUtils.ln(from, to)\n end\n end", "def create_symlink_from_data_to_cinder_mountpoint()\n\n # Chef::Log.info(\"#{node['data_dir_path']}/data/ is empty.\")\n if node.has_key?(\"cinder_volume_mountpoint\") && !node[\"cinder_volume_mountpoint\"].empty?\n Chef::Log.info(\"Cinder storage is enabled for the data directory at the mount point #{node[\"cinder_volume_mountpoint\"]}\")\n\n parent_data_dir = node['data_dir_path']\n data_dir = \"#{parent_data_dir}/data\"\n # Ruby Block\n ruby_block 'create_data_symlink' do\n block do\n # Check if the data symlink exists.\n if !File.symlink?(data_dir)\n\n Chef::Log.warn(\"data symlink doesn't exist in #{parent_data_dir}.\")\n if File.directory?(data_dir)\n raise \"#{data_dir} is a directory. It is supposed to be a symlink while using with Cinder. You cannot include Cinder storage if you were using Ephemeral with the first deployment\"\n else\n Chef::Log.info(\"neither data directory nor data symlink exist in #{parent_data_dir}.\")\n end\n else\n Chef::Log.info(\"data symlink exists in #{parent_data_dir}.\")\n data_link_path = File.readlink(data_dir)\n Chef::Log.info(\"Data symlink points to #{data_link_path}\")\n\n if data_link_path != node[\"cinder_volume_mountpoint\"]\n raise \"#{data_dir} is not linked to #{node[\"cinder_volume_mountpoint\"]}. It is supposed to be a symlink while using with Cinder.\"\n end\n end\n end\n end\n\n # Provide a symlink from the /app/solrdata<version>/data to the Cinder mount point\n Chef::Log.info(\"Provide a symlink from the #{data_dir} to the Cinder mount point #{node[\"cinder_volume_mountpoint\"]}\")\n link \"#{node['data_dir_path']}/data\" do\n to \"#{node[\"cinder_volume_mountpoint\"]}\"\n owner node['solr']['user']\n group node['solr']['user']\n end\n\n bash 'chown_blockstorage' do\n code <<-EOH\n sudo chown #{node['solr']['user']} /#{node[\"cinder_volume_mountpoint\"]}\n sudo chgrp #{node['solr']['user']} /#{node[\"cinder_volume_mountpoint\"]}\n EOH\n not_if { \"#{node[\"cinder_volume_mountpoint\"]}\".empty? }\n end\n\n else\n Chef::Log.info(\"Cinder storage is not enabled. So the following scripts will create the data directory in the ephemeral storage.\")\n end\n\n end", "def symlink(guest_path, bucket_path = \"/tmp/vagrant-cache/#{@name}\")\n return if @env[:cache_dirs].include?(guest_path)\n\n @env[:cache_dirs] << guest_path\n comm.execute(\"mkdir -p #{bucket_path}\")\n unless symlink?(guest_path)\n comm.sudo(\"mkdir -p `dirname #{guest_path}`\")\n if empty_dir?(bucket_path) && !empty_dir?(guest_path)\n # Warm up cache with guest machine data\n comm.sudo(\"shopt -s dotglob && mv #{guest_path}/* #{bucket_path}\")\n end\n comm.sudo(\"rm -rf #{guest_path}\")\n comm.sudo(\"ln -s #{bucket_path} #{guest_path}\")\n end\n end", "def make_link(source:, link:)\n @output.item @i18n.t('setup.ln', target: link, source: source)\n FileUtils::rm link if (File::symlink? link and not File::exist? link)\n FileUtils::ln_s source, link unless File::exist? link\n end", "def create_link_to_dummy_directory\n FileUtils.ln_sf(\"#{destination_root}/db\", Rails.root.join('db'))\n end", "def link_jrnl_config\n local_config = \"jrnl.yaml\" # local config, specifies Dropbox file location\n system %Q{mkdir -p \"$HOME/.config\"}\n jrnl_config_path = File.join(ENV['HOME'], \".config\", \"jrnl\", \"jrnl.yaml\")\n FileUtils.touch(jrnl_config_path)\n puts \"linking #{jrnl_config_path}\"\n system %Q{ln -sf \"$PWD/#{local_config}\" #{jrnl_config_path}}\nend", "def home_file(*path)\n File.join(ENV['HOME'], *path)\nend", "def home_file(*path)\n File.join(ENV['HOME'], *path)\nend", "def setup_home_path\n\t\t\tsuper\n\n\t\t\tAWS_SUBDIRS.each do |dir|\n\t\t\t\tpath = aws_home_path.join(dir)\n\t\t\t\tnext if File.directory?(path)\n\t\t\t\t\n\t\t\t\tbegin\n\t\t\t\t\[email protected](\"Creating: #{dir}\")\n\t\t\t\t\tFileUtils.mkdir_p(path)\n\t\t\t\trescue Errno::EACCES\n\t\t\t\t\traise Errors::HomeDirectoryNotAccessible, :home_path\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def create_symlinks\n links.each do |link|\n print \"Linking #{link.link_path}: \"\n if link.dir?\n print 'skipped'\n elsif !link.current?\n if link.create\n print 'linked'\n else\n print link.error\n end\n else\n print 'current'\n end\n print \"\\n\"\n end\n end", "def link_name(name)\n File.expand_path(File.join('~', '.' + File.basename(name)))\nend", "def write_create_symlinks_script(symlinks)\n File.open(SYMLINKS_SCRIPT, 'w') do |f|\n f.puts '#!/system/bin/sh'\n f.puts ''\n f.puts 'cd $(dirname $0)'\n f.puts ''\n f.puts \"single_file_binaries=\\\"#{symlinks.join(' ')}\\\"\"\n f.puts ''\n f.puts 'for i in $single_file_binaries; do'\n f.puts 'ln -s coreutils $i;'\n f.puts 'done'\n f.puts ''\n f.puts 'cd -'\n end\n FileUtils.chmod '+x', SYMLINKS_SCRIPT\n end", "def s_link(source_path, target_path)\n target_file = File.expand_path(target_path)\n\n # If the target file exists we don't really want to destroy it...\n if File.exists?(target_file) and not File.symlink?(target_file)\n puts \" ! Stashing your previous #{target_path} as #{target_path}.pre-mdf-bootstrap\"\n mv(target_file, File.expand_path(\"#{target_path}.pre-mdf-bootstrap\"))\n end\n\n if File.symlink?(target_file) and File.readlink(target_file).to_s != File.expand_path(source_path).to_s\n puts \" ! Existing symlink appears to point to incorrect file, moving it to #{target_file}.pre-mdf-bootstrap\"\n # Make a new link with the .old extension, pointing to the old target\n ln_s(File.readlink(target_file), File.expand_path(\"#{target_path}.pre-mdf-bootstrap\"))\n # Now we can get rid of the original target file to make room for the new link\n rm(target_file)\n end\n\n # At this point either the target file is the symlink we want,\n # or something weird happened and we don't want to replace it.\n unless File.exists?(target_file)\n # Counts on the fact that ln_s outputs \"puts\" the command for the user to see.\n ln_s(File.expand_path(source_path), target_file)\n end\nend", "def symlink(file_name, dest_file)\n log \"Symlinking file #{file_name} to #{dest_file}\"\n File.symlink(file_name, dest_file)\n end", "def symlink(file_name, dest_file)\n log \"Symlinking file #{file_name} to #{dest_file}\"\n File.symlink(file_name, dest_file)\n end", "def symlink_scripts_to_root *script_names\n script_names.flatten.each do |name, val|\n script_file = File.join self.scripts_path, name.to_s\n pointer_file = File.join self.root_path, name.to_s\n\n @shell.symlink script_file, pointer_file\n end\n end", "def create_links_to_ssh_keys\n @configuration_template.map do |node_info|\n ssh_key = @boxes.get_box(node_info[1]['box'])['ssh_key']\n return Result.error(\"File #{ssh_key} not found\") unless File.file?(ssh_key)\n\n FileUtils.ln_s(ssh_key, File.join(\n @configuration_path, \"#{node_info[0]}_#{KEY_FILE_NAME_SUFFIX}\"\n ))\n end\n Result.ok('')\n end", "def link old, new\n if File.exists? new\n if File.symlink? new\n return # symlinked already\n else # file exists but isn't a symlink, assuming regular file\n if $replace_all\n\tFile.delete new\n\tFile.symlink old, new\n\treturn\n end\n\n # ask what we should do (replace, replace_all, skip, skip_all, or quit)\n response = nil\n loop do\n\tputs \"#{new} already exists, 1) replace 2) replace all 3) skip 4) quit\"\n\tbegin\n\t response = Integer gets.chomp\n\trescue ArgumentError\n\t puts \"not a valid number\"\n\tend\n\n\tif (1..4).member? response\n\t break\n\telse\n\t puts \"number not in range of 1..4\"\n\t redo\n\tend\n end\n\n case response\n when 1\n\tFile.delete new\n\tFile.symlink old, new\n when 2\n\t$replace_all = true\n\tFile.delete new\n\tFile.symlink old, new\n when 3\n\treturn\n when 4\n\texit\n end\n end \n else\n # just create a regular symlink\n File.symlink old, new\n end\nend", "def stash_user_file(file,path)\n users = get_all_over500_users\n users.each_key do |u|\n puts \"copying files to #{u}\\'s home at #{path}.\"\n system \"ditto -V #{file} #{get_homedir(u)}/#{path}/#{File.basename(file)}\"\n FileUtils.chown_R(\"#{u}\", nil, \"#{get_homedir(u)}/#{path}/#{File.basename(file)}\")\n end\n end", "def create_symlinks(logger = nil)\n if @options[:preserve_environments]\n install_directory_symlink(logger, File.join(@options[:basedir], 'environments'), 'environments')\n @options.fetch(:create_symlinks, %w(modules manifests)).each do |x|\n install_directory_symlink(logger, File.join(@options[:basedir], x), x)\n end\n else\n if @options[:environment]\n logger.warn '--environment is ignored unless --preserve-environments is used' unless logger.nil?\n end\n if @options[:create_symlinks]\n logger.warn '--create-symlinks is ignored unless --preserve-environments is used' unless logger.nil?\n end\n install_directory_symlink(logger, @options[:basedir])\n end\n end", "def symlink!(base)\n puts \"symlink! #{base.inspect}\" if SYMLINK_TRACE\n if is_file? or is_dir?\n File.symlink @target, base\n else\n mkdir base\n for node in children\n node.symlink! \"#{base}/#{node.name}\"\n end\n end\n end", "def ln(src, dest, force: nil, noop: nil, verbose: nil)\n fu_output_message \"ln#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest0(src, dest) do |s,d|\n remove_file d, true if force\n File.link s, d\n end\n end", "def link_target\n return if current_directory? && linked_path == current_path\n\n FileUtils.ln_s File.expand_path(current_path), current_directory\n end", "def create\n raise ArgumentError, 'Symlink target undefined' unless to\n might_update_resource do\n provider.create\n end\n end", "def ln_s(src, dest, force: nil, noop: nil, verbose: nil)\n fu_output_message \"ln -s#{force ? 'f' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest0(src, dest) do |s,d|\n remove_file d, true if force\n File.symlink s, d\n end\n end", "def install(configs, a, target)\n print \"Installing #{a} to #{target}...\"\n\n symlinks = {}\n collisions = []\n configs[a].entries.each{|f|\n if not IGNORE.include?(f.to_s)\n # Compute symlink targets\n to = File.join(target, f)\n f = Pathname.new(File.join(APP_DIR, a, f)).expand_path\n\n # debug\n # puts \" #{to} => #{f}\"\n \n # account\n symlinks[to] = f\n if File.symlink?(to) then\n if not (File.readlink(to) == f.to_s) then\n collisions << to \n end\n elsif File.exists?(to)\n collisions << to \n end\n end\n }\n\n # test to see what exists\n if collisions.length > 0 then\n $stderr.puts \"\\n\\nError preparing for #{a}: #{collisions.length} file[s] already exist or are symlinks to somewhere else.\"\n $stderr.puts \"To rectify, copy-paste:\"\n collisions.map{|x| puts \"rm -#{(File.directory?(x))?'r':''}f \\\"#{x}\\\"\" }\n exit(1)\n end\n\n # Then do it\n symlinks.each{|new, old|\n # Only bother writing if the symlink is different\n if File.symlink?(new) and File.readlink(new) == old.to_s then\n # puts \"Skipping #{new}\"\n else\n File.symlink(old, new)\n end\n }\n\n print \"Done.\\n\"\nend", "def install_bin\n bin.install_symlink \"../opt/#{pkgname}/git-annex\"\n bin.install_symlink \"../opt/#{pkgname}/git-annex-shell\"\n bin.install_symlink \"../opt/#{pkgname}/git-annex\" => \"git-remote-tor-annex\"\n end", "def make_folders_absolute(f,tt)\n tt.elements.each(\"//node\") do |nn|\n if nn.attributes['LINK']\n nn.attributes['LINK']= File.expand_path(File.dirname(f))+\"/#{nn.attributes['LINK']}\"\n end\n end\n end", "def create_helper_symlink\n FileUtils.symlink \"../lib\", normalize(\"codelib\"), :force => true\n end", "def link_files(wildcard, dest_dir)\n for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }\n end", "def link_files(wildcard, dest_dir)\n for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }\n end", "def home_path\n File.expand_path(\"~\")\n end", "def symlink(old)\n warn 'Path::Name#symlink is obsoleted. Use Path::Name#make_symlink.'\n File.symlink(old, path)\n end", "def append_to_home_if_not_absolute( p )\n path = Pathname.new( p )\n unless path.absolute? then\n path = Pathname.new( home_dir ) + path\n end\n return path.to_s\n end", "def ln_if_necessary(src, dst)\n ln = false\n if !File.symlink?(dst)\n ln = true\n elsif File.readlink(dst) != src\n rm(dst)\n ln = true\n end\n if ln\n ln(src, dst)\n true\n end\n end", "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend", "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend", "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend", "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend", "def make_folders_absolute(f,tt)\n tt.elements.each(\"//node\") do |nn|\n if nn.attributes['LINK']\n nn.attributes['LINK']= File.expand_path(File.dirname(f))+\"/#{nn.attributes['LINK']}\"\n end\n end\n end", "def link fn,linkname\n\t\tif File.symlink?(linkname) and !Cfruby::FileOps::SymlinkHandler.points_to?(linkname,fn)\n\t\t\tCfruby.controller.inform('verbose', \"Existing #{linkname} is not pointing to #{fn}\")\n\t\t\tprint \"Existing #{linkname} is not pointing to #{fn}\\n\"\n\t\t\tCfruby::FileOps.delete linkname\n\t\tend\n\t\tif @cf.strict\n\t\t\tCfruby::FileOps.link fn,linkname\n\t\telse\n\t\t\tbegin\n\t\t\t\tCfruby::FileOps.link fn,linkname\n\t\t\trescue\n\t\t\t\tCfruby.controller.inform('verbose', \"Problem linking #{linkname} -> #{fn}\")\n\t\t\tend\n\t\tend\n\tend", "def mkpath\n FileUtils.mkpath( expand_tilde )\n end", "def install_dest\n ENV[\"DOTFILES_HOME\"] || ENV[\"HOME\"]\n end", "def dest_path( file )\n return File.join( ENV['HOME'], \".#{file}\" )\n end", "def linkDirContents(rootDir, targetDir)\n\trootDir = Pathname.new(rootDir)\n\ttargetDir = Pathname.new(targetDir)\n\n\t# Recurisvely visit all files in the rootDir\n\tFind.find(rootDir.to_s) { |srcFullPath|\n\t\tsrcFullPath = Pathname.new(srcFullPath)\n\t\trelativePath = srcFullPath.relative_path_from(rootDir)\n\n\t\tcase relativePath.to_s\n\t\twhen '.'\n\t\t\tnext\n\n\t\twhen '.DS_Store'\n\t\t\tnext\n\n\t\t# ignore git directory and children\n\t\twhen '.git'\n\t\t\tFind.prune\n\t\tend\n\n\t\t# Skip .git* files meant to be settings for this repo\n\t\tnext if relativePath.to_s.start_with? \".git\"\n\n\t\t# Skip this rake file\n\t\tnext if srcFullPath.to_s == __FILE__\n\n\n\t\tif relativePath.to_s.start_with? \"_\"\n\t\t\tremappedPath = relativePath.dup.to_s\n\t\t\tremappedPath[0] = '.'\n\n\t\t\ttargetFullPath = targetDir + remappedPath\n\n\t\t\tif targetFullPath.directory?\n\t\t\t\tFileUtils.rm_f(targetFullPath)\n\t\t\tend\n\n\t\t\tcreateSymlink(srcFullPath, targetFullPath)\n\t\t\tFind.prune\n\t\t\tnext\n\t\telse\n\t\t\ttargetFullPath = targetDir + relativePath\n\t\tend\n\n\t\t# Copy symlinks directly\n\t\tif srcFullPath.symlink?\n\t\t\tlinkTarget = srcFullPath.readlink\n\t\t\tputs \"Copying symlink: #{targetFullPath} => #{linkTarget}\"\n\t\t\tFileUtils.rm_f(targetFullPath)\n\t\t\t`cp -R #{srcFullPath} #{targetFullPath}`\n\t\t\tnext\n\t\tend\n\n\t\t# Recreate any directory structures\n\t\tif srcFullPath.directory?\n\t\t\tputs \"making dir: #{targetFullPath}\"\n\t\t\tFileUtils.mkdir_p(targetFullPath)\n\t\t\tnext\n\t\tend\n\n\t\t# Create the symlink\n\t\tcreateSymlink(srcFullPath, targetFullPath)\n\t}\nend", "def archive_home_directory( username )\n\t\tself.log.info \"Archiving home directory for %p\" % [ username ]\n\t\thomedir = HOMEDIR_BASE + username\n\t\tarchivedir = ARCHIVE_BASE + username\n\t\traise \"#{username}: no current home directory\" unless homedir.exist?\n\t\traise \"#{username}: already has an archived home\" if archivedir.exist?\n\n\t\tFileUtils.mv( homedir, archivedir )\n\tend", "def readlink() self.class.new( File.readlink( expand_tilde ) ) end", "def copy_to(relpath, abspath)\n end", "def makeSymlinks(files)\n\t\tr = Random.new\n\t\ttotalSymlinks = r.rand(SYMLINKS)\n\t\tsymlinks = Array.new\n\t\tfor i in 1..totalSymlinks\n\t\t\tfileNumber = r.rand(0..files.size-1)\n\t\t\tname = files[fileNumber]\n\t\t\tbaseName = File.basename(name) \n\t\t\tsymDirNumber = r.rand([email protected])\n\t\t\tsymDir = folders[symDirNumber]\n\t\t\tsymName = File.join(symDir, baseName)\n\t\t\tif symlinks.include?(symName) or symName == name\n\t\t\t\t#log \"symlink redo: #{symName}\"\n\t\t\t\tredo\n\t\t\tend\n\t\t\tFile.symlink(name, symName)\n\t\t\t#log \"Symlink: :#{symName} of #{name}\"\n\t\t\tsymlinks << symName\n\t\tend\n\t\treturn symlinks\n\tend", "def link(filename, outdir, platform='linux')\n f = base(filename)\n cmd, args = *case platform\n when 'darwin'\n ['gcc', '-arch i386']\n when 'linux'\n ['ld', '']\n else\n raise \"unsupported platform: #{platform}\"\n end\n run_and_warn_on_failure(\"#{cmd} #{args} -o #{f} #{filename} 2>&1\")\n `chmod u+x #{f}`\n return f\nend", "def hardlink_log(log)\n FileUtils.mkdir_p(\"log\")\n FileUtils.touch(log)\n\n kochiku_base_dir = File.join(__dir__, \"../../..\")\n\n FileUtils.mkdir_p(\"#{kochiku_base_dir}/logstreamer/logs/#{@build_attempt_id}/\")\n FileUtils.ln(log, \"#{kochiku_base_dir}/logstreamer/logs/#{@build_attempt_id}/stdout.log\")\n end", "def link(file_name, dest_file)\n log \"Linking file #{file_name} to #{dest_file}\"\n File.link(file_name, dest_file)\n end", "def link(file_name, dest_file)\n log \"Linking file #{file_name} to #{dest_file}\"\n File.link(file_name, dest_file)\n end", "def symlink?() end", "def install_to_directory\n # Get the current directory\n curr_dir = FileUtils::pwd + '/'\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n\n # Tell the user\n puts \"Installing the files to \".green + $install_dir.yellow\n puts \" (Keeping the .rb extensions) \".green if $keep_extensions\n\n # Go through the files\n files = ['deleteemailalias.rb','addemailalias.rb','listemailaliases.rb',\n 'deleteemaildomain.rb','addemaildomain.rb','deleteemailaccount.rb',\n 'listemailaccounts.rb','addemailaccount.rb','generate_password.rb']\n files.each { |f|\n # Remove the extenstion (unless we should keep it)\n nf = $keep_extensions ? f : f[0..-4]\n\n # Tell the user\n puts \"> Linking \".green + \"#{curr_dir}#{f}\".yellow + ' to '.green + \"#{$install_dir}#{nf}\".yellow\n\n if $force_install\n puts \"Forcing the install of #{nf}!\".red\n # Link the file\n fu.ln_sf curr_dir + f, $install_dir + nf\n else\n begin\n # Link the file\n fu.ln_s curr_dir + f, $install_dir + nf\n rescue Exception => e\n puts \"Couldn't link the file:\".pink\n puts e.message.red\n next\n end\n end\n\n puts \"> Adding 'execute permission' to the file\".green\n # adding \"execute permission\"\n fu.chmod \"a+x\", $install_dir + nf\n }\n\nend", "def elegant_move(file_name, destination_name)\n # Generate full paths\n destination = \"#{ENV['HOME']}/#{destination_name}\"\n file = \"#{ENV['HOME']}/dotfiles/#{file_name}\"\n\n # If the destination already exists\n if (File.exists?(destination) or File.symlink?(destination))\n # If the destination has the same content as the file, skip\n if files_are_same(destination, file)\n puts \"#{file_name} - skipping\".yellow\n else\n # Create the backup dir if doesn't already exist\n `mkdir -p ~/.backup`\n\n # Else backup the old file\n backup_path = \".backup/#{destination_name}_#{Time.now.to_f}\"\n backup = \"#{ENV['HOME']}/#{backup_path}\"\n puts \"#{file_name} - moving old\".green\n # Ignore errors we may get in case of dodgy symlinks\n `mv #{destination} #{backup} 2> /dev/null`\n \n # Then link the new file\n symlink file, destination, :force => true, :verbose => false\n end\n else\n # Else link the new file\n puts \"#{file_name} - creating\".green\n symlink file, destination, :force => true, :verbose => false\n end\nend", "def symlink?(file_name); end", "def stowed_symlink_path(creates)\n stowed_symlink = nil\n creates_path = creates.split('/')\n creates_path.clone.each do\n # Detect lowest level symlink from created_file within stow_path\n if ::File.symlink?(\"#{stow_resolved_target}/#{creates_path.join('/')}\")\n stowed_symlink = \"#{stow_resolved_target}/#{creates_path.join('/')}\"\n # Symlink found, break and use creates_path for stowed file\n # stowed_path = creates_path.join('/')\n break\n else\n # Remove lowest path if not a symlink\n creates_path.pop(1)\n end\n end\n\n Chef::Log.debug \".stowed_symlink_path: #{stowed_symlink}\"\n stowed_symlink\n end", "def home\n @home ||= File.expand_path('~')\n end" ]
[ "0.7351746", "0.7106921", "0.69083774", "0.67824507", "0.6738418", "0.67112315", "0.6655533", "0.6651139", "0.6582127", "0.65232766", "0.64796585", "0.6400774", "0.63721466", "0.63628507", "0.6301997", "0.6231396", "0.6231396", "0.6181049", "0.60331607", "0.60331607", "0.6005804", "0.6003564", "0.5968458", "0.59484655", "0.59372556", "0.5928447", "0.5878938", "0.5877094", "0.5873358", "0.5867313", "0.5846365", "0.5824758", "0.58157533", "0.58157533", "0.5810965", "0.57909465", "0.57902306", "0.5771053", "0.5762496", "0.5742776", "0.5740642", "0.56561893", "0.56480706", "0.5640474", "0.56318635", "0.56217444", "0.5525996", "0.5512871", "0.5512871", "0.5510075", "0.5505538", "0.55034596", "0.54811746", "0.5477784", "0.5458718", "0.5458718", "0.54313195", "0.5429597", "0.5429548", "0.53731686", "0.53701216", "0.5352427", "0.5342219", "0.53190637", "0.5311793", "0.5289987", "0.52816933", "0.52743816", "0.5261542", "0.52489144", "0.5241603", "0.5241603", "0.5234205", "0.5228871", "0.5216777", "0.520512", "0.5200373", "0.5200373", "0.5200373", "0.5200373", "0.52001476", "0.519342", "0.51822007", "0.517769", "0.51764107", "0.5172311", "0.5145457", "0.51306075", "0.5109413", "0.510348", "0.51025766", "0.5098376", "0.50979966", "0.50979966", "0.50963527", "0.50963247", "0.50948805", "0.5090276", "0.5078728", "0.5074984" ]
0.7957497
0
def initialize(layout, empty, goal)
def set_goal(x) @layout[@goal[0]][@goal[1]] = '•' @layout[x[0]][x[1]] = 'G' @goal = x end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(layout:)\n @layout = layout\n @sides = Math.sqrt(layout.length).floor\n @pos = layout.index('5') + 1\n end", "def layout=(_arg0); end", "def initialize()\n get_dimensions()\n get_start_p()\n get_end_p()\n end", "def initialize() end", "def initialize(layout, components)\n @layout = layout\n @hgroup = @layout.createSequentialGroup\n @vgroup = @layout.createSequentialGroup\n @vertical = nil\n @horizontals = []\n @components = components\n\n alignments_reset\n widths_reset\n heights_reset\n horizontals_reset\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def generation_initialize(opts = {})\n unless content = opts[:content]\n raise Error, \"Unexpected that opts[:content] is nil\"\n end\n @content = content\n @filter = opts[:filter]\n @yaml_object = empty_yaml_object(content_input: content)\n @top = opts[:top] || self\n generation_initialize_nested_dsl_files\n end", "def initialize(starting_x: 0, starting_y: 400)\n @starting_x = starting_x\n @starting_y = starting_y\n @flat_group = nil\n @sheet = WikiHouse.sheet.new\n Sk.find_or_create_layer(name: outside_edge_layer_name)\n Sk.find_or_create_layer(name: inside_edge_layer_name)\n @components_flattened = []\n end", "def initialize(size=DEFAULT_SIZE)\n super(SIZE_GRID, SIZE_GRID + HEIGHT_INFO_BLOCK, false)\n self.caption = 'A* Pathfinding Visualizer'\n @font = Gosu::Font.new(28)\n @message = 'Choose the start node.'\n @grid = Grid.new(self, size, size, SIZE_GRID)\n @start = @end = nil\n @needs_reset = false\n end", "def initialize(p0=\"\") end", "def _layout(*_arg0); end", "def initialize_element\n end", "def initialize(x, y, w, h, layout = QuestData::DATA_LAYOUT)\n @dest_scroll_oy = 0\n super(x, y, w, h)\n @dest_scroll_oy = self.oy\n self.layout = layout\n end", "def initialize(grid=empty_grid)\n @grid = grid\n end", "def initialize\n empty!\n end", "def initialize\n empty!\n end", "def initialize\n @start_vertical = nil\n @start_horizontal = nil\n @processed_maze = nil\n end", "def initialize\n @grid = empty_board\n end", "def initialize\n \n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize\n\t\t\n\tend", "def initialize(layout, corpus)\n @layout = layout\n @corpus = corpus\n\n @weights = ORDER1.map{ |o| o * 10 } # DEPRECATED\n end", "def initialize(*args)\n #This is a stub, used for indexing\n end", "def initialize\n\n\n\n end", "def initialize(*rest) end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize(*); end", "def initialize(*args); end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\r\n\r\n end", "def layouts=(_arg0); end", "def layouts=(_arg0); end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize()\n @rows = 7\n @cols = 7\n @connect = 4\n @ai = false\n @load = \"\"\n end", "def initialize\n \n end", "def initialize(p0, *rest) end", "def initialize(state, target_state)\n @rows, @cols = state.length, state.first.length\n @length = @rows * @cols\n @dirs = [[0, -1], [0, 1], [-1, 0], [1, 0]]\n @state, @target_state = state.flatten, target_state.flatten\n @state.each_with_index do |num, index|\n if num == 0\n @index_zero = index\n break\n end\n end\n end", "def initialize(anchor, where, slide_direction, disp = 0)\n super()\n @rl = Opal::ResourceLocator.instance\n @bgcolor = Rubygame::Color[:blue]\n @border = Rubygame::Color[:white]\n @anchor = anchor\n @where = where\n @slide_direction = slide_direction\n @displacement = disp\n @slide_offset = 0\n @speed = 120\n \n setup_gui\n hide\n end", "def initialize(parent); end", "def initialize variable_name, layout\n @variable = variable_name\n @layout = layout\n end", "def initialize(opts); end", "def initialize\nend", "def initialize(marker = INITIAL_MARKER)\n @marker = marker # will reveal the state of each square. Whether it has been marked or is empty\n end", "def initialize\n\n\nend", "def initialize\n# A normal initialization method\n@n, @totalX, @totalY = 0, 0.0, 0.0\nend", "def initialize(_layout, _data=[], _queries=[])\n @layout = _layout\n @queries = _queries\n #puts \"DATASET NEW queries:#{@queries}\"\n super(_data)\n end", "def initialize grid_size, initial\n @rows, @cols = grid_size.split(' ').collect {|i| i.to_i}\n split = initial.split(' ')\n @current_col = split[0].to_i\n @current_row = split[1].to_i\n @direction = split[2]\n @direction_switch = ['N', 'E', 'S', 'W']\n @direction_index = @direction_switch.index @direction\n end", "def initialize_from_element!\n end", "def initialize()\n @grid = []\n @rows = 0\n @cols = 0\n end", "def initialize\n \n end", "def initialize\n \n end", "def initialize()\r\n\r\n end", "def initialize(is_empty, has_stairs, has_enemy, has_captive, has_wall, is_ticking, has_golem)\n @is_empty = is_empty\n @has_stairs = has_stairs\n @has_enemy = has_enemy\n @has_captive = has_captive\n @has_wall = has_wall\n @has_bomb = is_ticking\n @has_golem = has_golem\n end", "def initialize\n\t\nend", "def initialize(empty = false)\n grid.abort(\"LOLxD\") unless Array.new(8) { Array.new(8) }\n set_board(grid) unless empty\n @captured = []\n end", "def initialize(setup)\n @grid = Array.new(8) { Array.new(8, nil)}\n\n if setup\n setup_pieces\n end\n end", "def initialize (starting_pos)\n # @starting_pos = starting_pos\n @root_node = PolyTreeNode.new(starting_pos)\n # kpf = KnightPathFinder.new([0, 0])\n @used_pos = [starting_pos]\n end", "def initialize()\n end", "def initialize (template); @template = template; end", "def constructor; end", "def initialize\n end", "def initialize(state); end", "def initial_setup\n # set initial values of vert_pos and sum\n vert_pos = 0\n @sum = @tree[0][0]\n\n # set initial children nodes\n @initial_child_1 = @tree[1][0]\n @initial_child_2 = @tree[1][1]\n end", "def initialize\n end", "def initialize()\n\t\tend", "def initialize\n # super(color, board, pos)\n end", "def init_create\n init_dict()\n @grid = Array.new(self.size) { Array.new(self.size, nil) }\n init_first_word()\n self.finished = false\n end", "def post_initialize(params)\n @planner_color_1 = params[:planner_color_1] || ::DotGrid::Color.new(\"CCCCCC\")\n @planner_color_2 = params[:planner_color_2] || ::DotGrid::Color.new(\"0099FF\")\n @grid_color = params[:grid_color] || ::DotGrid::Color.new(\"B3B3B3\")\n @dot_weight = params[:dot_weight] || 1.5\n @spacing = params[:spacing] ? params[:spacing].mm : 5.mm\n add_pattern(::DotGrid::Pattern::SquareGrid.new(params.merge!(:bounds => square_grid_bounds, grid_color: @planner_color_1)))\n add_pattern(::DotGrid::Pattern::DotGrid.new(params.merge!(:bounds => dot_grid_bounds)))\n end", "def initialize(z=\"\") end", "def initialize()\n\tend", "def initialize()\n\tend", "def initial\n end", "def initialize\n # complete\n end", "def initialize\n @board = Array[]\n initializeTop\n initializeMiddle\n initializeBottom\n end", "def initialize(options = {})\n set_layout_variables(options)\n validate! options\n end", "def initialize # A normal initialization method\n @n, @totalX, @totalY = 0, 0.0, 0.0\n end", "def initialize # A normal initialization method\n @n, @totalX, @totalY = 0, 0.0, 0.0\n end", "def initialize\n set_defaults\n end", "def initialize\n set_defaults\n end", "def initialize contents = nil, options = {}\n @contents, @weight = contents, 0\n options.apply_to self if options\n end", "def initialize(answerGrid)\n @grid = Grid.new(answerGrid)\n @history = History.new(@grid)\n @chrono = Chrono.new()\n @chrono.start()\n @currentHelp = nil\n @prevHelp = []\n @helpPlus = false\n end", "def initialize array_of_items\n\tend" ]
[ "0.6669134", "0.6650544", "0.6416586", "0.6313865", "0.622126", "0.6203751", "0.6203751", "0.6203751", "0.6203751", "0.6203751", "0.6155479", "0.6133175", "0.6126528", "0.61032385", "0.60895616", "0.6076829", "0.6059787", "0.6001044", "0.59906507", "0.59906507", "0.5987982", "0.5979788", "0.59763384", "0.59740305", "0.59740305", "0.59740305", "0.59740305", "0.59740305", "0.59740305", "0.59740305", "0.59740305", "0.59740305", "0.59740305", "0.59740305", "0.59443444", "0.5924171", "0.5916211", "0.5900844", "0.5868964", "0.586102", "0.586102", "0.5859823", "0.58592296", "0.58536255", "0.58536255", "0.58536255", "0.58536255", "0.5836551", "0.5834613", "0.5834613", "0.58340085", "0.58340085", "0.58215815", "0.5800411", "0.57960904", "0.57728934", "0.5760621", "0.5751883", "0.57384294", "0.5736799", "0.57275754", "0.57271856", "0.5724874", "0.5720492", "0.5716691", "0.5710854", "0.5710511", "0.57068104", "0.5693785", "0.5693785", "0.5693384", "0.5690648", "0.5689862", "0.56812716", "0.5678862", "0.567251", "0.5666855", "0.56646705", "0.5658516", "0.5647647", "0.5644944", "0.5643369", "0.5632356", "0.56309426", "0.56283003", "0.5622936", "0.56225294", "0.5608668", "0.5607226", "0.5607226", "0.559963", "0.5591116", "0.55908346", "0.5584211", "0.5574468", "0.5574468", "0.5572753", "0.5572753", "0.555396", "0.55509067", "0.554802" ]
0.0
-1
This call won't be visible in `schema()`
def abstract! GraphQL::SCHEMA.remove_call(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema\n raise NotImplementedError\n end", "def schema\n self\n end", "def skip_schema_queries; end", "def schema_definition\n of.schema_definition \n end", "def schema\n self.class.schema\n end", "def schema=(value); end", "def functional_update_schema # abstract\n raise 'abstract'\n end", "def chooseSchema\n @metadata.chooseSchema\n end", "def skip_schema_queries=(_arg0); end", "def schema\n adapter.schema\n end", "def broken_analyze_method_wtf\n ap Schema.create_from_many(schemas).attributes\n end", "def schema\n []\n end", "def json_schema\n raise NotImplementedError\n end", "def json_schema\n raise NotImplementedError\n end", "def apply_schema(name, type, options={})\n raise NotImplementedError\n end", "def schema\n @schema ||= metadata.ancestors('Schema').first\n end", "def schema\n @schema ||= []\n end", "def default_schema\n nil\n end", "def initialize_schema!\n Schema.create(self)\n end", "def schema\n return @schema\n end", "def get_schema_id()\n\t\tend", "def schema(obj)\n y(obj.send(\"column_names\"))\nend", "def schema\n connection.schema\n end", "def schema\n jiak.data.schema\n end", "def schema\n @_format.schema\n end", "def get_schema\n @schema = self\n yield\n @schema unless @schema == self\n ensure\n @schema = nil\n end", "def version; schema.version; end", "def set_schema(schema)\n define_class_method(:schema) {schema.to_s.to_sym}\n end", "def _sanity_check(schema)\n raise SchemaInternalError, \"No name provided on #{self}\" if name.nil?\n super(schema)\n end", "def fields!\n @schema.fields!\n end", "def xmlschema(p1 = v1)\n #This is a stub, used for indexing\n end", "def set_schema\n @schema = Schema.find(params[:id])\n end", "def schema\n @schema || (superclass.schema unless superclass == Model)\n end", "def define_schema\n yield schema if block_given?\n end", "def schema(&block)\n ActiveRecord::Schema.define(version: 0, &block)\nend", "def apply_schema_transformations\n # replace_exclusive_indicators_by_discriminators\n end", "def validate\n [] # schema.validate(@doc)\n end", "def schema\n absolutize(@schema)\n end", "def schema\n absolutize(@schema)\n end", "def schema\n if defined?(self.class::SCHEMA)\n self.class::SCHEMA\n else\n raise AvroPinions::NotFullyImplementedError, 'No Schema defined'\n end\n end", "def set_schema\n @schema = Schema.find(params[:id])\n end", "def set_schema\n @schema = Schema.find(params[:id])\n end", "def set_schema\n @schema = Schema.find(params[:id])\n end", "def run(conn, identifier)\n builder = DbAgile::Core::Schema::builder\n builder.schema(identifier){\n builder.logical{ load_logical_schema(conn, builder) }\n builder.physical{ load_physical_schema(conn, builder) }\n }\n builder._dump\n end", "def schema\n hyper_schema_link.schema\n end", "def schema_data\n dev_schema\n rescue\n VetsJsonSchema::SCHEMAS[@schema_name]\n end", "def get_schema_level()\n\t\tend", "def schema=(value)\n @schema = value\n end", "def get_json_schema(schema)\n Helpers.get_json_schema(schema)\nend", "def print_schema(schema)\n print_filtered_schema(schema, method(:is_defined_type))\n end", "def set_schema( schema )\n @schema = schema if @schema == self\n schema\n end", "def schema_params\n params.require(:schema).permit(:name)\n end", "def postprocess(json_schema); json_schema; end", "def _schema_ds\n @_schema_ds ||= begin\n ds = metadata_dataset.select{[\n pg_attribute[:attname].as(:name),\n SQL::Cast.new(pg_attribute[:atttypid], :integer).as(:oid),\n SQL::Cast.new(basetype[:oid], :integer).as(:base_oid),\n SQL::Function.new(:format_type, basetype[:oid], pg_type[:typtypmod]).as(:db_base_type),\n SQL::Function.new(:format_type, pg_type[:oid], pg_attribute[:atttypmod]).as(:db_type),\n SQL::Function.new(:pg_get_expr, pg_attrdef[:adbin], pg_class[:oid]).as(:default),\n SQL::BooleanExpression.new(:NOT, pg_attribute[:attnotnull]).as(:allow_null),\n SQL::Function.new(:COALESCE, SQL::BooleanExpression.from_value_pairs(pg_attribute[:attnum] => SQL::Function.new(:ANY, pg_index[:indkey])), false).as(:primary_key),\n Sequel[:pg_type][:typtype],\n (~Sequel[Sequel[:elementtype][:oid]=>nil]).as(:is_array),\n ]}.\n from(:pg_class).\n join(:pg_attribute, :attrelid=>:oid).\n join(:pg_type, :oid=>:atttypid).\n left_outer_join(Sequel[:pg_type].as(:basetype), :oid=>:typbasetype).\n left_outer_join(Sequel[:pg_type].as(:elementtype), :typarray=>Sequel[:pg_type][:oid]).\n left_outer_join(:pg_attrdef, :adrelid=>Sequel[:pg_class][:oid], :adnum=>Sequel[:pg_attribute][:attnum]).\n left_outer_join(:pg_index, :indrelid=>Sequel[:pg_class][:oid], :indisprimary=>true).\n where{{pg_attribute[:attisdropped]=>false}}.\n where{pg_attribute[:attnum] > 0}.\n order{pg_attribute[:attnum]}\n\n # :nocov:\n if server_version > 100000\n # :nocov:\n ds = ds.select_append{pg_attribute[:attidentity]}\n\n # :nocov:\n if server_version > 120000\n # :nocov:\n ds = ds.select_append{Sequel.~(pg_attribute[:attgenerated]=>'').as(:generated)}\n end\n end\n\n ds\n end\n end", "def _sanity_check(schema)\n raise SchemaInternalError, \"No name provided on #{self}\" if name.nil?\n raise SchemaInternalError, \"No definition provided on #{self}\" if definition.nil?\n end", "def schema\n execute(<<-eosql).collect { |row| row[0] }.collect { |t| table_schema(t) }\nSELECT rdb$relation_name FROM rdb$relations WHERE rdb$system_flag != 1\neosql\n end", "def schema_ds_dataset\n schema_utility_dataset\n end", "def schema(work_class_name:, context: nil)\n context ||= AllinsonFlex::Context.where(name: 'default')\n AllinsonFlex::DynamicSchema.where(\n allinson_flex_class: work_class_name,\n context: context\n ).order('created_at').last.schema\n rescue StandardError\n {}\n end", "def schema= new_schema\n frozen_check!\n @schema = new_schema\n end", "def schema= new_schema\n frozen_check!\n @schema = new_schema\n end", "def schema= new_schema\n frozen_check!\n @schema = new_schema\n end", "def table_schema(tbl)\n column_sql = <<-eosql\nSELECT rf.rdb$field_name AS \"name\",\n field.rdb$field_type AS \"type_code\",\n field.rdb$field_sub_type AS \"subtype_code\",\n-- -- -- field.rdb$field_length AS \"length\", -- -- --\n field.rdb$field_precision AS \"precision\",\n field.rdb$field_scale AS \"scale\",\n CASE\n WHEN rf.rdb$null_flag > 0\n THEN 'NO'\n ELSE 'YES'\n END AS \"nullable\",\n CASE\n WHEN iseg.rdb$index_name IS NOT NULL\n THEN 'YES'\n ELSE 'NO'\n END AS \"primary_key\"\nFROM rdb$relation_fields rf\nJOIN rdb$fields field ON rf.rdb$field_source = field.rdb$field_name\nLEFT JOIN rdb$relation_constraints c\n ON c.rdb$relation_name = rf.rdb$relation_name\n AND\n c.rdb$constraint_type = 'PRIMARY KEY'\nLEFT JOIN rdb$index_segments iseg\n ON iseg.rdb$index_name = c.rdb$index_name\n AND\n iseg.rdb$field_name = rf.rdb$field_name\nWHERE rf.rdb$relation_name = ?\nORDER BY rf.rdb$field_position, rf.rdb$field_name\neosql\n\n info = RDBI::Schema.new([], [])\n res = execute(column_sql, tbl.to_s.upcase)\n res.as(:Struct)\n while row = res.fetch[0]\n type = RDBI::Driver::Rubyfb::Types::field_type_to_rubyfb(row[:type_code], row[:subtype_code])\n info.columns << RDBI::Column.new(\n row[:name].to_sym,\n type,\n RDBI::Driver::Rubyfb::Types::rubyfb_to_rdbi(type, row[:scale]),\n row[:precision],\n row[:scale],\n row[:nullable] == 'YES',\n #nil, # metadata\n #nil, # default\n #nil, # table\n )\n (info.columns[-1].primary_key = row[:primary_key] == 'YES') rescue nil # pk > rdbi 0.9.1\n end\n return unless info.columns.length > 0\n info.tables << tbl\n info\n end", "def schema\n @schema ||= (default_schema || ETL::Schema::Table.new)\n end", "def schema\n @schema ||= begin\n s = Schema.from_gapi(@gapi.schema)\n # call fields so they will be available\n s.fields\n s.freeze\n end\n end", "def load_schema(file)\n end", "def schema_file\n raise 'schema_file not implemented for Feature, override in your class'\n end", "def schema_file\n raise 'schema_file not implemented for Feature, override in your class'\n end", "def user_defined_schemas(stream)\n return if (list = (@connection.user_defined_schemas - ['public'])).empty?\n\n stream.puts \" # Custom schemas defined in this database.\"\n list.each { |name| stream.puts \" create_schema \\\"#{name}\\\", force: :cascade\" }\n stream.puts\n end", "def get_schemas\n @schemas\n end", "def is_schemaless(options = {})\n options = { }.merge(options)\n # Add class-methods\n extend DataMapper::Is::Schemaless::ClassMethods\n # Add instance-methods\n include DataMapper::Is::Schemaless::InstanceMethods\n class_inheritable_accessor(:indexes)\n self.indexes ||= {}\n \n property :added_id, DataMapper::Types::Serial, :key => false \n property :id, DataMapper::Types::UUID, :unique => true, \n :nullable => false, \n :index => true,\n :default => Proc.new{ Guid.new.to_s }\n property :updated, DataMapper::Types::EpochTime, :key => true, \n :index => true, \n :default => Proc.new{ Time.now }\n property :body, DataMapper::Types::Json, :default => {}\n \n before :save, :add_model_type\n end", "def get_schema_level\n\t\tend", "def schema\n if @old_schema.nil?\n @old_schema = Schema.new(get(link('schema')))\n end\n return @old_schema \n end", "def schema_prefix\n ''\n end", "def build_schema(**args)\n if object.respond_to?(:each)\n build_collection_schema(args)\n else\n Surrealist.build_schema(instance: self, **args)\n end\n end", "def schema(schema_name, stream)\n stream << \" create_schema \\\"#{schema_name}\\\"\\n\"\n end", "def refresh_schema\n GraphQL::Client.dump_schema(HTTP, SCHEMA_PATH)\n end", "def schema\n @schema ||= GraphQL::Schema.define(\n query: graphql_query,\n mutation: graphql_mutation,\n resolve_type: ->(obj, _ctx) { @types[obj.class] }\n )\n end", "def build_schema(**args)\n if Helper.collection?(object)\n build_collection_schema(**args)\n else\n Surrealist.build_schema(instance: self, **args)\n end\n end", "def run(&block)\n original_path = @connection.schema_search_path\n set_path_if_required(@schema)\n yield\n ensure\n set_path_if_required(original_path)\n end", "def which_has_schema(schema)\n if schema.key? '$ref'\n ref = schema\n schema = resolve_ref(schema['$ref'])\n end\n\n self.baw_model_schema = defined?(ref) ? ref : schema\n let(:model_schema) {\n schema\n }\n end", "def load_schema!\n @columns_hash = _projection_fields.except(*ignored_columns)\n\n @columns_hash.each do |name, column|\n define_attribute(\n name,\n connection.lookup_cast_type_from_column(column),\n default: column.default,\n user_provided_default: false\n )\n end\n end", "def expected_columns; end", "def ext_schema\n @ext_schema ||= schema_versions[\"relaton-model-omg\"]\n end", "def to_schema\n self.value_to_schema unless self.value.blank?\n end", "def get_schema_id_iterator\n\t\tend", "def schema_generator\n JSON::SchemaGenerator\n end", "def use(&block)\n @schema = Dry::Validation.Params(&block)\n end", "def show\n respond_with(@schema) do |format|\n format.json { render json: @schema.to_json }\n end\n end", "def schema\n @schema ||= get_parser(options)\n end", "def __schema\n @relvar.namespace.schema\n end", "def [](*args)\n schema[*args]\n end", "def table; end", "def table; end", "def table; end", "def table; end", "def create_schema(schema)\n ActiveRecord::Base.connection.execute(\"CREATE SCHEMA #{schema}\")\n end", "def validate_against_schema\n lxml = XML::Document.string( self.to_xml )\n lxml.validate(Trufina.schema)\n end", "def init\n @schema = transform @source\n @schema = add_title @schema\n @schema = add_schema_url @schema\n @schema = add_required_fields @schema\n @schema = generate @schema\n end", "def Schema(string_or_io, options = T.unsafe(nil)); end", "def Schema(string_or_io, options = T.unsafe(nil)); end" ]
[ "0.7710992", "0.7041942", "0.7025683", "0.69620156", "0.69408774", "0.69123286", "0.69082534", "0.68427086", "0.6771424", "0.6739881", "0.67018056", "0.6696476", "0.6696312", "0.6696312", "0.6688387", "0.6642611", "0.6570198", "0.65092456", "0.6500674", "0.6486098", "0.6463113", "0.64596254", "0.6409933", "0.6404694", "0.6390564", "0.6358874", "0.63548166", "0.6347177", "0.632607", "0.62928826", "0.6257499", "0.62455916", "0.6243161", "0.6223475", "0.61958504", "0.61952573", "0.6183319", "0.6180251", "0.6180251", "0.6166455", "0.61398834", "0.61398834", "0.61376566", "0.6127501", "0.6123356", "0.6122573", "0.6121328", "0.61208546", "0.60962176", "0.6052498", "0.6050146", "0.6048457", "0.60279924", "0.6025088", "0.6006976", "0.59988105", "0.59925807", "0.59874874", "0.59801877", "0.59801877", "0.59801877", "0.5974753", "0.59641266", "0.59619117", "0.59615445", "0.59477144", "0.59477144", "0.5923848", "0.5919021", "0.5913342", "0.59079045", "0.59039754", "0.59018713", "0.59005946", "0.5898604", "0.5898455", "0.5883147", "0.58815664", "0.58431345", "0.5839141", "0.5838304", "0.5838138", "0.583409", "0.58325577", "0.58240765", "0.58132476", "0.5794402", "0.5788689", "0.5786421", "0.5780199", "0.57743317", "0.5772839", "0.5772839", "0.5772839", "0.5772839", "0.5756972", "0.5751424", "0.5745672", "0.573624", "0.573624" ]
0.64618486
21
Prawn's transparent function is wired backwards. A transparency of 1.0 is actually completely opaque, while 0.0 is fully transparent. Here is a new method, opacity, which behaves correctly.
def opacity(fill_o, stroke_o=nil, &block) @prawn.transparent(fill_o, stroke_o || fill_o) do yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transparent!\n @transparency = 1.0\n self\n end", "def translucent_alpha\n return 160\n end", "def transparent?\n alpha == ALPHA_TRANSPARENT\n end", "def rgba\n rgb + [opacity]\n end", "def opacity\n @opacity ||= @normalized.length == 3 ? 1.0 : @normalized.last\n end", "def transparent\n pixel = image_ptr[:transparent]\n pixel == -1 ? nil : pixel2color(pixel)\n end", "def transparent=(value)\n\t\t\t@transparent = value\n\t\tend", "def opacity(opacity)\n check_opacity(opacity)\n primitive \"opacity #{opacity}\"\n end", "def transparent?\n @transparent\n end", "def alpha\n (rgba & 0x7F000000) >> 24\n end", "def opaque?\n opacity == Utils::MAX_OPACITY\n end", "def opaque?\n alpha == ALPHA_OPAQUE\n end", "def transparent\n visual = @screen.get_rgba_visual()\n @window.set_visual visual\n @scroll.set_visual visual\n @webview.set_transparent true\n end", "def transparent\n visual = @screen.get_rgba_visual()\n @window.set_visual visual\n @scroll.set_visual visual\n @webview.set_transparent true\n end", "def transparency_mode\n super\n end", "def inverse\n rgba = self.to_a\n 3.times{|i| rgba[i] = 255 - rgba[i]}\n return self.new_extended_color(rgba)\n end", "def fill_opacity(opacity)\n check_opacity(opacity)\n primitive \"fill-opacity #{opacity}\"\n end", "def invert\n r = 1.0 - self.red\n g = 1.0 - self.green\n b = 1.0 - self.blue\n a = self.alpha\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end", "def invert\n Color.new(255 - @red, 255 - @green, 255 - @blue, @alpha)\n end", "def transparent(fill_t, stroke_t=nil, &block)\n @prawn.transparent(1.0-fill_t, 1.0-(stroke_t || fill_t)) do\n yield\n end\n end", "def transparent?\n type.transparent?\n end", "def update_opacity_change\n return if @opacity_duration == 0\n d = @opacity_duration\n @opacity = (@opacity * (d - 1) + @opacity_target) / d\n @opacity_duration -= 1\n end", "def settransparency(*)\n super\n end", "def test_has_transparent_foreground_on_bright_green_background\n Waveform.generate(fixture_asset(\"sample.wav\"), output(\"background_color-#00ff00+color-transparent.png\"), :background_color => \"#00ff00\", :color => :transparent)\n\n image = open_png(output(\"background_color-#00ff00+color-transparent.png\"))\n\n assert_equal ChunkyPNG::Color.from_hex(\"#00ff00\"), image[0, 0]\n assert_equal ChunkyPNG::Color::TRANSPARENT, image[60, 120]\n end", "def contents_opacity_is\n self.contents_opacity\n end", "def alpha=(value)\n self.rgba = (rgba & ~0xFF000000) | (self.class.normalize(value, ALPHA_MAX, :alpha) << 24)\n end", "def update_fade_effect\n if behind_toolbar?\n if self.opacity >= 60\n self.opacity -= 10\n @layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity\n end\n elsif self.opacity != 255\n self.opacity += 10\n @layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity\n end\n end", "def opaque!\n @transparency = TRANSPARENCY\n self\n end", "def bar_opacity=(alpha)\n @bar_opacity = [[alpha, 0].max, 255].min\n end", "def fadeToggleOpacity()\n @fadeToggleOpacity_duration = @w_fadeToggleOpacity.animationSpeed\n if (!@w_fadeToggleOpacity.visible)\n @w_fadeToggleOpacity.fadeIn()\n else\n @w_fadeToggleOpacity.fadeOut()\n end\n end", "def test_fadeOut_Opacity\n w = Window_Base.new(500, 50, 100, 50)\n @windows.push(w)\n w.opacity = 128\n w.fadeOut()\n return true\n end", "def transparent=(color)\n ::GD2::GD2FFI.send(:gdImageColorTransparent, image_ptr,\n color.nil? ? -1 : color2pixel(color))\n end", "def test_fadeInOut_Opacity\n @w_fadeToggleOpacity = Window_Base.new(200, 250, 100, 50)\n @w_fadeToggleOpacity.animationSpeed = 2000\n @w_fadeToggleOpacity.opacity = 128\n @w_fadeToggleOpacity.visible = false\n fadeToggleOpacity()\n return true\n end", "def alpha(value=nil)\n if !value.nil?\n value = value.alpha if value.is_a?(Sketchup::Color)\n r, g, b, a = self.to_a\n return self.new_extended_color(r, g, b, value)\n else\n return super()\n end\n end", "def fade_effect(duration, opacity)\n if @temp_basic_step_opacity == nil\n @temp_basic_step_opacity = opacity / duration.to_f\n \n @we_open_start_opacity = self.opacity\n end\n\n step_opacity = opacity - (duration * @temp_basic_step_opacity)\n \n self.opacity = @we_open_start_opacity + step_opacity\n\n if duration == 0\n @temp_basic_step_opacity = nil\n @we_open_start_opacity = nil\n end\n end", "def alpha(val=1.0)\n CGContextSetAlpha(@ctx, val)\n end", "def opacity=(opacity)\n if !opacity.nil? && opacity > 1\n fail ArgumentError, 'invalid value for \"opacity\", must be smaller than or equal to 1.'\n end\n\n if !opacity.nil? && opacity < 0\n fail ArgumentError, 'invalid value for \"opacity\", must be greater than or equal to 0.'\n end\n\n @opacity = opacity\n end", "def pbAlphaBlend(dstColor,srcColor)\n r=(255*(srcColor.red-dstColor.red)/255)+dstColor.red\n g=(255*(srcColor.green-dstColor.green)/255)+dstColor.green\n b=(255*(srcColor.blue-dstColor.blue)/255)+dstColor.blue\n a=(255*(srcColor.alpha-dstColor.alpha)/255)+dstColor.alpha\n return Color.new(r,g,b,a)\nend", "def render_transparent_background(columns, rows)\n Magick::Image.new(columns, rows) do |img|\n img.background_color = 'transparent'\n end\n end", "def fade_out(duration)\n delta = (255/60/duration.to_f).round\n @surface.fade(delta * -1)\n @finished = @surface.alpha == 255\n end", "def rgba\n [red, green, blue, alpha].freeze\n end", "def test_fadeIn_Opacity\n w = Window_Base.new(400, 50, 100, 50)\n @windows.push(w)\n w.opacity = 128\n w.visible = false\n w.fadeIn()\n return true\n end", "def test_opacity\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(200, 0, 24, 24), 1, 0, 200)\n uc.draw()\n }\n return true\n end", "def from_rgba(red, green, blue, alpha)\n Inker.color(\"rgba(#{red}, #{green}, #{blue}, #{alpha})\")\n end", "def alpha(a1)\n Rubyvis.rgb(r,g,b,a1)\n end", "def update_opacity\n self.opacity = @battler.max_opac\n @battler.refresh_opacity = false\n end", "def transparent?(input)\n options = [\n \"-format '%[channels]'\",\n input.shellescape\n ]\n raw = `identify #{options.join(' ')}`.chomp\n raw['rgba']\n end", "def save_alpha?\n !image_ptr[:saveAlphaFlag].zero?\n end", "def opaque?\n all? { |color| Color.opaque?(color) }\n end", "def fully_transparent?(value)\n a(value) == 0x00000000\n end", "def fully_transparent?(value)\n a(value) == 0x00000000\n end", "def stroke_opacity(opacity)\n check_opacity(opacity)\n primitive \"stroke-opacity #{opacity}\"\n end", "def escape\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.opacity = 255\n @_escape_duration = 32\n @_whiten_duration = 0\n @_appear_duration = 0\n @_collapse_duration = 0\n end", "def getAlphaOut\n if @fadeTime < 5\n return 0x11_000000\n elsif @fadeTime < 10\n return 0x22_000000\n elsif @fadeTime < 15\n return 0x33_000000\n elsif @fadeTime < 20\n return 0x44_000000\n elsif @fadeTime < 25\n return 0x55_000000\n elsif @fadeTime < 30\n return 0x66_000000\n elsif @fadeTime < 35\n return 0x77_000000\n elsif @fadeTime < 40\n return 0x88_000000\n elsif @fadeTime < 45\n return 0x99_000000\n elsif @fadeTime < 50\n return 0xaa_000000\n elsif @fadeTime < 55\n return 0xbb_000000\n elsif @fadeTime < 60\n return 0xcc_000000\n elsif @fadeTime < 65\n return 0xdd_000000\n elsif @fadeTime < 70\n return 0xee_000000\n else\n return 0xff_000000\n end\n end", "def restore_transparency(img_path, transparency_map)\n print_status(\"Restoring transparency for #{img_path}\")\n img = ChunkyPNG::Image.from_file(img_path)\n transparency_map.each do |i|\n img.pixels[i] = ChunkyPNG::Color::TRANSPARENT\n end\n img.save(img_path)\nend", "def invert!(alpha = false); end", "def test_opacity\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(200, 0, 40, 40), $data_actors[1], 0, 200)\n uc.draw()\n }\n return true\n end", "def opacity_change(during, on, opacity_start, opacity_end, distortion: :UNICITY_DISTORTION,\n time_source: :GENERIC_TIME_SOURCE)\n ScalarAnimation.new(during, on, :opacity=, opacity_start, opacity_end,\n distortion: distortion, time_source: time_source)\n end", "def fade_in(duration)\n delta = (255/60/duration.to_f).round\n @surface.fade(delta)\n @finished = @surface.alpha == 0\n end", "def every_pixel_transparent(image_region_pixel_array)\n\t\tfound_non_transparent = false\n\t\timage_region_pixel_array.each do |pixel|\n\t\t\tif pixel.opacity != 65535\n\t\t\t\tfound_non_transparent = true\t\n\t\t\tend\n\t\tend\n\t\treturn !found_non_transparent\n\tend", "def check_if_opacity_changed\n @color_components = nil if @color_components && @color_components[3] != @color.opacity\n end", "def alpha\n end", "def opaque!(value)\n value | 0x000000ff\n end", "def opaque!(value)\n value | 0x000000ff\n end", "def alpha; end", "def getAlphaIn\n if @fadeTime < 5\n return 0xff_000000\n elsif @fadeTime < 10\n return 0xee_000000\n elsif @fadeTime < 15\n return 0xdd_000000\n elsif @fadeTime < 20\n return 0xcc_000000\n elsif @fadeTime < 25\n return 0xbb_000000\n elsif @fadeTime < 30\n return 0xaa_000000\n elsif @fadeTime < 35\n return 0x99_000000\n elsif @fadeTime < 40\n return 0x88_000000\n elsif @fadeTime < 45\n return 0x77_000000\n elsif @fadeTime < 50\n return 0x66_000000\n elsif @fadeTime < 55\n return 0x55_000000\n elsif @fadeTime < 60\n return 0x44_000000\n elsif @fadeTime < 65\n return 0x33_000000\n elsif @fadeTime < 70\n return 0x22_000000\n else\n return 0x11_000000\n end\n end", "def check_if_opacity_changed\n @color_components = nil if @color_components && @color_components.first[3] != @color.opacity\n end", "def color_state_mod(color_pnt, enabled=active_state, alpha=255)\n case enabled\n when :enb, true then color_pnt.alpha = alpha * 0.8\n when :dis, false then color_pnt.alpha = alpha * 0.3\n end\n end", "def update_fade_in\n if @fade_in\n update_windowskin if contents_opacity == 0\n self.contents_opacity += 24\n @name_window.contents_opacity += 24\n @city_sprite.opacity += 24 if @city_sprite\n self.face_opacity = opacity\n @fade_in = false if contents_opacity == 255\n return true\n end\n return false\n end", "def alpha_blending?\n !image_ptr[:alphaBlendingFlag].zero?\n end", "def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.opacity = 255\n update_origin\n end", "def alpha\n return @alpha\n end", "def appear\n refresh\n self.visible = true\n self.opacity = 255\n end", "def update_collapse_opacity\n self.opacity = 256 - (48 - @effect_duration) * 6\n end", "def uicolor(alpha=1.0)\n red = self[0] / 255.0\n green = self[1] / 255.0\n blue = self[2] / 255.0\n UIColor.colorWithRed(red, green:green, blue:blue, alpha:alpha.to_f)\n end", "def draw_alpha_pixel(x,y,alpha,r,g,b)\r\n r = 0 if ( r < 0 ) \n r = 255 if ( r > 255 ) \r\n g = 0 if ( g < 0 ) \n g = 255 if ( g > 255 ) \r\n b = 0 if ( b < 0 ) \n b = 255 if ( b > 255 ) \r\n if ( x < 0 || y < 0 || x >= @x_size || y >= @y_size )\r\n #return(-1)\r\n #TODO check image_color_at method is right?\n else \r\n rGB2 = image_color_at(@picture, x, y)\n # debugger\n r2 = (rGB2 >> 16) & 0xFF\r\n g2 = (rGB2 >> 8) & 0xFF\r\n b2 = rGB2 & 0xFF\r\n ialpha = (100 - alpha)/100\r\n alpha = alpha / 100\r\n ra = (r*alpha+r2*ialpha).floor\r\n ga = (g*alpha+g2*ialpha).floor\r\n ba = (b*alpha+b2*ialpha).floor\r\n image_set_pixel(@picture,x,y,ra,ga,ba)\n end \r\n end", "def complement\n newvalues = self.rgba[0..-2].map {|v| Range.O.complement( v )}\n newvalues += [self.a]\n return Color[ *newvalues ]\n end", "def opaque_palette\n self.class.new(map { |c| ChunkyPNG::Color.opaque!(c) })\n end", "def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.ox = @cw/2\n self.opacity = 255\n end", "def test_alpha_compat\n expect { @img.alpha }.not_to raise_error\n assert [email protected]\n expect { @img.alpha Magick::ActivateAlphaChannel }.not_to raise_error\n assert @img.alpha\n end", "def compareOpacity(c1, c2, c3)\n\tif c1.opacity == c2.opacity and c1.opacity == c3.opacity\n\t\treturn true\n\telsif c1.opacity != c2.opacity and c1.opacity != c3.opacity and c2.opacity != c3.opacity\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def compose_precise(fg, bg)\n return fg if opaque?(fg) || fully_transparent?(bg)\n return bg if fully_transparent?(fg)\n \n fg_a = a(fg).to_f / MAX\n bg_a = a(bg).to_f / MAX\n a_com = (1.0 - fg_a) * bg_a\n\n new_r = (fg_a * r(fg) + a_com * r(bg)).round\n new_g = (fg_a * g(fg) + a_com * g(bg)).round\n new_b = (fg_a * b(fg) + a_com * b(bg)).round\n new_a = ((fg_a + a_com) * MAX).round\n rgba(new_r, new_g, new_b, new_a)\n end", "def compose_precise(fg, bg)\n return fg if opaque?(fg) || fully_transparent?(bg)\n return bg if fully_transparent?(fg)\n\n fg_a = a(fg).to_f / MAX\n bg_a = a(bg).to_f / MAX\n a_com = (1.0 - fg_a) * bg_a\n\n new_r = (fg_a * r(fg) + a_com * r(bg)).round\n new_g = (fg_a * g(fg) + a_com * g(bg)).round\n new_b = (fg_a * b(fg) + a_com * b(bg)).round\n new_a = ((fg_a + a_com) * MAX).round\n rgba(new_r, new_g, new_b, new_a)\n end", "def _alpha_color color\n return nil unless trns\n\n # For color type 0 (grayscale), the tRNS chunk contains a single gray level value, stored in the format:\n #\n # Gray: 2 bytes, range 0 .. (2^bitdepth)-1\n #\n # For color type 2 (truecolor), the tRNS chunk contains a single RGB color value, stored in the format:\n #\n # Red: 2 bytes, range 0 .. (2^bitdepth)-1\n # Green: 2 bytes, range 0 .. (2^bitdepth)-1\n # Blue: 2 bytes, range 0 .. (2^bitdepth)-1\n #\n # (If the image bit depth is less than 16, the least significant bits are used and the others are 0)\n # Pixels of the specified gray level are to be treated as transparent (equivalent to alpha value 0);\n # all other pixels are to be treated as fully opaque ( alpha = (2^bitdepth)-1 )\n\n @alpha_color ||=\n case hdr.color\n when COLOR_GRAYSCALE\n v = trns.data.unpack('n')[0] & (2**hdr.depth-1)\n Color.from_grayscale(v, :depth => hdr.depth)\n when COLOR_RGB\n a = trns.data.unpack('n3').map{ |v| v & (2**hdr.depth-1) }\n Color.new(*a, :depth => hdr.depth)\n else\n raise Exception, \"color2alpha only intended for GRAYSCALE & RGB color modes\"\n end\n\n color == @alpha_color ? 0 : (2**hdr.depth-1)\n end", "def whiten\n self.blend_type = 0\n self.color.set(255, 255, 255, 128)\n self.opacity = 255\n @_whiten_duration = 16\n @_appear_duration = 0\n @_escape_duration = 0\n @_collapse_duration = 0\n end", "def do_colorize(image, hash)\n opc = hash[:opacity]\n i2 = image.colorize(opc, opc, opc, hash[:colorize])\n opcounter = hash[:opacity]\n while opcounter > 0.0\n #i2 = i2.darken(0.25)\n #i2 = i2.contrast(true)\n opcounter -= 0.15\n end\n i2 = i2.modulate 1.0, 1.0+(1.0-1.0*hash[:opacity]), 1.0\n return i2\n end", "def fadeIn\n if @orig_opacity == nil || self.opacity < @orig_opacity\n @duration = self.animationSpeed\n if @orig_opacity == nil\n @orig_opacity = self.opacity\n end\n self.opacity = 0\n self.visible = true\n @opening = true\n @closing = false\n @animationType = FADE\n end\n end", "def fade(ratio=0)\n r, g, b, a = self.to_a\n a = [[a*ratio, 255].min, 0].max.to_i\n return self.new_extended_color(r, g, b, a)\n end", "def darken(value=0)\n return self.brighten(-value)\n end", "def save_alpha=(bool)\n ::GD2::GD2FFI.send(:gdImageSaveAlpha, image_ptr, bool ? 1 : 0)\n end", "def stroke_alpha\n dsl.stroke.alpha if dsl.stroke\n end", "def inspect\n alpha? ? rgba_str : hex_str\n end", "def inspect\n alpha? ? rgba_str : hex_str\n end", "def alpha=(num)\n @alpha = constrain num, 0..255\n end", "def draw_alpha_pixel(x,y,alpha,r,g,b)\n r = 0 if ( r < 0 )\n r = 255 if ( r > 255 )\n g = 0 if ( g < 0 )\n g = 255 if ( g > 255 )\n b = 0 if ( b < 0 )\n b = 255 if ( b > 255 )\n if ( x < 0 || y < 0 || x >= @x_size || y >= @y_size )\n #return(-1)\n #TODO check image_color_at method is right?\n else\n rGB2 = image_color_at(@picture, x, y)\n\n r2 = (rGB2 >> 16) & 0xFF\n g2 = (rGB2 >> 8) & 0xFF\n b2 = rGB2 & 0xFF\n ialpha = (100 - alpha)/100\n alpha = alpha / 100\n ra = (r*alpha+r2*ialpha).floor\n ga = (g*alpha+g2*ialpha).floor\n ba = (b*alpha+b2*ialpha).floor\n image_set_pixel(@picture,x,y,ra,ga,ba)\n end\n end", "def pbMEFade(x=0.0); pbMEStop(x);end", "def initialize(color,opacity)\n @color=color\n @opacity=opacity\n end", "def alpha?\n alpha < 1\n end", "def alpha?\n alpha < 1\n end", "def update_fade_in\n return false\n end" ]
[ "0.7591453", "0.7154349", "0.7128903", "0.7127573", "0.6816985", "0.6744407", "0.668012", "0.6657842", "0.6600432", "0.65268475", "0.6472317", "0.63767964", "0.6374885", "0.6374885", "0.6290318", "0.6203895", "0.61447126", "0.60796994", "0.6077734", "0.60453206", "0.6018642", "0.5988226", "0.5951255", "0.59405386", "0.5919507", "0.58898664", "0.5853998", "0.58441484", "0.58257204", "0.58190465", "0.5791275", "0.5769364", "0.57638663", "0.57609445", "0.5754522", "0.5731735", "0.57176936", "0.5713934", "0.5689573", "0.5673669", "0.5661876", "0.56571263", "0.56373245", "0.56292737", "0.5625113", "0.5610076", "0.560192", "0.55980057", "0.55863774", "0.5579144", "0.5579144", "0.5575267", "0.55391717", "0.5522092", "0.55217874", "0.5521159", "0.5518985", "0.5502742", "0.5495671", "0.54417914", "0.5433383", "0.5426936", "0.539271", "0.539271", "0.53887653", "0.53828466", "0.5371512", "0.53535676", "0.5350362", "0.53357077", "0.533005", "0.530612", "0.52989215", "0.5284629", "0.52752423", "0.52555543", "0.5244389", "0.52312255", "0.5226571", "0.5225525", "0.5222664", "0.5218251", "0.52157044", "0.51945484", "0.51783055", "0.5173658", "0.5153557", "0.5140541", "0.5138832", "0.5119884", "0.5111839", "0.5087582", "0.5087582", "0.5078041", "0.5062381", "0.5052545", "0.50519866", "0.5035196", "0.5035196", "0.50191694" ]
0.6131058
17
Prawn's transparent function is wired backwards. A transparency of 1.0 is actually completely opaque, while 0.0 is fully transparent. Here we invert the options to transparent so that transparent 1.0 is actually fully transparent.
def transparent(fill_t, stroke_t=nil, &block) @prawn.transparent(1.0-fill_t, 1.0-(stroke_t || fill_t)) do yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transparent!\n @transparency = 1.0\n self\n end", "def translucent_alpha\n return 160\n end", "def transparent?\n alpha == ALPHA_TRANSPARENT\n end", "def invert\n Color.new(255 - @red, 255 - @green, 255 - @blue, @alpha)\n end", "def invert\n r = 1.0 - self.red\n g = 1.0 - self.green\n b = 1.0 - self.blue\n a = self.alpha\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end", "def transparency_mode\n super\n end", "def inverse\n rgba = self.to_a\n 3.times{|i| rgba[i] = 255 - rgba[i]}\n return self.new_extended_color(rgba)\n end", "def transparent?\n @transparent\n end", "def transparent=(value)\n\t\t\t@transparent = value\n\t\tend", "def transparent\n visual = @screen.get_rgba_visual()\n @window.set_visual visual\n @scroll.set_visual visual\n @webview.set_transparent true\n end", "def transparent\n visual = @screen.get_rgba_visual()\n @window.set_visual visual\n @scroll.set_visual visual\n @webview.set_transparent true\n end", "def invert!(alpha = false); end", "def transparent\n pixel = image_ptr[:transparent]\n pixel == -1 ? nil : pixel2color(pixel)\n end", "def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.ox = @cw/2\n self.opacity = 255\n end", "def transparent?\n type.transparent?\n end", "def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.opacity = 255\n update_origin\n end", "def complement\n newvalues = self.rgba[0..-2].map {|v| Range.O.complement( v )}\n newvalues += [self.a]\n return Color[ *newvalues ]\n end", "def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end", "def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end", "def rgba\n rgb + [opacity]\n end", "def test_has_transparent_foreground_on_bright_green_background\n Waveform.generate(fixture_asset(\"sample.wav\"), output(\"background_color-#00ff00+color-transparent.png\"), :background_color => \"#00ff00\", :color => :transparent)\n\n image = open_png(output(\"background_color-#00ff00+color-transparent.png\"))\n\n assert_equal ChunkyPNG::Color.from_hex(\"#00ff00\"), image[0, 0]\n assert_equal ChunkyPNG::Color::TRANSPARENT, image[60, 120]\n end", "def opaque!\n @transparency = TRANSPARENCY\n self\n end", "def opaque?\n alpha == ALPHA_OPAQUE\n end", "def settransparency(*)\n super\n end", "def transparent?(input)\n options = [\n \"-format '%[channels]'\",\n input.shellescape\n ]\n raw = `identify #{options.join(' ')}`.chomp\n raw['rgba']\n end", "def fully_transparent?(value)\n a(value) == 0x00000000\n end", "def fully_transparent?(value)\n a(value) == 0x00000000\n end", "def opaque?\n opacity == Utils::MAX_OPACITY\n end", "def alpha\n (rgba & 0x7F000000) >> 24\n end", "def render_transparent_background(columns, rows)\n Magick::Image.new(columns, rows) do |img|\n img.background_color = 'transparent'\n end\n end", "def restore_transparency(img_path, transparency_map)\n print_status(\"Restoring transparency for #{img_path}\")\n img = ChunkyPNG::Image.from_file(img_path)\n transparency_map.each do |i|\n img.pixels[i] = ChunkyPNG::Color::TRANSPARENT\n end\n img.save(img_path)\nend", "def set_transparency_mode(opts)\n opts = check_params(opts,[:modes])\n super(opts)\n end", "def matte_reset!\n alpha(TransparentAlphaChannel)\n self\n end", "def whiten\n self.blend_type = 0\n self.color.set(255, 255, 255, 128)\n self.opacity = 255\n @_whiten_duration = 16\n @_appear_duration = 0\n @_escape_duration = 0\n @_collapse_duration = 0\n end", "def invert(params = {})\n params[:name] ||= @pictureName.gsub('.png', 'Inverted.png')\n params[:save] ||= @picturePath\n \n inv = dup\n \n (0...inv.width).each do |i|\n (0...inv.height).each do |j|\n red = 255 - ChunkyPNG::Color.r(inv[i,j])\n blue = 255 - ChunkyPNG::Color.g(inv[i,j])\n green = 255 - ChunkyPNG::Color.b(inv[i,j])\n inv[i,j] = ChunkyPNG::Color.rgb(red, blue, green)\n end\n end\n \n inv.pictureName, inv.picturePath = params[:name], params[:save]\n inv\n end", "def negate\n scale(-1.0)\n end", "def pbAlphaBlend(dstColor,srcColor)\n r=(255*(srcColor.red-dstColor.red)/255)+dstColor.red\n g=(255*(srcColor.green-dstColor.green)/255)+dstColor.green\n b=(255*(srcColor.blue-dstColor.blue)/255)+dstColor.blue\n a=(255*(srcColor.alpha-dstColor.alpha)/255)+dstColor.alpha\n return Color.new(r,g,b,a)\nend", "def transparent=(color)\n ::GD2::GD2FFI.send(:gdImageColorTransparent, image_ptr,\n color.nil? ? -1 : color2pixel(color))\n end", "def go_transparent(session, state=true)\n session[:_sipper_b2b_transparent] = state\n peer_session = get_peer_session(session)\n peer_session[:_sipper_b2b_transparent] = state if peer_session\n end", "def save_alpha?\n !image_ptr[:saveAlphaFlag].zero?\n end", "def getAlphaOut\n if @fadeTime < 5\n return 0x11_000000\n elsif @fadeTime < 10\n return 0x22_000000\n elsif @fadeTime < 15\n return 0x33_000000\n elsif @fadeTime < 20\n return 0x44_000000\n elsif @fadeTime < 25\n return 0x55_000000\n elsif @fadeTime < 30\n return 0x66_000000\n elsif @fadeTime < 35\n return 0x77_000000\n elsif @fadeTime < 40\n return 0x88_000000\n elsif @fadeTime < 45\n return 0x99_000000\n elsif @fadeTime < 50\n return 0xaa_000000\n elsif @fadeTime < 55\n return 0xbb_000000\n elsif @fadeTime < 60\n return 0xcc_000000\n elsif @fadeTime < 65\n return 0xdd_000000\n elsif @fadeTime < 70\n return 0xee_000000\n else\n return 0xff_000000\n end\n end", "def invert() end", "def escape\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.opacity = 255\n @_escape_duration = 32\n @_whiten_duration = 0\n @_appear_duration = 0\n @_collapse_duration = 0\n end", "def invert; end", "def rgba\n [red, green, blue, alpha].freeze\n end", "def alpha(val=1.0)\n CGContextSetAlpha(@ctx, val)\n end", "def darken(value=0)\n return self.brighten(-value)\n end", "def opacity\n @opacity ||= @normalized.length == 3 ? 1.0 : @normalized.last\n end", "def opaque_palette\n self.class.new(map { |c| ChunkyPNG::Color.opaque!(c) })\n end", "def opaque!(value)\n value | 0x000000ff\n end", "def opaque!(value)\n value | 0x000000ff\n end", "def inverse!\r\n conjugate!\r\n scale!(1.0/norm)\r\n end", "def invert\n end", "def opposite_color\n @base.brightness > 0.5 ? black : white\n end", "def compose_precise(fg, bg)\n return fg if opaque?(fg) || fully_transparent?(bg)\n return bg if fully_transparent?(fg)\n \n fg_a = a(fg).to_f / MAX\n bg_a = a(bg).to_f / MAX\n a_com = (1.0 - fg_a) * bg_a\n\n new_r = (fg_a * r(fg) + a_com * r(bg)).round\n new_g = (fg_a * g(fg) + a_com * g(bg)).round\n new_b = (fg_a * b(fg) + a_com * b(bg)).round\n new_a = ((fg_a + a_com) * MAX).round\n rgba(new_r, new_g, new_b, new_a)\n end", "def compose_precise(fg, bg)\n return fg if opaque?(fg) || fully_transparent?(bg)\n return bg if fully_transparent?(fg)\n\n fg_a = a(fg).to_f / MAX\n bg_a = a(bg).to_f / MAX\n a_com = (1.0 - fg_a) * bg_a\n\n new_r = (fg_a * r(fg) + a_com * r(bg)).round\n new_g = (fg_a * g(fg) + a_com * g(bg)).round\n new_b = (fg_a * b(fg) + a_com * b(bg)).round\n new_a = ((fg_a + a_com) * MAX).round\n rgba(new_r, new_g, new_b, new_a)\n end", "def safe_colorize_deactive\n CLIColorize.off\n end", "def opaque?\n all? { |color| Color.opaque?(color) }\n end", "def filter_color(col)\n col =~ /transparent|false/i ? nil : col\n end", "def color_state_mod(color_pnt, enabled=active_state, alpha=255)\n case enabled\n when :enb, true then color_pnt.alpha = alpha * 0.8\n when :dis, false then color_pnt.alpha = alpha * 0.3\n end\n end", "def alpha_mask(data, options = {})\n @canvas.alpha_mask data\n end", "def every_pixel_transparent(image_region_pixel_array)\n\t\tfound_non_transparent = false\n\t\timage_region_pixel_array.each do |pixel|\n\t\t\tif pixel.opacity != 65535\n\t\t\t\tfound_non_transparent = true\t\n\t\t\tend\n\t\tend\n\t\treturn !found_non_transparent\n\tend", "def deopacize(alpha = 128)\n cl = self.clone\n cl.alpha = alpha\n cl\n end", "def alpha_blending?\n !image_ptr[:alphaBlendingFlag].zero?\n end", "def disable_colorization(value = T.unsafe(nil)); end", "def inverted; invert = true; self; end", "def fade_out(duration)\n delta = (255/60/duration.to_f).round\n @surface.fade(delta * -1)\n @finished = @surface.alpha == 255\n end", "def inverse_brightness\n h, s, l, a = self.to_hsl\n l = 100 - l\n return self.from_hsl([h, s, l, a])\n end", "def fadeToggleOpacity()\n @fadeToggleOpacity_duration = @w_fadeToggleOpacity.animationSpeed\n if (!@w_fadeToggleOpacity.visible)\n @w_fadeToggleOpacity.fadeIn()\n else\n @w_fadeToggleOpacity.fadeOut()\n end\n end", "def update_fade_effect\n if behind_toolbar?\n if self.opacity >= 60\n self.opacity -= 10\n @layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity\n end\n elsif self.opacity != 255\n self.opacity += 10\n @layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity\n end\n end", "def back_color2\n Color.new(0, 0, 0, 0)\n end", "def back_color2\n Color.new(0, 0, 0, 0)\n end", "def fade_out(type, parameters)\n case type\n when :transition\n Graphics.freeze\n Graphics.brightness = 255\n when :fade_bk\n (parameters - 1).downto(0) do |i|\n Graphics.brightness = i * 255 / parameters\n Graphics.update\n end\n end\n end", "def getAlphaIn\n if @fadeTime < 5\n return 0xff_000000\n elsif @fadeTime < 10\n return 0xee_000000\n elsif @fadeTime < 15\n return 0xdd_000000\n elsif @fadeTime < 20\n return 0xcc_000000\n elsif @fadeTime < 25\n return 0xbb_000000\n elsif @fadeTime < 30\n return 0xaa_000000\n elsif @fadeTime < 35\n return 0x99_000000\n elsif @fadeTime < 40\n return 0x88_000000\n elsif @fadeTime < 45\n return 0x77_000000\n elsif @fadeTime < 50\n return 0x66_000000\n elsif @fadeTime < 55\n return 0x55_000000\n elsif @fadeTime < 60\n return 0x44_000000\n elsif @fadeTime < 65\n return 0x33_000000\n elsif @fadeTime < 70\n return 0x22_000000\n else\n return 0x11_000000\n end\n end", "def option_transparent\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"option transparent \" + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def alpha=(value)\n self.rgba = (rgba & ~0xFF000000) | (self.class.normalize(value, ALPHA_MAX, :alpha) << 24)\n end", "def desaturate(value=0)\n return self.saturate(-value)\n end", "def alpha(a1)\n Rubyvis.rgb(r,g,b,a1)\n end", "def back_color2\n Color.new(0, 0, 0, 0)\n end", "def reverse()\n newcolorlist = []\n self.colorlist.reverse.foreach do |color, index|\n newcolorlist += [(0.0..1.0).complement( index ), color]\n end\n return Palette[ :colorlist, newcolorlist ]\n end", "def alpha(value=nil)\n if !value.nil?\n value = value.alpha if value.is_a?(Sketchup::Color)\n r, g, b, a = self.to_a\n return self.new_extended_color(r, g, b, value)\n else\n return super()\n end\n end", "def test_fadeInOut_Opacity\n @w_fadeToggleOpacity = Window_Base.new(200, 250, 100, 50)\n @w_fadeToggleOpacity.animationSpeed = 2000\n @w_fadeToggleOpacity.opacity = 128\n @w_fadeToggleOpacity.visible = false\n fadeToggleOpacity()\n return true\n end", "def matte_replace(x, y)\n f = copy\n f.alpha(OpaqueAlphaChannel) unless f.alpha?\n target = f.pixel_color(x, y)\n f.transparent(target)\n end", "def default_flip\n return false\n end", "def default_flip\n return false\n end", "def compose_quick(fg, bg)\n return fg if opaque?(fg) || fully_transparent?(bg)\n return bg if fully_transparent?(fg)\n \n a_com = int8_mult(0xff - a(fg), a(bg))\n new_r = int8_mult(a(fg), r(fg)) + int8_mult(a_com, r(bg))\n new_g = int8_mult(a(fg), g(fg)) + int8_mult(a_com, g(bg))\n new_b = int8_mult(a(fg), b(fg)) + int8_mult(a_com, b(bg))\n new_a = a(fg) + a_com\n rgba(new_r, new_g, new_b, new_a)\n end", "def flip\n __flip__\n end", "def from_rgba(red, green, blue, alpha)\n Inker.color(\"rgba(#{red}, #{green}, #{blue}, #{alpha})\")\n end", "def constrain_to_colors(array)\n array[0] > 255 ? array[0] = 255 : array[0] < 0 ? array[0] = 0 : array[0]\n array[1] > 255 ? array[1] = 255 : array[1] < 0 ? array[1] = 0 : array[1]\n array[2] > 255 ? array[2] = 255 : array[2] < 0 ? array[2] = 0 : array[2]\n return array\n end", "def disable_color\n return translate_color(7)\n end", "def compose_quick(fg, bg)\n return fg if opaque?(fg) || fully_transparent?(bg)\n return bg if fully_transparent?(fg)\n\n a_com = int8_mult(0xff - a(fg), a(bg))\n new_r = int8_mult(a(fg), r(fg)) + int8_mult(a_com, r(bg))\n new_g = int8_mult(a(fg), g(fg)) + int8_mult(a_com, g(bg))\n new_b = int8_mult(a(fg), b(fg)) + int8_mult(a_com, b(bg))\n new_a = a(fg) + a_com\n rgba(new_r, new_g, new_b, new_a)\n end", "def back_color1\n Color.new(0, 0, 0, 192)\n end", "def back_color1\n Color.new(0, 0, 0, 192)\n end", "def inspect\n alpha? ? rgba_str : hex_str\n end", "def inspect\n alpha? ? rgba_str : hex_str\n end", "def back_color1\n Color.new(0, 0, 0, 192)\n end", "def opacity(fill_o, stroke_o=nil, &block)\n @prawn.transparent(fill_o, stroke_o || fill_o) do\n yield\n end\n end", "def save_alpha=(bool)\n ::GD2::GD2FFI.send(:gdImageSaveAlpha, image_ptr, bool ? 1 : 0)\n end", "def test_opacity\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(200, 0, 24, 24), 1, 0, 200)\n uc.draw()\n }\n return true\n end", "def test_fadeOut_Opacity\n w = Window_Base.new(500, 50, 100, 50)\n @windows.push(w)\n w.opacity = 128\n w.fadeOut()\n return true\n end" ]
[ "0.74207765", "0.6997088", "0.6789387", "0.67167205", "0.6661498", "0.6592917", "0.6565955", "0.65284747", "0.6423661", "0.6328033", "0.6328033", "0.6292357", "0.62793136", "0.61363834", "0.607293", "0.60413915", "0.59928936", "0.5937802", "0.5937802", "0.5815012", "0.5774961", "0.5704441", "0.5696309", "0.56573343", "0.56196105", "0.56084025", "0.56084025", "0.55600965", "0.5537905", "0.55321425", "0.55083215", "0.5488695", "0.54450375", "0.54443735", "0.5428097", "0.54215336", "0.5378036", "0.5347058", "0.53134954", "0.53134596", "0.5303738", "0.52778673", "0.5272912", "0.52676475", "0.5265516", "0.5257188", "0.52491546", "0.5248494", "0.5246781", "0.5244148", "0.5244148", "0.5242259", "0.52333176", "0.52319837", "0.5214814", "0.5210045", "0.5206237", "0.52004665", "0.5164863", "0.51393217", "0.511805", "0.51105493", "0.510982", "0.5106675", "0.51024127", "0.5099115", "0.50881547", "0.50868607", "0.5066529", "0.5048087", "0.5040059", "0.5040059", "0.5034706", "0.50204104", "0.50200886", "0.50162816", "0.50143397", "0.4985939", "0.49622875", "0.4962258", "0.49568534", "0.4955862", "0.48902318", "0.48886204", "0.48886204", "0.48845166", "0.4872958", "0.48729187", "0.48692372", "0.48522258", "0.48495018", "0.4839687", "0.4839687", "0.48386148", "0.48386148", "0.48342633", "0.48233324", "0.48211974", "0.48153454", "0.4807898" ]
0.58757037
19
get list of all of the paintings by specific artist
def list_paintings Painting.all.select do |painting| painting.artist == self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paintings\n Painting.all.select {|p| p.artist == self}\n end", "def artists\n paintings.collect do |p|\n p.artist \n end\n end", "def paintings\n Painting.all.select {|painting| painting.artist == self}\n end", "def paintings\n Painting.all.select {|painting| painting.artist == self}\n end", "def paintings\n Painting.all.select {|painting| painting.artist == self}\n end", "def artists\n paintings.map do |painting|\n painting.artist\n end\n end", "def paintings\n Painting.all.find_all do |pi|\n pi.artist == self\n end\n end", "def paintings\n Painting.all.select{|painting| painting.artist == self}\n end", "def paintings()\n Painting.all.select { | painting | painting.artist == self }\n end", "def paintings\n Painting.all.select{|painting_instance| painting_instance.artist == self}\n end", "def paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def paintings\n Painting.all.select do |painting_instance|\n painting_instance.artist == self\n end\n end", "def all_paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def paintings\n Painting.all.select{|painting| painting.artist == self}\n end", "def all_my_paintings\n Painting.all.select{|picture| picture.artist == self}\n end", "def artists\n self.paintings.map do |painting|\n painting.artist\n end.uniq\n end", "def artists\n paintings.map{|art| art.artist.name}\n\n end", "def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |painting| painting.artist }\n end", "def paintings\n Painting.all.select do |p|\n p.artist == self \n end\nend", "def all_artists\n match = Painting.all.select{|painting| painting.gallery == self}\n match.map{|painting| painting.artist}\nend", "def all_paintings\n artist_paintings = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n artist_paintings.map do |painting_ob|\n painting_ob.title\n end\nend", "def find_photographs_by_artist(artist)\n artist_photos = []\n @photographs.each do |photograph|\n if photograph[:artist_id] == artist[:id]\n artist_photos << photograph\n end\n end\n artist_photos\n end", "def show \n @artist = Artist.find(params[:id])\n @paintings = @artist.paintings\n end", "def show\n @paintings = @artist.paintings\n end", "def galleries\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery\n end\n end.compact.uniq\n end", "def all_galleries\n gallery_arr = Painting.all.select do |painting_ob|\n painting_ob.artist == self\n end\n gallery_arr.map do |painting_ob|\n painting_ob.gallery.name\n end\nend", "def paintings # Get a list of all the paintings by a specific(keywrod for instance method) artists\n Painting.all.select{|list| list.gallery == self}\n # binding.pry\n end", "def artist_names #return array of the names of all artists that have a painting in a gallery\n artists.name #pull array from artists method and call reader to get their name\n end", "def artists\n @songs.collect do |song|\n song.artist\n end\n end", "def artists\n @songs.collect do |song|\n song.artist\n end\n end", "def find_artists\n album_ids = []\n album_results = CONNECTION.execute(\"SELECT * FROM albums_styles WHERE style_id = #{@id};\")\n album_results.each do |hash|\n album_ids << hash[\"album_id\"]\n end\n artist_ids = []\n artist_results = CONNECTION.execute(\"SELECT * FROM albums_artists WHERE album_id IN (#{album_ids.join(\",\")})\")\n artist_results.each do |hash|\n artist_ids << hash[\"artist_id\"]\n end\n \n Artist.find_many(artist_ids)\n end", "def artists\n @songs.map { |m| m.artist }.uniq\n end", "def artists\n songs.map {|song| song.artist}\n end", "def artists\n songs.map do |song|\n song.artist\n end\n end", "def artists\n songs.map do |song|\n song.artist\n end\n end", "def artists\n self.songs.map {|song| song.artist}\n end", "def artists\n self.songs.collect{|song| song.artist}\n end", "def artists\n songs.collect do |song|\n song.artist\n end\n .uniq #does not return duplicate artists if the genre has more than one song by a particular artist (genre has many artists through songs)\n end", "def artists\n @songs.collect{|song| song.artist}.uniq\n end", "def all_artist_names_by_gallery\n all_artists_by_gallery.map do |artist|\n # artist.name == Painting.artist.name\n artist.name\n end\n end", "def artists_with_multiple_photographs\n artists = []\n @artists.each do |artist|\n @photographs.each do |photo|\n if artist[:id] == photo[:artist_id]\n artists << artist\n end\n end\n end\n artists\n end", "def gallaries\n paintings.map{|paint| paint.gallery}\n\n end", "def paintings\n Painting.all.select do |painting|\n painting.gallery == self\n end\n end", "def artists\n songs.collect do |song|\n song.artist\n\n end\nend", "def artists\n @songs.collect do |song| #<Song:0x007f874c4eeed8 @artist=#<Artist:0x007f874c4ef0b8 @name=\"Jay-Z\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @genre=#<Genre:0x007f874c4ef018 @name=\"rap\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @name=\"99 Problems\">\n song.artist ##<Artist:0x007f874c4ef0b8 @name=\"Jay-Z\", @songs=[#<Song:0x007f874c4eeed8 @artist=#<Artist:0x007f874c4ef0b8 ...>, @genre=#<Genre:0x007f874c4ef018 @name=\"rap\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @name=\"99 Problems\">]>\n end\n end", "def paintings\n Painting.all.select do |a|\n a.gallery == self\n end\n end", "def artists\n genre_artists = []\n Song.all.each {|song|\n if song.genre == self &&\n !genre_artists.include?(song.artist)\n genre_artists << song.artist\n end\n }\n genre_artists\n end", "def artist()\n sql = \"SELECT * FROM artists WHERE id = $1\"\n values = [@artist_id]\n artists = SqlRunner.run(sql, values)\n result = artists.map {|artist| Artist.new(artist)}\n return result\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map {|painting| painting.gallery}\n end", "def artists\n artists = []\n self.songs.each do |song|\n artists << song.artist\n end\n artists.uniq\n end", "def artist_images\n ArtistImage.find_by_artist_id(self.id)\n end", "def artists\n songs.map do |song|\n song.artist\n # binding.pry\n end\n end", "def galleries\n paintings.map{|painting| painting.gallery}.uniq\n end", "def photographs_taken_by_artist_from(country)\n artists_match_country = @artists.find_all do |artist|\n artist.country == country\n end\n photos = []\n @photographs.each do |photo|\n artists_match_country.each do |artist|\n if photo.artist_id == artist.id\n photos << photo\n end\n end\n end\n photos\n end", "def galleries\n paintings.map {|p| p.gallery}\n end", "def artists\nSong.all.collect{|x| x.artist}\nend", "def galleries\n paintings.map do |p|\n p.gallery\n end\n end", "def galleries()\n self.paintings().map { | painting | painting.gallery }.uniq\n end", "def cities\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery.city\n end\n end.compact.uniq\n end", "def photographs_taken_by_artist_from(country)\n photos_by_country = []\n @photographs.each do |photo|\n @artists.each do |artist|\n if photo[:artist_id] == artist[:id] && artist[:country] == country\n photos_by_country << photo\n end\n end\n end\n photos_by_country\n end", "def artists\n self.songs.collect {|song| song.artist}\nend", "def artists\n # - this method will show the connection between songs and artists \n self.songs.collect do |f| \n f.artist\n end\n end", "def list_galleries\n list_paintings.map do |gallery_painting|\n gallery_painting.gallery\n end\n end", "def gal_artist\n beef = paintings.map{|exp| exp.artist.years_active} #accesing artist object in paintings method(mentioned above) and years_active instance_method\n tot = beef.inject{|sum, n| sum + n} #sum of all\n # avg = (beef_tot / beef.length).round(0) #avg of the num of elements(beef_tot) divide by number of arrays we summed up (beef.length)\n # binding.pry\n\n end", "def list_artists\n all_artists = artist_data[\"artists\"][\"items\"]\n all_artists.each do | artist |\n artist_name = artist[\"name\"]\n artists[artist_name] ||= {}\n artists[artist_name][:popularity] = artist[\"popularity\"]\n end\n artists\n end", "def all_cities\n city_arr = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n city_arr.map do |painting_ob|\n painting_ob.gallery.city\n end\nend", "def artists(artist)\n if song.artist = nil || !Artist.find_by_name(name)\n song.artist = artist \n Artist.all << artist \n end \n end", "def list_artist\n Artist.all.each.with_index(1) {|artist, i| puts \"#{i}. #{artist.name}\"}\n end", "def songs \n Song.all.select do |e|\n e.artist == self\n end\n end", "def artist_names\n artists.map do |artist|\n artist.name\n end\n end", "def bookmarked_artists\n doc = request(@user, \"favoriteartists\")\n artists = []\n doc.xpath('//rss/channel/item').each do |node|\n artists << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :artist => node.xpath('mm:Artist/dc:title').text.strip,\n :station => node.xpath('pandora:stationLink').text.strip }\n end\n artists\n end", "def songs\n Song.all_by_artist(self)\n end", "def galleries\n galleries_array = paintings.map {|painting| painting.gallery}\n galleries_array.uniq\n end", "def artworksIn\n\tlistback = []\n\t@art = Artwork.all\n\t@artcreated = ArtworkCreatedBy.all\n\[email protected] do |a|\n\t\[email protected] do |ac|\n\t\t\tif self.artist_id == ac.artist_id\n\t\t\t\tif a.art_id == ac.art_id\n\t\t\t\t\tlistback << a\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tlistback\nend", "def all_galleries\n self.all_paintings.map do |painting|\n painting.gallery\n end.uniq\n end", "def galleries\n self.paintings.map{|painitng| painitng.gallery}.uniq\n end", "def albums\n sql = \"SELECT * FROM albums WHERE artist_id = #{@id};\"\n #Select all from albums when the id of the artist we are working on matched the artist_id in albums\n album_list = SqlRunner.run( sql )\n # Save the array to a varibale\n return album_list.map { |album| Album.new(album) }\n # Map the array to a hash.\n end", "def songs\n Song.all.select {|songs| songs.artist == self}\n end", "def songs\n Song.all.select {|s| s.artist == self}\n end", "def songs\n Song.all.select do |song|\n song.artist == self.name\n end\n end", "def track_artists\n @tracks.collect{ |t| t.artist }.compact.uniq\n end", "def songs\n Song.all.select do |song| \n song.artist == self\n end \n end", "def artist_names\n self.artists.collect do |n|\n n.name \n end\n end", "def songs\n Song.all.select do |song|\n song.artist == self\n end\n end", "def songs\n Song.all.select do |song|\n song.artist == self\n end\n end", "def songs\n Song.all.select do |song|\n song.artist == self\n end\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def all_by_artist()\n\n sql = \"\n SELECT * FROM albums\n WHERE artist_id = $1;\n \"\n\n album_hashes = SqlRunner.run(sql, [@id])\n album_list = album_hashes.map {|album_hash| Album.new(album_hash)}\n return album_list\n\nend", "def songs\n Song.all.select do |song_instance|\n song_instance.artist == self\n end\n end", "def photographs_taken_by_artists_from(country)\n country_by_artist = @artists.find_all do |artist|\n artists.first[:country] == country\n end\n @photographs.find_all do |photos|\n photos[:id] == country_by_artist[:id]\n end\n # require 'pry'; binding.pry\n end", "def retrieve_artists_by_label\n artistMap = Hash.new(nil)\n Artist.all.each do |rapper|\n if artistMap[rapper.label] == nil\n newArtistArr = []\n newArtistArr << rapper\n artistMap[rapper.label] = newArtistArr\n else\n existingArtistArr = artistMap[rapper.label]\n existingArtistArr << rapper\n end\n end\n artistMap\n end", "def list_presenting_artists(gallery)\n gallery.artist_name.each.with_index(1) {|artist, i| puts \"#{i}. #{artist}\"}\n end", "def songs\n Song.all.select do |song_instance|\n song_instance.artist == self \n end\n end", "def galleries\n galleries = self.paintings.map do |pi|\n pi.gallery\n end\n galleries.uniq\n end", "def artists\n if RESPONSE.code == 200\n # Return data to page\n JSON.parse(RESPONSE.to_s)['topartists']['artist']\n else\n # print error message\n \"Error Code #{RESPONSE.code}\"\n end\n end", "def songs\n Song.all.select {|songs|songs.artist == self}\n end" ]
[ "0.83807814", "0.8183065", "0.81789553", "0.81789553", "0.81789553", "0.81573445", "0.8153511", "0.81418484", "0.8136609", "0.8131651", "0.811929", "0.811929", "0.80990595", "0.8081278", "0.80803007", "0.79875827", "0.7919767", "0.78768665", "0.7677567", "0.7522961", "0.7402071", "0.7211995", "0.7037214", "0.70189804", "0.6961106", "0.692381", "0.6884372", "0.6686039", "0.66628397", "0.650499", "0.650499", "0.64596236", "0.6382908", "0.63566226", "0.6351892", "0.6351892", "0.63288164", "0.63253784", "0.63199425", "0.6313111", "0.6305486", "0.62973547", "0.6269221", "0.62586504", "0.62344486", "0.6208617", "0.62068677", "0.6184204", "0.6176028", "0.61577535", "0.61577535", "0.61577535", "0.61503917", "0.613459", "0.60258424", "0.6021815", "0.60052633", "0.598714", "0.5981961", "0.5967599", "0.59674907", "0.59580475", "0.59491175", "0.59430677", "0.593698", "0.59325075", "0.59133035", "0.588855", "0.5862456", "0.5853315", "0.58501863", "0.58447754", "0.58123165", "0.57879734", "0.57858366", "0.576197", "0.57599056", "0.5749317", "0.5732895", "0.57219374", "0.5706744", "0.5688667", "0.5685937", "0.5678906", "0.5674377", "0.5661188", "0.5660097", "0.5656624", "0.5656624", "0.5656624", "0.5648339", "0.5643276", "0.56413066", "0.5640131", "0.5638569", "0.5638396", "0.5637886", "0.5632431", "0.5623448", "0.5621365" ]
0.8317784
1
Get a list of all the galleries that a specific artist has paintings in
def list_galleries list_paintings.map do |gallery_painting| gallery_painting.gallery end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galleries\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery\n end\n end.compact.uniq\n end", "def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |painting| painting.artist }\n end", "def galleries\n paintings.map {|p| p.gallery}\n end", "def all_galleries\n gallery_arr = Painting.all.select do |painting_ob|\n painting_ob.artist == self\n end\n gallery_arr.map do |painting_ob|\n painting_ob.gallery.name\n end\nend", "def galleries\n paintings.map {|painting| painting.gallery}\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |p|\n p.gallery\n end\n end", "def galleries\n paintings.map{|painting| painting.gallery}.uniq\n end", "def galleries()\n self.paintings().map { | painting | painting.gallery }.uniq\n end", "def galleries\n galleries = self.paintings.map do |pi|\n pi.gallery\n end\n galleries.uniq\n end", "def galleries\n galleries_array = paintings.map {|painting| painting.gallery}\n galleries_array.uniq\n end", "def all_galleries\n self.all_paintings.map do |painting|\n painting.gallery\n end.uniq\n end", "def all_artists\n match = Painting.all.select{|painting| painting.gallery == self}\n match.map{|painting| painting.artist}\nend", "def all_galleries_featured_in\n my_galleries = self.all_my_paintings.map{|picture| picture.gallery}.uniq\n end", "def paintings\n Painting.all.select do |a|\n a.gallery == self\n end\n end", "def paintings\n Painting.all.select do |painting|\n painting.gallery == self\n end\n end", "def gallaries\n paintings.map{|paint| paint.gallery}\n\n end", "def galleries\n self.paintings.map{|painitng| painitng.gallery}.uniq\n end", "def paintings\n Painting.all.select {|p| p.artist == self}\n end", "def artists\n paintings.collect do |p|\n p.artist \n end\n end", "def all_my_paintings\n Painting.all.select{|picture| picture.artist == self}\n end", "def galleries\n galleries = self.paintings.map do |p|\n p.gallery\n end\n galleries.uniq\nend", "def paintings\n Painting.all.select{|painting_instance| painting_instance.artist == self}\n end", "def paintings\n Painting.all.select {|painting| painting.artist == self}\n end", "def paintings\n Painting.all.select {|painting| painting.artist == self}\n end", "def paintings\n Painting.all.select {|painting| painting.artist == self}\n end", "def paintings()\n Painting.all.select { | painting | painting.artist == self }\n end", "def paintings\n Painting.all.select{|painting| painting.artist == self}\n end", "def list_paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def paintings\n Painting.all.select do |painting_instance|\n painting_instance.artist == self\n end\n end", "def paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def all_artist_names_by_gallery\n all_artists_by_gallery.map do |artist|\n # artist.name == Painting.artist.name\n artist.name\n end\n end", "def paintings\n Painting.all.select{|painting| painting.artist == self}\n end", "def paintings\n Painting.all.find_all do |pi|\n pi.artist == self\n end\n end", "def artists\n self.paintings.map do |painting|\n painting.artist\n end.uniq\n end", "def artists\n paintings.map do |painting|\n painting.artist\n end\n end", "def find_photographs_by_artist(artist)\n artist_photos = []\n @photographs.each do |photograph|\n if photograph[:artist_id] == artist[:id]\n artist_photos << photograph\n end\n end\n artist_photos\n end", "def artists\n paintings.map{|art| art.artist.name}\n\n end", "def paintings # Get a list of all the paintings by a specific(keywrod for instance method) artists\n Painting.all.select{|list| list.gallery == self}\n # binding.pry\n end", "def all_paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def artists_with_multiple_photographs\n artists = []\n @artists.each do |artist|\n @photographs.each do |photo|\n if artist[:id] == photo[:artist_id]\n artists << artist\n end\n end\n end\n artists\n end", "def artist_names #return array of the names of all artists that have a painting in a gallery\n artists.name #pull array from artists method and call reader to get their name\n end", "def showGalleries\n @galleries = Gallery.uniq.joins(:arts).where('arts.uploader = ?', current_user.id.to_s)\n end", "def paintings\n Painting.all.select do |p|\n p.artist == self \n end\nend", "def artists\n genre_artists = []\n Song.all.each {|song|\n if song.genre == self &&\n !genre_artists.include?(song.artist)\n genre_artists << song.artist\n end\n }\n genre_artists\n end", "def artists\n songs.collect do |song|\n song.artist\n end\n .uniq #does not return duplicate artists if the genre has more than one song by a particular artist (genre has many artists through songs)\n end", "def galleries\n galleries = []\n Dir.glob(\"#{@options.cache_dir}/*\").each do |path| \n name = path.split('/').last\n puts name\n gallery = {}\n gallery[:title] = name.gsub(/[_]/, ' ').capitalize\n puts (gallery[:path] = \"gallery/#{name}\")\n thumb = Dir.glob(\"#{path}/*/thumb.*\").first\n thumb = Dir.glob(\"#{path}/*/*.*\").first unless thumb # else take the first image.\n thumb = thumb.split('/').last\n puts (gallery[:thumb] = \"image/m/#{name}/#{thumb}\")\n galleries << gallery\n end\n galleries\n end", "def list_presenting_artists(gallery)\n gallery.artist_name.each.with_index(1) {|artist, i| puts \"#{i}. #{artist}\"}\n end", "def find_artists\n album_ids = []\n album_results = CONNECTION.execute(\"SELECT * FROM albums_styles WHERE style_id = #{@id};\")\n album_results.each do |hash|\n album_ids << hash[\"album_id\"]\n end\n artist_ids = []\n artist_results = CONNECTION.execute(\"SELECT * FROM albums_artists WHERE album_id IN (#{album_ids.join(\",\")})\")\n artist_results.each do |hash|\n artist_ids << hash[\"artist_id\"]\n end\n \n Artist.find_many(artist_ids)\n end", "def show\n @images = @galleries_album.galleries\n end", "def artist_images\n ArtistImage.find_by_artist_id(self.id)\n end", "def items()\n data['galleries']\n end", "def get_galleries_names_on_page(_browser = @browser)\n Log.logger.info(\"Getting gallery link-names on the page\")\n i = 1\n galleries_list = []\n galleries_xpath = \"//div[contains(@class, 'media-gallery-collection')]/div\"\n nog = Integer(_browser.find_elements(:xpath => galleries_xpath).size)\n Log.logger.info(\"Found #{nog} galleries\")\n while i <= nog\n JQuery.wait_for_events_to_finish(_browser)\n gal_name = _browser.find_element(:xpath => \"//div[contains(@class, 'media-gallery-collection')]/div[#{i}]\").attribute(\"about\")\n gal_name.gsub!(/\\/content\\//,'')\n i += 1\n galleries_list << gal_name\n end\n return galleries_list\n end", "def photographs_taken_by_artist_from(country)\n artists_match_country = @artists.find_all do |artist|\n artist.country == country\n end\n photos = []\n @photographs.each do |photo|\n artists_match_country.each do |artist|\n if photo.artist_id == artist.id\n photos << photo\n end\n end\n end\n photos\n end", "def artists\n @songs.map { |m| m.artist }.uniq\n end", "def all_paintings\n artist_paintings = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n artist_paintings.map do |painting_ob|\n painting_ob.title\n end\nend", "def artists\n @songs.collect{|song| song.artist}.uniq\n end", "def list_gallery\n Galleries.all.each.with_index(1) { |gallery, i| puts \"#{i}. #{gallery.name}\"}\n end", "def artists\n @songs.collect do |song|\n song.artist\n end\n end", "def artists\n @songs.collect do |song|\n song.artist\n end\n end", "def artists\n songs.map {|song| song.artist}\n end", "def artists\n self.songs.collect{|song| song.artist}\n end", "def artists\n artists = []\n self.songs.each do |song|\n artists << song.artist\n end\n artists.uniq\n end", "def artists\n songs.collect do |song|\n song.artist\n\n end\nend", "def artists\n self.songs.map {|song| song.artist}\n end", "def photographs_taken_by_artist_from(country)\n photos_by_country = []\n @photographs.each do |photo|\n @artists.each do |artist|\n if photo[:artist_id] == artist[:id] && artist[:country] == country\n photos_by_country << photo\n end\n end\n end\n photos_by_country\n end", "def genres\n @new_array_of_genres = []\n @songs.each do |song| #iterate through each song to find the genre\n if @new_array_of_genres.include?(song.genre) #does not return duplicate genres\n nil\n else\n @new_array_of_genres << song.genre #collects genres through its songs\n end\n end\n @new_array_of_genres #returns a collection of genres for all of the artists songs\n end", "def cities\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery.city\n end\n end.compact.uniq\n end", "def artists\n @songs.collect do |song| #<Song:0x007f874c4eeed8 @artist=#<Artist:0x007f874c4ef0b8 @name=\"Jay-Z\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @genre=#<Genre:0x007f874c4ef018 @name=\"rap\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @name=\"99 Problems\">\n song.artist ##<Artist:0x007f874c4ef0b8 @name=\"Jay-Z\", @songs=[#<Song:0x007f874c4eeed8 @artist=#<Artist:0x007f874c4ef0b8 ...>, @genre=#<Genre:0x007f874c4ef018 @name=\"rap\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @name=\"99 Problems\">]>\n end\n end", "def genres \n songs.collect{ |s| s.genre }.uniq #returns collection of genres for all of the artist's songs/ does not return duplicate genres/ collects genres\n end", "def artists\n songs.map do |song|\n song.artist\n end\n end", "def artists\n songs.map do |song|\n song.artist\n end\n end", "def show\n @arts = Array.new()\n @gallery.art_ids.each do |aid|\n @arts << Art.find(aid)\n end\n\n end", "def gallery\n @galleries = Gallery.all\n end", "def genres\n all_genres = []\n Song.all.each do |x|\n if x.artist == self\n all_genres << x.genre\n end\n end\nall_genres\nend", "def galleries\n @galleries ||= Fotolia::Galleries.new(self)\n end", "def gal_artist\n beef = paintings.map{|exp| exp.artist.years_active} #accesing artist object in paintings method(mentioned above) and years_active instance_method\n tot = beef.inject{|sum, n| sum + n} #sum of all\n # avg = (beef_tot / beef.length).round(0) #avg of the num of elements(beef_tot) divide by number of arrays we summed up (beef.length)\n # binding.pry\n\n end", "def artists\nSong.all.collect{|x| x.artist}\nend", "def albums\n sql = \"SELECT * FROM albums WHERE artist_id = #{@id};\"\n #Select all from albums when the id of the artist we are working on matched the artist_id in albums\n album_list = SqlRunner.run( sql )\n # Save the array to a varibale\n return album_list.map { |album| Album.new(album) }\n # Map the array to a hash.\n end", "def genres\n songs.map{|song| song.genre} # giving back all the genres under that particular artist. artists can have nmany genres and calling of theirmany genres.\n # Song.all.map{|ind_song| ind_song.genre} #giving back all the different genres from the collection of song array. giving back all the genres of the songs\n # binding.pry\n end", "def artists\n self.songs.collect {|song| song.artist}\nend", "def photographs_taken_by_artists_from(country)\n country_by_artist = @artists.find_all do |artist|\n artists.first[:country] == country\n end\n @photographs.find_all do |photos|\n photos[:id] == country_by_artist[:id]\n end\n # require 'pry'; binding.pry\n end", "def show \n @artist = Artist.find(params[:id])\n @paintings = @artist.paintings\n end", "def artworksIn\n\tlistback = []\n\t@art = Artwork.all\n\t@artcreated = ArtworkCreatedBy.all\n\[email protected] do |a|\n\t\[email protected] do |ac|\n\t\t\tif self.artist_id == ac.artist_id\n\t\t\t\tif a.art_id == ac.art_id\n\t\t\t\t\tlistback << a\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tlistback\nend", "def artists\n # - this method will show the connection between songs and artists \n self.songs.collect do |f| \n f.artist\n end\n end", "def show\n @paintings = @artist.paintings\n end", "def songs\n Song.all_by_artist(self)\n end", "def genres\n songs.collect do |song|\n song.genre\n end\n .uniq #does not return duplicate genres if the artist has more than one song of a particular genre (artist has many genres through songs)\n end", "def songs \n Song.all.select do |e|\n e.artist == self\n end\n end", "def songs\n Song.all.select do |song_instance|\n song_instance.artist == self\n end\n end", "def songs\n #use select to iterate thru songs\n Song.all.select{|song| song.artist == self}\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def songs\n Song.all.select {|song| song.artist == self }\n end", "def all_cities\n city_arr = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n city_arr.map do |painting_ob|\n painting_ob.gallery.city\n end\nend", "def songs\n Song.all.select {|s| s.artist == self}\n end", "def songs\n Song.all.select do |song| \n song.artist == self\n end \n end" ]
[ "0.8480682", "0.832521", "0.82131815", "0.80622935", "0.8029989", "0.7934373", "0.7934373", "0.7934373", "0.79326504", "0.79094577", "0.7883147", "0.7845615", "0.7817575", "0.7720498", "0.76563257", "0.7621297", "0.7353742", "0.73248523", "0.72613746", "0.7208073", "0.7180583", "0.71698415", "0.70861185", "0.70773894", "0.70533437", "0.7037215", "0.7037215", "0.7037215", "0.7030527", "0.7014712", "0.7003796", "0.6999425", "0.6988997", "0.6988997", "0.6985378", "0.69674194", "0.6964675", "0.6948117", "0.6929992", "0.69156927", "0.6882086", "0.6867191", "0.6838608", "0.67884713", "0.67872244", "0.66074157", "0.654625", "0.6493753", "0.63944954", "0.6387211", "0.6360974", "0.6257968", "0.62127787", "0.6194107", "0.6191897", "0.61842036", "0.6183264", "0.609371", "0.6084708", "0.6060818", "0.6054521", "0.605418", "0.605418", "0.60430026", "0.6022441", "0.6018126", "0.59944236", "0.59937656", "0.59655565", "0.59621906", "0.5958239", "0.593395", "0.5928812", "0.5918991", "0.5918991", "0.5910882", "0.5879145", "0.58663917", "0.58557796", "0.5846718", "0.57958513", "0.57643574", "0.5758437", "0.5744288", "0.5743824", "0.57316977", "0.5719524", "0.5709788", "0.56989616", "0.56937236", "0.5688066", "0.5676854", "0.56650233", "0.56637627", "0.5657237", "0.5657237", "0.5645803", "0.56346846", "0.56343806", "0.56265837" ]
0.7944763
5
Get a list of all cities that contain galleries that a specific artist has paintings in
def list_cities list_galleries.map do |gallery| gallery.city end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cities\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery.city\n end\n end.compact.uniq\n end", "def cities()\n self.galleries().map { | gallery | gallery.city }.uniq\n end", "def galleries\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery\n end\n end.compact.uniq\n end", "def cities\n galleries.map {|gallery| gallery.city}\n end", "def cities\n galleries.map {|gallery| gallery.city}\n end", "def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |painting| painting.artist }\n end", "def cities\n galleries.map {|g| g.city}\n end", "def cities \n galleries.map{|g| g.city}.uniq\n end", "def cities\n galleries.map{|gallery| gallery.city}.uniq\n end", "def cities\n galleries.map do |gallery|\n gallery.city\n end\n end", "def cities\n galleries.map do |gallery|\n gallery.city\n end\n end", "def all_cities\n city_arr = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n city_arr.map do |painting_ob|\n painting_ob.gallery.city\n end\nend", "def cities\n galleries.map do |c|\n c.city\n end\n end", "def all_galleries\n gallery_arr = Painting.all.select do |painting_ob|\n painting_ob.artist == self\n end\n gallery_arr.map do |painting_ob|\n painting_ob.gallery.name\n end\nend", "def cities\n self.galleries.map do |gi|\n gi.city\n end\n end", "def all_cities\n self.all_galleries.map do |gallery|\n gallery.city\n end.uniq\n end", "def cities\n galleries.map do |gallery| \n gallery.city \n end\n end", "def all_artists\n match = Painting.all.select{|painting| painting.gallery == self}\n match.map{|painting| painting.artist}\nend", "def all_featured_cities\n cities_featured = self.all_galleries_featured_in.map{|gallery| gallery.city}\n end", "def galleries\n paintings.map{|painting| painting.gallery}.uniq\n end", "def cities\n self.galleries.map do |g|\n g.city\n end\nend", "def galleries()\n self.paintings().map { | painting | painting.gallery }.uniq\n end", "def galleries\n galleries_array = paintings.map {|painting| painting.gallery}\n galleries_array.uniq\n end", "def cities\n self.galleries.map{|painitng| painitng.city}\n end", "def all_galleries\n self.all_paintings.map do |painting|\n painting.gallery\n end.uniq\n end", "def galleries\n galleries = self.paintings.map do |pi|\n pi.gallery\n end\n galleries.uniq\n end", "def galleries\n paintings.map {|p| p.gallery}\n end", "def galleries\n paintings.map {|painting| painting.gallery}\n end", "def maps\n @cities = Art.joins(:galleries).where(\"galleries.show = true and arts.city <> '' \").pluck(\"city\").uniq!\n\n if params[:city].to_s != \"\"\n @city= params[:city].to_s== \"oa\" ? \"\" : params[:city].to_s\n search = \"galleries.show = true and arts.city = '\"+@city+\"'\"\n @galleries = Gallery.joins(:arts).where(search.to_s).distinct\n return\n end\n @galleries = Gallery.where(show: true).order('id DESC')\n end", "def all_galleries_featured_in\n my_galleries = self.all_my_paintings.map{|picture| picture.gallery}.uniq\n end", "def artists_with_multiple_photographs\n artists = []\n @artists.each do |artist|\n @photographs.each do |photo|\n if artist[:id] == photo[:artist_id]\n artists << artist\n end\n end\n end\n artists\n end", "def cities\n Gallery.all.map{|list| list.city}\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def all_cities\n self.all.map do |gallery|\n gallery.city.uniq\n end\n end", "def galleries\n paintings.map do |p|\n p.gallery\n end\n end", "def list_galleries\n list_paintings.map do |gallery_painting|\n gallery_painting.gallery\n end\n end", "def find_photographs_by_artist(artist)\n artist_photos = []\n @photographs.each do |photograph|\n if photograph[:artist_id] == artist[:id]\n artist_photos << photograph\n end\n end\n artist_photos\n end", "def cities\n galleries.map do |gallery|\n gallery.city\n end\n #undefined method `city' for \"New York\":String\n end", "def galleries\n galleries = self.paintings.map do |p|\n p.gallery\n end\n galleries.uniq\nend", "def paintings\n Painting.all.select do |painting|\n painting.gallery == self\n end\n end", "def photographs_taken_by_artist_from(country)\n artists_match_country = @artists.find_all do |artist|\n artist.country == country\n end\n photos = []\n @photographs.each do |photo|\n artists_match_country.each do |artist|\n if photo.artist_id == artist.id\n photos << photo\n end\n end\n end\n photos\n end", "def galleries\n self.paintings.map{|painitng| painitng.gallery}.uniq\n end", "def photographs_taken_by_artist_from(country)\n photos_by_country = []\n @photographs.each do |photo|\n @artists.each do |artist|\n if photo[:artist_id] == artist[:id] && artist[:country] == country\n photos_by_country << photo\n end\n end\n end\n photos_by_country\n end", "def artists\n paintings.collect do |p|\n p.artist \n end\n end", "def paintings\n Painting.all.select do |a|\n a.gallery == self\n end\n end", "def paintings\n Painting.all.select{|painting| painting.artist == self}\n end", "def paintings\n Painting.all.select{|painting| painting.artist == self}\n end", "def paintings\n Painting.all.select {|painting| painting.artist == self}\n end", "def paintings\n Painting.all.select {|painting| painting.artist == self}\n end", "def paintings\n Painting.all.select {|painting| painting.artist == self}\n end", "def paintings\n Painting.all.select{|painting_instance| painting_instance.artist == self}\n end", "def artists\n self.paintings.map do |painting|\n painting.artist\n end.uniq\n end", "def paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def paintings()\n Painting.all.select { | painting | painting.artist == self }\n end", "def photographs_taken_by_artists_from(country)\n country_by_artist = @artists.find_all do |artist|\n artists.first[:country] == country\n end\n @photographs.find_all do |photos|\n photos[:id] == country_by_artist[:id]\n end\n # require 'pry'; binding.pry\n end", "def paintings\n Painting.all.select do |painting_instance|\n painting_instance.artist == self\n end\n end", "def gallaries\n paintings.map{|paint| paint.gallery}\n\n end", "def paintings\n Painting.all.select {|p| p.artist == self}\n end", "def all_artist_names_by_gallery\n all_artists_by_gallery.map do |artist|\n # artist.name == Painting.artist.name\n artist.name\n end\n end", "def all_paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def all_my_paintings\n Painting.all.select{|picture| picture.artist == self}\n end", "def artists\n songs.collect do |song|\n song.artist\n end\n .uniq #does not return duplicate artists if the genre has more than one song by a particular artist (genre has many artists through songs)\n end", "def paintings\n Painting.all.select do |p|\n p.artist == self \n end\nend", "def all_species\n return species if species.present?\n Species.joins(:geo_entities).where(geo_entities: { id: countries.map(&:id) })\n end", "def list_paintings\n Painting.all.select do |painting|\n painting.artist == self\n end\n end", "def paintings\n Painting.all.find_all do |pi|\n pi.artist == self\n end\n end", "def find_artists\n album_ids = []\n album_results = CONNECTION.execute(\"SELECT * FROM albums_styles WHERE style_id = #{@id};\")\n album_results.each do |hash|\n album_ids << hash[\"album_id\"]\n end\n artist_ids = []\n artist_results = CONNECTION.execute(\"SELECT * FROM albums_artists WHERE album_id IN (#{album_ids.join(\",\")})\")\n artist_results.each do |hash|\n artist_ids << hash[\"artist_id\"]\n end\n \n Artist.find_many(artist_ids)\n end", "def artists\n paintings.map do |painting|\n painting.artist\n end\n end", "def artists\n genre_artists = []\n Song.all.each {|song|\n if song.genre == self &&\n !genre_artists.include?(song.artist)\n genre_artists << song.artist\n end\n }\n genre_artists\n end", "def artists\n paintings.map{|art| art.artist.name}\n\n end", "def compile_artists(location)\n Artist.where(\"state = ? and city = ?\", \"#{location.state}\", \"#{location.city}\" )\n end", "def all_organisations_in_city(city)\n sparql = \"\n SELECT DISTINCT ?uri ?label\n WHERE \n {\n VALUES ?city { \\\"#{city}\\\" }\n GRAPH <http://data.artsapi.com/graph/organisations> {\n ?uri <http://data.artsapi.com/def/arts/locationCity> ?city .\n ?uri <http://www.w3.org/2000/01/rdf-schema#label> ?label .\n }\n }\n \"\n\n results = User.current_user.within { Tripod::SparqlClient::Query.select(sparql) }\n\n results.map { |r| [r[\"uri\"][\"value\"], r[\"label\"][\"value\"]] }\n end", "def cities\n gallaries.map{|place| place.city}\n\n end", "def paintings # Get a list of all the paintings by a specific(keywrod for instance method) artists\n Painting.all.select{|list| list.gallery == self}\n # binding.pry\n end", "def favorite_place_coords\n res = []\n stories.includes(:places => [{:place_categories => :parent}, :location]).each do |s|\n s.places.each do |p|\n next unless p.name.present?\n base_cat = p.get_parent_categories.first ? p.get_parent_categories.first.name : 'other'\n res << {name: p.name, base_category: base_cat, place_url: '/places/' + p.id.to_s, lat: p.location.lat, lng: p.location.lng}\n # binding.pry\n end\n end\n res\n end", "def big_year_species\n @species_list = []\n Categories::Order.all.order(:position).each do |order|\n Categories::Family.where(parent_id: order.id).order(:position).each do |family|\n species = Species.joins(birds: :user)\n .where(\"(birds.published = 'true') AND (birds.species_id IS NOT NULL) AND (birds.expert_id IS NOT NULL)\")\n .where(users: { :big_year => 'true' })\n .where('EXTRACT(year FROM birds.timestamp) = ?', 2015)\n .where('EXTRACT(year FROM birds.created_at) = ?', 2015)\n .where(category_id: family.id)\n .distinct('species.id')\n .order(:position)\n @species_list = @species_list + species\n end\n end\n end", "def artist_names #return array of the names of all artists that have a painting in a gallery\n artists.name #pull array from artists method and call reader to get their name\n end", "def get_works_for(year)\n Alchemy::Page.published\n .joins(elements: :ingredients)\n .includes(elements: :ingredients)\n .reorder(:lft)\n .where(alchemy_ingredients: { type: \"Alchemy::Ingredients::Select\" })\n .where('alchemy_ingredients.value = ?', year)\n .distinct\n end", "def all_paintings\n artist_paintings = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n artist_paintings.map do |painting_ob|\n painting_ob.title\n end\nend", "def artists\n @songs.collect{|song| song.artist}.uniq\n end", "def artists\n @songs.map { |m| m.artist }.uniq\n end", "def genres\n @new_array_of_genres = []\n @songs.each do |song| #iterate through each song to find the genre\n if @new_array_of_genres.include?(song.genre) #does not return duplicate genres\n nil\n else\n @new_array_of_genres << song.genre #collects genres through its songs\n end\n end\n @new_array_of_genres #returns a collection of genres for all of the artists songs\n end", "def find_all_visited_cities()\n all_cities = cities()\n visited_cities = []\n for city in all_cities\n if city.visited == 1\n visited_cities.push(city)\n end\n end\n return visited_cities\nend", "def artist_images\n ArtistImage.find_by_artist_id(self.id)\n end", "def artists\n songs.collect do |song|\n song.artist\n\n end\nend", "def index\n @city=\"\"\n @tag=\"\"\n @cssclass=\"\"\n @cities = Art.joins(:galleries).where(\"galleries.show = true and arts.city <> '' \").pluck(\"city\").uniq!\n\n if params[:tag].to_s != \"\"\n @galleries = Gallery.tagged_with(params[:tag].to_s).where(show: true).page(params[:page]).per_page(16).order('id DESC')\n @tag = params[:tag].to_s\n return\n end\n\n if params[:city].to_s != \"\"\n search = \"galleries.show = true and arts.city = '\"+params[:city].to_s+\"'\"\n @galleries = Gallery.joins(:arts).where(search.to_s).distinct.page(params[:page]).per_page(16)\n @city=params[:city].to_s\n return\n end\n\n @galleries = Gallery.where(show: true).page(params[:page]).per_page(16).order('id DESC')\n end", "def artists\n songs.map {|song| song.artist}\n end", "def artists\n @songs.collect do |song|\n song.artist\n end\n end", "def artists\n @songs.collect do |song|\n song.artist\n end\n end", "def songs\n Song.all.select {|songs| songs.artist == self}\n end", "def artists\n artists = []\n self.songs.each do |song|\n artists << song.artist\n end\n artists.uniq\n end", "def artists\nSong.all.collect{|x| x.artist}\nend", "def songs\n #use select to iterate thru songs\n Song.all.select{|song| song.artist == self}\n end", "def songs\n Song.all.select {|s| s.artist == self}\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def songs\n Song.all.select do |song_instance|\n song_instance.artist == self \n end\n end", "def genres\n all_genres = []\n Song.all.each do |x|\n if x.artist == self\n all_genres << x.genre\n end\n end\nall_genres\nend" ]
[ "0.7548772", "0.7131511", "0.71006894", "0.70397425", "0.70397425", "0.7035672", "0.70278883", "0.7004595", "0.6989426", "0.68765855", "0.68765855", "0.6871487", "0.6863928", "0.6824331", "0.6794716", "0.67617637", "0.6715184", "0.6708487", "0.669699", "0.6591813", "0.65679216", "0.6548944", "0.6497605", "0.6477596", "0.6459128", "0.6450299", "0.6437736", "0.6414356", "0.6413781", "0.6344586", "0.6335778", "0.6316513", "0.62826073", "0.62826073", "0.62826073", "0.6259577", "0.6249085", "0.6222477", "0.61993456", "0.6191716", "0.61362463", "0.6130024", "0.611965", "0.6110483", "0.60891724", "0.6029724", "0.6023275", "0.6011524", "0.59628344", "0.59580255", "0.59580255", "0.59580255", "0.5944517", "0.59157175", "0.59081066", "0.59081066", "0.5878261", "0.5866586", "0.58573735", "0.58460325", "0.5814103", "0.58085674", "0.5801842", "0.5793976", "0.57715863", "0.57446045", "0.5740157", "0.5735432", "0.57340527", "0.5723842", "0.57146156", "0.5713412", "0.5710432", "0.5679944", "0.5667482", "0.55438894", "0.5492154", "0.54616886", "0.54382", "0.5422722", "0.5406058", "0.5381562", "0.53168577", "0.53056836", "0.52528155", "0.52403224", "0.52299476", "0.52127683", "0.5212288", "0.5168034", "0.5167707", "0.5167707", "0.5139362", "0.5135462", "0.5134091", "0.51330996", "0.5131622", "0.5127436", "0.51249963", "0.5117342" ]
0.66972464
18
To display output immediately on windows using git bash
def find_fibonacci_index_by_length(digits) fibonacci_series = [1, 1] while fibonacci_series.last < 10 ** (digits - 1) fibonacci_series << fibonacci_series[-1] + fibonacci_series[-2] end fibonacci_series.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def prep_screen\n system(\"clear\")\n print \"Current project is \".blue\n print \"#{File.basename(File.expand_path(\".\"))}\".blue.on_light_white\n \n if File.exist?(\".git\")\n branch = `git rev-parse --abbrev-ref HEAD`\n print \" (current branch: \".blue\n print branch.strip.blue.on_light_white\n print \")\".blue\n end\n puts \"\"\n end", "def prompt_git_status\n if !is_git?\n return \"\"\n end\n stat = `git status`\n res = \"\"\n res += ( stat.include?(\"ahead\") ? \"^\" : \"\" )\n res += ( stat.include?(\"modified\") ? \"*\" : \"\" )\n res += ( stat.include?(\"untracked\") ? \"+\" : \"\" )\n res += ( stat.include?(\"deleted\") ? \"-\" : \"\" )\n res!=\"\" ? \"[#{res}]\".magenta : \"\"\nend", "def gitworld(command)\n home = ENV[\"PWD\"]\n paths = [ \\\n\t\"vendor/bundles/Cordova/Bundle/FormModelBundle\",\t\\\n\t\"vendor/phpspec\",\t\\\n\t\"vendor/phpspec-symfony2\",\t\\\n\t\"vendor/PHPAutotest\",\t\\\n ]\n paths.each do |path|\n fullpath = \"#{home}/#{path}\"\n if File.directory? fullpath\n Dir.chdir(\"#{fullpath}\")\n popen3(\"git #{command}\") do |stdin, stdout, stderr, wait_thr|\n output = stdout.read\n error = stderr.read\n printf \"============================[ %30s ]=======\\n%s\", path, output\n puts \"\" if output.length > 0\n print stderr.read\n puts \"\" if error.length > 0\n end\n end\n end\nend", "def capture_stdout(*command, dir: repo_cache_dir)\n success, output = Samson::CommandExecutor.execute(\n *command,\n whitelist_env: ['HOME', 'PATH'],\n timeout: 30.minutes,\n err: '/dev/null',\n dir: dir\n )\n output.strip if success\n end", "def stdouts; end", "def git_status(path_r)\n Dir.chdir(path_r) do\n fill = 80 - path_r.size()\n fill = 0 if fill < 0\n puts path_r + '-'*fill\n puts `git status`\n end\nend", "def bash_on_windows?; end", "def my_backticks(cmd)\n rd, wr = IO.pipe\n\n pid = fork {\n rd.close\n\n $stdout.reopen(wr)\n exec(cmd)\n }\n\n wr.close\n Process.wait(pid)\n rd.read\nend", "def shell_output\n $shell_history ||= []\n cmd = get_string(\"Enter shell command:\", :maxlen => 50) do |f|\n require 'canis/core/include/rhistory'\n f.extend(FieldHistory)\n f.history($shell_history)\n end\n if cmd && !cmd.empty?\n run_command cmd\n $shell_history.push(cmd) unless $shell_history.include? cmd\n end\n end", "def run\n logger.info(\"Running command : git-shell -c #{@cmd_cmd} '#{@real_path}'\")\n if system(Settings.git.shell, \"-c\", \"#{@cmd_cmd} '#{@real_path}'\")\n logger.info(\"\\t\\tOK\")\n else\n logger.info(\"\\t\\tKO\")\n end\n end", "def echo_on\n system \"stty echo\"\n end", "def setup()\n $stdout.sync\n end", "def run(cmd)\n puts \"\\033[1;37m#{cmd}\\033[0m\"\n result = `#{cmd}`\n abort unless $?.success?\n puts result unless result.empty?\n result\nend", "def local_os_shell\n cls\n banner\n prompt = \"(Local)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit$|^quit$|^back$/i\n puts \"OK, Returning to Main Menu\".light_red + \"....\".white\n break\n else\n begin\n rez = commandz(cmd) #Run command passed\n puts \"#{rez.join}\".cyan #print results nicely for user....\n rescue Errno::ENOENT => e\n puts \"#{e}\".light_red\n rescue => e\n puts \"#{e}\".light_red\n end\n end\n end\nend", "def execute(input: $stdin, output: $stdout)\n message = 'Standard'\n puts message\n puts Pastel.new.green(TTY::Font.new(:standard).write(message))\n\n :gui\n end", "def git(command)\n there { `git #{command} 2>&1`.strip }\n end", "def echo msg\n $stdout.puts msg\nend", "def stdout(event) ; $stdout.puts event ; $stdout.flush ; end", "def help\n puts \"Usage: git file-history filename\"\n puts \" Show blame history for a file\"\n exit 1\nend", "def status_line(switch_on = true)\n if switch_on\n set_vars :_display_busy => 1, :_display_status => 1\n else # switch off\n set_vars :_display_busy => 0, :_display_status => 0\n end\n sleep 1\n exec 'redisplay;'\n end", "def remote_shell args\n remote(args) do |ssh|\n command = true\n while command\n print \"> \"\n command = gets\n if command\n result = ssh.exec! command\n puts result.split(\"\\n\").awesome_inspect if not result.nil?\n end\n end\n ssh.exec! \"exit\"\n end\n end", "def run_command\n # this should probably be run without bundle exec, I guess\n 'git status --porcelain'\n end", "def test_scm_st_036\n printf \"\\n Test 036\"\n end", "def git_call(command, verbose = debug_mode, enforce_success = false)\n if verbose\n puts\n puts \" git #{command}\"\n puts\n end\n output = `git #{command}`\n puts output if verbose and not output.empty?\n # If we need sth. to succeed, but it doesn't, then stop right there.\n if enforce_success and not last_command_successful?\n puts output unless output.empty?\n raise UnprocessableState\n end\n output\n end", "def backtick_output(command)\n success, output = run_external(command, {}, SETTINGS[:project])\n return output, success\n end", "def git_describe\n @git_describe ||= begin\n git_cmd = \"git describe\"\n shell = Mixlib::ShellOut.new(git_cmd,\n :cwd => Omnibus.root)\n shell.run_command\n shell.error!\n shell.stdout.chomp\n end\n end", "def log(bit)\n puts \"\\033[35m#{bit} \\033[0m\"\nend", "def list( by_line=false )\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n line_by_line = by_line ? \"-v\" : \"\"\n\n git_log_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} status #{line_by_line}\"\n log.info(x) { \"[git] status command => #{git_log_cmd}\" }\n git_log_output = %x[#{git_log_cmd}]\n\n git_log_output.log_debug if by_line\n git_log_output.log_info unless by_line\n\n end", "def pretty_run(title, cmd)\n puts\n print_bar(100, title)\n puts \"> #{cmd}\"\n puts\n Kernel.system(cmd) unless pretend?\n print_bar(100)\n end", "def stdout_of command\n win_os? && command.gsub!(/'/, '\"')\n stdout = `#{command}`\n $?.success? || fail(\"`#{command}` failed\")\n stdout\nend", "def stdout\n @cmd_result.stdout\n end", "def run(cmd, cwd)\n begin\n Bundler.with_clean_env do\n PTY.spawn( \"cd #{cwd} && #{cmd}\" ) do |stdout, stdin, pid|\n begin\n stdout.each do |line|\n puts line\n end\n rescue Errno::EIO\n end\n Process.wait(pid)\n end\n end\n rescue PTY::ChildExited => e\n end\n end", "def log_command(command)\n require 'time'\n filename = File.join(Git.git_dir, \"git-scripts.log\")\n log = File.open(filename, \"a\")\n log.puts \"#{Time.now.iso8601}: #{command}\"\n log.close\nend", "def stdout(command, data)\n # called when the process writes to STDOUT\n end", "def git(*args)\n system \"git \" + args.join(\" \")\nend", "def commit_status()\n if @status_line\n if @ping_from\n # Debug mode show final line value as history.\n puts @status_line\n else\n # Normal mode advance to the next line leaving this line as history.\n puts\n end\n STDOUT.flush\n @status_line = nil\n end\n end", "def debug_shell\n puts '------ Opening debug shell -----'\n @orig_dir = Dir.pwd\n begin\n if respond_to?(:prepare_debug_shell)\n prepare_debug_shell\n end\n system('bash')\n ensure\n Dir.chdir(@orig_dir)\n end\n puts '------ Exiting debug shell -----'\n end", "def puts something\n command = 'pbcopy'\n command << \" -pboard #{@board}\" if @board\n command << \" -Prefer #{@format}\" if @format\n out = IO::popen command, 'w+'\n out.print something\n out.close\n @current = something\n end", "def catch_text\n # get the actual offset\n start = @buffer.get_iter_at_offset(@@offset)\n\n # get the command\n cmd = @buffer.get_text(start, @buffer.end_iter)\n\n # Save the command to the history object\n @historic.append(cmd)\n\n # Write the command to our pipe\n send_cmd(cmd)\n\n # Add a return line to our buffer\n insert_text(\"\\n\")\n\n # Call the prompt\n prompt()\n\n # Create the mark tag if not exist\n if (not @buffer.get_mark('end_mark'))\n @buffer.create_mark('end_mark', @buffer.end_iter, false)\n end\n\n # Save our offset\n @@offset = @buffer.end_iter.offset\n end", "def output_stdout!\n\t\tmsg = @connection.gets\n\t\tbasic_parse(msg)\n\tend", "def git_cmd(*args, &block)\n system_args = ['--git-dir', root_url, '-c', 'core.quotepath=false']\n args = (system_args + Array(args)).flatten\n args = args.map { |arg| self.class.shell_quote(arg.to_s) }.join(' ')\n cmd = [self.class.quoted_git_command, args].join(' ')\n\n exit_status, errors = self.class.shell_out(cmd, &block)\n\n raise Redmine::Scm::Adapters::CommandFailed, errors unless exit_status == 0\n end", "def introduction\n puts 'hello welcome to the github scrapper'.light_blue\n puts 'this tool is desgined for fetching data from github quickly and saving it to a csv file'.light_blue\nend", "def stamp\n @output.write(\"#{ESC}o\")\n end", "def desc\n \"Interactive TTY\"\n end", "def run_for_output(cmd)\n LOG.debug \"RUNNING (for output): #{cmd}\"\n out, _status = Open3.capture2e(cmd)\n out.strip\n end", "def ruby_app_shell(cmd, options={})\n ignore_errors = options[:ignore_errors] || false\n log = !!(Cucumber.logger)\n\n all_output = ''\n Dir.chdir(ruby_app_root) do\n Cucumber.logger.debug(\"bash> #{cmd}\\n\") if log\n Bundler.with_clean_env do\n IO.popen(\"#{cmd} 2>&1\", 'r') do |output|\n output.sync = true\n done = false\n until done\n begin\n line = output.readline + \"\\n\"\n all_output << line\n Cucumber.logger.debug(line) if log\n rescue EOFError\n done = true\n end\n end\n end\n end\n end\n\n $?.success?.should(be_true) unless ignore_errors\n all_output\n end", "def ruby_app_shell(cmd, options={})\n ignore_errors = options[:ignore_errors] || false\n log = !!(Cucumber.logger)\n\n all_output = ''\n Dir.chdir(ruby_app_root) do\n Cucumber.logger.debug(\"bash> #{cmd}\\n\") if log\n Bundler.with_clean_env do\n IO.popen(\"#{cmd} 2>&1\", 'r') do |output|\n output.sync = true\n done = false\n until done\n begin\n line = output.readline + \"\\n\"\n all_output << line\n Cucumber.logger.debug(line) if log\n rescue EOFError\n done = true\n end\n end\n end\n end\n end\n\n $?.success?.should(be_true) unless ignore_errors\n all_output\n end", "def shell(*) end", "def git command\n output = `git #{command} 2>&1`.chomp\n unless $?.success?\n raise RuntimeError, output\n end\n output\n end", "def test_stdout_redir\n with_fixture 'stdoutredir' do\n assert system(\"ruby\", ocra, \"stdoutredir.rb\", *DefaultArgs)\n assert File.exist?(\"stdoutredir.exe\")\n system(\"stdoutredir.exe > output.txt\")\n assert File.exist?(\"output.txt\")\n assert_equal \"Hello, World!\\n\", File.read(\"output.txt\")\n end\n end", "def display(msg)\n stdout.puts msg\n return \"#{msg}\\n\"\n end", "def stdout\n run unless ran?\n\n @stdout\n end", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Github pages..'\n puts %x[git push origin HEAD:gh-pages --force]\nend", "def output_history commits\n # output each commit\n commits.each_with_index do |commit, i|\n puts \"\\033[031m#%03d \\033[0m#{commit[:message]} \\033[34m(#{commit[:timestamp]} by #{commit[:author]})\" % (commits.length - i)\n end\n\n # ansi reset\n print \"\\033[0m\"\n end", "def cmd(str)\n\t\[email protected] str\n\tend", "def capture_with_status(*args)\n _print_command(*args)\n args.last.delete :errexit if args.last.is_a? Hash\n args.last.delete :xtrace if args.last.is_a? Hash\n stdout, status = Open3.capture2(*args)\n return stdout.chomp, status\nend", "def run_cmd(cmd)\n Dir.chdir(Rails.root) {\n #@output = `cd #{CTMWEB_PATH} && #{cmd} 2>&1`\n cmd = \"#{cmd}\"\n @output = `#{cmd}`\n }\n result = $?.success?\n if result\n print \"OK\\n\".green\n else\n print \"ERROR\\n\".red\n puts \"#{@output.to_s.red}\"\n send_to_flowdock(\"CTMWEB\", \"Deployment for #{Rails.env.upcase} failed. (CMD: #{cmd})\", @tags)\n abort \"Deployment Halted.\".red\n end\nend", "def console(&blk); end", "def console(&blk); end", "def git\n require 'parsedate'\n puts 'Doing local Git commit...'\n d = Time.new()\n git_comment = \"#{d}\"\n `git add ../.`\n `git commit ../. -m \"#{git_comment}\"`\nend", "def shell_out command=nil\n $shell_history ||= []\n command ||= get_string(\"Enter system command:\", :maxlen => 50) do |f|\n require 'canis/core/include/rhistory'\n f.extend(FieldHistory)\n f.history($shell_history)\n end\n ##w = @window || @form.window\n #w.hide\n Ncurses.endwin\n ret = system command\n Ncurses.refresh\n #Ncurses.curs_set 0 # why ?\n #w.show\n return ret\n end", "def system_cmd(cmd)\n exit_val = nil\n cmd_to_run = cmd\n cmd_to_run = \"#{@git_ssh_cmd} #{cmd}\" if cmd.start_with? 'git'\n Open3.popen3(cmd_to_run) do |stdin, stdout, stderr, wait_thr|\n stdin.close\n\n block_size = 1\n io_buffers = {stdout: '', stderr: ''}\n output_buffer = []\n outputs = {stdout => :stdout, stderr => :stderr}\n\n begin\n until outputs.keys.all?(&:eof) do\n ready = IO.select(outputs.keys)\n if ready\n readable = ready[0]\n readable.each do |f|\n file_type = outputs[f]\n begin\n data = f.read_nonblock(block_size)\n\n io_buffers[file_type] << data\n if data == \"\\n\"\n payload = {file_type => io_buffers[file_type]}\n puts payload.inspect\n output_buffer << payload\n\n io_buffers[file_type] = \"\"\n end\n rescue EOFError\n end\n end\n end\n end\n rescue IOError\n end\n\n exit_val = wait_thr.value\n @build.build_logs.create(\n text: output_buffer.to_json,\n cmd: cmd_to_run,\n exit_code: exit_val,\n )\n end\n\n exit_val\n end", "def record_shell_interaction(commands)\n ShellSimulator.new(commands).capture_output do\n load VIRTUAL_SHELL_PROGRAM\n end\nend", "def run_and_watch_prompt(cmd, regex_to_watch)\n run cmd, :pty => true do |ch, stream, data|\n watch_prompt(ch, stream, data, regex_to_watch)\n end\nend", "def git_command(cmd, opt_str, dir)\n run_in_shell(\"git #{cmd} #{opt_str}\", dir)\n end", "def after_resolution\n output.puts\n end", "def prompt\r\n vm = Thread.current[:vm]\r\n puts\r\n\r\n if vm.show_stack\r\n vm.data_stack.to_foorth_s(vm)\r\n puts vm.pop\r\n end\r\n\r\n '>' * vm.context.depth + '\"' * vm.quotes + '(' * vm.parens\r\n end", "def prompt\n print '> '\n $stdout.flush\nend", "def shell_out_command(cmd, msg)\n cmd_local = \"#{cmd}\" + \" -c #{knife_config}\" + \"#{grep_cmd}\"\n shell_out = Mixlib::ShellOut.new(\"#{cmd_local}\", :timeout => timeout)\n puts \"#{msg}\"\n puts \"#{cmd_local}\"\n @op = shell_out.tap(&:run_command).stdout\n puts \"#{cmd_stdout}\"\n return shell_out\n end", "def helloWindows\n puts \"Hello\"\n sleep(0.5)\n puts \"Axel is gone\"\n sleep(1)\n puts \"It's just you and me\"\n sleep(1)\n puts \"Shall we start the real tutorial now?\"\n sleep(1)\n end", "def smb_pipe_audit\n\t\tprint_status(\"SMB Session Pipe Auditor\")\n\t\tprint_caution(\"Target IP: \")\n\t\tzIP=gets.chomp\n\n\t\tprint_status(\"Launching MSF SMB Session Pipe Auditor against #{zIP} in a new x-window.....\")\n\t\trcfile=\"#{$temp}msfassist.rc\"\n\t\tf=File.open(rcfile, 'w')\n\t\tf.puts \"db_connect #{MSFDBCREDS}\"\n\t\tf.puts 'use auxiliary/scanner/smb/pipe_auditor'\n\t\tf.puts \"set RHOSTS #{zIP}\"\n\t\tf.puts 'run'\n\t\tf.close\n\t\tpipe_audit=\"xterm -title 'MSF SMB Pipe Auditor' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{MSFPATH}/msfconsole -r #{rcfile}'\\\"\"\n\t\tfireNforget(pipe_audit)\n\t\tprint_line(\"\")\n\tend", "def prompt\n puts \"TRAC Emulator #{VERSION}\"\n puts\n catch :done do\n loop do\n idle = \"#(PS,#(RS)(\\n))\"\n catch :reset do\n execute(idle)\n end\n if @dispatch.trace\n @dispatch.trace = false\n puts 'Exiting trace...'\n end\n end\n end\n puts 'Exiting...'\n puts\n end", "def main\n loop do\n # current path used for readline\n cmdline = Readline.readline(\"#{shell_format} \", true)\n break if %w[exit quit q].include?(cmdline)\n\n Readline::HISTORY.pop if %W[hist #{''}].include?(cmdline)\n check_type_of_command(cmdline)\n end\nend", "def shownext\n if @session.current_screen and @session.current_screen.stdin\n display @session.current_screen\n @session.next\n else\n print Paint[\"... \", :cyan]\n @playprompt = false\n @lastelapsed = 0\n end\nend", "def execute(input: $stdin, output: $stdout)\n prompt = TTY::Prompt.new\n\n prompt.suggest('sta', ['stage', 'stash', 'commit', 'branch'])\n\n possible = %w(status stage stash commit branch blame)\n prompt.suggest('b', possible, indent: 4, single_text: 'Perhaps you meant?')\n\n return :gui\n end", "def run_and_output(cmd)\n run(cmd).output\n end", "def git(*args)\n Dir.chdir(@dir) do\n git = Process.spawn('git', *args)\n Process.wait(git)\n raise \"git #{args.join(' ')} (in #{@dir}) failed: #{$?.exitstatus}\" if $?.exitstatus != 0\n end\n end", "def run_cmd(cmd)\n Chef::Log.info \"executing: #{cmd}\"\n result = Mixlib::ShellOut.new(cmd).run_command.stdout.strip\n return result\nend", "def prompt()\n\tprint \"Geef commando > \"\nend", "def send_output(output)\n output += \"\\n\" unless output.end_with? \"\\n\" or output.empty?\n send_data output\n send_command_prompt\n end", "def shell(cmd)\n `#{cmd}`\n end", "def shell(cmd)\n `#{cmd}`\n end", "def stdout\n STDOUT\n end", "def shell\n platform_service(:shell)\n end", "def install_git\n\tKitchenplan::Log.debug \"Git is installed by the go.bat bootstrap on Windows, skipping install_git()\"\n end", "def print_line(msg = '')\n # TODO: there are unhandled quirks in async output buffering that\n # we have not solved yet, for instance when loading meterpreter\n # extensions, supporting Windows, printing output from commands, etc.\n # Remove this guard when issues are resolved.\n=begin\n if (/mingw/ =~ RUBY_PLATFORM)\n print(msg + \"\\n\")\n return\n end\n print(\"\\033[s\") # Save cursor position\n print(\"\\r\\033[K\" + msg + \"\\n\")\n if input and input.prompt\n print(\"\\r\\033[K\")\n print(input.prompt.tr(\"\\001\\002\", ''))\n print(input.line_buffer.tr(\"\\001\\002\", ''))\n print(\"\\033[u\\033[B\") # Restore cursor, move down one line\n end\n=end\n\n print(msg + \"\\n\")\n end", "def update_screen(output)\n if output != $last_update\n clear_screen\n puts(output)\n end\nend", "def git_exec(command, *args)\n Dir.chdir(@grit_repo.working_dir) do\n %x{git #{command} #{args.join(' ')}}\n end\n end", "def issue_command(str)\n puts str\nend", "def stdout\n @vm.stdout\n end", "def desc\n \"Command shell\"\n end", "def run\n Signal.trap('EXIT') do\n reset_terminal\n exit\n end\n Signal.trap('WINCH') do\n screen_settings\n redraw\n place_cursor\n end\n\n setup_terminal\n config_read\n parse_ls_colors\n set_bookmark '0'\n\n redraw true\n place_cursor\n\n # do we need this, have they changed after redraw XXX\n @patt = nil\n @sta = 0\n\n # forever loop that prints dir and takes a key\n loop do\n key = get_char\n\n unless resolve_key key # key did not map to file name, so don't redraw\n place_cursor\n next\n end\n\n break if @quitting\n\n next if only_cursor_moved?\n\n next unless @redraw_required # no change, or ignored key\n\n redraw rescan?\n place_cursor\n\n end\n write_curdir\n puts 'bye'\n config_write if @writing\n @log&.close\nend", "def git(command, options = {})\n error = options[:error] || true\n unless which(\"git\") || which(\"git.exe\") || which(\"git.bat\")\n raise GitNotInstalled\n end\n\n response = Mixlib::ShellOut.new(%{git #{command}}, options)\n response.run_command\n\n if error && response.error?\n raise GitError.new \"#{command} #{cache_path}: #{response.stderr}\"\n end\n\n response.stdout.strip\n end", "def diff_output\n `\n git diff \\\n --diff-filter=AM \\\n --ignore-space-at-eol \\\n --no-color \\\n --cached \\\n -p \\\n -- '*.rb' '*.rake'\n `\n end" ]
[ "0.6219506", "0.61200327", "0.61200327", "0.61200327", "0.61200327", "0.61200327", "0.61200327", "0.6103044", "0.60350794", "0.59949106", "0.5973232", "0.59097284", "0.58951396", "0.5886012", "0.586864", "0.58550465", "0.582788", "0.5807792", "0.5802978", "0.5773198", "0.5745784", "0.5721667", "0.57142776", "0.5706426", "0.5704753", "0.56900024", "0.56893885", "0.56506765", "0.56479645", "0.5633985", "0.5629367", "0.55938286", "0.5577253", "0.5572841", "0.5564923", "0.5556476", "0.55412453", "0.55262804", "0.55173624", "0.5514453", "0.54903823", "0.5472194", "0.54596406", "0.545397", "0.54501426", "0.5440263", "0.54197335", "0.54188055", "0.54104805", "0.54050726", "0.540174", "0.54011774", "0.53869814", "0.53854454", "0.5378956", "0.53670365", "0.5366946", "0.53661567", "0.5361823", "0.5347089", "0.53445196", "0.534284", "0.5336437", "0.5321813", "0.53215665", "0.53215665", "0.5312186", "0.53097004", "0.52962404", "0.529344", "0.52908546", "0.52884704", "0.5283642", "0.5283355", "0.52827686", "0.52824277", "0.52737933", "0.5267495", "0.5261491", "0.5260866", "0.52565324", "0.52474326", "0.5247112", "0.52459735", "0.5245493", "0.5243804", "0.52363133", "0.5235425", "0.5235425", "0.5234664", "0.5232037", "0.523197", "0.5228612", "0.5227766", "0.5222267", "0.5219499", "0.5217791", "0.5216754", "0.5215654", "0.52065563", "0.52042735" ]
0.0
-1
A random animal has escaped!
def escape choices = @animals.keys @animals[choices[rand(choices.length)]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_animal\n\t animals.sample\n end", "def make_noise\n puts \"Making a generic animal noise... Meep.\"\n end", "def hit( damage )\n p_up = rand( charisma )\n if p_up % 9 == 7\n @life += p_up / 4\n puts \"[#{ self.class } magick powers up #{ p_up }!]\"\n end\n @life -= damage\n puts \"[#{ self.class } has died.]\" if @life <= 0\n end", "def meow()\n punctuations = '.!?'\n \"#{CAT_FACES[rand(CAT_FACES.length)]} Meow#{punctuations[rand(punctuations.length)]}\"\n end", "def hatch\n @status = Idle\n @target = nil\n @virility = 0\n babies = []\n rand(MaxBabiesFromEgg).to_i.times {babies << baby_salmon}\n babies\n end", "def hit damage\n out = ''\n p_up = rand charisma\n if p_up % 9 == 7\n @life += p_up / 4\n out << \"[#{self.name} magick powers up #{p_up}!]\\n\"\n end\n @life -= damage\n out << \"[#{self.name} has died.]\\n\" if @life <= 0\n out\n end", "def sword_damage(str, dex, luck)\n damage = (str + dex)/2 * rand(luck)\n if damage == 0\n puts \"You missed!\"\n else\n puts \"Your sword strikes for #{damage} damage!\"\n end\nend", "def makePetMakeNoise\n @pet.makeNoise(rand(10))\n end", "def random_encounter\n narrate(\"an enemy appears!\")\n a = Fight.new(@player, @enemy_list.sample)\n if a.now\n here\n else\n\n #here is where u die\n STDIN.getch\n puts\n puts \"There is only one god and his name is Death. And there is only one thing we say to Death: Not today.\"\n \n STDIN.getch\n puts\n\n\n start = Startup.new()\n start.start\n end\n end", "def randomize\n @dog_count = rand(6) + 1;\n @cat_count = rand(85) + 1;\n @mouse_count = rand(336) + 1;\n return self\n end", "def die\n # set the animal's alive property to false,\n # and decrease the Animal class' count by 1 :(\n @alive = false\n @@animal_count -= 1\n end", "def attack\r\n\t\tputs \"#@name the #@type attacks!\"\r\n\t\tputs \" \"\r\n\t\t$attack = rand(20..60)\r\n\tend", "def die\n puts 1 + rand(6)\nend", "def random_joke\n joke nil\n end", "def roll_die\n Random.new.rand(1..6)\nend", "def attack\r\n\t\tputs \"#@name the #@type attacks!\"\r\n\t\tputs \" \"\r\n\t\tsleep 1\r\n\t\t$attack = rand(1..100)\r\n\tend", "def encounter\n if self.outrun_zombie?\n return \"You escape!\"\n elsif self.survive_attack?\n return \"You kill the zombie!\"\n else\n return \"You are one of the shuffling horde now.\"\n end\n end", "def treasure\n [\"ring\", \"necklace\", \"dagger\", \"amulet\", \"ruby\", \"sapphire\", \"piece of jade\", \"human skull\", \"tarask skull\"].sample\nend", "def cut_off_random\n\t\n\trand_id = rand(0...@heads)\n\t\t\n\t@heads += 1\n\t\n\[email protected](rand_id, @@personality_array.sample, @@personality_array.sample)\n\t\n\t\tputs \"Despite slicing off head # #{rand_id}, the vicious #{@name} grows two more! They seem #{@personalities[rand_id]} and #{@personalities[rand_id + 1]}.\"\n\tend", "def eat\n @hungry = false\n end", "def eat\n @hungry = false\n end", "def eat\n @hungry = false\n end", "def complain\n # random number from 1 to 4\n (rand(4) + 1).times do\n excl = rand(3)\n rnd = [rand(5) - 1, 0].max\n if rnd == 0\n print \"GET ME OFF\"\n elsif rnd < 3\n print \"HOT\"\n else\n print \"OW\"\n end\n excl.times { print \"!\" }\n print \" \"\n end\n puts\n end", "def mutate\n @dog_count = rand(2) == 0 ? 1 + rand(6) : dog_count\n @cat_count = rand(2) == 0 ? 1 + rand(85) : cat_count\n @mouse_count = rand(2) == 0 ? 1 + rand(336) : mouse_count\n end", "def work_out\n self.happiness += 2\n self.hygiene -= 3\n return \"♪ another one bites the dust ♫\" \n end", "def random_statement(r)\n\tcase r.rand(6).to_i\n\twhen 0\n\t\treturn \" :D\"\n\twhen 1\n\t\treturn \" Yawn. I'm tired...\"\n\twhen 2\n\t\t#Dice because it was randomly generated\n\t\treturn \" 🎲🎲🎲\"\n\twhen 3\n\t\treturn \" D:\"\n\twhen 4\n\t\treturn \" Hm.\"\n\telse\n\t\treturn \" ~_~\"\n\tend\nend", "def process_escape\n $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))\n success = @preemptive ? true : (rand < @escape_ratio)\n Sound.play_escape\n if success\n process_abort\n $game_party.alive_members.each do |member|\n member.battle_phase = :escape\n end\n else\n @escape_ratio += 0.1\n $game_message.add('\\.' + Vocab::EscapeFailure)\n $game_party.clear_actions\n end\n wait_for_message\n return success\n end", "def process_escape\n $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))\n success = @preemptive ? true : (rand < @escape_ratio)\n Sound.play_escape\n if success\n process_abort\n $game_party.alive_members.each do |member|\n member.battle_phase = :escape\n end\n else\n @escape_ratio += 0.1\n $game_message.add('\\.' + Vocab::EscapeFailure)\n $game_party.clear_actions\n end\n wait_for_message\n return success\n end", "def get_damage\n 1 + Random.rand(3)\n end", "def eat_milk_and_cookies\n if Random.rand(5) == 0\n p \"MMMMM #{@name} just ate an Chocolatechip Cookie\"\n elsif Random.rand(5)== 1\n p \"MMMMM #{@name} just ate an Snickerdoodle Cookie\"\n elsif Random.rand(5) == 2\n p \"MMMMM #{@name} just ate an Oreo Cookie\"\n elsif Random.rand(5) == 3\n p \"MMMMM #{@name} just ate an Sugar Cookie\"\n else\n p \"MMMMM #{@name} just ate an Almond Cookie\"\n end\n end", "def run(opponent)\n rand(EscapeRate) == 0\n end", "def attack #basic attack for now\r\n attack_value = strength + rand(25..50)\r\n puts \"#{@name} SWINGS his Weapon for #{attack_value} Points of Damage!\"\r\n end", "def guessable_letters(animal)\n alphabet = *('a'..'z')\n letter_array = animal.name.downcase.split('')\n\n while letter_array.length < 12\n letter_array.push(alphabet.sample)\n end\n return letter_array.shuffle\n end", "def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end", "def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end", "def attack\r\n\t\tputs \"#@name attacks the player!\"\r\n\t\tputs \" \"\r\n\t\t$attack = rand(1..40)\r\n\t\treturn\r\n\tend", "def gotAttack(damage)\r\n @@probsDeflects = Array['deflect', 'deflect', 'deflect', 'deflect', 'deflect',\r\n 'deflect', 'deflect', 'deflect', 'got hit', 'got hit' ]\r\n\r\n @@probs = @@probsDeflects[rand(0..9)]\r\n if @role.upcase == \"HERO\"\r\n if @@probs == 'deflect'\r\n puts \"#{@name} deflects the attack.\"\r\n @hitpoint += damage\r\n end\r\n end\r\n @hitpoint -= damage\r\n end", "def hit_it_back\n\t\thit_it = rand(4)\n\t\tif hit_it == 0\n\t\t\tputs \"out. bad luck kiddo\"\n\t\t\tincrement_opponent_game_score\n\t\telsif hit_it == 1\n\t\t\tputs \"ok, at least you got it in\"\n\t\t\topponent_now_has_upper_hand\n\t\telsif hit_it == 2\n\t\t\tputs \"that's good, work his backhand\"\n\t\t\topponent_returns_pretty_good_shot\n\t\telsif hit_it == 3\n\t\t\tputs \"nice shot what a ripper\"\n\t\t\topponent_attempts_to_return_awesome_shot\n\t\tend\n\tend", "def attack()\n return @level + rand(3) - rand(3)\n end", "def attack\r\n\t\tputs \"#@name attacks the player!\"\r\n\t\tputs \" \"\r\n\t\tsleep 1\r\n\t\t$attack = rand(1..100)\r\n\tend", "def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n @hygiene\n end", "def cheat\n\t\t@die = 1\n\t\t@die2 = 1 + rand(5)\n\t\tputs @die\n\t\tputs @die2\n\tend", "def random_typhoon_generator\n\n #Normal Typhoon\n r = rand(50) #Currently: 1/50 chance\n if (r%49 == 0)\n sz = rand(3)\n sX = rand(40-12) + 12\n sY = rand(12-1) + 1\n dX = rand(10-3) + 3\n dY = rand(2-1) + 1\n typhoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n addObject(typhoon1)\n end\n #Strong Typhoon\n r = rand(90) #Currently: 1/90 chance\n if (r%89 == 0)\n sz = 3\n sX = rand(46-12) + 12\n sY = rand(12-1) + 1\n dX = rand(11-3) + 3\n dY = rand(2-1) + 1\n typhoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n addObject(typhoon1)\n end\n end", "def reproduce (animal)\n e = animal.energy\n if (animal.energy >= REPRODUCTION_ENERGY)\n animal.energy = animal.energy << -1\n animalNu = animal.clone\n genesNu = animal.genes.clone\n mutation = rand(8)\n genesNu[mutation] = [1, (animalNu.genes[mutation] + rand(3) - 1)].max\n animalNu.genes = genesNu\n $animals.push(animalNu)\n end\nend", "def rand_brancket\n (rand(2) == 0) ? \"【#{FFaker::Food.meat}】\" : ''\nend", "def treasure_drop(enemy)\n if rand(100) < enemy.treasure_prob\n treasure = $data_items[enemy.item_id] if enemy.item_id > 0\n treasure = $data_weapons[enemy.weapon_id] if enemy.weapon_id > 0\n treasure = $data_armors[enemy.armor_id] if enemy.armor_id > 0\n end\n return treasure\n end", "def giveMeATreasure\n n=Random.rand(@hiddenTreasures.size)\n \n return @hiddenTreasures.delete_at(n)\n end", "def %(enemy)\n lettuce = rand(charisma)\n puts \"[healthy lettuce gives you #{lettuce} life points]\"\n @life +=lettuce\n fight(enemy, 0)\n end", "def pika_attack(enemy_hp)\n #randomization\n random = rand(10) + 1 #includes 10\n if random == 1 || random == 2\n puts \"Oh no, Pikachu missed!\".colorize(:yellow)\n elsif random == 3 || random == 4 || random == 5\n enemy_hp = enemy_hp - 2\n puts \"Pikachu used Tail Whip. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n elsif random == 6 || random || 7 || random == 8\n enemy_hp = enemy_hp - 3\n puts \"Pikachu used ThunderShock. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n else\n enemy_hp = enemy_hp - 4\n puts \"Pikachu used Slam. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n end\n return enemy_hp\nend", "def random_weapon\n weapons = [\"sword\",\"bow and arrow\",\"laser gun\",\"Jungle Sword\",\"Lunar Cue\",\"Crimson Blaster\",\"Quake Hammer\",\"Drive Vortex\",\"Drive Defender\",\" Road Blaster\",\"Turbo Axe\",\"Rocket Blaster \"]\n weapon = weapons[rand(weapons.length)]\nend", "def flee(monster)\n if dice_roll < @agility\n puts \"----- Nice! -----\".top_border\n puts \"You've made a deft escape.\".bottom_border\n return true \n else\n puts \"Oh no! Your escape was blocked.\"\n monster.attack(self)\n return false\n end \n end", "def random_face_emoji\n %w[cool goofy monocle sly smile think].sample\n end", "def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n fight( enemy, 0 )\n end", "def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n fight( enemy, 0 )\n end", "def /(enemy)\n fight(enemy, rand(4 + ((enemy.life % 10)**2)))\n end", "def /( enemy )\n fight( enemy, rand( 4 + ( ( enemy.life % 10 ) ** 2 ) ) )\n end", "def /( enemy )\n fight( enemy, rand( 4 + ( ( enemy.life % 10 ) ** 2 ) ) )\n end", "def treasure_chance\n chance = roll.d100(1)\n if chance <= 100\n @treasure = Treasure.new\n end\n end", "def treasure_chance\n chance = roll.d100(1)\n if chance <= 100\n @treasure = Treasure.new\n end\n end", "def treasure_chance\n chance = roll.d100(1)\n if chance <= 100\n @treasure = Treasure.new\n end\n end", "def destroy!\n (rand(3) + 5).times { Explosion.new(@x + rand(BoomOffset * 2) - BoomOffset, @y + rand(BoomOffset * 2) - BoomOffset) }\n kill!\n end", "def destroy!\n (rand(3) + 5).times { Explosion.new(@x + rand(BoomOffset * 2) - BoomOffset, @y + rand(BoomOffset * 2) - BoomOffset) }\n kill!\n end", "def /(enemy)\n fight(enemy, rand(4+((enemy.life%10) ** 2)))\n end", "def attack_effect_dispersion\r\n if self.damage.abs > 0\r\n amp = [self.damage.abs * 15 / 100, 1].max\r\n self.damage += rand(amp+1) + rand(amp+1) - amp\r\n end\r\n end", "def %(enemy)\n lettuce = rand(charisma)\n puts \"[Healthy lettuce gives you #{lettuce} life points!!]\"\n @life += lettuce\n fight(enemy, 0)\n end", "def destroyed!\n 30.times do\n explosion = generate SmallExplosion\n explosion.position += random_vector(rand(40))\n explosion.speed += random_vector(rand(20))\n end\n end", "def tenders_flip()\n\tif Random.rand(2) == 0 #achieves 50/50 probability\n\t\t\"It's Chicken Tenders Day!\" \n\telse \n\t\t\"Nope.\"\n\tend\nend", "def alien_fire_bullet()\r\n # The aliens will fire bullets at random, \r\n # The randomness is controlled by @alien_fire_rand\r\n @aliens.each { |alien|\r\n if rand(@alien_fire_rand) == 0\r\n @bullets.push Bullet.new(alien.x, alien.y+ 40, 'evil')\r\n end\r\n }\r\n end", "def roll_die\n die_roll = rand(1..6)\n #\nend", "def run(user, enemy)\n \n # Higher probability of escape when the enemy has low agility.\n if (user.sample_agilities(enemy))\n user.escaped = true\n type(\"#{user.name} successfully escapes the clutches of the #{enemy.name}!\\n\\n\")\n return\n end\n\n # Should already be false.\n user.escaped = false\n type(\"#{user.name} is cornered!\\n\\n\")\n end", "def new_animal\n\tputs \"What is the name of the animal?\"\n\tname = gets.chomp.capitalize\n\tputs \"What species of animal is #{name}?\"\n\tspecies = gets.chomp.downcase\n\t# instantiating new Animal object\n\tanimal = Animal.new(name, species)\n\t# setting animal instance to $my_shelter\n\t$my_shelter.rescue_animal(animal)\nend", "def discardHiddenTreasure(t)\n \n end", "def work_out\n self.happiness = @happiness + 2\n self.hygiene = @hygiene - 3\n \"♪ another one bites the dust ♫\"\n end", "def random_typhoon_generator\n\t\t\n\t\t#Normal Typhoon\n\t\tr = rand(50) #Currently: 1/50 chance\n\t\tif(r%49 == 0)\n\t\tsz = rand(3)\n\t\tsX = rand(40-12) + 12\n\t\tsY = rand(12-1) + 1\n\t\tdX = rand(10-3) + 3\n\t\tdY = rand(2-1) + 1\n\t\ttyphoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n\t\taddObject(typhoon1)\n\t\tend\n\t\t#Strong Typhoon\n\t\tr = rand(90) #Currently: 1/90 chance\n\t\tif(r%89 == 0)\n\t\tsz = 3\n\t\tsX = rand(46-12) + 12\n\t\tsY = rand(12-1) + 1\n\t\tdX = rand(11-3) + 3\n\t\tdY = rand(2-1) + 1\n\t\ttyphoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n\t\taddObject(typhoon1)\n\t\tend\n\tend", "def randomly( word )\n send( [ :point, :delete, :insert ].random, word )\n end", "def create_random_name\n String.new(Faker::Games::ElderScrolls.creature)\n end", "def victory_check\n if @word == @player\n @game_over = true\n puts \"Victory!\"\n elsif @wrong_count >= 5\n @game_over = true\n puts \"Defeat!\"\n puts \"The word was: '#{@word.join('')}'\"\n end\n end", "def simple_random_obfuscate(word)\n letters = vowels_to_numbers(word).upcase.split('')\n \"#{random_obfuscation_segment}#{letters.join(random_obfuscation_segment)}#{random_obfuscation_segment}\"\n end", "def spawn_smulg\r\n smulg = spawn_monster(\"Smulg\", 30, 15, 65, 50, rand(3..5), (3..10))\r\nend", "def cuddle\n attempt = [0, 1]\n hug = attempt.sample\n end", "def slip_damage_effect\n # Set damage\n self.damage = self.maxhp / 10\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Subtract damage from HP\n self.hp -= self.damage\n # End Method\n return true\n end", "def poor_random\n (0...16).map { rand(97..122).chr }.join\n end", "def santa_machine(number)\r\n\t\r\n\texample_genders = [\"male\", \"female\", \"agender\", \"bigender\", \"gender fluid\", \"other\" ]\r\n\texample_ethnicities = [\"black\", \"white\", \"Japanese\", \"lizzard\", \"merpeople\" , \"plant\"]\r\n\tnumber.times do\r\n \t\tsanta = Santa.new(example_genders.sample, example_ethnicities.sample, rand(0..140))\r\n \t\tsanta.reindeer_shuffle\r\n \t\tsanta.about\r\n \t\tend\r\n\r\nend", "def enemy_attack(pika_hp)\n random = rand(10) + 1 #includes 10\n if random == 1 || random == 2 || random == 3 || random == 4\n puts \"The enemy's attack missed! Pikachu's hp is #{pika_hp}.\".colorize(:red)\n elsif random == 5 || random == 6\n pika_hp = pika_hp - 1\n puts \"The enemy used Growl. Pikachu's hp is reduced to #{pika_hp}.\".colorize(:red)\n elsif random == 7 || random == 8\n pika_hp = pika_hp - 2\n puts \"The enemy used Quick Attack. Pikachu's hp is reduced to #{pika_hp}.\".colorize(:red)\n else\n pika_hp = pika_hp - 3\n puts \"The enemy used Scratch. Pikachu's hp is reduced to #{pika_hp}.\".colorize(:red)\n end\n return pika_hp\nend", "def throw_die\n\t\tcase rand(4)\n\t\twhen 0\n\t\t\t@counts[:NORTH] += 1\n\t\t\t:NORTH\n\t\twhen 1\n\t\t\t@counts[:SOUTH] += 1\n\t\t\t:SOUTH\n\t\twhen 2\n\t\t\t@counts[:EAST] += 1\n\t\t\t:EAST\n\t\twhen 3\n\t\t\t@counts[:WEST] += 1\n\t\t\t:WEST\n\t\tend\n\tend", "def lose_game\n print \"Game Over! The word was #{@random_word}!\"\n end", "def work_out\n self.hygiene -= 3\n self.happiness += 2\n return \"♪ another one bites the dust ♫\"\nend", "def attack(weapon)\n rand(10) + weapon.power\n end", "def adopt_animal(name)\n @animals_in_shelter.each_with_index do |animal, i|\n if name == animal.get_animal_name\n puts \"#{name} has been adopted!\"\n @animals_in_shelter.delete_at(i)\n end\n end\n end", "def magiceightball\n\t\t answers = [\"outlook not so good\", \"cloudy, ask again later\", \"it is meant to be\", \"you may rely on it\"]\n\t\t @result = answers[Random.rand(4)]\n\tend", "def almost_die\n puts 'Eva almost die!'\n end", "def handle_victory(entity)\n type(\"You defeated the #{entity.name}!\\n\")\n super(entity)\n print \"\\n\"\n end", "def draw_letters\n compact_bag = {\n \"A\" => 9,\n \"B\" => 2, \n \"C\" => 2, \n \"D\" => 4, \n \"E\" => 12, \n \"F\" => 2, \n \"G\" => 3, \n \"H\" => 2, \n \"I\" => 9,\n \"J\" => 1, \n \"K\" => 1, \n \"L\" => 4,\n \"M\" => 2,\n \"N\" => 6,\n \"O\" => 8,\n \"P\" => 2, \n \"Q\" => 1, \n \"R\" => 6,\n \"S\" => 4, \n \"T\" => 6,\n \"U\" => 4,\n \"V\" => 2,\n \"W\" => 2,\n \"X\" => 1, \n \"Y\" => 2, \n \"Z\" => 1\n }\n expanded_bag = []\n compact_bag.each do |letters, number|\n number.times do \n expanded_bag << letters\n end\n end \n\n random = []\n\n 10.times do \n x = rand expanded_bag.length\n while random.include? x\n x = rand expanded_bag.length\n end\n random << x\n end\n\n hand = random.map {|number| expanded_bag[number]}\nend", "def weird_stuff\n puts \"Mussolini apparently liked to eat raw garlic, although he suffered\n from severe stomach ulcers. He also had many Jewish friends, and didn't like\n Hitler very much. Yeah right!\"\n #sleep(20)\n puts \"Idi Amin gave himself the title His Excellency, President for Life Field\n Marshall Al Hadj Doctor Idi Amin Dada, VC, DSO, MC, Lord of all the Beasts\n of the Earth and Fishes of the Sea and Conqueror of the British Empire in\n Africa in General and Uganda in particular.\"\n #sleep(20)\n puts \"Adolf Hitler thought of himself as a pacifist. He was a vegetarian.\n It is said that he injured his groin during World War I, and his left\n testicle was removed. Hitler enjoyed watching Charley Chaplin, who made fun\n of Hitler.\"\n #sleep(20)\n puts \"Stalin was also the man behind the most wicked practical joke ever\n played. Being a very private man he gave the order that no person should\n enter his bed chambers on pain of death. Later, while in his chambers he\n decided to test whether his guards had listened to this instruction.\n Pretending to scream in pain, he called for the guards stationed outside\n the door. Fearing that their leader was in trouble the guards burst into\n the room. Stalin had them executed for failing to follow his standing orders.\n This little prank soon backfired, however, when Stalin suffered a seizure\n while alone in his bedroom. The guards were too afraid to enter, finding\n him hours later laid in a puddle of stale urine. He died three days later.\"\n #sleep(30)\n puts \"Niyazov loved to rename things. For example, he renamed the month of\n January Turkmenbashi, which means Father of the Turkmen, a name he gave\n himself. He also 'legislated' the renaming of the days of the week to ones\n that translate to 'Young Day', 'Spirituality Day', etc. He even renamed the\n word 'bread', Gurbansoltan, after his own mother. Niyazov outlawed beards on\n men and cosmetics on TV anchors, and prohibited both chewing tobacco and lip-\n syncing on Turkmenistan soil. In a society of smokers, Niyazov recommended\n that people chew on bones, which he argued would strengthen their teeth. He\n authored a book, the Book of the Soul, and ordered students in schools and\n mosques to read and study it, and in the case of mosques, to give it equal\n respect to the Quran (and if not, the mosque would be demolished). To get a\n driver's license, people had to memorize the contents of the book. Finally,\n Niyazov told everyone that he had made a pact with G-d that anyone who read\n his book three times would go to heaven. In 2005, he ordered a copy of his\n book to be sent to outer space.\"\n #sleep(60)\n puts \"Mussolini apparently liked to eat raw garlic, although he suffered\n from severe stomach ulcers. He also had many Jewish friends, and didn't like\n Hitler very much. Yeah right!\"\n #sleep(10)\n puts \"He gave himself the title His Excellency, President for Life Field\n Marshall Al Hadj Doctor Idi Amin Dada, VC, DSO, MC, Lord of all the Beasts\n of the Earth and Fishes of the Sea and Conqueror of the British Empire in\n Africa in General and Uganda in particular.\"\n end", "def random_ascii\n print send(all_giraffes[rand(all_giraffes.length)])\n end", "def handle_typos_1(doors)\n\tputs \"Man you should make a proper decision or learn how to type!\".upcase\n\tputs \"Try again\"\n\tputs \"> \"\n\tdoor_choose(doors)\nend", "def attack\n (attack_strength * rand(0.8..1.2)).truncate(2)\n end", "def cook\n @burger.thaw\n @burger.make_patty\n @burger.grill\n end", "def draw\n letters.delete_at(rand(letters.size))\n end", "def compute_damage\r\n return rand(1..6)\r\n end" ]
[ "0.6798156", "0.6408442", "0.6360252", "0.63510513", "0.6194009", "0.61634916", "0.61489147", "0.61195916", "0.6066545", "0.5979255", "0.5964513", "0.5946106", "0.59340477", "0.5855034", "0.58448046", "0.58423245", "0.58343303", "0.582192", "0.5800945", "0.57682335", "0.57682335", "0.57682335", "0.57677686", "0.5762511", "0.57565963", "0.57565504", "0.57558703", "0.57558703", "0.57450587", "0.5713827", "0.57078236", "0.56867087", "0.5670914", "0.56673694", "0.56673694", "0.566183", "0.5661818", "0.56462985", "0.5634551", "0.5633076", "0.5627511", "0.5627426", "0.56180435", "0.5615728", "0.5614396", "0.56001955", "0.5593053", "0.5583057", "0.55763507", "0.55746573", "0.5569528", "0.55678177", "0.55593455", "0.55593455", "0.55554736", "0.5555192", "0.5555192", "0.55513537", "0.55513537", "0.55513537", "0.55502445", "0.55502445", "0.554624", "0.55296224", "0.5528382", "0.55211884", "0.5518945", "0.5512057", "0.5509311", "0.5498953", "0.54952383", "0.5492717", "0.54869837", "0.5478424", "0.5475574", "0.5473497", "0.5468793", "0.5468791", "0.5467542", "0.546064", "0.5455078", "0.54445076", "0.5436503", "0.54321665", "0.5424334", "0.5418392", "0.5415507", "0.54137075", "0.5409947", "0.5398802", "0.53927314", "0.5392016", "0.53892916", "0.53875834", "0.5375095", "0.53749907", "0.5374605", "0.5374428", "0.5374208", "0.5371706" ]
0.7901396
0
Since I wrote this on Windows I don't have fortune...but the internet does!
def get_fortune open('http://www.coe.neu.edu/cgi-bin/fortune') do |page| page.read.scan(/<pre>(.*)<\/pre>/m)[0][0].gsub("\t",' ') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vanilla_windows?; end", "def really_windows?; end", "def private; end", "def user_os_complex\r\n end", "def ext; end", "def ext; end", "def executable_real?() end", "def isWindows()\r\n # See: http://stackoverflow.com/questions/4871309\r\n require 'rbconfig'\r\n return (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)\r\nend", "def bash_on_windows?; end", "def terpene; end", "def short_name( fn )\n #puts \"Calculate short name for #{fn}\\n\"\n return fn if ARCH != 'w32'\n fn.gsub!( /\\//, \"\\\\\" )\n buffer = ' ' * 260\n length = ShortPName.call( fn, buffer, buffer.size )\n fn = buffer.slice(0..length-1) if length > 0\n fn.gsub!( /\\\\/, '/' )\n return fn\nend", "def berlioz; end", "def probers; end", "def host_os; end", "def host_os; end", "def os_windows_other\n\t\t\t\t\tnot_os_windows_2k12.not_os_windows_8.not_os_windows_7.not_os_windows_2k8.not_os_windows_vista.not_os_windows_2k3.not_os_windows_xp.not_os_windows_2k.not_os_windows_nt\n\t\t\t\tend", "def mozart; end", "def ibu; end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend", "def is_windows?(dbc)\n begin\n q = dbc.query('SELECT @@version_compile_os;')\n q.each { |x| @os = x[0] }\n if @os =~ /Win|\\.NET/i\n if @os =~ /Win64/i\n @build='x64'\n else\n @build='x32'\n end\n return true\n else\n return false\n end\n rescue Mysql::Error => e\n puts \"Problem confirming target is Windows\".light_red + \"!\".white\n puts \"\\t=> \".white + \"#{e}\".light_red\n puts \"Sorry, can't continue without this piece\".light_red + \"....\\n\\n\".white\n exit 666;\n end\nend", "def windows?\n ruby_platform?(:windows)\nend", "def mac_mri?; end", "def windows?; end", "def platform; end", "def platform; end", "def platform; end", "def detect; end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i\nend", "def ios; end", "def windows_xp?\n windows? && !!(ua =~ /Windows NT 5.1/)\n end", "def windows?\n\tRbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend", "def blg; end", "def verdi; end", "def has_pathname_length_limitations?\n # Goddamn, does Windows ever suck. Man.\n os_type =~ /^\\s*windows\\s*$/i\n end", "def shell_error_string ( e )\n if e > 32\n return nil\n else\n return case e\n when 0 then \"Out of memory or resources\"\n #define ERROR_FILE_NOT_FOUND 2L\n #define SE_ERR_FNF 2\n when 2 then \"File not found\"\n #define ERROR_PATH_NOT_FOUND 3L\n #define SE_ERR_PNF 3\n when 3 then \"Path not found\"\n #define SE_ERR_ACCESSDENIED 5\n when 5 then \"Access denied\"\n #define SE_ERR_OOM 8\n when 8 then \"Not enough memory\"\n #define ERROR_BAD_FORMAT 11L\n when 11 then \"Invalid exe\"\n #define SE_ERR_SHARE 26\n when 26 then \"Sharing violation\"\n #define SE_ERR_ASSOCINCOMPLETE 27\n when 27 then \"Invalid file association\"\n #define SE_ERR_DDETIMEOUT 28\n when 28 then \"DDE timeout\"\n #define SE_ERR_DDEFAIL 29\n when 29 then \"DDE fail\"\n #define SE_ERR_DDEBUSY 30\n when 30 then \"DDE busy\"\n #define SE_ERR_NOASSOC 31\n when 31 then \"No file association\"\n #define SE_ERR_DLLNOTFOUND 32\n when 32 then \"DLL not found\"\n else \"Unspecified error\"\n end # case\n end # else\nend", "def schubert; end", "def gounod; end", "def how_it_works\r\n end", "def file_utils; end", "def test_sources\n # just get whatever length fortunes\n LinuxFortune.short=false\n LinuxFortune.long=false\n\n sources = LinuxFortune.get_sources\n assert !sources.nil? and sources.size > 0\n end", "def win; end", "def platform\n \"win\"\n end", "def loc; end", "def loc; end", "def loc; end", "def gcwd; end", "def main; end", "def identify; end", "def autorun; end", "def win_bin?\n new_resource.version.split('.')[0].to_i > 1\nend", "def extension; end", "def extension; end", "def extension; end", "def extension; end", "def external; end", "def windows?\n ::RUBY_PLATFORM =~ /mingw|mswin/\n end", "def getMINGWPWDPath\n makeWindowsPathIntoMinGWPath Dir.pwd\nend", "def getMINGWPWDPath()\n makeWindowsPathIntoMinGWPath Dir.pwd\nend", "def getMouseLocation\n def windows\n require \"Win32API\"\n getCursorPos = Win32API.new(\"user32\", \"GetCursorPos\", 'P', 'L')\n # point is a Long,Long-struct\n point = \"\\0\" * 8\n if getCursorPos(point)\n a.unpack('LL')\n else\n [nil,nil]\n end\n end\n\n def linux\n loc_string = `xdotool getmouselocation --shell`[/X=(\\d+)\\nY=(\\d+)/]\n loc_string.lines.map {|s| s[/.=(\\d+)/, 1].to_i}\n end\n\n def osx\n # if we are running in RubyCocoa, we can access objective-c libraries\n require \"osx/cocoa\"\n OSX::NSEvent.mouseLocation.to_a\n rescue LoadError\n # we are not running in ruby cocoa, but it should be preinstalled on every system\n coords = `/usr/bin/ruby -e 'require \"osx/cocoa\"; puts OSX::NSEvent.mouseLocation.to_a'`\n coords.lines.map {|s| s.to_f }\n end\n\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n windows\n when /darwin|mac os/\n osx\n when /linux|solaris|bsd/\n linux\n else\n raise Error, \"unknown os: #{host_os.inspect}\"\n end\nrescue Exception => e\n [nil,nil]\nend", "def weber; end", "def unix?\n !windows?\n end", "def test_12c\r\n db = build '/http/alias'\r\n db.not_found_image = 'image-1.jpg'\r\n db.use_not_found = true\r\n r = db.fetch('foo.jpg',:width => 61)\r\n assert(/.http.alias.w.61.image-1.jpg/===r)\r\n assert File.exists?(File.join(db.root,'w','61','image-1.jpg'))\r\n#debugger\r\n r = db.fetch('foo.jpg',:width => 61, :absolute => true)\r\n assert(Regexp.new(db.root+'.w.61.image-1.jpg')===r)\r\n end", "def linux? ; RUBY_PLATFORM =~ /linux/i end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def whiny; end", "def standalone; end", "def tiny; end", "def used?; end", "def xtest_posix\nputs \"*\"*80\nassert_equal(false, true)\n assert_equal(\"\", \"Need way to set posix mode from app!\")\n end", "def windows?\n !!(ua =~ /Windows/)\n end", "def maglev?(platform = T.unsafe(nil)); end", "def windows?(platform = T.unsafe(nil)); end", "def caveats\n <<~EOS\n Ogmtools has not been updated since 2004 and is no longer being developed,\n maintained or supported. There are several issues, especially on 64-bit\n architectures, which the author will not fix or accept patches for.\n Keep this in mind when deciding whether to use this software.\n EOS\n end", "def valid_for_platform?; true; end", "def executable?() end", "def rossini; end", "def smb_fingerprint_windows_sp(os)\n sp = ''\n\n if (os == 'Windows XP')\n # SRVSVC was blocked in SP2\n begin\n smb_create(\"\\\\SRVSVC\")\n sp = 'Service Pack 0 / 1'\n rescue ::Rex::Proto::SMB::Exceptions::ErrorCode => e\n if (e.error_code == 0xc0000022)\n sp = 'Service Pack 2+'\n end\n end\n end\n\n if (os == 'Windows 2000' and sp.length == 0)\n # LLSRPC was blocked in a post-SP4 update\n begin\n smb_create(\"\\\\LLSRPC\")\n sp = 'Service Pack 0 - 4'\n rescue ::Rex::Proto::SMB::Exceptions::ErrorCode => e\n if (e.error_code == 0xc0000022)\n sp = 'Service Pack 4 with MS05-010+'\n end\n end\n end\n\n #\n # Perform granular XP SP checks if LSARPC is exposed\n #\n if (os == 'Windows XP')\n\n #\n # Service Pack 2 added a range(0,64000) to opnum 0x22 in SRVSVC\n # Credit to spoonm for first use of unbounded [out] buffers\n #\n handle = dcerpc_handle(\n '4b324fc8-1670-01d3-1278-5a47bf6ee188', '3.0',\n 'ncacn_np', [\"\\\\BROWSER\"]\n )\n\n begin\n dcerpc_bind(handle)\n\n stub =\n NDR.uwstring(Rex::Text.rand_text_alpha(rand(10)+1)) +\n NDR.wstring(Rex::Text.rand_text_alpha(rand(10)+1)) +\n NDR.long(64001) +\n NDR.long(0) +\n NDR.long(0)\n\n dcerpc.call(0x22, stub)\n sp = \"Service Pack 0 / 1\"\n\n rescue ::Interrupt\n raise $!\n rescue ::Rex::Proto::SMB::Exceptions::ErrorCode\n rescue ::Rex::Proto::SMB::Exceptions::ReadPacket\n rescue ::Rex::Proto::DCERPC::Exceptions::Fault\n sp = \"Service Pack 2+\"\n rescue ::Exception\n end\n\n\n #\n # Service Pack 3 fixed information leaks via [unique][out] pointers\n # Call SRVSVC::NetRemoteTOD() to return [out] [ref] [unique]\n # Credit:\n # Pointer leak is well known, but Immunity also covered in a paper\n # Silent fix of pointer leak in SP3 and detection method by Rhys Kidd\n #\n handle = dcerpc_handle(\n '4b324fc8-1670-01d3-1278-5a47bf6ee188', '3.0',\n 'ncacn_np', [\"\\\\BROWSER\"]\n )\n\n begin\n dcerpc_bind(handle)\n\n stub = NDR.uwstring(Rex::Text.rand_text_alpha(rand(8)+1))\n resp = dcerpc.call(0x1c, stub)\n\n if(resp and resp[0,4] == \"\\x00\\x00\\x02\\x00\")\n sp = \"Service Pack 3\"\n else\n if(resp and sp =~ /Service Pack 2\\+/)\n sp = \"Service Pack 2\"\n end\n end\n\n rescue ::Interrupt\n raise $!\n rescue ::Rex::Proto::SMB::Exceptions::ErrorCode\n rescue ::Rex::Proto::SMB::Exceptions::ReadPacket\n rescue ::Exception\n end\n end\n\n sp\n end", "def who_we_are\r\n end", "def makeWindowsPathIntoMinGWPath(path)\n modifiedPath = path.gsub(/\\\\/, '/')\n modifiedPath.gsub(/^(\\w+):[\\\\\\/]/) { \"/#{$1.downcase}/\" }\nend", "def cmd; end", "def opening; end", "def opening; end", "def opening; end", "def windows?\n RUBY_PLATFORM =~ /mswin/\n end", "def refutal()\n end", "def internal_encoding()\n #This is a stub, used for indexing\n end", "def alt; end", "def is_windows?\n win_patterns = [\n /bccwin/i,\n /cygwin/i,\n /djgpp/i,\n /mingw/i,\n /mswin/i,\n /wince/i\n ]\n\n case RUBY_PLATFORM\n when *win_patterns\n return true\n else\n return false\n end\nend", "def hpricot? ; false end", "def pausable; end", "def windows_nix?\n (/cygwin|mingw|bccwin/ =~ ruby_platform) != nil\n end", "def dh; end", "def anchored; end", "def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end", "def check_for_executable; end", "def jack_handey; end", "def issn; end", "def hiss; end" ]
[ "0.6202848", "0.60501164", "0.5667129", "0.54712135", "0.5391244", "0.5391244", "0.5362545", "0.5347999", "0.5334077", "0.5266414", "0.51972693", "0.5186158", "0.51754975", "0.5160945", "0.5160945", "0.51428443", "0.5122108", "0.5111898", "0.50940716", "0.5092257", "0.5077617", "0.5072547", "0.5041001", "0.5019042", "0.5019042", "0.5019042", "0.5013807", "0.5006429", "0.5001436", "0.4992392", "0.49922252", "0.49823275", "0.4959666", "0.4957972", "0.4943957", "0.49325144", "0.49231946", "0.49112412", "0.4895889", "0.48871008", "0.4885544", "0.48776892", "0.4877362", "0.4877362", "0.4877362", "0.4876616", "0.48628145", "0.4861299", "0.48606044", "0.4860047", "0.485567", "0.485567", "0.485567", "0.485567", "0.48536623", "0.48461154", "0.4844587", "0.48370638", "0.4825656", "0.48234966", "0.48183784", "0.48136157", "0.48109418", "0.48100924", "0.48100924", "0.48100924", "0.48100924", "0.48031253", "0.48005584", "0.47972792", "0.47885492", "0.47859424", "0.47788382", "0.47769764", "0.4775887", "0.4771051", "0.4764451", "0.4764361", "0.47603244", "0.47546935", "0.47383472", "0.47344002", "0.47328347", "0.47294617", "0.47294617", "0.47294617", "0.4728909", "0.4728576", "0.47175023", "0.47159427", "0.4703088", "0.46986482", "0.46964446", "0.46920013", "0.46918356", "0.46909392", "0.46899992", "0.4685954", "0.46855435", "0.46851444", "0.4684693" ]
0.0
-1
Initialize a Route from a XML::Node.
def initialize(opts = {}) if(opts[:gpx_file] and opts[:element]) rte_element = opts[:element] @gpx_file = opts[:gpx_file] @name = (rte_element.at("name").inner_text rescue nil) @points = [] rte_element.search("rtept").each do |point| @points << Point.new(:element => point, :gpx_file => @gpx_file) end else @points = (opts[:points] or []) @name = (opts[:name]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(xml_node)\n @xml = xml_node\n end", "def initialize(xml_node)\n @xml = xml_node\n end", "def initialize(xml_node)\n @xml = xml_node\n end", "def initialize(xml_node, instance: nil)\n @xml_node = xml_node\n @instance = instance\n end", "def initialize( node )\n @node = node\n end", "def initialize(node)\n @node = node\n end", "def initialize(node)\n @node = node\n end", "def from_xml_node(parent, opts=OPTS)\n new.from_xml_node(parent, opts)\n end", "def initialize(route)\n @original_route = route\n end", "def initialize(node:)\n @node = node\n end", "def initialize(node)\n @node = node\n end", "def initialize(node)\n @node = node\n end", "def initialize(node)\n @node = node\n end", "def initialize(node)\n @node = node\n end", "def initialize(node)\n @node = node\n end", "def initialize(node)\n @node = node\n end", "def initialize(node)\n self.date = Utils.parse_iso_8601_date(node.content) rescue nil\n self.date_str = node.content\n self.event = node.attribute('event').content rescue nil\n end", "def from_node(node); end", "def initialize(node)\n @node = node\n end", "def initialize(node)\n self.identifier = node.content\n self.scheme = node.attribute('scheme').content rescue nil\n end", "def initialize(route, day: WEEKDAY, time: ALL_DAY)\n @route, @day, @time = route, day, time\n end", "def initialize node\n raise ArgumentError, \"Expected SGF::Node argument but received #{node.class}\" unless node.instance_of? SGF::Node\n @root = node\n @current_node = node\n end", "def initialize(node)\n @root_node = node\n end", "def load_from_xml(node)\n # Get all information from the root's children nodes\n node.children.each do |child|\n case child.name.to_s\n when 'id'\n @id = child.content.to_i\n when 'title'\n @title = child.content\n when 'image'\n check_image_node(child)\n when 'date'\n @date = Time.parse(child.content)\n when 'streamable'\n check_streamable_node(child)\n when 'size'\n @size = child.content.to_i\n when 'description'\n @description = child.content\n when 'duration'\n @duration = child.content.to_i\n when 'creator'\n @creator = child.content\n when 'url'\n @url = child.content\n when 'text'\n # ignore, these are only blanks\n when '#text'\n # libxml-jruby version of blanks\n else\n raise NotImplementedError, \"Field '#{child.name}' not known (#{child.content})\"\n end #^ case\n end #^ do |child|\n end", "def initialize(node)\n self.node = node\n self.title = node['title']\n self.author = node['author']\n self.url = node['url']\n end", "def initialize(node)\n # get trajectory type\n @trajectory = node.attributes[\"trajectory\"].downcase\n # check availability of trajectory type\n unless TRAJTYPE.include?(@trajectory)\n raise ArgumentError, 'Unknown trajectory type!' \n end\n # get element list\n elist = node.elements\n # load information of start position\n @eye = elist[\"eye\"].text.to_a\n @target = elist[\"target\"].text.to_a\n @up = elist[\"up\"].text.to_a\n # load trajectory specific parameters\n @params = Hash.new\n TRAJPARAM[@trajectory].each do |key|\n @params[key] = elist[key].text.array? ?\n elist[key].text.to_a :\n elist[key].text.to_f\n end\n # initialize other fields\n @outfd = nil\n end", "def route_xml(route_id, query_params = nil)\n get(\"/routes/#{route_id}/xml\", query_params)\n end", "def initialize(node, client)\n @xml = node\n @client = client\n @hash = nil\n \n if self['ID']\n @pe_id = self['ID'].to_i\n else\n @pe_id = nil\n end\n @name = self['NAME'] if self['NAME']\n end", "def initialize(routes)\n @routes = routes\n end", "def initialize(routes)\n @routes = routes\n end", "def initialize(routes)\n @routes = routes\n end", "def initialize(node, twine)\n @twine = twine\n @start = false\n @id = node['pid']\n @name = node['name']\n @tags = node['tags']\n @x = @y = nil\n if node.key?('position')\n @x, @y = node['position'].split(',').map {|e| e.to_i}\n end\n @body = node.text\n @links = []\n end", "def initialize(node, attrs={})\n @node = node\n\n @attributes = {tag: node.name}\n ATTRIBUTES.each do |k|\n if node.key?(k.to_s)\n attributes[k] = node[k]\n end\n end\n update_attributes(attrs)\n end", "def load_from_xml(node)\n # Get all information from the root's children nodes\n node.children.each do |child|\n case child.name.to_s\n when 'id'\n @id = child.content.to_i\n when 'title'\n @title = child.content.to_s\n when 'artists'\n @artists = [] if @artists.nil?\n child.children.each do |artist|\n @artists << Artist.new(:name => artist.content) if artist.name == 'artist'\n @headliner = Artist.new(:name => artist.content) if artist.name == 'headliner'\n end\n @artists << @headliner unless @headliner.nil? || headliner_alrady_listed_in_artist_list?\n when 'image'\n check_image_node(child)\n when 'url'\n @url = child.content\n when 'description'\n @description = child.content\n when 'attendance'\n @attendance = child.content.to_i\n when 'reviews'\n @reviews = child.content.to_i\n when 'tag'\n @tag = child.content\n when 'startDate'\n @start_date = Time.parse(child.content)\n when 'startTime'\n @start_time = child.content\n when 'endDate'\n @end_date = Time.parse(child.content)\n when 'tickets'\n # @todo Handle tickets\n when 'venue'\n @venue = Venue.new_from_xml(child)\n when 'website'\n @website = child.content.to_s\n when 'text'\n # ignore, these are only blanks\n when '#text'\n # libxml-jruby version of blanks\n else\n raise NotImplementedError, \"Field '#{child.name}' not known (#{child.content})\"\n end #^ case\n end #^ do |child|\n @artists.uniq!\n end", "def initialize(*args)\n\t\t\t@elements = []\n\t\t\tload_xml(args[0]) if args[0].kind_of? REXML::Element\n\t\tend", "def initialize(route, parts)\n @route = route #'/' + File.basename(file).chomp('.raze')\n @parts = parts\n end", "def from_xml(node)\r\n @story_id = node['id']\r\n @title = node['name']\r\n @description = node['description'] || \"\"\r\n @url = node['url']\r\n accepted_at_node = node['accepted_at']\r\n @accepted_at = accepted_at_node.nil? ? nil : DateTime.parse(accepted_at_node)\r\n @created_at = DateTime.parse(node['created_at'])\r\n @updated_at = DateTime.parse(node['updated_at'])\r\n @requested_by_id = node['requested_by_id']\r\n @current_state = node['current_state']\r\n owned_by_node = node['owned_by']\r\n @owned_by_id = node['owned_by_id'] # owned_by_node.nil? || owned_by_node.length == 0 ? 'no one' : owned_by_node\r\n @story_type = node['story_type']\r\n estimate_node = node['estimate']\r\n @estimate = estimate_node.nil? ? 0 : estimate_node.to_i\r\n @estimate = 0 if @estimate < 0\r\n labelnode = node['labels']\r\n @labels = labelnode\r\n\r\n self\r\n end", "def initialize \n @doc = Document.new \n @action = @doc.add_element('action')\n @param = Element.new('parameter')\n end", "def new\n @route = Route.new\n end", "def initialize(node: Capybara.current_session, path: nil)\n @node = node\n @path = path\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route_instance\n @route_instance = RouteInstance.find(params[:id])\n end", "def initialize(node)\n self.name = node.content\n self.file_as = node.attribute('file-as').content rescue nil\n self.role = node.attribute('role').content rescue nil\n end", "def init_with_node(node)\n @internal_node = node\n self.classname = self.class.to_s unless @internal_node.hasProperty(\"classname\")\n $NEO_LOGGER.debug {\"loading node '#{self.class.to_s}' node id #{@internal_node.getId()}\"}\n end", "def initialize( routes=[], options={} )\n\t\troutes.each do |tuple|\n\t\t\tself.log.debug \" adding route: %p\" % [ tuple ]\n\t\t\tself.add_route( *tuple )\n\t\tend\n\tend", "def initialize(run, xml)\n @run = run\n\n parse_xml(xml)\n end", "def initialize(nodes_fragement)\n @nodes_xml = nodes_fragement\n @children = set_children\n end", "def from_xml(*args, &block)\n create_represented(*args, &block).from_xml(*args)\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def from_xml(xml)\n\t\tend", "def from_xml(xml)\n @xml = xml\n self.before_from_xml if defined?(before_from_xml)\n from_xml_via_map(@xml)\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def set_route\n @route = Route.find(params[:id])\n end", "def route(*args)\n Route.new(self, *args)\n end", "def create_from_xml(xml, pares)\n raise PaResMissing.new \"(2500) PaRes argument can not be omitted.\" if pares.nil?\n @request_xml = REXML::Document.new xml\n REXML::XPath.first(@request_xml, \"//ThreeDSecure\").add_element(\"PaRes\").text=pares\n end", "def initialize(pid, name, xml_document)\n feed = feed\n @pid = pid\n @name = name\n @xml_document = xml_document\n end", "def initialize\n @routes = {}\n end", "def initialize(arg=nil)\n case arg\n when Node\n @root = arg\n when NilClass\n @root = StringNode.new(\"\")\n else\n @root = StringNode.new(arg.to_s)\n end\n end", "def initialize(node = nil, options = nil)\n super()\n\n self.node = node\n self.options = options\n end", "def from_xml_elem(ctx, root)\n #p [:from_xml_elem, :ctx, root]\n attributes = root.attributes.inject({ }) { |hash, (k, v)| hash[k] = EscapeXML.unescape(v.to_s); hash}\n text, children = root.children.partition{ |x| text_node?(x) }\n text = text.map{ |x| x.to_s}.reject{ |s| s =~ /^\\s*$/}.join('')\n element_name = root.name\n if element_name !~ /[A-Z]/\n element_name = Doodle::Utils.camel_case(element_name)\n end\n klass = Utils.const_lookup(element_name, ctx)\n #p [:creating_new, klass, text, attributes]\n #p [:root1, root]\n # don't pass in empty text - screws up when class has only\n # child elements (and no attributes) because tries to\n # instantiate child element from empty string \"\"\n if text == \"\"\n text = nil\n end\n args = [text, attributes].compact\n oroot = klass.new(*args) {\n #p [:in_block]\n from_xml_elem(root)\n }\n #p [:oroot, oroot]\n oroot\n end", "def initialize(xml = nil, edge = nil)\n scanXml(xml, edge) if(!xml.nil?) ;\n end", "def from_node(original_node); end", "def initialize(nokogiri_xml, client)\n @xml = nokogiri_xml.to_xml\n @client = client\n @attributes = Vebra.parse(nokogiri_xml)\n end", "def initialize(node)\n @children = nil\n end", "def initialize(node)\n # ------- fundamental info -------\n @name = node.attributes[\"name\"]\n # ------- load surface -------\n # initialize surface list\n @surflist = Array.new\n # read surface one by one\n node.elements.each(\"surface\") do |s|\n if s.attributes[\"name\"]\n # get surface name\n sname = s.attributes[\"name\"].downcase\n # check existence of attribution \"name\"\n raise ArgumentError, \"surface #{sname} do not found!\" \\\n unless @@surflib[sname]\n # copy surface from surface lib\n @surflist << @@surflib[sname].clone\n else\n # load surface by configuration\n @surflist << SurfConfig.new(s)\n end\n end\n # ------- load camera -------\n @camera = CamConfig.new(node.elements[\"camera\"])\n # ------- show information -------\n puts \"Loaded Model : #{@name}\"\n end", "def initialize()\n @root = Node.new(nil)\n end", "def initialize(children = [], properties = {})\n super(Uri.ast_type, children, properties)\n end", "def initialize( sender_id, conn_id, path, headers, body, raw=nil )\n\t\tsuper\n\t\tself.log.debug \"Parsing XML request body\"\n\t\t@data = Nokogiri::XML( body )\n\tend", "def new\n\t\tlogger.debug(\"/routes/new params[:route] : #{params[:route].inspect}\")\n\t\t@route = Route.new(params[:route])\n\t\t@sports = Sport.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @route }\n\t\tend\n\tend", "def initialize(node, direction)\n super()\n @node = node\n @direction = direction\n end", "def initialize(object, node_name: nil)\n @object = object\n @node_name = node_name\n end", "def initialize(xml_path, namespace='vmw')\n @xml_path = xml_path\n load\n @xml.root.add_namespace namespace, NameSpaces[namespace]\n @namespace = namespace\n end", "def initialize(node)\n\t\t\t@title = node.find_first(\"T\").try(:content)\n\n\t\t\t# Fully qualified URL to the result.\n\t\t\t@link = node.find_first(\"UE\").try(:content)\n\n\t\t\t@description = node.find_first(\"S\").try(:content)\n\n #check for custom search description when not regular search result\n if @description.empty?\n @description = node.find_first(\".//BLOCK /T\").try(:content)\n end\n\t\tend", "def initialize(xmldata=\"\")\n setPerson(xmldata)\n end", "def new\n @route = Route.new route_params\n end", "def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end", "def initialize(xml)\n @doc = Nokogiri::XML(xml)\n parse_response\n end", "def initialize(xml)\n teams = xml.xpath('team')\n home_team = teams.first\n away_team = teams.last\n @id = xml[:id]\n @scheduled = Time.parse xml[:scheduled]\n @status = xml[:status]\n @home = create_hash(home_team)\n @away = create_hash(away_team)\n end", "def initialize\n #load_config\n load_routes\n end", "def initialize(tree, node_or_address)\n @tree = tree\n if node_or_address.is_a?(SpaceTreeNode) ||\n node_or_address.is_a?(SpaceTreeNodeLink)\n @node_address = node_or_address.node_address\n elsif node_or_address.is_a?(Integer)\n @node_address = node_or_address\n else\n PEROBS.log.fatal \"Unsupported argument type #{node_or_address.class}\"\n end\n end", "def load_xml(str)\r\n @xml = REXML::Document.new(str.to_s)\r\n xml_to_instance\r\n self\r\n end", "def initialize(req, route_params = {})\n @req = req\n @params = route_params\n #@params\n parse_query(@req.query_string)\n parse_body(@req.body)\n end", "def initialize(node_name, options)\n @node_name = node_name\n @options = options\n end", "def initialize(xml)\n #puts \"________________________________________\"\n #puts xml\n #puts \"________________________________________\"\n @doc = Nokogiri::XML(xml)\n parse_response\n end", "def initialize(text_node)\n Hatemile::Helper.require_not_nil(text_node)\n Hatemile::Helper.require_valid_type(text_node, Nokogiri::XML::Text)\n\n @data = text_node\n init(text_node, self)\n end", "def initialize(node, file_path:, parent_node: nil)\n @node = node\n @rich_node = nil\n @file_path = file_path\n @parent_node = parent_node\n end", "def initialize( sender_id, conn_id, path, headers, body, raw=nil )\n\t\tsuper\n\t\tself.log.debug \"Parsing XML request body\"\n\t\t@reader = LibXML::XML::Reader.string( body )\n\tend", "def init_from_xml(xmlDoc)\r\n @type = xmlDoc.expanded_name\r\n xmlDoc.each_element(\"ID\") { |e| @procID = e.text }\r\n xmlDoc.each_element(\"GROUP\") { |e| @group = e.text }\r\n xmlDoc.each_element(\"PATH\") { |e| @path = e.text }\r\n xmlDoc.each_element(\"ARGSLINE\") { |e| @cmdLineArgs = e.text }\r\n xmlDoc.each_element(\"ENV\") { |e| @env = e.text }\r\n # Dump the XML description of the OML configuration into a file\r\n xmlDoc.each_element(\"OML_CONFIG\") { |config|\r\n configPath = nil\r\n config.each_element(\"omlc\") { |omlc|\r\n configPath = \"/tmp/#{omlc.attributes['exp_id']}-#{@procID}.xml\"\r\n }\r\n f = File.new(configPath, \"w+\")\r\n config.each_element {|el|\r\n f << el.to_s\r\n }\r\n f.close\r\n # Set the OML_CONFIG environment with the path to the XML file\r\n @env << \" OML_CONFIG=#{configPath} \"\r\n }\r\n end" ]
[ "0.65647846", "0.65647846", "0.65647846", "0.6071775", "0.573555", "0.5704915", "0.5704915", "0.5697585", "0.56942225", "0.5670697", "0.56428957", "0.56428957", "0.56428957", "0.56428957", "0.5611898", "0.5611898", "0.55562955", "0.55041456", "0.5499941", "0.54832435", "0.54750794", "0.54237705", "0.54070383", "0.5383654", "0.5357171", "0.53406405", "0.5320667", "0.528444", "0.5282366", "0.5282366", "0.5282366", "0.52647734", "0.5234903", "0.5229504", "0.51761127", "0.51676726", "0.5158703", "0.5157902", "0.51302654", "0.51300085", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.51081467", "0.5094786", "0.5060233", "0.5042715", "0.50379187", "0.50376594", "0.5035417", "0.5027869", "0.4999385", "0.49945328", "0.49900267", "0.49844095", "0.49844095", "0.49844095", "0.49780637", "0.49752524", "0.4975155", "0.49737513", "0.4953626", "0.49519572", "0.49321836", "0.49300814", "0.49251103", "0.49211383", "0.49196526", "0.49128234", "0.4907456", "0.49029458", "0.4901043", "0.48904604", "0.48851895", "0.48743075", "0.48654193", "0.48567024", "0.4842073", "0.48390633", "0.4822063", "0.4822063", "0.4821211", "0.48166105", "0.48083347", "0.480771", "0.4798689", "0.47971883", "0.4792735", "0.47841546", "0.47841147", "0.47829995", "0.4782583" ]
0.0
-1
Delete points outside of a given area.
def crop(area) points.delete_if{ |pt| not area.contains? pt } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_area(area)\n points.delete_if{ |pt| area.contains? pt }\n end", "def delete_area(area)\n reset_meta_data\n segments.each do |seg|\n seg.delete_area(area)\n update_meta_data(seg) unless seg.empty?\n end\n segments.delete_if { |seg| seg.empty? }\n end", "def remove(x, y)\n removed = @crates.reject! {|sc| x >= sc.min_x &&\n x <= sc.max_x &&\n y >= sc.min_y &&\n y <= sc.max_y }\n !removed.nil?\n end", "def inArea lat, lon\n if(!inBounds(lat,lon))\n false\n else\n lastpoint = border_points.last\n y2 = 100\n x2 = 200\n a = (y2 - lat)/(x2 - lon)\n b = lat - a*lon\n icount = 0\n border_points_minus_removed.each_with_index do |point|\n\tif(intersect(lastpoint, point, a, b, lon, x2))\n\t icount += 1\n\tend\n\tlastpoint = point\n end\n (icount % 2) == 1\n end\n end", "def filter_locations_bu(points)\n filter_locations(points, 16.06.within(0.07), 50.41.within(0.1))\nend", "def area(x=$game_player.x, y=$game_player.y)\n new_area = @areas.reverse.detect {|area| x >= area.x && y >= area.y }\n @area = new_area if @area != new_area\n @area\n end", "def collidesWithEnemy\n for x in @x.round..(@x + @width).round\n for y in (@y - @height)[email protected]\n if @map.enemyContainsPoint?(x, y)\n @map.PobjectArray.delete(self)\n return\n end\n end\n end\n end", "def area_clicked(leftX, topY, rightX, bottomY)\n # complete this code\n if ((mouse_x > leftX and mouse_x < rightX) and (mouse_y > topY and mouse_y < bottomY))\n true\n else\n false\n end\nend", "def lies_outside? point\n\t\tx = point.x\n\t\ty = point.y\n\n\t\tx < 0 or x > @dimension or \\\n\t\ty < 0 or y > @dimension\n\tend", "def find_area\n\t\t@area = 0.5 * ((@point1.x - @point3.x)*(@point2.y - @point1.y) - (@point1.x - @point2.x)*(@point3.y - @point1.y)).abs\n\tend", "def main_area_off\n\t\tif @main_array.length > 0 then\n\t\t\tfor i in 0..(@main_array.length - 1) do\n\t\t\t\t@layer_general.remove( @main_array[i] )\n\t\t\tend\n\t\t\t@main_array.clear\n\t\tend\n\t\tself.remove( @layer_general )\n\tend", "def without_individual_blocks(options)\n piece = options[:piece]\n game = options[:game]\n board = game.board\n\n collection = clone\n\n collection.coordinates.reject! do |coordinate|\n at_position = board.at_square(coordinate.square_name) \n piece.ally?(at_position) \n end\n\n collection\n end", "def select_points_in_danger_zone(points)\n points.select { |p|\n (p.first < @warning_min_x && p.first > @error_min_x) ||\n (p.last < @warning_min_y && p.last > @error_min_y) ||\n (p.first > @warning_max_x && p.first < @error_max_x) ||\n (p.last > @warning_max_x && p.last < @error_max_y)\n }\n end", "def detect_bandaid(image:, area: 2000)\n objects = detect_image(image: image)\n objects.each_with_index do |object, i|\n remove(i) if object.width * object.height > area\n end\n end", "def check_area(point1, point2, point3)\n area = (point1.x * (point2.y - point3.y) +\n point2.x * (point3.y - point1.y) +\n point3.x * (point1.y - point2.y))/2\n if (area < 0)\n area = -area\n end\n return area\nend", "def filter_locations_tu(points)\n filter_locations(points, 15.9.within(0.07), 50.57.within(0.1))\nend", "def remove_entity_from_grid(entity)\n cells_overlapping(entity.x, entity.y).each do |s|\n raise \"#{entity} not where expected\" unless s.delete? entity\n end\n end", "def filter_locations(points, lon_deg_range, lat_deg_range)\n points.select do |p|\n lon_deg_range.include?(p[0]) && lat_deg_range.include?(p[1])\n end\nend", "def is_out_of_boundary?(point)\n point.x < 0 || point.y < 0 || point.x >= @dimension || point.y >= @dimension\n end", "def find_non_dominated(points)\n points.reject do |point0|\n points.any? do |point1|\n dominates?(point1, point0)\n end\n end\n end", "def border_points_minus_removed\n points = []\n border_points.each do |point|\n points << point if !point.marked_for_destruction?\n end\n points\n end", "def test_inside_non_overlapping()\n shape_ds = Gdal::Ogr.open('../../ogr/data/testpoly.shp')\n shape_lyr = shape_ds.get_layer(0)\n\n shape_lyr.set_spatial_filter_rect( -10, -130, 10, -110 )\n assert(check_features_against_list( shape_lyr, 'FID',\n [ 13 ] ))\n end", "def filter_locations_hk(points)\n filter_locations(points, 15.845.within(0.07), 50.21.within(0.1))\nend", "def unclustered_points\n points.select {|point| not point.clustered? }\n end", "def setArea\n return unless border_points_changed?\n self.area = 0\n return unless border_points_minus_removed.length >= 3\n centerLat = centerLatitude\n centerLong = centerLongitude\n last = border_points.last\n x1 = (last.longitude > centerLong ? 1 : -1) * (last.dist last.latitude, centerLong)\ny1 = (last.latitude > centerLat ? 1 : -1) * (last.dist centerLat, last.longitude)\n sum = 0\n border_points_minus_removed.each_with_index do |point, index|\n x2 = (point.longitude > centerLong ? 1 : -1) * (point.dist point.latitude, centerLong)\ny2 = (point.latitude > centerLat ? 1 : -1) * (point.dist centerLat, point.longitude)\n sum += x1*y2 - x2*y1\n x1 = x2\n y1 = y2\n end\n self.area = (sum/2).abs\n end", "def eliminate_coliding_areas all_possible_areas\n puts 'All areas initial: ' + all_possible_areas.values.map{|areas| areas.count }.inspect\n\n all_possible_areas_reduced = {}\n\n # Reduce areas by eliminiting the ones which touch on another\n # numbered tile\n all_possible_areas.keys.each do |numbered_tile|\n x,y = numbered_tile.split('-').map(&:to_i)\n # Create board with compased tiles on all numbered tiles minus the\n # numbered tile\n restricted_board = create_restricted_board([x,y]).to_a\n all_compased_numbered_tiles = []\n (0..(@row_count-1)).to_a.each do |i|\n (0..(@col_count-1)).to_a.each do |j|\n all_compased_numbered_tiles << [i,j] if restricted_board[i][j] == 1\n end\n end\n\n all_areas_for_numbered_tile = all_possible_areas[numbered_tile].dup\n\n all_possible_areas_reduced[numbered_tile] = all_areas_for_numbered_tile.delete_if do |area|\n next if area.count == 1\n # Skip area, hmm do I need this bellow\n # next if (@b_nl[x,y] == 1)\n # Remove area if colinding\n area & all_compased_numbered_tiles != []\n end\n end #for each numbered_tile,area_span\n\n puts 'All numbered tile areas reduced(not coliding other numbered tiles)' + all_possible_areas_reduced.values.map{|areas| areas.count }.inspect\n all_possible_areas_reduced\n end", "def remove(row, column)\n # We have to do four things:\n #\n # 1. Make sure \"row\" is in bounds\n # 2. Make sure \"column\" is in bounds\n # 3. Make sure there's a piece at (row, column) to remove\n # 4. If all the above check out, remove the appropriate piece\n end", "def addToAreas\n AreaPlace.delete parent_area_place_ids\n centerLat = centerLatitude\n centerLong = centerLongitude\n Place.areas.each do |area|\n if(area.inArea(centerLat, centerLong))\n AreaPlace.create(:area_id => area.id, :place_id => self.id)\n end\n end\n end", "def delete(game_object)\r\n range_x, range_y = @game_object_positions[game_object]\r\n return unless range_x && range_y\r\n \r\n range_x.each do |x|\r\n range_y.each do |y|\r\n @map[x][y] = nil\r\n end\r\n end\r\n end", "def can_clear? ( x, y )\n !self[x][y].visible && \n !self[x][y].mine && \n self[x][y].nearby_mines == 0\n end", "def remove_polygon(options)\n polygon = Google::OptionsHelper.to_polygon(options)\n \n self.remove_overlay polygon\n polygon.removed_from_map self \n end", "def draw(area_draw_params)\n destroy if area_proxy.nil?\n end", "def crop(area)\n reset_meta_data\n segments.each do |seg|\n seg.crop(area)\n update_meta_data(seg) unless seg.empty?\n end\n segments.delete_if { |seg| seg.empty? }\n end", "def collidesWithPlayer\n for x in @x.round..(@x + @width).round\n for y in (@y - @height)[email protected]\n if @map.player.containsPoint?(x, y)\n @map.PobjectArray.delete(self)\n @map.player.loseHealth\n end\n end\n end\n end", "def unset_points!(points)\n\t\tpoints.each do |point|\n\t\t\tunset_point!(point)\n\t\tend\n\tend", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def find_area_beneath\n detect_in(@areas, :area) { |area| area.piles.include?(@pile_beneath) }\n end", "def valid_drop_spot(x,y)\n return true\n end", "def check_is_out_of_board(a_width, a_long)\n \tif(occupied_points.any? { |point| !point.is_in_range(a_width, a_long) })\n\t\traise 'Ship is out of board!'\n\tend\n end", "def out_of_bounds?(x, y, lower_limit = 0, upper_limit = 4)\n (x < lower_limit or y < lower_limit) or (x > upper_limit or y > upper_limit)\n end", "def <<(area)\n overlapping, non_overlapping = @areas.partition {|a| a.overlaps?(area)}\n while overlapping.length > 0\n overlapping.each {|a| area &= a}\n overlapping, non_overlapping = non_overlapping.partition {|a| a.overlaps?(area)}\n end\n @areas = non_overlapping + [area]\n end", "def remove_point(point)\n self.points.delete point\n point.cluster = nil\n end", "def prune_free_list\n i = 0\n while i < @free_rectangles.size\n j = i + 1\n while j < @free_rectangles.size\n if is_contained_in?(@free_rectangles[i], @free_rectangles[j])\n @free_rectangles.delete_at(i)\n i -= 1\n break\n end\n if is_contained_in?(@free_rectangles[j], @free_rectangles[i])\n @free_rectangles.delete_at(j)\n else\n j += 1\n end\n end\n i += 1\n end\n end", "def is_outside_view\n @x2<0 && @y2<0\n end", "def empty_neighbours point\n neighbours(point).select do |(x, y)|\n at(x, y) < 0\n end\n end", "def inArea?(x,y,width,height)\n rect=Rect.new(x,y,width,height)\n return self.over?(rect)\n end", "def boundaries(x, y)\n return false if x > 7 || x < 0 || y > 7 || y < 0\n return true\n\n end", "def exclude(x, y, z)\n @grid[x][y].exclude(z)\n end", "def detect_area\n detect_in(@areas, :area) { |area| area.hit?(@mouse_pos) }\n end", "def filter_by_area\n loc_ids=Area.new(params[:area_tl],params[:area_br]).locations.collect {|loc| loc.id}\n @[email protected](id: loc_ids)\n end", "def leave(p)\n ix = @array.bsearch_index { |ele| ele >= p }\n @array.delete_at(ix)\n nil\n end", "def delete_selected\n\tarray2 = [1,5,2,4,3,7,9,6,8]\n\tarray2.delete_if{|x| x == 4 || x > 6} \n\tputs array2\nend", "def remove_inaccessible_cells(map, goal)\n # Use a flood fill to keep cells; everything not flooded gets a 99.\n basin = Set.new\n flood_fill(map, basin, goal[0], goal[1])\n map.height.times do |row|\n map.width.times do |col|\n map.set(row, col, 99) unless basin.include?([row, col])\n end\n end\n end", "def ships\n MyShip.where(\"location ~= POINT(?)\", self.location)\n end", "def filter(players)\n players.reject do |player|\n player.send(self.class.points_method) < limit\n end\n end", "def waypoints_minus_removed\n points = []\n waypoints.each do |waypoint|\n points << waypoint if !waypoint.marked_for_destruction?\n end\n points\n end", "def area_clicked(leftX, topY, rightX, bottomY)\r\n# complete this code\r\nend", "def placementClear (length, direction, coords, who)\n valid = true\n bowX, bowY = getCoords(coords[0])\n for i in (1...length)\n if valid == true \n if direction == 0 #North\n x = bowX\n y = bowY - i\n elsif direction == 1 #South\n x = bowX\n y = bowY + i\n elsif direction == 2 #East\n x = bowX + i\n y = bowY\n else #West\n x = bowX - i\n y = bowY\n end\n if x < 0 || x > 9 || y < 0 || y > 9 || \n shipPresent(getIndex(x,y), who)\n valid = false\n end\n if valid\n coords << getIndex(x, y)\n end\n end\n end\n return valid\n end", "def removeAllCuratorCameraAreas _args\n \"removeAllCuratorCameraAreas _args;\" \n end", "def valid_cells(array)\n array.delete_if do |coord| \n !board.valid_coordinate?(coord) || !board.board_hash[coord].empty?\n end\n end", "def clip_off_wall\n if wall = clip then\n normal = NORMAL[wall]\n self.ga = (normal + random_turn(90)).degrees unless (normal - ga).abs < 45\n end\n end", "def trim_box(x0, y0, x1, y1)\n @pages.trim_box = [ x0, y0, x1, y1 ]\n end", "def RemovePoints(score)\n\tscore = score - 50\nend", "def clear_at(x, y)\r\n lookup_x = (x / @grid[0]).to_i\r\n lookup_y = (y / @grid[1]).to_i\r\n @map[lookup_x][lookup_y] = nil\r\n end", "def enemyContainsPoint?(x, y)\n @DobjectArray.each do |object|\n if object.is_a? Enemy and (object.x + object.width / 2 - x).abs <= object.width / 2 and (object.y - object.height / 2 - y).abs <= object.height / 2\n object.loseHealth\n return true\n end\n end\n return false\n end", "def destroy\r\n super\r\n @areas.dup.each do |area|\r\n area.destroy\r\n end\r\n @areas = nil\r\n Game.instance.remove_continent(self)\r\n return\r\n end", "def outside?(p1, p2, p3, q)\n return true if q.equal?(p1) || q.equal?(p2) || q.equal?(p3)\n\n x, y, rsquared = MB::Geometry.circumcircle(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y)\n\n dx = q.x - x\n dy = q.y - y\n dsquared = dx * dx + dy * dy\n\n MB::M.sigfigs(dsquared, RADIUS_SIGFIGS) >= MB::M.sigfigs(rsquared, RADIUS_SIGFIGS)\n end", "def coordinate_area\n (@x_max.to_f - @x_min.to_f) * (@y_max.to_f - @y_min.to_f)\n end", "def without_blocks(options)\n game = options[:game]\n piece = options[:piece]\n\n board = game.board\n \n coordinates.each_with_index do |coordinate, index|\n at_position = board.at_square(coordinate.square_name)\n \n # Blocked by an opponent. Include this space.\n if piece.opponent?(at_position)\n return set_including_index(index)\n # Blocked by an ally. Do not include this space.\n elsif piece.ally?(at_position)\n return set_before_index(index)\n end\n end\n\n clone\n end", "def area\n (@p1.x * @p2.y + @p2.x * @p3.y + @p3.x * @p1.y - @p1.y * @p2.x - @p2.y * @p3.x - @p3.y * @p1.x).abs / 2.0\n end", "def sub!(point)\r\n @x -= point.x\r\n @y -= point.y\r\n end", "def setPhotosInArea\n return unless area_changed?\n PlacePhotoInArea.delete place_photos_in_area_ids\n Photo.all.each do |photo|\n if(inArea(photo.ref_latitude, photo.ref_longitude))\n PlacePhotoInArea.create(:place_id => id, :photo_id => photo.id)\n end\n end\n end", "def all_water_in_column?(x, y_min, y_max)\n !self.positions.any? { |pos| pos.x == x && pos.y >= y_min && pos.y < y_max && !pos.water? }\n end", "def input_remove_wall\n # The mouse needs to be inside the grid, because we only want to remove walls\n # the cursor is directly over\n # Recalculations should only occur when a wall is actually deleted\n if mouse_inside_grid?\n if grid.walls.key?(cell_closest_to_mouse)\n grid.walls.delete(cell_closest_to_mouse)\n reset_search\n end\n end\n end", "def itemMark(c,x,y)\n $areaX1 = c.canvasx(x)\n $areaY1 = c.canvasy(y)\n c.delete 'area'\nend", "def delete_outliers(deviations, y=nil)\n nx = self.class.new\n ny = self.class.new if y\n distribution = \n if y\n self.residuals_from_least_squares(y)\n else\n self\n end\n mean, std_dev = distribution.sample_stats\n cutoff = deviations.to_f * std_dev\n #puts \"CUTOFF: #{cutoff}\"\n distribution.each_with_index do |res,i|\n #puts \"RES: #{res}\"\n unless (res - mean).abs > cutoff\n #puts \"ADDING\"\n nx << self[i] \n (ny << y[i]) if y\n end\n end\n if y\n [nx,ny]\n else\n #puts \"GIVING BACK\"\n nx\n end\n end", "def setAreas\n return unless self.distance_changed? || self.height_gain_changed? || self.height_loss_changed?\n PlaceRouteInArea.delete place_routes_in_area_ids\n Place.areas.all.each do |area|\n waypoints.each do |waypoint|\n if(area.inArea(waypoint.latitude, waypoint.longitude))\n PlaceRouteInArea.create(:place_id => area.id, :route_id => id)\n\t break\n end\n end\n end\n end", "def points_query\n # request.path => \"/points/123,-74.006605,40.714623\"\n query = request.path.split(\"/\").last.split(\";\")\n points = query.inject([]) do |r, _|\n id, lon, lat = _.split(\",\")\n r << {:id => id, :lon => lon, :lat => lat}\n end\n\n tolerance = params[:tolerance].to_f if params[:tolerance].present?\n\n lon_lats = points.map{|point| [point[:lon], point[:lat]] }\n areas = Area.polygon_contains_points(points, tolerance)\n points_in_area = []\n areas.each do |area|\n points = area.filter_including_points(points)\n area_as_json = {\n :layer_id => area.layer_id,\n :area_id => area.id,\n :points => points,\n :pointsWithinCount => points.count\n }\n points_in_area << area_as_json\n end\n\n if params['idsonly'] && params['idsonly'] == 'true'\n points_in_area.each { |p| p.delete(:points) }\n end\n\n result = {\n :points_in_area => points_in_area\n }\n\n # points_in_area = (\n # {id => id, layer_id => layer_id, area_id => area_id, points => ( {id => id, x =>x, y =>y}, {id => id, x =>x, y =>y}, ...)},\n # {id => id, layer_id => layer_id, area_id => area_id, points => ( {id => id, x =>x, y =>y}, {id => id, x =>x, y =>y}, ...)}\n # )\n render :json => result\n end", "def out_of_bounds?\n (0..@grid_size[0]).cover?(@coordinates[0]) &&\n (0..@grid_size[1]).cover?(@coordinates[1])\nend", "def area\r\n return (( (@p1.x*(@p2.y - @p3.y)) + (@p2.x*(@p3.y - @p1.y)) + (@p3.x*(@p1.y - @p2.y)) )/2.0).abs\r\n end", "def area_clicked(mouse_x,mouse_y)\n # complete this code\n if (mouse_y < 642 && mouse_y> 545) then\n if (mouse_x < 548 && mouse_x > 454) then\n return 5\n elsif (mouse_x <445 && mouse_x > 353) then\n return 4\n elsif (mouse_x < 342 && mouse_x > 250) then\n return 3\n elsif (mouse_x < 241 && mouse_x > 148) then\n return 2\n elsif (mouse_x < 138 && mouse_x > 42) then\n return 1\n end\n end\n end", "def all_within(lat, long, dist)\n @data.select { |d| d.distance_from(lat, long) < dist }\n end", "def filterFormants(fs)\n fs.delete_if { |f| f[0] < $MIN_F1 || f[0] > $MAX_F1 || f[1] > $MIN_F2 || f[1] < $MAX_F2}\nend", "def contains(v)\n if @area == (Tri.area(v, @points[:a], @points[:c]) + \n Tri.area(v, @points[:b], @points[:a]) + \n Tri.area(v, @points[:c], @points[:b]))\n return true\n else\n return false\n end\n end", "def out_of_bounds?\n (0..@grid_size[0]).cover?(@coordinates[0]) &&\n (0..@grid_size[1]).cover?(@coordinates[1])\n end", "def get_area\n openstudio::getArea(@points_list)\n end", "def loose_bounds\n return [@min, @max].collect { |p| Point.new(p) }\n end", "def all_water_in_row?(y, x_min, x_max)\n !self.positions.any? { |pos| pos.y == y && pos.x >= x_min && pos.x < x_max && !pos.water? }\n end", "def area\n return @area if defined?(@area)\n\n sum = 0.0\n (0...vertices.length).each do |i|\n prev = vertices[i - 1]\n curr = vertices[i]\n\n sum += ((prev.x * curr.y) - (prev.y * curr.x))\n end\n\n @area = sum / 2\n @area\n end", "def unclip\n loop do\n must_do = false\n $WINDOW.current_map.solid_game_objects.each do |ob|\n next if ob.id == 1 || ob.id == self.id\n if ob.hb.check_brute_collision(@hb)\n must_do = true\n clipping = true\n while (clipping)\n angle = Gosu.angle(ob.hb.x, ob.hb.y, @hb.x, @hb.y)\n add_x = Gosu.offset_x(angle, 1)\n add_y = Gosu.offset_y(angle, 1)\n place(@hb.x+add_x, @hb.y+add_y)\n if !ob.hb.check_brute_collision(@hb)\n clipping = false\n end\n end\n end\n end\n break if !must_do\n end\n end", "def has_point(x, y)\n is_negative = (x < 0 or y < 0)\n is_greater_than_dimensions = (x > @width or y > @height)\n\n if is_negative or is_greater_than_dimensions\n result = false\n puts \"[#{x},#{y}] is Outside of Grid, Robot will ignore command\"\n else\n result = true\n end\n\n return result;\n end", "def setPlaces\n\n return unless area_changed?\n AreaPlace.delete child_area_place_ids\n return unless area > 0\n\n places = Place.find_by_bounding_box max_latitude, min_latitude, max_longitude, min_longitude\n\n places.each do |place|\n if place.area.nil? || self.area > place.area\n #Add if center point is in this area\n\tif inArea(place.centerLatitude, place.centerLongitude)\n AreaPlace.create(:area_id => id, :place_id => place.id)\n\tend\n end\n end\n end", "def remove_en_passant(x, y)\n\t\topposite_team_color = (@board[x][y].piece.color == :white ? :black : :white)\n\t\tpawns = collect_pawns(opposite_team_color)\n\t\tpawns.each do |pawn|\n\t\t\tif @board[x][y].piece.color == :white\n\t\t\t\tpawn.piece = nil if pawn.piece.en_passant == true && @board[x][y - 1] == pawn\n\t\t\telse\n\t\t\t\tpawn.piece = nil if pawn.piece.en_passant == true && @board[x][y + 1] == pawn\n\t\t\tend\n\t\tend\n\tend", "def uncanned(*_excluded)\n self.brk_excluded ||= []\n self.brk_excluded.push(*_excluded)\n end", "def over_max?(points, x,y, max_x,max_y)\n max = 3\n max -= 1 if x==0 || x==max_x\n max -= 1 if y==0 || y==max_x\n return points > max\n end", "def area()\n segments.map { |seg| seg.area(start_point) }.reduce(:+)\n end" ]
[ "0.8508142", "0.6264223", "0.6124254", "0.6010757", "0.5884434", "0.5817747", "0.5687705", "0.5654825", "0.55968916", "0.55712456", "0.5515255", "0.5513358", "0.54945576", "0.5492532", "0.54894036", "0.5452016", "0.5449933", "0.54427755", "0.5435893", "0.54346335", "0.54180616", "0.54046", "0.53743833", "0.534225", "0.5326607", "0.5323633", "0.5314851", "0.5303152", "0.5272261", "0.5269775", "0.52559423", "0.52516806", "0.5243402", "0.519914", "0.51909316", "0.516564", "0.516564", "0.516564", "0.5154113", "0.5154113", "0.51469874", "0.5099388", "0.50979173", "0.50967723", "0.50926006", "0.5090876", "0.50739866", "0.50717854", "0.50644714", "0.5060408", "0.50532293", "0.50405407", "0.50303596", "0.5015364", "0.50037885", "0.50024956", "0.50009197", "0.49984172", "0.49910265", "0.494056", "0.49348855", "0.49250263", "0.4901669", "0.4893729", "0.4893384", "0.48700708", "0.48644102", "0.48637682", "0.48617744", "0.48548", "0.48542225", "0.48526132", "0.48521444", "0.4845621", "0.4844963", "0.48403376", "0.48401475", "0.48299062", "0.48266044", "0.48249814", "0.48144004", "0.4809568", "0.48074743", "0.48006874", "0.47935277", "0.47895318", "0.47799617", "0.47769558", "0.4776747", "0.47561318", "0.47555596", "0.47522444", "0.47522396", "0.47395536", "0.473804", "0.47363585", "0.47321108", "0.47317833", "0.4730767", "0.47303885" ]
0.80233586
1
Delete points within the given area.
def delete_area(area) points.delete_if{ |pt| area.contains? pt } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop(area)\n points.delete_if{ |pt| not area.contains? pt }\n end", "def delete_area(area)\n reset_meta_data\n segments.each do |seg|\n seg.delete_area(area)\n update_meta_data(seg) unless seg.empty?\n end\n segments.delete_if { |seg| seg.empty? }\n end", "def remove(x, y)\n removed = @crates.reject! {|sc| x >= sc.min_x &&\n x <= sc.max_x &&\n y >= sc.min_y &&\n y <= sc.max_y }\n !removed.nil?\n end", "def remove_point(point)\n self.points.delete point\n point.cluster = nil\n end", "def unset_points!(points)\n\t\tpoints.each do |point|\n\t\t\tunset_point!(point)\n\t\tend\n\tend", "def delete(game_object)\r\n range_x, range_y = @game_object_positions[game_object]\r\n return unless range_x && range_y\r\n \r\n range_x.each do |x|\r\n range_y.each do |y|\r\n @map[x][y] = nil\r\n end\r\n end\r\n end", "def draw(area_draw_params)\n destroy if area_proxy.nil?\n end", "def destroy\n @area.destroy\n flash[:notice] = \"Successfully removed #{@area.name} from the system.\"\n redirect_to areas_url\n end", "def delete_at(p0) end", "def crop(area)\n reset_meta_data\n segments.each do |seg|\n seg.crop(area)\n update_meta_data(seg) unless seg.empty?\n end\n segments.delete_if { |seg| seg.empty? }\n end", "def destroy\r\n super\r\n @areas.dup.each do |area|\r\n area.destroy\r\n end\r\n @areas = nil\r\n Game.instance.remove_continent(self)\r\n return\r\n end", "def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(areas_url) }\n format.xml { head :ok }\n end\n end", "def del\r\n @@tiles.delete_at(@tileno)\r\n @x1,@y1,@x2,@y2,@inclusive,@id,@tileno=nil\r\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def remove(row, column)\n # We have to do four things:\n #\n # 1. Make sure \"row\" is in bounds\n # 2. Make sure \"column\" is in bounds\n # 3. Make sure there's a piece at (row, column) to remove\n # 4. If all the above check out, remove the appropriate piece\n end", "def remove_polygon(options)\n polygon = Google::OptionsHelper.to_polygon(options)\n \n self.remove_overlay polygon\n polygon.removed_from_map self \n end", "def destroy\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.destroy\n format.html { redirect_to areas_url,\n notice: (crud_notice('destroyed', @area) + \"#{undo_link(@area)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to areas_url, alert: \"#{@area.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def RemovePoints(score)\n\tscore = score - 50\nend", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n respond_with(@area)\n end", "def destroy\n @apartment_geopoint.destroy\n respond_to do |format|\n format.html { redirect_to apartment_geopoints_url }\n format.json { head :no_content }\n end\n end", "def collidesWithEnemy\n for x in @x.round..(@x + @width).round\n for y in (@y - @height)[email protected]\n if @map.enemyContainsPoint?(x, y)\n @map.PobjectArray.delete(self)\n return\n end\n end\n end\n end", "def destroy\n @geopoint = Geopoint.find(params[:id])\n @geopoint.destroy\n\n respond_to do |format|\n format.html { redirect_to geopoints_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @observation = Observation.find(params[:observation_id])\n @area = Area.find(params[:area_id])\n @touch = @area.touches.find(params[:id])\n\n\n # @touch = Touch.find(params[:id])\n @touch.destroy\n\n respond_to do |format|\n format.html { redirect_to coral_observation_area_path(@area.observation.coral, @area.observation, @area), notice: 'Area was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def border_points_minus_removed\n points = []\n border_points.each do |point|\n points << point if !point.marked_for_destruction?\n end\n points\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end", "def addToAreas\n AreaPlace.delete parent_area_place_ids\n centerLat = centerLatitude\n centerLong = centerLongitude\n Place.areas.each do |area|\n if(area.inArea(centerLat, centerLong))\n AreaPlace.create(:area_id => area.id, :place_id => self.id)\n end\n end\n end", "def destroy\n\t\t@address = Address.find(params[:id])\n\t\[email protected] do |c|\n\t\t\tc.destroy\n\t\tend\n\t\tredirect_to address_url(@address)\n\tend", "def remove_entity_from_grid(entity)\n cells_overlapping(entity.x, entity.y).each do |s|\n raise \"#{entity} not where expected\" unless s.delete? entity\n end\n end", "def destroy\n @area.destroy\n respond_to do |format|\n format.html { redirect_to areas_url, notice: 'El Área fue eliminada éxitosamente.' }\n format.json { head :no_content }\n end\n end", "def deleting(arr, min, max)\n arr.delete(min)\n arr.delete(max)\n arr\n end", "def delete_object(x, y)\n @generator_flag = false if @grid[y][x].object.class == MapAbxn::Generator\n @grid[y][x] = nil\n end", "def setArea\n return unless border_points_changed?\n self.area = 0\n return unless border_points_minus_removed.length >= 3\n centerLat = centerLatitude\n centerLong = centerLongitude\n last = border_points.last\n x1 = (last.longitude > centerLong ? 1 : -1) * (last.dist last.latitude, centerLong)\ny1 = (last.latitude > centerLat ? 1 : -1) * (last.dist centerLat, last.longitude)\n sum = 0\n border_points_minus_removed.each_with_index do |point, index|\n x2 = (point.longitude > centerLong ? 1 : -1) * (point.dist point.latitude, centerLong)\ny2 = (point.latitude > centerLat ? 1 : -1) * (point.dist centerLat, point.longitude)\n sum += x1*y2 - x2*y1\n x1 = x2\n y1 = y2\n end\n self.area = (sum/2).abs\n end", "def destroy\r\n @area = Area.find(params[:id])\r\n domain_id = @area.domain_id\r\n @area.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to areas_url domain_id: domain_id, notice: 'Area was successfully deleted.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @group_area = GroupArea.find(params[:id])\n @group_area.destroy\n\n respond_to do |format|\n format.html { redirect_to group_areas_url }\n format.json { head :no_content }\n end\n end", "def delete datapoints\n datapoints = [*datapoints]\n datapoints.each do |dp|\n @user.delete \"/users/me/goals/#{@slug}/datapoints/#{dp.id}.json\"\n end\n end", "def area(x=$game_player.x, y=$game_player.y)\n new_area = @areas.reverse.detect {|area| x >= area.x && y >= area.y }\n @area = new_area if @area != new_area\n @area\n end", "def destroy\n @area_attribute.destroy\n respond_to do |format|\n format.html { redirect_to area_attributes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @postulate_area_interest.destroy\n respond_to do |format|\n format.html { redirect_to postulate_area_interests_url }\n format.json { head :no_content }\n end\n end", "def clear_at(x, y)\r\n lookup_x = (x / @grid[0]).to_i\r\n lookup_y = (y / @grid[1]).to_i\r\n @map[lookup_x][lookup_y] = nil\r\n end", "def destroy\n @area.destroy\n respond_to do |format|\n format.html { redirect_to admin_areas_url, notice: 'Area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_measures(start, end_measure)\n start_index = (start.to_i * self.beats_per_measure.to_i)-self.beats_per_measure.to_i-1\n end_index = (end_measure.to_i * self.beats_per_measure.to_i)-1\n i = start_index\n while i < end_index\n self.chords.delete_at(start_index)\n i+=1\n end\n end", "def delete_waypoint _num\n SQF.deleteWaypoint [@this, _num].to_a\n end", "def delete_ppoint\n @ppoint = Ppoint.find(params[:ppoint_id])\n @ppoint_id = @ppoint.id.to_s\n @ppoint.destroy\n \n respond_to do |format|\n format.js\n end\n end", "def removeAllCuratorCameraAreas _args\n \"removeAllCuratorCameraAreas _args;\" \n end", "def destroy\n load_points_entry_type\n authorize! :destroy, @points_entry_type\n destroy_points_entry_type\n end", "def waypoints_minus_removed\n points = []\n waypoints.each do |waypoint|\n points << waypoint if !waypoint.marked_for_destruction?\n end\n points\n end", "def main_area_off\n\t\tif @main_array.length > 0 then\n\t\t\tfor i in 0..(@main_array.length - 1) do\n\t\t\t\t@layer_general.remove( @main_array[i] )\n\t\t\tend\n\t\t\t@main_array.clear\n\t\tend\n\t\tself.remove( @layer_general )\n\tend", "def destroy\n @area.destroy\n flash[:danger] = 'Area was successfully deleted.'\n redirect_to :back\n end", "def delete_selected\n\tarray2 = [1,5,2,4,3,7,9,6,8]\n\tarray2.delete_if{|x| x == 4 || x > 6} \n\tputs array2\nend", "def destroy\n require_user()\n @area_of_expertise.destroy\n respond_to do |format|\n format.html { redirect_to area_of_expertises_url, notice: 'Area of expertise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @projectarea = Projectarea.find(params[:id])\n @projectarea.destroy\n\n respond_to do |format|\n format.html { redirect_to(projectareas_url) }\n format.xml { head :ok }\n end\n end", "def clearPath(p1,p2)\n if (p1[\"x\"]-p2[\"x\"])==0 and (p1[\"y\"]-p2[\"y\"])==0\n return true\n elsif (p1[\"x\"]-p2[\"x\"])==0 || (p1[\"y\"]-p2[\"y\"])==0\n # points are in same column\n if (p1[\"x\"]-p2[\"x\"])==0\n compA1 = p1[\"y\"]\n compA2 = p1[\"x\"]\n compB1 = p2[\"y\"]\n compB2 = p2[\"x\"]\n if p2[\"y\"]>p1[\"y\"]\n increment = true\n else\n increment = false\n end\n compy = true\n # points are in same row\n else\n compA1 = p1[\"x\"]\n compA2 = p1[\"y\"]\n compB1 = p2[\"x\"]\n compB2 = p2[\"y\"]\n if p2[\"x\"]>p1[\"x\"]\n increment = true\n else\n increment = false\n end\n compy = false\n end\n\n counter = 0\n collisions = Array.new\n comp = compA1\n until comp==compB1\n if increment\n comp+=1\n else\n comp-=1\n end\n #need to call spaceAt() from gameboard class -> returns Space obj then use Space.getPiece() to check if it's empty or not\n if compy\n position = {\"x\" => compA2, \"y\" => comp}\n if spaceEmpty(position)\n counter+=1\n else\n return position\n end\n else\n position = {\"x\" => comp, \"y\" => compA2}\n if spaceEmpty(position)\n counter+=1\n else\n return position\n end\n end\n end\n\n if counter==(compB1-compA1)\n return true\n end\n return collisions\n end\n return false\n end", "def remove_point(index)\n MSPhysics::Newton::CurvySlider.remove_point(@address, index)\n end", "def remove_point(index)\n MSPhysics::Newton::CurvySlider.remove_point(@address, index)\n end", "def destroy\n @area = Area.find(params[:id])\n if @area.children.size == 0 and @area.name != \"localhost\"\n @area.destroy\n flash[:notice] = \"Deleted #{@area.to_s}\" \n else\n flash[:notice] = \"#{@area.to_s} not deleted. It has children or is the localhost node.\" \n end\n\n respond_to do |format|\n #format.html { redirect_to(areas_url) }\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @country_area = CountryArea.find(params[:id])\n @country_area.destroy\n\n respond_to do |format|\n format.html { redirect_to country_areas_url }\n format.json { head :no_content }\n end\n end", "def select_points_in_danger_zone(points)\n points.select { |p|\n (p.first < @warning_min_x && p.first > @error_min_x) ||\n (p.last < @warning_min_y && p.last > @error_min_y) ||\n (p.first > @warning_max_x && p.first < @error_max_x) ||\n (p.last > @warning_max_x && p.last < @error_max_y)\n }\n end", "def find_area\n\t\t@area = 0.5 * ((@point1.x - @point3.x)*(@point2.y - @point1.y) - (@point1.x - @point2.x)*(@point3.y - @point1.y)).abs\n\tend", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to points_url }\n format.json { head :no_content }\n end\n end", "def filter_locations_bu(points)\n filter_locations(points, 16.06.within(0.07), 50.41.within(0.1))\nend", "def destroy\n @interest_area = InterestArea.find(params[:id])\n @interest_area.destroy\n\n respond_to do |format|\n format.html { redirect_to interest_areas_url }\n format.json { head :no_content }\n end\n end", "def sub!(point)\r\n @x -= point.x\r\n @y -= point.y\r\n end", "def destroy\n if @base_point.destroy\n flash[:success] = \"拠点情報削除しました\"\n else\n flash[:danger] = \"拠点情報削除に失敗しました\"\n end\n redirect_to base_points_path\n end", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @business_geopoint.destroy\n respond_to do |format|\n format.html { redirect_to business_geopoints_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_geo = current_user.post_geos.find(params[:id])\n @post_geo.destroy\n\n respond_to do |format|\n format.html { redirect_to [:client, :post_geos] }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_area.destroy\n respond_to do |format|\n format.html { redirect_to core_areas_url }\n format.json { head :no_content }\n end\n end", "def prune_free_list\n i = 0\n while i < @free_rectangles.size\n j = i + 1\n while j < @free_rectangles.size\n if is_contained_in?(@free_rectangles[i], @free_rectangles[j])\n @free_rectangles.delete_at(i)\n i -= 1\n break\n end\n if is_contained_in?(@free_rectangles[j], @free_rectangles[i])\n @free_rectangles.delete_at(j)\n else\n j += 1\n end\n end\n i += 1\n end\n end", "def destroy\n @point.destroy\n respond_to do |format|\n format.html { redirect_to points_url }\n format.json { head :no_content }\n end\n end", "def removeAllCuratorEditingAreas _args\n \"removeAllCuratorEditingAreas _args;\" \n end", "def destroy\n @area_of_law = AreaOfLaw.find(params[:id])\n @area_of_law.destroy\n purge_all_pages\n\n respond_to do |format|\n format.html { redirect_to admin_areas_of_law_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @userarea.destroy\n respond_to do |format|\n format.html { redirect_to user_area_destroy_path(), notice: 'Userarea was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def check_area(point1, point2, point3)\n area = (point1.x * (point2.y - point3.y) +\n point2.x * (point3.y - point1.y) +\n point3.x * (point1.y - point2.y))/2\n if (area < 0)\n area = -area\n end\n return area\nend", "def remove(rect)\n\t\[email protected](rect)\n\tend", "def leave(p)\n ix = @array.bsearch_index { |ele| ele >= p }\n @array.delete_at(ix)\n nil\n end", "def destroy\n @point.destroy\n respond_to do |format|\n format.html { redirect_to points_url, notice: 'Point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_area = SurveyArea.find(params[:id])\n @survey_area.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_areas_url }\n format.json { head :no_content }\n end\n end", "def itemMark(c,x,y)\n $areaX1 = c.canvasx(x)\n $areaY1 = c.canvasy(y)\n c.delete 'area'\nend", "def destroy\n @point_of_interest = PointOfInterest.find(params[:id])\n @point_of_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to(point_of_interests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @userarea = Userarea.find(params[:id])\n @userarea.destroy\n respond_to do |format|\n format.html { redirect_to users_path(:id), info: 'El área de usuario fue destruida con éxito.' }\n format.json { head :no_content }\n end\n end", "def delete_range( ref )\n delete( Element.new( sheet, ref ) )\n end", "def drop_duplicated_records(pois, poi)\n\tpois.each do |xx|\n\t\txx.destroy if xx.ref == poi.ref && (!xx.lat || !xx.lng)\n\tend\nend", "def prune_question_set(round_id)\n puts 'Entering prune_question_set()'\n round = Round.find(round_id)\n QuestionOccurrence.where(round_id: round_id).where(\"index_in_round > ?\", round.max_qo_index).each{ |qo| qo.destroy; }\n puts 'Exiting prune_question_set()'\n end", "def clean\n @first_point = true\n @locate_thread.kill if @locate_thread\n if @map_thread\n @glade['toolbar_generate_map'].active = false\n @map_thread.kill\n end\n @glade['add_point'].sensitive = false\n @glade['toolbar_move'].sensitive = false\n @glade['toolbar_record_points'].sensitive = true\n @glade['toolbar_record_points'].active = false if @glade['toolbar_record_points'].active?\n @glade['toolbar_move'].active = false if @glade['toolbar_move'].active?\n @current_file = nil\n @segments = []\n @points = []\n @x_coords = Hash.new\n @planning.clear\n @glade['mainwindow'].title = PROG_NAME\n end", "def destroy\n @evaluation.area_courses.delete_all if @evaluation.is_a? Course\n @evaluation.destroy\n flash[:info] = \"¡Evaluación Eliminada!\"\n redirect_back fallback_location: evaluations_path\n end", "def removeCuratorCameraArea _obj, _args\n \"_obj removeCuratorCameraArea _args;\" \n end", "def detect_bandaid(image:, area: 2000)\n objects = detect_image(image: image)\n objects.each_with_index do |object, i|\n remove(i) if object.width * object.height > area\n end\n end", "def inArea lat, lon\n if(!inBounds(lat,lon))\n false\n else\n lastpoint = border_points.last\n y2 = 100\n x2 = 200\n a = (y2 - lat)/(x2 - lon)\n b = lat - a*lon\n icount = 0\n border_points_minus_removed.each_with_index do |point|\n\tif(intersect(lastpoint, point, a, b, lon, x2))\n\t icount += 1\n\tend\n\tlastpoint = point\n end\n (icount % 2) == 1\n end\n end", "def unclustered_points\n points.select {|point| not point.clustered? }\n end", "def destroy\n @sub_area.destroy\n respond_to do |format|\n format.html { redirect_to sub_areas_url, notice: 'Sub area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def area_clicked(leftX, topY, rightX, bottomY)\n # complete this code\n if ((mouse_x > leftX and mouse_x < rightX) and (mouse_y > topY and mouse_y < bottomY))\n true\n else\n false\n end\nend", "def remove_unused_polylines\n\t\t#Polyline.delete(self.polyline_id)\n\t\tPolyline.destroy_all([\"id = ?\", self.polyline_id])\n\t\t\n\t\tSyncronisation.destroy_all([\"route_id = ?\", self.id])\n\t\t\n\t\t#Polyline.find(:all, :conditions => [\"video_id = ?\", self.id]).each { |object| object.destroy }\n\tend", "def eliminate_coliding_areas all_possible_areas\n puts 'All areas initial: ' + all_possible_areas.values.map{|areas| areas.count }.inspect\n\n all_possible_areas_reduced = {}\n\n # Reduce areas by eliminiting the ones which touch on another\n # numbered tile\n all_possible_areas.keys.each do |numbered_tile|\n x,y = numbered_tile.split('-').map(&:to_i)\n # Create board with compased tiles on all numbered tiles minus the\n # numbered tile\n restricted_board = create_restricted_board([x,y]).to_a\n all_compased_numbered_tiles = []\n (0..(@row_count-1)).to_a.each do |i|\n (0..(@col_count-1)).to_a.each do |j|\n all_compased_numbered_tiles << [i,j] if restricted_board[i][j] == 1\n end\n end\n\n all_areas_for_numbered_tile = all_possible_areas[numbered_tile].dup\n\n all_possible_areas_reduced[numbered_tile] = all_areas_for_numbered_tile.delete_if do |area|\n next if area.count == 1\n # Skip area, hmm do I need this bellow\n # next if (@b_nl[x,y] == 1)\n # Remove area if colinding\n area & all_compased_numbered_tiles != []\n end\n end #for each numbered_tile,area_span\n\n puts 'All numbered tile areas reduced(not coliding other numbered tiles)' + all_possible_areas_reduced.values.map{|areas| areas.count }.inspect\n all_possible_areas_reduced\n end" ]
[ "0.7838925", "0.71845305", "0.5964875", "0.58766615", "0.5810191", "0.5728985", "0.56989366", "0.56181186", "0.55151284", "0.54429793", "0.5421543", "0.5416216", "0.5416216", "0.5377805", "0.5377805", "0.5373822", "0.53577256", "0.53577256", "0.53577256", "0.5337163", "0.5323409", "0.53227276", "0.5298856", "0.52942675", "0.5274213", "0.5250366", "0.5247659", "0.5247582", "0.52281827", "0.5222163", "0.519329", "0.5186032", "0.5181191", "0.5171674", "0.5154648", "0.51408476", "0.5135749", "0.51339877", "0.5126545", "0.5124889", "0.5107491", "0.51068443", "0.5105473", "0.5096007", "0.50925547", "0.5084527", "0.5082485", "0.5082449", "0.5077366", "0.50740737", "0.5067445", "0.5063782", "0.5057365", "0.5056478", "0.50545806", "0.5031175", "0.50259835", "0.5025905", "0.5025905", "0.5018711", "0.5015607", "0.5012156", "0.500886", "0.499777", "0.49955553", "0.4987139", "0.49726102", "0.49709317", "0.4958396", "0.4958396", "0.4958396", "0.4955022", "0.49527186", "0.49374202", "0.49370867", "0.49348983", "0.4931607", "0.49192497", "0.49112675", "0.49021995", "0.4897974", "0.48801306", "0.48790112", "0.4877405", "0.48746985", "0.48736268", "0.48720902", "0.48643002", "0.48641518", "0.48634416", "0.48630893", "0.48595947", "0.4853961", "0.4847536", "0.48429945", "0.48395988", "0.48311383", "0.48245695", "0.48243085", "0.48189765" ]
0.8895161
0
outputs slides in the slides folders
def slides(folder = "slides") results = [] Dir["./source/#{folder}/_*.{html,md}.*"].each do |slide_path| slide_path = slide_path.gsub("./source/", "").gsub("/_", "/").gsub(/$_/, "") results << slide_path end results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slides\n @file_manager.slide_files\n end", "def latex(title, basedir = \"\")\n\t\t# Open the file to write\n\t\tbaseName = File.basename(@file.path, \".svg\")\n\t\tfile = File.new(baseName + \"#{@latex_file_count}\" + \".tex\", \"w\")\n\t\t\n\t\t# Print the \n\t\t(@latex_count..@count - 1).each do |i|\n\t\t\tfile.puts(\"\\\\begin{slide}{#{title}}\\n\" +\n\t\t\t\t\t \" \\\\centering\\n\" +\n \" \\\\includegraphics[]{\" + basedir + baseName + \"#{i}}\\n\" +\n \"\\\\end{slide}\\n\\n\")\n\t\tend\n\t\t\n\t\t# Finalize\n\t\t@latex_count = @count\n\t\t@latex_file_count += 1\n\t\tfile.close\n\tend", "def slides\n @slides = Array.new\n @files.each do |f|\n if f.name.include? 'ppt/slides/slide'\n @slides.push Slide.new(self, f.name)\n end\n end\n @slides.sort{|a,b| a.slide_num <=> b.slide_num}\n end", "def index\n @slides = Slide.all\n end", "def generate(destination)\n destination = Pathname(destination).expand_path\n # First, we find all of the renderable files in the project and iterate over that list.\n #\n # Next, we create a [Page](./soundwave/page.html) object for each file and write it to\n # the destination path.\n find_paths.each do |path|\n page = Page.new(self, path)\n page.write(destination.join(page.output_path))\n end\n end", "def create_directory(name_slide, counter)\n puts 'Creating Nested Slide(s) Directory...'\n # NEW: Create a nested file with the name given\n Dir.mkdir \"./slides_archive/#{name_slide}/\" unless File.exist? \"./slides_archive/#{name_slide}/\"\n puts \"DONE ✓ (Created No. #{counter} nested directory)\"\n end", "def slides\n slides = Array.new\n move_dirs = slide_dirs\n\n move_dirs.length.times do |i|\n new_loc = [@location[0] + move_dirs[i][0], \n @location[1] + move_dirs[i][1]]\n \n next unless @board.valid_location?(*new_loc)\n slides << new_loc if @board[*new_loc].nil?\n end\n \n slides\n end", "def create_parent_directory\n puts 'Creating Main Directory...'\n # CREATE: Make a main directory to store in slides\n Dir.mkdir './slides_archive/' unless File.exist? './slides_archive/'\n puts 'DONE ✓\\n'\n end", "def example_markdown_targets()\n target_files = []\n\n example_dir = File.join(K4_ROOT, 'example')\n ext = 'md'\n filelist = FileList[File.join(example_dir, \"*.#{ext}\")]\n filelist.each do |source_path|\n source_basename = File.basename(source_path)\n next if source_basename =~ /^_/\n\n source_basename = source_basename.gsub(/#{ext}$/, 'html')\n target_path = File.join(example_dir, source_basename)\n # File.delete(target_path) if File.exists?(target_path)\n\n file(target_path) do |t, args|\n puts t.name\n src = File.read(source_path)\n compiler_ = MarkdownCompiler.new(@compiler)\n html_source = compiler_.to_slide(src)\n File.open(target_path, 'w') do |io|\n io.write(html_source)\n end\n end\n target_files << target_path\n end\n return target_files\n end", "def index\n @contents = @slide.contents\n redirect_to new_presentation_slide_content_path(@presentation, @slide) unless @contents.any?\n end", "def write_pages\n pages = Dir[\"#{source_path}/*.html\"].each do |p_name|\n page = Page.new(source_path, File.basename(p_name))\n # TODO allow user to specify which layouts a page should use \n page.render(site_payload, layouts.select{|x| x.name == \"application.html\"})\n page.write(destination_path)\n end\n end", "def files_to_page\n insert_to_page('div', html)\n insert_to_page('script', js, false)\n insert_to_page('style', style, false)\n end", "def slides\n @id = params[:id]\n @item = Item.find(@id)\n begin\n @slides = @item.images.where(['publish=?', true]).order('position')\n rescue => error\n flash[:error] = error.message\n ensure\n # no slides found so create some\n if @slides.empty?\n @slides = @item.create_images\n end\n end\n unless @id.nil? || @slides.nil? || @slides.empty?\n respond_to do |format|\n format.xml\n end\n else\n flash[:error] = 'Unable to locate process slides for id number ' + params[:id].to_s + '.'\n end\n end", "def render\n STDERR.puts(\"render to #{self.output}\")\n if self.output and File.directory? self.output\n Dir.chdir(self.base)\n command = [\"jekyll\", \".\", self.output].join(\" \")\n STDERR.puts(\"running [[ #{command} ]]\")\n IO.popen(command) { |io|\n while (line = io.gets) do\n STDERR.puts line\n end\n } \n \n end\n STDERR.puts(\"render complete\")\n end", "def generate_index_files\n @folders.each do |folder, files|\n puts \" + Creating #{@dest}/#{folder}/index.html\" if @verbose\n File.open(\"#{@dest}/#{folder}/index.html\", \"w\") do |index|\n title = \"Rails Plug-in for #@name #@version\"\n index.write(\"<html><head><title>#{title}</title></head>\\n\")\n index.write(\"<body>\\n\")\n index.write(\"<h2>#{title}</h2>\\n\")\n extra_links = create_extra_links()\n index.write(\"<p>#{extra_links}</p>\\n\") if extra_links \n files.each { |fn|\n puts(\" - Adding #{fn}\") if @verbose\n index.write(\"&nbsp;&nbsp;<a href=\\\"#{fn}\\\">#{fn}</a><br/>\\n\")\n }\n index.write(\"<hr size=\\\"1\\\"/><p style=\\\"font-size: x-small\\\">Generated with RailsPluginPackageTask<p>\")\n index.write(\"</body>\\n\")\n index.write(\"</html>\\n\")\n end\n end\n end", "def generate_index_files\n @folders.each do |folder, files|\n puts \" + Creating #{@dest}/#{folder}/index.html\" if @verbose\n File.open(\"#{@dest}/#{folder}/index.html\", \"w\") do |index|\n title = \"Rails Plug-in for #@name #@version\"\n index.write(\"<html><head><title>#{title}</title></head>\\n\")\n index.write(\"<body>\\n\")\n index.write(\"<h2>#{title}</h2>\\n\")\n extra_links = create_extra_links()\n index.write(\"<p>#{extra_links}</p>\\n\") if extra_links\n files.each { |fn|\n puts(\" - Adding #{fn}\") if @verbose\n index.write(\"&nbsp;&nbsp;<a href=\\\"#{fn}\\\">#{fn}</a><br/>\\n\")\n }\n index.write(\"<hr size=\\\"1\\\"/><p style=\\\"font-size: x-small\\\">Generated with RailsPluginPackageTask<p>\")\n index.write(\"</body>\\n\")\n index.write(\"</html>\\n\")\n end\n end\n end", "def save_slide_as slide_number,output_path,output_format\n begin\n \n if @filename == ''\n raise('input file not specified')\n end \n \n if output_path == ''\n raise('output path not specified')\n end\n \n if slide_number == ''\n raise('slide number not specified')\n end\n \n if output_format == ''\n raise('output format not specified')\n end\n \n # if not File.exist?(inputFile)\n # raise('input file doesn't exist.')\n # end\n \n \n \n str_uri = $product_uri + '/slides/'+@filename+'/slides/'+slide_number.to_s+'?format=' + output_format\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response_stream = RestClient.get(str_signed_uri,{:accept=>'application/json'})\n \n \n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n \n if valid_output == '' \n output_path = $out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + slide_number.to_s + '.' + output_format\n Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)\n return ''\n else\n return valid_output\n end\n \n rescue Exception=>e\n print e \n end \n end", "def render_document(input, outdir, outname, format, vars)\r\n \r\n \r\n #TODO: Clarify the following\r\n # on Windows, Tempdir contains a drive letter. But drive letter\r\n # seems not to work in pandoc -> pdf if the path separator ist forward\r\n # slash. There are two options to overcome this\r\n #\r\n # 1. set tempdir such that it does not contain a drive letter\r\n # 2. use Dir.mktempdir but ensure that all provided file names\r\n # use the platform specific SEPARATOR\r\n #\r\n # for whatever Reason, I decided for 2.\r\n \r\n tempfile = input\r\n tempfilePdf = \"#{@tempdir}/x.TeX.md\".to_osPath\r\n tempfileHtml = \"#{@tempdir}/x.html.md\".to_osPath\r\n outfilePdf = \"#{outdir}/#{outname}.pdf\".to_osPath\r\n outfileDocx = \"#{outdir}/#{outname}.docx\".to_osPath\r\n outfileHtml = \"#{outdir}/#{outname}.html\".to_osPath\r\n outfileRtf = \"#{outdir}/#{outname}.rtf\".to_osPath\r\n outfileLatex = \"#{outdir}/#{outname}.latex\".to_osPath\r\n outfileText = \"#{outdir}/#{outname}.txt\".to_osPath\r\n outfileSlide = \"#{outdir}/#{outname}.slide.html\".to_osPath \r\n \r\n #todo: handle latexStyleFile by configuration\r\n latexStyleFile = File.dirname(File.expand_path(__FILE__))+\"/../../ZSUPP_Styles/default.latex\"\r\n latexStyleFile = File.expand_path(latexStyleFile).to_osPath\r\n\r\n vars_string=vars.map.map{|key, value| \"-V #{key}=#{value.esc}\"}.join(\" \")\r\n \r\n @log.info(\"rendering #{outname} as [#{format.join(', ')}]\")\r\n \r\n if $?.success? then\r\n \r\n if format.include?(\"pdf\") then\r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfilePdf)\r\n \r\n cmd=\"pandoc -S #{tempfilePdf.esc} --toc --standalone --latex-engine xelatex --number-sections #{vars_string}\" +\r\n \" --template #{latexStyleFile.esc} --ascii -o #{outfilePdf.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"latex\") then\r\n \r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfilePdf)\r\n \r\n cmd=\"pandoc -S #{tempfilePdf.esc} --toc --standalone --latex-engine xelatex --number-sections #{vars_string}\" +\r\n \" --template #{latexStyleFile.esc} --ascii -o #{outfileLatex.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"html\") then\r\n \r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileHtml.esc}\"\r\n \r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"docx\") then\r\n \r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileDocx.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"rtf\") then\r\n \r\n ReferenceTweaker.new(\"html\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -o #{outfileRtf.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"txt\") then\r\n \r\n ReferenceTweaker.new(\"pdf\").prepareFile(tempfile, tempfileHtml)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --self-contained --ascii --number-sections #{vars_string}\" +\r\n \" -t plain -o #{outfileText.esc}\"\r\n `#{cmd}`\r\n end\r\n \r\n if format.include?(\"slide\") then\r\n \r\n ReferenceTweaker.new(\"slide\").prepareFile(tempfile, tempfilePdf)\r\n \r\n cmd=\"pandoc -S #{tempfileHtml.esc} --toc --standalone --number #{vars_string}\" +\r\n \" --ascii -t dzslides --slide-level 2 -o #{outfileSlide.esc}\"\r\n `#{cmd}`\r\n end\r\n else\r\n \r\n @log.error \"failed to perform #{cmd}\"\r\n #TODO make a try catch block kere\r\n \r\n end\r\n \r\n end", "def index\n #@deck = Powerpoint::Presentation.new\n # Creating an introduction slide:\n # title = 'Bicycle Of the Mind'\n # subtitle = 'created by Steve Jobs'\n # @deck.add_intro title, subtitle\n\n # Creating a text-only slide:\n # Title must be a string.\n # Content must be an array of strings that will be displayed as bullet items.\n # title = 'Why Mac?'\n # content = ['Its cool!', 'Its light.']\n # @deck.add_textual_slide title, content\n\n # Creating an image Slide:\n # It will contain a title as string.\n # and an embeded image\n #title = 'Everyone loves Macs:'\n #subtitle = 'created by Steve Jobs'\n #content = ['Its cool!', 'Its light.']\n #image_path = ActionController::Base.helpers.asset_path('/app/assets/images/ss.png').to_s\n #image = view_context.image_path 'ss.png'\n #url = 'http://localhost:3000' + image\n #image = view_context.image_path 'https://res.cloudinary.com/indoexchanger/image/upload/v1501168483/qxbvro2yhvibid0ra5rp.jpg'\n #puts image\n #@deck.add_pictorial_slide title, url\n #@deck.add_textual_slide title, subtitle\n #\n\n # Specifying coordinates and image size for an embeded image.\n # x and y values define the position of the image on the slide.\n # cx and cy define the width and height of the image.\n # x, y, cx, cy are in points. Each pixel is 12700 points.\n # coordinates parameter is optional.\n # coords = {x: 124200, y: 3356451, cx: 2895600, cy: 1013460}\n # @deck.add_pictorial_slide title, image_path, coords\n\n # Saving the pptx file to the current directory.\n #@deck.save('mps.pptx')\n # @products = Product.all\n # \n \n @presentation = RubySlides::Presentation.new\n \n chart_title = \"Chart Slide exported from ruby\"\n chart_series = [\n {\n column: \"Col1\",\n rows: [\"Lorem\", \"Ipsum\", \"Dolar\", \"Ismet\"],\n values: [\"1\", \"3\", \"5\", \"7\"]\n },\n {\n column: \"Col2\",\n color: 'FF9800',\n rows: [\"A\", \"B\", \"C\", \"D\"],\n values: [\"2\", \"4\", \"6\", \"8\"]\n }\n ]\n @presentation.chart_slide chart_title, chart_series\n\n @presentation.save('mps.pptx')\n\n @products = Product.order('created_at DESC')\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"all_products.xlsx\"'\n }\n end\n end", "def generateDocument(input, outdir, outname, format, vars, editions=nil, snippetfiles=nil) \r\n \r\n \r\n # combine the input files\r\n \r\n temp_filename = \"#{@tempdir}/x.md\".to_osPath\r\n collect_document(input, temp_filename)\r\n \r\n # process the snippets\r\n \r\n if not snippetfiles.nil?\r\n snippets={}\r\n snippetfiles.each{|f|\r\n if File.exists?(f)\r\n type=File.extname(f)\r\n case type\r\n when \".yaml\" \r\n x=YAML.load(File.new(f))\r\n when \".xlsx\"\r\n x=load_snippets_from_xlsx(f)\r\n else\r\n @log.error(\"Unsupported File format for snipptets: #{type}\")\r\n x={}\r\n end\r\n snippets.merge!(x)\r\n else\r\n @log.error(\"Snippet file not found: #{f}\")\r\n end\r\n }\r\n \r\n replace_snippets_in_file(temp_filename, snippets) \r\n end\r\n \r\n \r\n if editions.nil?\r\n # there are no editions\r\n render_document(temp_filename, outdir, outname, format, vars)\r\n else\r\n # process the editions\r\n editions.each{|edition_name, properties|\r\n edition_out_filename = \"#{outname}_#{properties[:filepart]}\"\r\n edition_temp_filename = \"#{@tempdir}/#{edition_out_filename}.md\"\r\n vars[:title] = properties[:title]\r\n\r\n if properties[:debug]\r\n process_debug_info(temp_filename, edition_temp_filename, edition_name.to_s)\r\n lvars=vars.clone \r\n lvars[:linenumbers] = \"true\"\r\n render_document(edition_temp_filename, outdir, edition_out_filename, [\"pdf\", \"latex\"], lvars) \r\n else \r\n filter_document_variant(temp_filename, edition_temp_filename, edition_name.to_s) \r\n render_document(edition_temp_filename, outdir, edition_out_filename, format, vars) \r\n end\r\n }\r\n end\r\n end", "def open_narration(slide_no)\n if @type == 'm4a'\n @files.extract(\"ppt/media/media#{slide_no}.m4a\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.m4a\") rescue\n $filename+'media'+slide_no.to_s+'.m4a'\n end\n if @type == 'wav'\n\n @files.extract(\"ppt/media/media#{slide_no}.wav\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.wav\") rescue\n $filename+'media'+slide_no.to_s+'.wav'\n\n end\n end", "def generate_Song_Pages\n template_doc = File.open(\"lib/templates/song.html.erb\")\n template = ERB.new(template_doc.read)\n Song.all.each do |song|\n File.write(\"_site/song/#{song.url}\", template.result(binding))\n end\n end", "def generate_pdf(filename)\n @destination_path = \"#{Rails.root}/public/files/\"+filename.remove('pptx')+'pdf'\n Libreconv.convert( @files.to_s, @destination_path, nil, 'pdf:writer_pdf_Export')\n # Docsplit.extract_pdf(@files.to_s)\n\n # Creates the manipulated pptx file physically\n FileUtils.mv @files.to_s, \"#{Rails.root}/public/files/\"+filename\n @destination_path\n end", "def loadSlides(filename)\n return unless filename.end_with? '.md'\n\n content = File.read(File.join(Showoff::Locale.contentPath, filename))\n\n # if there are no !SLIDE markers, then make every H1 define a new slide\n unless content =~ /^\\<?!SLIDE/m\n content = content.gsub(/^# /m, \"<!SLIDE>\\n# \")\n end\n\n slides = content.split(/^<?!SLIDE\\s?([^>]*)>?/)\n slides.shift # has an extra empty string because the regex matches the entire source string.\n\n # this is a counter keeping track of how many slides came from the file.\n # It kicks in at 2 because at this point, slides are a tuple of (options, content)\n seq = slides.size > 2 ? 1 : nil\n\n # iterate each slide tuple and add slide objects to the array\n slides.each_slice(2) do |data|\n options, content = data\n @slides << Showoff::Presentation::Slide.new(options, content, :section => @name, :name => filename, :seq => seq)\n seq +=1 if seq\n end\n\n end", "def siblings\n # List other markdown files in the same folder.\n\n # Sibling folder.\n folder = File.dirname @absolute_path\n\n Slimdown::Folder.new(folder).pages\n end", "def index\n @presentation = Presentation.friendly.find(params[:presentation_id])\n @slides = @presentation.slides.order(sort_order: :asc)\n redirect_to new_presentation_slide_path(@presentation) unless @slides.any?\n\n add_breadcrumb @presentation.name, presentation_path(@presentation)\n add_breadcrumb 'Slides', presentation_slides_path(@presentation)\n\n end", "def generate(site)\n # layout: tutorial_slides\n # layout: base_slides\n\n site.pages.select { |page| SLIDE_LAYOUTS.include? page.data['layout'] }.each do |page|\n dir = File.dirname(File.join('.', page.url))\n page2 = Jekyll::Page.new(site, site.source, dir, page.name)\n page2.data['layout'] = 'slides-plain'\n page2.basename = if page2.data.key?('lang')\n \"slides-plain_#{page2.data['lang'].upcase}\"\n else\n 'slides-plain'\n end\n page2.content = page2.content.gsub(/^name:\\s*([^ ]+)\\s*$/) do\n anchor = ::Regexp.last_match(1)\n\n \"<span id=\\\"#{anchor.strip}\\\"><i class=\\\"fas fa-link\\\" aria-hidden=\\\"true\\\"></i> #{anchor}</span>\"\n end\n if page2.data.key?('redirect_from')\n page2.data['redirect_from'].map { |x| x.gsub!(%r{/slides}, '/slides-plain') }\n end\n\n site.pages << page2\n end\n end", "def show\n @contents = @slide.contents\n end", "def generate_gallery_index\n galleries_dir = File.join(@site_path, @config[:gallery_path])\n\n if File.exist?(galleries_dir)\n photo_root = File.join(@config[:site_path], @config[:photo_path])\n\n @log.debug(\" generating the gallery index\")\n\n links = {}\n\n Find.find(galleries_dir) do |path|\n if path =~ /\\w+\\.gallery/\n gallery = YAML.load_file(path)\n\n gallery[:photos].each_with_index do |photo_path, i|\n desc_file = \"#{photo_path.split('.')[0]}.description\"\n gallery[:photos][i] = YAML.load_file(File.join(@site_path, @config[:photo_path], desc_file))\n gallery[:photos][i][:path] = File.join(photo_root, photo_path)\n gallery[:photos][i][:thumb] = File.join(photo_root, File.dirname(photo_path), gallery[:photos][i][:thumb])\n end\n\n # Sort the images in chronological (alphabetical) order.\n #gallery[:photos].sort! {|x,y| x[:path] <=> y[:path]}\n\n # Mark up the description text.\n gallery[:description] = Markdown.new(gallery[:description]).to_html\n\n # Pick the name for the result file.\n gallery_path = path.gsub('gallery', 'html')\n\n File.open(gallery_path, 'w') do |f|\n page = {}\n page[:title] = gallery[:name]\n page[:body] = generate_gallery(gallery)\n\n f << generate_page(page)\n end\n\n links[gallery[:name]] = gallery_path.gsub(@site_path, @config[:site_path])\n end\n end\n\n page = {}\n page[:title] = @config[:gallery_title]\n page[:body] = \"\"\n\n links.keys.sort.each do |k|\n page[:body] << \"<h3><a href='#{links[k]}'>#{k}</a></h3>\"\n end\n\n File.open(File.join(@site_path, @config[:gallery_path], 'index.html'), 'w') do |f|\n f << generate_page(page)\n end\n end\n end", "def build(ostream = nil)\n if File.exists? root(:output)\n raise Errno::EEXISTS unless File.directory? root(:output)\n else\n Dir.mkdir root(:output)\n end\n\n begin\n all.each do |page|\n ostream << \" * #{page.output_path}\\n\" if ostream\n\n begin\n rendered = page.render\n force_file_open(page.output_path) { |file| file << rendered }\n\n rescue RenderError => e\n ostream << \" *** Error: #{e.to_s}\".gsub(\"\\n\", \"\\n *** \") << \"\\n\"\n end\n end\n\n rescue NoGemError => e\n ostream << \" *** Error: #{e.message}\\n\"\n end\n end", "def presentation\n\tif not @arc_logz.empty?\n\t\t@arc_logz.each do |log|\n\t\t\tputs \"#{FYEL}Archived Log File Found#{HC}#{FWHT}: #{log.chomp}#{RS}\"\n\t\tend\n\tend\n\tif not @bin_logz.empty?\n\t\t@bin_logz.each do |log|\n\t\t\tputs \"#{FGRN}Binary Log File Found#{HC}#{FWHT}: #{log.chomp}#{RS}\"\n\t\tend\n\tend\n\tif not @logz.empty?\n\t\[email protected] do |log|\n\t\t\tputs \"#{FGRN}Non-Binary Log File Found#{HC}#{FWHT}: #{log.chomp}#{RS}\"\n\t\tend\n\tend\n\tputs\nend", "def index\n @slideshows = Slideshow.all\n end", "def get_output_folder\n File.join( Rails.root, 'public', 'output' )\n end", "def set_presentation\n @presentation = Presentation.find(params[:id])\n @jury = Jury.find params[:jury_id] rescue nil\n @current_template = @jury ? :jury : :show\n @pages = Dir.entries(\"public/pdf/#{@presentation.path}\") - ['.', '..']\n @pages.sort!\n end", "def create_docs\n directory 'templates/docs', 'docs'\nend", "def run\n\t\tself.print_hosts # generate all the host_*.html files\n\t\tself.print_index # generate the index.html file\n\t\tself.print_vulns # generate all the vuln_*.html files\n\t\tself.print_vuln_overview # generate the vuln_overview.html file\n\tend", "def create\n @mode = 'I'\n render 'admin/slides/slide'\n end", "def slide(dir)\n @row, @col = slide_pos(dir)\n make_king\n nil\n end", "def slidedown(markdown)\n slides = []\n begin\n slide = nil\n markdown.split(\"\\n\").each do |line|\n case line\n when /^\\#\\s+/\n # New slide\n slides << slide if slide\n title = line[1..-1].strip\n if title =~ /^\\!\\[.*\\]\\(.*\\)/\n # Image slide\n /^\\!\\[.*\\]\\((?<image_url>.*)\\)/ =~ title\n slide = {:image => image_url, :code => []}\n else\n # Normal slide\n slide = {:code => [], :title => title}\n end\n else\n slide[:code] << line\n end\n end\n slides << slide if slide\n end\n\n slides.each do |item|\n item[:code] = item[:code].join(\"\\n\")\n end\n\n result = \"\"\n slides.each_with_index do |slide, i|\n html = \"<header><h2>#{slide[:title]}</h2></header>\"\n cover = false\n if slide[:code].strip == ''\n # Cover slide\n cover = true\n else\n # Normal slide\n html << markdown(slide[:code])\n end\n\n if slide[:image]\n # Pure image slide\n html = \"<div class='slide cover' id='slide_#{i}'><div><section><img src='#{slide[:image]}'/></section></div></div>\"\n else\n # Normal slide\n classes = ['slide']\n classes << 'cover' if cover\n html = \"<div class=\\\"#{classes.join(' ')}\\\" id=\\\"slide_#{i}\\\"><div><section>#{html}</section></div></div>\"\n end\n result << html\n end\n result\n end", "def save_slide(name, slide_index, format, out_path, options = nil, width = nil, height = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil)\n save_slide_with_http_info(name, slide_index, format, out_path, options, width, height, password, folder, storage, fonts_folder)\n nil\n end", "def convertHtmlToMarkdown\n root = pathExports\n n = 1\n Pathname.glob(pathExports() + \"**/*.html\").each do |p|\n puts \"File \" + n.to_s + \": \" + p.to_s\n n = n + 1\n infile = p.to_s\n outfile = p.sub_ext(\".md\").to_s\n command = \"pandoc -f html -t markdown -o #{outfile} #{infile}\"\n puts command\n sh(command)\n end\nend", "def dodir(dirname,output)\r\n Dir.foreach(dirname) do |content|\r\n if(content!=\".\" and content!=\"..\" and not content=~/^\\./) then\r\n begin\r\n if(File.directory?(dirname+'/'+content)) then\r\n output.puts \"--- START: [\"+content+\"] ---\\n\"\r\n dodir(dirname+'/'+content,output)\r\n output.puts \"--- END: [\"+content+\"] ---\\n\"\r\n else\r\n dofile(dirname+'/'+content,output) if content=~/.py$/\r\n end\r\n end \r\n end \r\n end\r\nend", "def index\n @slides = Slide.paginate(:page => params[:page], :per_page => 10).order('id DESC').accessible_by(current_ability)\n end", "def index\n @slides = Slide.paginate(:page => 1, :per_page => 10)\n @page = 'slides'\n end", "def post_processing_slides( content )\n \n # 1) add slide breaks\n \n if config.slide? # only allow !SLIDE directives fo slide breaks?\n # do nothing (no extra automagic slide breaks wanted)\n else \n if (@markup_type == :markdown && Markdown.lib == 'pandoc-ruby') || @markup_type == :rest\n content = add_slide_directive_before_div_h1( content )\n else\n if config.header_level == 2\n content = add_slide_directive_before_h2( content )\n else # assume level 1\n content = add_slide_directive_before_h1( content )\n end\n end\n end\n\n\n dump_content_to_file_debug_html( content )\n\n # 2) use generic slide break processing instruction to\n # split content into slides\n\n slide_counter = 0\n\n slides = []\n slide_buf = \"\"\n \n content.each_line do |line|\n if line.include?( '<!-- _S9SLIDE_' )\n if slide_counter > 0 # found start of new slide (and, thus, end of last slide)\n slides << slide_buf # add slide to slide stack\n slide_buf = \"\" # reset slide source buffer\n else # slide_counter == 0\n # check for first slide with missing leading SLIDE directive (possible/allowed in takahashi, for example)\n ## remove html comments and whitspaces (still any content?)\n ### more than just whitespace? assume its a slide\n if slide_buf.gsub(/<!--.*?-->/m, '').gsub( /[\\n\\r\\t ]/, '').length > 0\n logger.debug \"add slide with missing leading slide directive >#{slide_buf}< with slide_counter == 0\"\n slides << slide_buf\n slide_buf = \"\"\n else\n logger.debug \"skipping slide_buf >#{slide_buf}< with slide_counter == 0\"\n end\n end\n slide_counter += 1\n end\n slide_buf << line\n end\n \n if slide_counter > 0\n slides << slide_buf # add slide to slide stack\n slide_buf = \"\" # reset slide source buffer \n end\n\n\n slides2 = []\n slides.each do |source|\n slides2 << Slide.new( source, config )\n end\n\n\n puts \"#{slides2.size} slides found:\"\n \n slides2.each_with_index do |slide,i|\n print \" [#{i+1}] \"\n if slide.header.present?\n print slide.header\n else\n # remove html comments\n print \"-- no header -- | #{slide.content.gsub(/<!--.*?-->/m, '').gsub(/\\n/,'$')[0..40]}\"\n end\n puts\n end\n \n \n # make content2 and slide2 available to erb template\n # -- todo: cleanup variable names and use attr_readers for content and slide\n\n ### fix: use class SlideDeck or Deck?? for slides array?\n \n content2 = \"\"\n slides2.each do |slide|\n content2 << slide.to_classic_html\n end\n \n @content = content2\n @slides = slides2 # strutured content\n end", "def link_to_slides(attrs = {})\n link_to(\"slides\", \"./slides.html\", attrs)\n end", "def rebuild_pptx\n Zip::File.open(@files.to_s, Zip::File::CREATE) { |zipfile|\n @slides.each do |f|\n if f.changed\n # Temporary file to store the manipulated xml\n temp_file = Tempfile.new(f.slide_file_name)\n # Store the manipulated xml inside the file\n temp_file.write(f.raw_xml)\n temp_file.close\n # Collect temporary files to unlink them later\n @temp_files << temp_file\n # Replace the original slide with the new one\n zipfile.replace(f.slide_xml_path, temp_file.path)\n end\n end\n }\n end", "def htmls_to_pdfs(opts)\n base_dir = base_dir(opts[:base_dir])\n Html2Pdf::CLI.start [\n \"export\",\n \"--base-dir\",\n base_dir,\n \"--recursive\"]\n end", "def output(path)\n if @first_pass\n @first_pass = false\n FileUtils.rm_rf path if clean_first\n end\n FileUtils.mkdir_p path\n \n if quick_mode\n posts.chop! 20\n end\n @stats.reset\n \n unless metadata.nil? || !metadata['static'].is_a?(Array)\n stats.record(:site, :static) do\n for dir in metadata['static']\n FileUtils.cp_r File.join(source_dir, dir), File.join(path, dir)\n end\n end\n end\n \n before = Time.now\n Dir.chdir(path) do\n stats.record(:site, :pages) do\n pages.each do |name, page|\n FileUtils.mkdir_p page.output_dir unless File.directory?(page.output_dir)\n if check_mtime\n if File.file?(page.output_path) && File.mtime(page.output_path) > page.source_mtime\n next\n end\n page.load\n end\n File.open(page.output_path, 'w') { |f| f.write page.render }\n end\n end\n \n stats.record(:site, :posts) do\n posts.each do |post|\n FileUtils.mkdir_p post.output_dir unless File.directory?(post.output_dir)\n if check_mtime\n if File.file?(post.output_path) && File.mtime(post.output_path) > post.source_mtime\n next\n end\n post.load\n end\n File.open(post.output_path, 'w') { |f| f.write post.render }\n end\n end\n \n stats.record(:site, :stylesheets) do\n unless stylesheets.nil?\n stylesheets.each do |name, stylesheet|\n FileUtils.mkdir_p stylesheet.output_dir unless File.directory?(stylesheet.output_dir)\n if check_mtime\n if File.file?(stylesheet.output_path) && File.mtime(stylesheet.output_path) > stylesheet.source_mtime\n next\n end\n stylesheet.load\n end\n File.open(stylesheet.output_path, 'w') { |f| f.write stylesheet.render }\n end\n end\n end\n \n stats.record(:site, :indices) do\n unless year_index.nil? && month_index.nil? && day_index.nil?\n posts.each_index do |dir|\n posts = self.posts.from(dir)\n Dir.chdir(dir) do\n context = dir.split('/').collect { |c| c.to_i }\n date_index = case context.length\n when 1\n year_index\n when 2\n month_index\n when 3\n day_index\n else\n nil\n end\n date_index.posts = posts\n date_index.context = Time.local *context\n File.open('index.html', 'w') { |f| f.write date_index.render }\n end\n end\n end\n \n unless tag_index.nil?\n tags.each do |tag|\n tag_index.context = tag.name\n tag_index.posts = tag\n FileUtils.mkdir_p tag.output_dir\n File.open(tag.output_path, 'w') { |f| f.write tag_index.render }\n end\n end\n end\n end\n \n self.stats.display if show_statistics\n end", "def produce_moments_files(seconds,src_path,out_path,htmlfilename,resizewidth)\n c = 0\n moments = create_pics_moments(seconds,src_path)\n make_output_dir(out_path)\n File.open(\"#{out_path}/#{htmlfilename}\", 'a') do |htmlfile| # creates and writes html file\n #htmlfile << %&header\\n& # insert here html code before pictures\n while c < moments.size\n dir = \"#{out_path}/#{c}\" # path to output subdirectory\n rdir = dir + '/resized' # path to subdirectory with resized pictures\n make_output_dir(dir) # making output subdir\n make_output_dir(rdir) # making resized subdir\n htmlfile << %&<div class=\"images\" id=\"set#{c}\">\\n& # opening pictures set div\n moments[c].each do |pic| \n #copy_pic(pic,dir)\n resize_pic(pic,900,dir) # instead of copy_pic\n puts 'copied: ' + pic\n resize_pic(pic,resizewidth,rdir)\n htmlfile << %& <a target=\"_blank\" href=\"../_images/#{c}/#{File.basename(pic)}\"><img src=\"../_images/#{c}/resized/#{File.basename(pic)}\" alt=\"#{File.basename(pic)}\"></a>\\n& # main html\n end\n c +=1\n htmlfile << %&</div>\\n& # closing pictures set div\n end\n #htmlfile << %&footer\\n& #insert here html code after pictures\n end\nend", "def write(dest_prefix, dest_suffix = nil)\n #self.render(@site.layouts, @site.site_payload) if self.output == nil\n\n path = File.join(dest_prefix, CGI.unescape(self.url))\n dest = File.dirname(path)\n\n # Create directory\n FileUtils.mkdir_p(dest) unless File.exist?(dest)\n\n # write partials\n #@partials.each do |partial|\n # @settings[partial].write if @settings[partial] != nil\n #end\n\n # Debugging - create html version of PDF\n #File.open(\"#{path}.html\", 'w') {|f| f.write(self.output) } if @settings[\"debug\"]\n #@settings.delete(\"debug\")\n\n self.output = File.read(\"#{path}\") if @name != \"/.pdf\"\n\n # Build PDF file\n fix_relative_paths\n kit = PDFKit.new(self.output, @settings)\n file = kit.to_file(File.join(dest_prefix, @name))\n end", "def post_processing_slides( content )\r\n \r\n # 1) add slide break \r\n \r\n if (@markup_type == :markdown && @markdown_libs.first == 'pandoc-ruby') || @markup_type == :rest\r\n content = add_slide_directive_before_div_h1( content )\r\n else\r\n content = add_slide_directive_before_h1( content )\r\n end\r\n\r\n dump_content_to_file_debug_html( content )\r\n\r\n # 2) use generic slide break processing instruction to\r\n # split content into slides\r\n\r\n slide_counter = 0\r\n\r\n slides = []\r\n slide_source = \"\"\r\n \r\n content.each_line do |line|\r\n if line.include?( '<!-- _S9SLIDE_' ) or\r\n line.include?( '<!-- _S9TRANSITION_' ) then\r\n if slide_counter > 0 then # found start of new slide (and, thus, end of last slide)\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer\r\n end\r\n slide_counter += 1\r\n end\r\n slide_source << line\r\n end\r\n \r\n if slide_counter > 0 then\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer \r\n end\r\n\r\n ## split slide source into header (optional) and content/body\r\n ## plus check for (css style) classes\r\n\r\n slides2 = []\r\n transition = nil\r\n transitioncount = 0\r\n slides.each do |slide_source|\r\n slide = Slide.new\r\n\r\n ## check for css style classes \r\n from = 0\r\n while (pos = slide_source.index( /<!-- _S9(SLIDE|STYLE|TRANSITION)_(.*?)-->/m, from ))\r\n type = $1.downcase\r\n klass = $2.strip\r\n if $1 == 'TRANSITION'\r\n transition = klass\r\n transitioncount = 0\r\n klass = 'middle'\r\n logger.debug \\\r\n\" adding css classes (plus middle for #{transition}) from pi #{type}: #{klass}\"\r\n slide.transition = transition + '-title'\r\n else\r\n if transition\r\n transitioncount += 1\r\n slide.transition = \"#{transition}[#{transitioncount}]\"\r\n logger.debug \\\r\n\" adding css classes (plus #{transition}) from pi #{type}: #{klass}\"\r\n else\r\n logger.debug \" adding css classes from pi #{type}: #{klass}\"\r\n end\r\n end\r\n\r\n if slide.classes.nil?\r\n slide.classes = klass\r\n else\r\n slide.classes << \" #{klass}\"\r\n end\r\n \r\n from = Regexp.last_match.end(0)\r\n end\r\n \r\n # try to cut off header using non-greedy .+? pattern; tip test regex online at rubular.com\r\n # note/fix: needs to get improved to also handle case for h1 wrapped into div\r\n # (e.g. extract h1 - do not assume it starts slide source)\r\n if slide_source =~ /^\\s*(<h1.*?>.*?<\\/h\\d>)\\s*(.*)/m \r\n slide.header = $1\r\n slide.content = ($2 ? $2 : \"\")\r\n logger.debug \" adding slide with header:\\n#{slide.header}\"\r\n else\r\n slide.content = slide_source\r\n logger.debug \" adding slide with *no* header:\\n#{slide.content}\"\r\n end\r\n slides2 << slide\r\n end\r\n\r\n # for convenience create a string w/ all in-one-html\r\n # no need to wrap slides in divs etc.\r\n \r\n content2 = \"\"\r\n slides2.each do |slide| \r\n content2 << slide.to_classic_html\r\n end\r\n \r\n # make content2 and slide2 available to erb template\r\n # -- todo: cleanup variable names and use attr_readers for content and slide\r\n \r\n @slides = slides2 # strutured content \r\n @content = content2 # content all-in-one \r\n end", "def quickout results\r\n\tout = File.open('out.txt','w')\r\n\tout.sync=true\r\n\t\r\n\tresults.each_pair do |k,v|\r\n\t\tname, images, interwikimap = k, *v\r\n\t\t\r\n\t\tout.puts \"* [[#{name}]]\"\r\n\t\tout.puts images.to_a.map{|img, langs| \r\n\t\t\t\"** [[:commons:File:#{img}|]] na #{langs.uniq.map{|l| \"[[:#{l}:#{interwikimap[l.to_s]}|#{l}]]\"}.join ','}\"\r\n\t\t}\r\n\tend\r\n\t\r\n\tout.close\r\n\t\r\n\treturn ['out.txt']\r\nend", "def generate\n # Ensure site is a directory\n FileUtils.mkdir_p site_path\n\n # If there is more than one language, then we need to create\n # multiple files, one for each language.\n if languages.size >= 1\n\n # Enter the most dastardly loop. \n # Create a View::Document with sections only containing the \n # specified language. \n languages.map do |language|\n document_views = documents.map do |document|\n document.sections = document.sections.map do |section|\n section.examples = section.examples.select {|ex| ex.language.blank? || ex.language == language }\n section\n end\n\n Views::Document.new document\n end\n\n # Use Mustache to create the file\n page = Page.new\n page.title = title\n page.logo = File.basename logo if logo\n page.documents = document_views\n\n File.open(\"#{site_path}/#{language.underscore}.html\", \"w\") do |file|\n file.puts page.render\n end\n end\n\n # copy the default language to the index and were done!\n FileUtils.cp \"#{site_path}/#{default.underscore}.html\", \"#{site_path}/index.html\"\n\n # There are no languages specified, so we can just create one page\n # using a collection of Document::View.\n else \n document_views = documents.map do |document|\n Views::Document.new document\n end\n\n page = Page.new\n page.title = title\n page.logo = File.basename logo if logo\n page.documents = document_views\n\n File.open(\"#{site_path}/index.html\", \"w\") do |file|\n file.puts page.render\n end\n end\n\n # Copy the logo if specified\n FileUtils.cp \"#{logo}\", \"#{site_path}/#{File.basename(logo)}\" if logo\n\n # Copy all the stylesheets into the static directory and that's it!\n resources_path = File.expand_path \"../resources\", __FILE__\n\n FileUtils.cp \"#{resources_path}/style.css\", \"#{site_path}/style.css\"\n FileUtils.cp \"#{resources_path}/syntax.css\", \"#{site_path}/syntax.css\"\n end", "def output_path; end", "def perform(deck_id)\n puts \"Generating pdf images for #{deck_id}\"\n @deck = Deck.find(deck_id)\n @deck.build_slides\n end", "def write_html(options={})\n texmath_dir = File.join(images_dir, 'texmath')\n mkdir images_dir\n mkdir texmath_dir\n if cover?(options)\n File.write(path(\"epub/OEBPS/#{cover_filename}\"), cover_page)\n end\n\n pngs = []\n chapters.each_with_index do |chapter, i|\n target_filename = path(\"epub/OEBPS/#{xhtml(chapter.fragment_name)}\")\n File.open(target_filename, 'w') do |f|\n content = File.read(path(\"html/#{chapter.fragment_name}\"))\n doc = strip_attributes(Nokogiri::HTML(content))\n # Use xhtml in references.\n doc.css('a.hyperref').each do |ref_node|\n ref_node['href'] = ref_node['href'].sub('.html', xhtml('.html'))\n end\n body = doc.at_css('body')\n if body.nil?\n $stderr.puts \"\\nError: Document not built due to empty chapter\"\n $stderr.puts \"Chapters must include a title using the Markdown\"\n $stderr.puts \" # This is a chapter\"\n $stderr.puts \"or the LaTeX\"\n $stderr.puts \" \\\\chapter{This is a chapter}\"\n exit(1)\n end\n inner_html = body.children.to_xhtml\n if math?(inner_html)\n html = html_with_math(chapter, images_dir, texmath_dir, pngs,\n options)\n html ||= inner_html # handle case of spurious math detection\n else\n html = inner_html\n end\n f.write(chapter_template(\"Chapter #{i}\", html))\n end\n end\n # Clean up unused PNGs.\n png_files = Dir[path(\"#{texmath_dir}/*.png\")]\n (png_files - pngs).each do |f|\n if File.exist?(f)\n puts \"Removing unused PNG #{f}\" unless options[:silent]\n FileUtils.rm(f)\n end\n end\n end", "def extract_first_page_images\n #######\n # Docsplit.extract_images(document.file.file, :size => %w{200x 700x 1000x}, :format => :jpg, :pages => %w{1}, output: output_path)\n Docsplit.extract_images(file.path, :size => %w{200x 700x 1000x}, :format => :jpg, :pages => %w{1}, output: \"public/#{self.docsplit_dir}\" )\n \n # def store_path(for_file=filename)\n # # File.join([store_dir, full_filename(for_file)].compact)\n # \"#{self.model.class.to_s.underscore}\" + \"/\" + \"#{mounted_as}\" + \"/\" + \"#{self.model.user.uuid.to_s}\" + \"/\" + \"#{self.model.slug}\" + \"/\" + \"#{(version_name || :original).to_s}\" + \"_\" + \"#{self.file.basename}\" + \".jpg\"\n # end\n # if Rails.env.production?\n # document.store!(new_file=\"#{output_path}/200x/#{document.model.file_name.chomp(document.model.document.file.extension)[0..-2]}_1.jpg}\")\n # document.store!(new_file=\"#{output_path}/700x/#{document.model.file_name.chomp(document.model.document.file.extension)[0..-2]}_1.jpg}\")\n # document.store!(new_file=\"#{output_path}/1000x/#{document.model.file_name.chomp(document.model.document.file.extension)[0..-2]}_1.jpg}\")\n # end\n # Docsplit.extract_images(document.file.file, :size => %w{200x 700x 1000x}, :format => :jpg, :pages => %w{1}, output: \"/tmp/uploads/docsplit/#{model.class.to_s.underscore}/#{model.slug}\")\n\n\n # ::Docsplit.extract_images(self.pdf, :size => %w{200x 700x 1000x}, :format => :jpg, :pages => %w{1}, output: output_path)\n # if Rails.env.production?\n # # Rename file folders. \n # FileUtils.mv local_output_path + \"160x\", s3_output_path + \"160x\"\n # FileUtils.mv local_output_path + \"700x\", s3_output_path + \"700x\"\n # FileUtils.mv local_output_path + \"1000x\", s3_output_path + \"1000x\"\n # end\n \n true\n # self\n end", "def build_docs\n object_map.each do |index, objects|\n objects.each do |object|\n template_context = {\n #:meta => Site\n index => object\n }\n content = converter.render(template_map[index], template_context)\n filename = converter.filename_for(object)\n write_output_file(filename, content)\n end\n end\n end", "def transform_pages(dir = '')\n base = File.join(self.source, dir)\n entries = Dir.entries(base)\n entries = entries.reject { |e| ['.', '_'].include?(e[0..0]) }\n \n entries.each do |f|\n if File.directory?(File.join(base, f))\n transform_pages(File.join(dir, f))\n else\n first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }\n \n if first3 == \"---\"\n page = Page.new(self.source, dir, f)\n page.add_layout(self.layouts, site_payload)\n page.write(self.dest)\n else\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end", "def download_presentation(name, format, options = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil, slides = nil)\n data, _status_code, _headers = download_presentation_with_http_info(name, format, options, password, folder, storage, fonts_folder, slides)\n data\n end", "def slideshow(options={})\n default_options = { duration: 7000, slides: [], transition: \"toggle\" }\n options = default_options.merge(options)\n html = ''\n if options[:slides].size > 1\n html += slideshow_controls(options)\n options[:slides].each_with_index do |slide,i|\n html += slideshow_frame(slide, i)\n end\n raw(html + javascript_tag(\"start_slideshow(1, #{options[:slides].size}, #{options[:duration]}, '#{options[:transition]}');\"))\n else\n raw(slideshow_frame(options[:slides].first))\n end\n end", "def pathDocuments\n \"./documents/\"\nend", "def slideshow\n self\n end", "def index\n @write_right = userCould :slide\n if params[:search] then\n @slides = Slide.find(:all, :conditions => [\"name LIKE ?\", \"%#{params[:search]}%\"])\n redirect_to @slides[0] if @slides.count == 1\n else\n @slides = Slide.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end\n end", "def output_dir(options = {})\n options[:dir] = \"generate\"\n build_webby_path(options)\n end", "def show\n @slides [email protected](params[:urlpage])\n \n end", "def convert!\n merged_contents = []\n @files.each do |file|\n markup = Markup.new file, @remove_front_matter\n html = convert_image_urls markup.render, file.filename\n if @merge\n html = \"<div class=\\\"page-break\\\"></div>#{html}\" unless merged_contents.empty?\n merged_contents << html\n else\n output_pdf(html, file)\n end\n end\n\n unless merged_contents.empty?\n html = merged_contents.join\n output_pdf(html, nil)\n end\n end", "def getOutputDir(experiment)\n return File.absolute_path(File.join(Constants::EMBEDDINGS_PATH, getId(experiment)))\nend", "def generate()\n prepare\n ::Dir.mkdir(@output_path) unless ::File.exists? @output_path\n\n @pages.each do |name, page|\n SiteLog.debug(\"Starting page generation - #{name}\")\n page.generate(@output_path, @version, @preserve_tree)\n SiteLog.debug(\"Finished page generation - #{name}\")\n end\n\n @files.each do |path, data|\n path = ::File.join(@output_path, path)\n ::FileUtils.mkdir_p(::File.dirname(path))\n ::File.open(path, \"w\") do |f|\n f.write(data)\n end\n end\n end", "def write(new_files)\n case settings[:style]\n when :classic\n # Single file\n printf \"Writing classic app to: %s\\n\", settings[:output_file]\n File.open(settings[:output_file], 'w') do |f|\n #f << \"##\\n\"\n #f << \"# Generated by \\\"rake #{ARGV * ' '}\\\"\\n\"\n #f << \"# Keep up to date: #{PLUGIN_URL}\\n\"\n #f << \"#\\n\"\n new_files.each do |file|\n f << \"\\n# #{file.first.sub(/\\.rb$/,'').humanize}\\n\"\n f << file.last\n end\n end\n when :modular\n # Separate files\n new_files.each do |file|\n filename = \"#{settings[:output_dir]}/#{file.first}\"\n printf \" write %-40s\\n\", filename\n File.open(filename, 'w') do |f|\n #f << \"##\\n\"\n #f << \"# Generated by \\\"rake #{ARGV * ' '}\\\"\\n\"\n #f << \"# Keep up to date: #{PLUGIN_URL}\\n\"\n #f << \"#\\n\"\n f << \"class #{settings[:class_name]}\\n\"\n f << file.last\n f << \"end\\n\" \n end\n end\n else\n raise \"Invalid style for Sinatra::FromRails: #{settings[:style]} (must be :classic or :modular)\"\n end\n end", "def jekyll\n pattern = File.join(\"#{@dir}\", '**')\n ret = Dir.glob(pattern).map! {|f| (File.directory?(f) && !jekyll_folders?(f)) ? \"#{remove_output_folder f}\" : \"\" }.compact.uniq\n ret.delete(\"\")\n ret\n end", "def output_file(type)\n if (type == :html)\n \"#{DirMap.public}#{News.public_path}/#{self.filename}.html\"\n else\n \"#{DirMap.public}#{News.public_path}/#{self.filename}.html\"\n end\n end", "def display_saves\n Dir.children('./saves').each_with_index { |name, idx| puts \"#{idx}. #{name}\" }\nend", "def download_slide(name, slide_index, format, options = nil, width = nil, height = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil)\n data, _status_code, _headers = download_slide_with_http_info(name, slide_index, format, options, width, height, password, folder, storage, fonts_folder)\n data\n end", "def generate_Genre_Pages\n template_doc = File.open(\"lib/templates/genre.html.erb\")\n template = ERB.new(template_doc.read)\n Genre.all.each do |genre|\n File.write(\"_site/genre/#{genre.url}\", template.result(binding))\n end\n end", "def show_asset_files\n display_collection_of_folders_docs_tasks\n end", "def show\n @carousel_slides = @carousel.carousel_slides\n end", "def push(slide)\n n = to_a.size + 1\n # Paths within the zip file of new files we have to write.\n slide_path = Pathname.new(\"/ppt/slides/slide#{n}.xml\")\n slide_rels_path = Pathname.new(\"/ppt/slides/_rels/slide#{n}.xml.rels\")\n slide_notes_path = Pathname.new(\"/ppt/notesSlides/notesSlide#{n}.xml\")\n slide_notes_rels_path = Pathname.new(\"/ppt/notesSlides/_rels/notesSlide#{n}.xml.rels\")\n\n # Update ./ppt\n # !!! CREATE !!!\n # ./slides\n # Create new files\n # ./slide(\\d+).xml file\n @doc.copy slide_path, slide.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.copy slide_rels_path, slide.rels.path\n # ./notesSlides\n # Create new files\n # ./notesSlide(\\d+).xml file\n @doc.copy slide_notes_path, slide.notes.path\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.copy slide_notes_rels_path, slide.notes.rels.path\n \n # !!! UPDATES !!!\n # Update the notes in the new slide to point at the new notes\n @doc.edit_xml slide_rels_path do |xml|\n # TODO - Move this rel logic into the parts so that we don't have to repeat ourselves when calculating this stuff out.\n xml.at_xpath(\"//xmlns:Relationship[@Type='#{Notes::REL_TYPE}']\")['Target'] = slide_notes_path.relative_path_from(slide_path.dirname)\n end\n\n # Update teh slideNotes reference to point at the new slide\n @doc.edit_xml slide_notes_rels_path do |xml|\n xml.at_xpath(\"//xmlns:Relationship[@Type='#{Slide::REL_TYPE}']\")['Target'] = slide_path.relative_path_from(slide_notes_path.dirname)\n end\n\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n types = xml.at_xpath('/xmlns:Relationships')\n types << Nokogiri::XML::Node.new(\"Relationship\", xml).tap do |n|\n n['Id'] = next_id\n n['Type'] = Slide::REL_TYPE\n n['Target'] = slide_path.relative_path_from(@doc.presentation.path.dirname)\n end\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n slides = xml.at_xpath('/p:presentation/p:sldIdLst')\n next_slide_id = slides.xpath('//p:sldId[@id]').map{ |n| n['id'] }.sort.last.succ\n slides << Nokogiri::XML::Node.new(\"p:sldId\", xml).tap do |n|\n # TODO - Fix the ID that's jacked up.\n n['id'] = next_slide_id\n n['r:id'] = next_id\n end\n end\n end\n\n # Update ./[Content-Types].xml with new slide link and slideNotes link\n @doc.edit_xml @doc.content_types.path do |xml|\n types = xml.at_xpath('/xmlns:Types')\n types << Nokogiri::XML::Node.new(\"Override\", xml).tap do |n|\n n['PartName'] = slide_path\n n['ContentType'] = Slide::CONTENT_TYPE\n end\n types << Nokogiri::XML::Node.new(\"Override\", xml).tap do |n|\n n['PartName'] = slide_notes_path\n n['ContentType'] = Notes::CONTENT_TYPE\n end\n end\n\n # Great, that's all done, so lets return the slide eh?\n slide slide_path\n end", "def bilder(type)\n Dir[\"output/bilder/#{type}/*.*\"].map do |bild|\n \"<a class='fancybox' rel='#{type}' href='/bilder/#{type}/#{File.basename(bild)}'><img src='/bilder/#{type}/thumbs/#{File.basename(bild)}' alt='' /></a>\"\n end.join(\"\")\nend", "def output_lilypond(format)\n filename = File.join(Rails.root, 'downloads', SecureRandom.uuid)\n lilypond_path = Rails.application.config.lilypond_path\n chartup = Chartup::Chart.new(self.chartup)\n case format\n when :pdf\n Open3.capture2(\"#{lilypond_path} --output=#{filename} -\", :stdin_data => chartup.to_ly)\n when :png\n Open3.capture2(\"#{lilypond_path} --output=#{filename} -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts -ddelete-intermediate-files --png -\", :stdin_data => chartup.to_ly)\n end\n \"#{filename}.#{format.to_s}\"\n rescue Chartup::Error\n raise\n end", "def write_articles\r\n puts \"Converting articles to EPUB:\"\r\n STDOUT.flush\r\n progress = ProgressBar.new(\"Converting\", @issue.articles.length)\r\n @issue.articles.each do |article|\r\n if !article.content\r\n next\r\n end\r\n template = ERB.new(File.new(File.join(@dirs[:templates], \"article.html.erb\")).read, nil, \"%\")\r\n output_file = File.new(File.join(@dirs[:content], article_path(article)), \"w+\")\r\n output_file.write(template.result(binding))\r\n output_file.close\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n end", "def show_document\n\tprint_header\n\tprint_document\n\tprint_footer\nend", "def save_presentation(name, format, out_path, options = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil, slides = nil)\n save_presentation_with_http_info(name, format, out_path, options, password, folder, storage, fonts_folder, slides)\n nil\n end", "def render_and_write_templates\n clean_build_dir()\n\n yard_file_hash = {}\n\n Dir.glob(\"#{Dir.pwd}/projects/*\").select { |f| File.directory? f }.each do|project_dir|\n yard_file = \"#{project_dir}/yard.yaml\"\n\n unless yard_file.empty?\n yard = YAML::load_file(yard_file)\n next if yard['disabled']\n\n apps = yard['apps']\n project_name = yard['project']['name']\n project_pipelines = yard['pipelines']\n\n Dir.mkdir \"#{BUILD_DIR}/#{project_name}\"\n puts project_name\n\n apps.each do |app_name, app_config|\n Dir.mkdir(\"#{BUILD_DIR}/#{project_name}/#{app_name}/\")\n app_pipelines = Hash.new({})\n\n project_pipelines.each do |pipeline|\n app_pipelines[pipeline['name']] = app_pipelines[pipeline['name']].merge(pipeline)\n end\n\n unless app_config.nil? || app_config['pipelines'].nil?\n app_config['pipelines'].each do |pipeline|\n app_pipelines[pipeline['name']] = app_pipelines[pipeline['name']].merge(pipeline)\n end\n end\n\n # puts app_pipelines\n\n base_files = Dir[\"#{Dir.pwd}/base/*\"]\n project_base_files = Dir[\"#{project_dir}/base/*\"]\n app_files = Dir[\"#{project_dir}/#{app_name}/*\"]\n\n app_pipelines.each do|pipeline_name, pipeline_config|\n template_name = pipeline_config['templateName'] ? pipeline_config['templateName'] : \"#{pipeline_name}.json\"\n\n app_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n project_base_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n\n base_files.each do|path|\n render_and_write(\n pipeline_config: pipeline_config,\n path: path,\n template_name: template_name,\n app_name: app_name,\n project_name: project_name,\n app_template_vars: app_config['template_vars']\n )\n end\n end\n end\n end\n end\n end", "def w_to_pdf(s)\n fn = rem_ext(s,'.w')\n puts \"dir: #{File.dirname(fn)}\"\n doc_dir = File.dirname(fn)!='.' ? './pdf' : '../source/pdf'\n cd(File.dirname(fn)) do\n fn = File.basename(fn)\n 2.times do\n puts \"nuweb -o -l #{fn}.w\"\n puts `nuweb -o -l #{fn}.w`\n puts \"latex -halt-on-error #{fn}.tex\"\n puts `latex -halt-on-error #{fn}.tex`\n puts \"dvipdfm -o #{rep_dir(doc_dir,fn)}.pdf #{fn}.dvi\"\n puts `dvipdfm -o #{rep_dir(doc_dir,fn)}.pdf #{fn}.dvi`\n end\n end\n end", "def index\n logger.info params.inspect\n if params[:toggle_activation]\n slide = Slide.where(:id => params[:toggle_activation]).first\n logger.info slide\n slide.toggle_visibility!\n slide.save\n end\n if params[:up]\n slide = Slide.where(:position => params[:up]).first\n if slide.position > 1\n other_slide = Slide.where(:position => slide.position-1).first\n other_slide.increment :position\n slide.decrement :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n if params[:down]\n slide = Slide.where(:position => params[:down]).last\n logger.info \"found slide #{slide.inspect}\"\n if slide.position < Slide.where(:visible => true).count\n other_slide = Slide.where(:position => slide.position+1).first\n other_slide.decrement :position\n slide.increment :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n\n @slides = Slide.find( :all, :order => \"visible DESC, position ASC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @slides }\n end\n end", "def index\n @slideshows = Slideshow.all\n @pag_url = '/slideshows/reload_pag'\n @page = 'home'\n end", "def render_results\n initialize_target_directory\n\n options = { disable_escape: true }\n template_path = File.expand_path('../templates/index.html.slim', __FILE__)\n rendered_template = Slim::Template.new(template_path, options).render(self)\n\n File.open(\"#{@target_dir}/index.html\", 'w') do |file|\n file.write rendered_template\n end\n end", "def slide\n slde = { start_date: mk_date(start_year),\n end_date: mk_date((end_year.presence || start_year)),\n text: mk_text(body, name) }\n if image.attached?\n slde['media'] = { url: cover_url.to_s,\n link: url }\n end\n slde\n end", "def download_slideshow\n Down.download bucket_url.url\n end", "def show\n session[:slideshow] = @slideshow\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n end", "def children\n # Check to see whether dir exists.\n Slimdown::Folder.new(@absolute_path.chomp('.md')).pages\n end", "def flex_output\n\n flex_output = ENV['TM_FLEX_OUTPUT']\n proj_dir = proj_root\n\n if flex_output && proj_dir\n return proj_dir + '/' + flex_output\n end\n\n fx_out = file_specs.sub(/\\.(mxml|as)/, \".swf\")\n\n #TODO: Link to usual src dirs and improve sub with a regexp that\n #matches src backwards (ie foo/src/bar/src/class) from the end of line.\n if File.exist?( proj_dir.to_s + '/bin' )\n fx_out.sub!('src','bin')\n end\n\n fx_out\n\n end", "def html\n haml_opts = '-f xhtml'\n # process partials\n puts 'Compiling Partials...'\n inc_files = Dir['./haml/_partials/*.haml']\n inc_files.each do |name|\n file_input = name\n file_output = name.sub('.haml','.inc')\n haml_call = 'haml '+haml_opts+' '+file_input+' '+file_output\n `#{haml_call}`\n puts ' :: Converting '+name+' => '+file_output\n end\n puts 'Partials compile complete...'\n # process pages\n puts 'Compiling HTML files...'\n haml_files = Dir['./haml/*.haml']\n haml_files.each do |name|\n file_input = name\n file_output = name.sub('.haml','.html').sub('./haml/','../www/')\n haml_call = 'haml '+haml_opts+' '+file_input+' '+file_output\n `#{haml_call}`\n puts ' :: Converting '+name+' => '+file_output\n end\n puts 'HTML compile complete...'\n # regex/cleanup script\n puts 'Calling HAML cleanup script...'\n `./_scripts/hamlcleanup.pl haml/_partials/*.inc`\n `./_scripts/hamlcleanup.pl ../www/*.html`\n # move files as needed\nend", "def write_posts\n posts.each do |p|\n # TODO allow user to specify which layouts a post should use \n p.render(layouts)\n p.write(File.join(destination_path, \"posts\"))\n end\n end", "def convert images_directory , pdfs_directory\n\n # Get all files from that directory\n all_images = Dir.entries(images_directory)\n\n #Segregate only the required the question paper images , just in case the directory contains other files\n all_images.keep_if { |a| ((a.start_with? \"mid-\") || (a.start_with? \"end-\")) && ((a.end_with? \".jpg\") || (a.end_with? \".png\") || (a.end_with? \".tif\") || (a.end_with? \".gif\") || (a.end_with? \".svg\") || (a.end_with? \".bmp\"))}\n\n #Store number of images as a variable to show % finished\n number_of_images = all_images.count\n\n # Initialisation of variables like Array of names of papers , eg. mid-spring-2016-MA20104\n Dir.chdir(images_directory)\n papernames_array = []\n i = 0\n all_images = all_images.sort\n stack = Magick::ImageList.new\n\n #Loop through all paper images & batch merge them into PDFs , even if a paper has 3 pages / images\n all_images.each do |file|\n papernames_array[i] = file[0..22]\n if i == 0\n Dir.chdir(images_directory)\n stack = Magick::ImageList.new\n incoming = Magick::ImageList.new file\n stack.concat(incoming)\n else\n if papernames_array[i].eql? papernames_array[i-1]\n Dir.chdir(images_directory)\n incoming = Magick::ImageList.new file\n stack.concat(incoming)\n else\n Dir.chdir(pdfs_directory)\n stack.write(papernames_array[i-1]+\".pdf\")\n Dir.chdir(images_directory)\n stack = Magick::ImageList.new\n incoming = Magick::ImageList.new file\n stack.concat(incoming)\n end\n if i == number_of_images-1\n Dir.chdir(pdfs_directory)\n stack.write(papernames_array[i]+\".pdf\")\n end\n end\n i = i + 1\n percentage = (i.to_f/number_of_images.to_f) * 100\n puts \"Processing #{i}/#{number_of_images} images , #{percentage}% done\"\n end\nend", "def create_html path\n html_name = \"#{File.basename(path, '.md')}.html\"\n\n if html_name !~ /^index/\n html_name = 'md/' + html_name\n end\n\n puts \"Ejecutando «pc-pandog -i #{path} -o #{html_name}»…\"\n system(\"pc-pandog -i #{path} -o #{html_name}\")\n\n html = get_html(html_name)\n new_html = []\n\n write = true\n html.each do |l|\n if l =~ /<head>/\n write = false\n if html_name !~ /^index/\n new_html.push($head.join(\"\\n\"))\n else\n new_html.push($head.join(\"\\n\").gsub('<link type=\"text/css\" rel=\"stylesheet\" href=\"../css/styles.css\">', '<link type=\"text/css\" rel=\"stylesheet\" href=\"css/styles.css\">').gsub('<script type=\"text/javascript\" src=\"../js/piwik.js\"></script>', '<script type=\"text/javascript\" src=\"js/piwik.js\"></script>'))\n end\n elsif l =~ /<\\/head>/\n write = true\n elsif l =~ /<style>/\n if html_name !~ /^index/\n new_html.push($header.join(\"\\n\"))\n else\n new_html.push($header.join(\"\\n\").gsub('../index.html', '').gsub(/\"(\\S+?\\.html)\"/, 'html/' + '\\1')) \n end\n elsif l =~ /<\\/body>/\n new_html.push($footer.join(\"\\n\"))\n new_html.push(l)\n else\n if write == true\n new_html.push(l)\n end\n end\n end\n\n new_html = beautifier_html(new_html)\n\n\t# Se actualiza la información\n\tarchivo = File.new(html_name, 'w:UTF-8')\n\tarchivo.puts new_html\n\tarchivo.close\n\n # Si no es el index, lo mueve a la carpeta «html»\n if html_name !~ /^index/\n FileUtils.mv(html_name, 'html')\n end\nend", "def create_output_files\n return unless @option_output_path\n return if @collected_nodes.empty?\n @collected_nodes.each do |certname, properties|\n next if properties['settings'].empty?\n output_file = \"#{@option_output_path}/nodes/#{certname}.yaml\"\n File.write(output_file, properties['settings'].to_yaml)\n output(\"## Wrote Hiera YAML file: #{output_file}\\n\\n\")\n end\n return if @common_settings.empty?\n output_file = \"#{@option_output_path}/common.yaml\"\n File.write(output_file, @common_settings.to_yaml)\n end", "def start(name = nil)\n name ||= 'presentation.rb'\n p = Presentation.new\n p.load_slides_from_file File.expand_path(name)\n # TODO: p.load_theme File.expand_path(options[:theme])\n p.start\n end" ]
[ "0.6497139", "0.61745334", "0.61078626", "0.5863233", "0.5781155", "0.5706453", "0.5698531", "0.56745404", "0.5674443", "0.56563073", "0.5644831", "0.5642305", "0.5601661", "0.5594342", "0.5588806", "0.5573301", "0.55543184", "0.5554176", "0.5547611", "0.5519717", "0.5515841", "0.54914796", "0.5488118", "0.5479118", "0.54646546", "0.54522246", "0.5433583", "0.5433364", "0.53875977", "0.5383767", "0.5376883", "0.5329762", "0.5328409", "0.5324722", "0.53180325", "0.531541", "0.53135866", "0.5311039", "0.52858675", "0.5280046", "0.5253443", "0.52533484", "0.5238454", "0.52378964", "0.5232352", "0.5226745", "0.5226668", "0.5218376", "0.5216009", "0.5213133", "0.52037454", "0.5201041", "0.5195805", "0.51939505", "0.51907754", "0.51862735", "0.5173158", "0.5171171", "0.51639295", "0.51610494", "0.51600534", "0.51556337", "0.5153298", "0.5144086", "0.5135673", "0.5129828", "0.5109797", "0.51086533", "0.510106", "0.5094374", "0.50888807", "0.50840795", "0.5080943", "0.50809205", "0.5075827", "0.5066326", "0.5042952", "0.5039632", "0.50394225", "0.50348043", "0.5029523", "0.5022267", "0.5019266", "0.5016062", "0.50151944", "0.50095403", "0.5001803", "0.49981636", "0.49958637", "0.49957132", "0.49953118", "0.49944368", "0.499364", "0.4991243", "0.49877045", "0.49851677", "0.49826473", "0.49801964", "0.49738166", "0.497039" ]
0.6691781
0
Supplies a slightly smaller designsystem approved column structure when set to false (as used in Evo), by default. DMS, however requires a simple 'col' (full width) layout and will have :full_width set to true manually while both apps coexist with slightly different page layouts.
def full_width options.fetch(:full_width, false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_layout layout = nil\n @column_layout = layout if configurable? && layout\n @column_layout\n end", "def enable_extended_mkcol?\n true\n end", "def full_width_column(options={}, &block)\n row(options) do\n column(12, &block)\n end\n end", "def is_flex_column_class?\n true\n end", "def second_main_column_cols\n if user_signed_in?\n 'col-10 p-0'\n else\n 'col-12 p-0'\n end\n end", "def profile_property_columns_tag(options={})\n defaults = {:editable => false, :width => 480, :edit_control_width => 11}\n options = defaults.merge(options).symbolize_keys\n html = ''\n if options[:editable]\n html << content_tag(:col, '', :width => \"#{options[:width] - options[:edit_control_width]}\")\n html << content_tag(:col, '', :width => \"#{options[:edit_control_width]}\")\n else\n html << content_tag(:col, '', :width => \"#{options[:width]}\")\n end\n html\n end", "def build_columns\n return unless configurable?\n return if @columns_opted == false\n selector(ORMUtils.properties(model), @columns_opted, @columns_ignored).each do |setup|\n setup << {summary: false} if setup.last == 'text'\n column *setup\n end\n end", "def columns *args\n if args.size > 0 && configurable?\n raise 'please call %s only inside #model block' % __method__ if model_defined?\n return @columns_opted = false if args.first == false\n @columns_opted = args\n end\n end", "def columns\n @columns || 150\n end", "def do_show\n super\n display_columns = ShowColumns\n display_columns -= ModeratorOnlyColumns unless can_edit_member(@record, current_user)\n active_scaffold_config.show.columns = display_columns\n end", "def venueColumns \n venueLayout[\"columns\"]\n end", "def show_banded_columns\n return @show_banded_columns\n end", "def static_col(name, value, width = 12, options = {})\n content = content_tag(:label, name) + content_tag(:p, value)\n content_tag :div, content, class: \"small-#{width} columns #{options[:col]}\"\n end", "def allow_layout?\n true\n end", "def column_space(); @column_space; end", "def show_banded_columns=(value)\n @show_banded_columns = value\n end", "def _conditional_layout?; end", "def hide_other_columns\n\t\t\n\t\t\t# Hide all other columns\n\t\t\t(@model.columnCount - 1).times do |i|\n\t\t\t\tself.setColumnHidden(i + 1, true)\n\t\t\tend\n\t\t\t \n\t\t\t# Resize first column to fit whole width\n\t\t\tself.resizeColumnToContents(0)\n\t\t\tself.setUniformRowHeights(true)\t\t\t\t\t\n\t\tend", "def flex_column(*args, &block)\n include FlexColumns::HasFlexColumns\n flex_column(*args, &block)\n end", "def column which_column\n return if (content = card_aspects(which_column).collect { |aspect| card_aspect_rendered aspect }.compact).empty?\n content_tag :div, safe_join(content), class: \"col-md-#{12/card_ncolumns}\"\n end", "def columns_incdec howmany\n @gviscols += howmany.to_i\n @gviscols = 1 if @gviscols < 1\n @gviscols = 6 if @gviscols > 6\n @pagesize = @grows * @gviscols\nend", "def column_widths\n []\n end", "def width\n @columns * @block_size\n end", "def nasty_columns_1\n @company = Company.new\n @company.name = \"B\"\n @company.rating = 2\n render :inline => \"snicker....\"\n end", "def columns\n 1\n end", "def keep_geom_columns_option\n \"-oo KEEP_GEOM_COLUMNS=#{keep_geom_columns? ? 'YES' : 'NO'}\"\n end", "def wantsFullScreenLayout\n\t\ttrue\n\tend", "def maybe_column\n @browser.div(:class => /shortlist_area shortlist_maybe/)\n end", "def should_render_col_az?\n false\n end", "def should_render_col_az?\n false\n end", "def columns\n layout_text.blank? ? 12 : layout[0].size\n end", "def column_width\n return @column_width\n end", "def columns_default\n super + ['web_page']\n end", "def adjust_column_width\n grouped_columns = group_by{|column| column.width == \"0%\" ? \"without\" : \"with\"};\n with = grouped_columns[\"with\"] || []\n without = grouped_columns[\"without\"] || []\n # origin 5% keeped for selection column width\n used = with.inject(5){|total, column| column.width =~ /(\\d+)%$/ ? total + $1.to_i : total}\n begin\n avg_width = (100 - used) / without.size\n left_width = (100 - used) % without.size\n without.each{|col| col.width = \"#{avg_width}%\"}\n without.last.width = \"#{avg_width + left_width}%\"\n end if not without.empty?\n end", "def multi_column?\n @columns.size > 1\n end", "def col\n horizontals_push; alignments_reset ; widths_reset\n end", "def no_column\n @browser.div(:class => \"shortlist_area shortlist_no section\")\n end", "def config_column(col, options = {})\n TkGrid.columnconfigure content, col, options\n end", "def expand_column_widths\n columns_count = table.columns_count\n max_width = renderer.width\n extra_column_width = ((max_width - natural_width) / columns_count.to_f).floor\n\n widths = (0...columns_count).reduce([]) do |lengths, col|\n lengths << renderer.column_widths[col] + extra_column_width\n end\n distribute_extra_width(widths)\n end", "def enforce\n assert_minimum_width\n padding = renderer.padding\n\n if natural_width <= renderer.width\n if renderer.resize\n expand_column_widths\n else\n renderer.column_widths.map do |width|\n padding.left + width + padding.right\n end\n end\n else\n if renderer.resize\n shrink\n else\n rotate\n end\n end\n end", "def start_columns(size = 2, gutter = 10)\n # Start from the current y-position; make the set number of columns.\n return false if @columns_on\n\n @columns = {\n :current => 1,\n :bot_y => @y\n }\n @columns_on = true\n # store the current margins\n @columns[:left] = @left_margin\n @columns[:right] = @right_margin\n @columns[:top] = @top_margin\n @columns[:bottom] = @bottom_margin\n # Reset the margins to suit the new columns. Safe enough to assume the\n # first column here, but start from the current y-position.\n @top_margin = @page_height - @y\n @columns[:size] = size || 2\n @columns[:gutter] = gutter || 10\n w = absolute_right_margin - absolute_left_margin\n @columns[:width] = (w - ((size - 1) * gutter)) / size.to_f\n @right_margin = @page_width - (@left_margin + @columns[:width])\n end", "def layout_config\n @squeezed_layout_config\n end", "def column_size; end", "def column_width=(value)\n @column_width = value\n end", "def column_width colindex, width\n @cw[colindex] ||= width\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", width) \n else\n @chash[colindex].w = width\n end\n @chash\n end", "def columns; end", "def nasty_columns_2\n @company = Company.new\n @company.name = \"\"\n @company.rating = 2\n render :inline => \"double snicker....\"\n end", "def shrink\n column_size = table.columns_size\n ratio = ((natural_width - renderer.width) / column_size.to_f).ceil\n\n widths = (0...column_size).reduce([]) do |lengths, col|\n width = (renderer.column_widths[col] - ratio)\n # basically ruby 2.4 Numeric#clamp\n width = width < minimum_width ? minimum_width : width\n width = width > renderer.width ? renderer.width : width\n lengths << width\n end\n distribute_extra_width(widths)\n end", "def calculate_columns!\n\n\n\n span_count = columns_span_count\n\n\n\n columns_count = children.size\n\n\n\n\n\n\n\n all_margins_width = margin_size * (span_count - 1)\n\n\n\n column_width = (100.00 - all_margins_width) / span_count\n\n\n\n\n\n\n\n columns.each_with_index do |column, i|\n\n\n\n is_last_column = i == (columns_count - 1)\n\n\n\n column.set_column_styles(column_width, margin_size, is_last_column)\n\n\n\n end\n\n\n\n end", "def columns?\n @columns_on\n end", "def add_dynamic_columns\n organism = Organism.find(:first, :conditions => [\"project_id = ?\", current_project_id])\n c = active_scaffold_config\n \n for cp in [c.list, c.update, c.create, c]\n columns_for_deletion = (cp.columns.map(&:name).map(&:to_sym) - Organism.columns.map(&:name).map(&:to_sym))\n cp.columns.exclude *columns_for_deletion\n \n if organism\n dynamic_columns ||= organism.dynamic_attributes.map(&:name)\n cp.columns.add dynamic_columns\n end\n end\n \n true\n end", "def columns\n end", "def content_columns\n model.content_columns.select do |column|\n !Formtastic::Helpers::InputsHelper::SKIPPED_COLUMNS.include? column.name.to_sym\n end\n end", "def draw_columns\n @sections[:body][:fields].each do |field, settings|\n settings = [settings[0], @posY, (@defaults.merge (settings[1] || { }).symbolize_keys!)]\n settings[2][:style] = settings[2][:style].to_sym\n set_options settings[2]\n draw_line(@posY + @sections[:body][:settings][:height]/2)\n field = settings[2][:column] || field.to_s.split('_').inject('') do |str, part|\n str << part.camelize << \" \"\n end\n draw_text field, settings\n end\n draw_line(@posY - @sections[:body][:settings][:height]/2)\n set_pos_y @sections[:body][:settings][:height]\n end", "def scaffold_column_options(column_name)\n @scaffold_column_options_hash ||= {}\n @scaffold_column_options ||= {}\n @scaffold_column_options[column_name] ||= scaffold_merge_hashes(@scaffold_column_options_hash[column_name], SCAFFOLD_OPTIONS[:column_options][column_name], scaffold_column_type_options(scaffold_column_type(column_name)))\n end", "def column_width\n @level_order.inject(0) do |width_, level_|\n w_ = level_.name.size\n w_ > width_ ? w_ : width_\n end\n end", "def column_width colindex, width=:NONE\n if width == :NONE\n #return @cw[colindex]\n return get_column(colindex).width\n end\n @_skip_columns[colindex] = true ## don't calculate col width for this.\n get_column(colindex).width = width\n self\n end", "def no_layout?; end", "def payload_filters2_enable_vulnerability_columns\n\n action = \"AddRemoveColumns.screen\"\n parameters = {\n :screenSettingKey => \"payloadFilter2s.\",\n :columnDisplayNames => %w[ payloadFilter2s.column.cve payloadFilter2s.column.secunia payloadFilter2s.column.bugtraq payloadFilter2s.column.ms ].join(\",\"),\n :columnAdminSettingNames => %w[ summaryCVE summarySECUNIA summaryBUGTRAQ summaryMS ].join(\",\")\n }\n settings = {\n \"summaryCVE\" => true,\n \"summarySECUNIA\" => true,\n \"summaryBUGTRAQ\" => true,\n \"summaryMS\" => true\n }\n\n post_setting(action, parameters, settings)\n\n end", "def width\n cols\n end", "def yes_column\n @browser.div(:class => \"shortlist_area shortlist_yes section\")\n end", "def wantsFullScreenLayout\n true\n end", "def column(sizes=\"col-sm-12\", options={}, &block)\n raise ArgumentError, \"Missing block\" unless block_given?\n\n if sizes.is_a?(Hash)\n options = options.merge(sizes)\n sizes = \"\"\n end\n\n options[:class] = \"cols #{sizes} #{options[:class]}\"\n\n content_tag(:div, options) do\n capture(&block)\n end\n end", "def columns(*cs)\n if cs.empty?\n super\n else\n self.columns = cs\n self\n end\n end", "def blank_column\n blank_col = '<div class=\"crossbeams-col\"><!-- BLANK COL --></div>'\n @nodes << OpenStruct.new(render: blank_col)\n end", "def search_field_size_modification\n return if Rails.configuration.proposal_mode\n\n ' search-field-wide' if Rails.configuration.umm_t_enabled\n end", "def column_renders_as(column)\n if column.respond_to? :each\n :subsection\n elsif column.active_record_class.locking_column.to_s == column.name.to_s || column.form_ui == :hidden\n :hidden\n elsif column.association.nil? || column.form_ui || !active_scaffold_config_for(column.association.klass).actions.include?(:subform) || override_form_field?(column)\n :field\n else\n :subform\n end\n end", "def sidebar!\n content_for(:layout_sidebar) do\n 'true'\n end\n end", "def content_cols\n longest = @list.max_by(&:length)\n ## 2013-03-06 - 20:41 crashes here for some reason when man gives error message no man entry\n return 0 unless longest\n longest.length\n end", "def hide_column(name)\n raise \"Wrong column name '#{name}'!\" unless @header.include?(name)\n\n @options[:hide_columns] = [] unless @options[:hide_columns]\n @options[:hide_columns] << name.to_s\n end", "def get_column_for(tag_name, subfield_name)\n if options_config.include?(tag_name) and options_config[tag_name].include?(\"layout\")\n f = options_config[tag_name][\"layout\"][\"fields\"].assoc(subfield_name)\n return f if f\n end\n return [subfield_name, {\"cols\" => 1}]\n end", "def have_model_design?\n\t\t\ttrue\n\tend", "def geometry_columns!; end", "def column_div(options = {}, &block)\n klass = options.delete(:type) == :primary ? \"col1\" : \"col2\"\n # Allow callers to pass in additional classes.\n options[:class] = \"#{klass} #{options[:class]}\".strip\n concat(content_tag(:div, capture(&block), options))\n end", "def column_div(options = {}, &block)\n klass = options.delete(:type) == :primary ? \"col1\" : \"col2\"\n # Allow callers to pass in additional classes.\n options[:class] = \"#{klass} #{options[:class]}\".strip\n concat(content_tag(:div, capture(&block), options))\n end", "def predefined_columns\n helper_module = \"Netzke::Helpers::#{short_widget_class_name}#{data_class.name}\".constantize rescue nil\n \n data_class_columns = data_class && data_class.column_names.map(&:to_sym) || []\n \n if helper_module\n exposed_attributes = helper_module.respond_to?(:exposed_attributes) ? normalize_array_of_columns(helper_module.exposed_attributes) : nil\n virtual_attributes = helper_module.respond_to?(:virtual_attributes) ? helper_module.virtual_attributes : []\n excluded_attributes = helper_module.respond_to?(:excluded_attributes) ? helper_module.excluded_attributes : []\n attributes_config = helper_module.respond_to?(:attributes_config) ? helper_module.attributes_config : {}\n \n res = exposed_attributes || data_class_columns + virtual_attributes\n \n res = normalize_columns(res)\n \n res.reject!{ |c| excluded_attributes.include? c[:name] }\n\n res.map!{ |c| c.merge!(attributes_config[c[:name]] || {})}\n else\n res = normalize_columns(data_class_columns)\n end\n \n res\n end", "def have_model_design?\n\t\ttrue\n\tend", "def custom_show_content_classes\n 'col-md-12 show-document'\n end", "def custom_show_content_classes\n 'col-md-12 show-document'\n end", "def scaffold_column_options(column_name)\n @scaffold_column_options_hash ||= scaffold_column_options_hash\n @scaffold_column_options_hash[column_name]\n end", "def column(c=0)\n percent_width(g_col_width, column_width(c))\n end", "def set_grid_columns(columns)\n TSApi.tsapi_setDefinedColumnsOnDisplay(columns, 0)\n end", "def appropriate_column_listing(columns = columns_joined)\n has_config_defined_cols? == true ? \", #{columns}\" : \"\"\n end", "def set_grid_columns_on_display(columns, display_id)\n TSApi.tsapi_setDefinedColumnsOnDisplay(columns, display_id)\n end", "def main_content_classes\n if !has_search_parameters?\n \"col-xs-12\"\n else\n super\n end\n end", "def stop_columns\n return false unless @columns_on\n @columns_on = false\n\n @columns[:bot_y] = @y if @y < @columns[:bot_y]\n\n if (@columns[:bot_y] > @bottom_margin) or @column_number == 1\n @y = @columns[:bot_y]\n else\n start_new_page\n end\n restore_margins_after_columns\n @columns = {}\n true\n end", "def use_autowidth() @use_autowidth; end", "def columns=(integer); end", "def layout_fields\n \n end", "def render\n\t\tclear_screen\n\t\tcenter_this [\"\",\" MINESWEE\\u2691ER\"]\n\n\t\t# Create the upper and lower vertical edges of board\n\t\tboard_vertical_edge = \" +\"\n\t\[email protected] { board_vertical_edge << \"--\" }\n\t\tboard_vertical_edge << \"-+\"\n\n\t\t# Display column headers vertically to save space\n\t\t# Places tens place directly above the ones place, if necessary\n\t\ttens = \" \"\n\t\tones = \" \"\n\t\[email protected] do |x|\n\t\t\tif x >= 10\n\t\t\t\ttens << x.to_s[0] + \" \"\n\t\t\t\tones << x.to_s[1] + \" \"\n\t\t\telse\n\t\t\t\ttens << \" \"\n\t\t\t\tones << x.to_s + \" \"\n\t\t\tend\n\t\tend\n\t\tcenter_this tens if @width >= 11\n\t\tcenter_this ones\n\t\tcenter_this board_vertical_edge # Display top edge of board\n\n\t\t# Loop through and display each row\n\t\t@cell_at.each_with_index do |row, row_title|\n\t\t\t# Add the row title, as a letter, to the row contents\n\t\t\trow_contents = row_title.to_s.tr(\"0-9\", \"a-z\").upcase + \" | \"\n\t\t\t# Loop through each cell in row and it to row contents\n\t\t\trow.each do |col|\n\t\t\t\tcase col.state\n\t\t\t\twhen :hidden\n\t\t\t\t\trow_contents << \"\\u2591 \"\n\t\t\t\twhen :flagged\n\t\t\t\t\trow_contents << \"\\u2691 \"\n\t\t\t\twhen :visible\n\t\t\t\t\trow_contents << col.risk unless col.risk == :mine\n\t\t\t\t\trow_contents << \"\\u2699\" if col.risk == :mine\n\t\t\t\t\trow_contents << \" \"\n\t\t\t\tend\n\t\t\tend\n\t\t\trow_contents << \"|\"\n\t\t\tcenter_this row_contents # Display row\n\t\tend\n\t\tcenter_this board_vertical_edge # Display bottom edge of board\n\t\tcenter_this \" FLAGS LEFT: #{@flags_left}\" # Display remaining flags\n\t\tputs\n\t\tputs\n\tend", "def custom_layout\n case action_name\n when \"industry_xls\"\n \"no_layout\"\n when \"supplier_profiles\"\n \"no_layout\"\n when \"total_xls\"\n \t \"no_layout\"\n when \"industry_level\"\n \"no_layout\"\n when \"supplier_level\"\n \"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\n when \"customer_record\"\n \t\"no_layout\"\n when \"most_company_xls\"\n \t\"no_layout\"\n when \"conversion_industry\"\n \t\"no_layout\"\n when \"conversion_company\"\n \t\"no_layout\"\n when \"company_xls\"\n \t\"no_layout\"\t\n when \"suppliers_profiles\"\n \t\"no_layout\"\n when \"registered_suppliers\"\n \t\"no_layout\"\n when \"unregistered_suppliers\"\n \t\"no_layout\"\n when \"all_customers\"\n \t\"no_layout\"\n when \"jagent\"\n \t\"no_layout\"\n when \"sagent\"\n \t\"no_layout\"\n when \"poll\"\n \"no_layout\"\t\n when \"industry_conversion\"\n \"no_layout\"\t\n when \"company_conversion\"\t\t\n \"no_layout\"\n when \"reviews_processed\"\n \"no_layout\"\n when \"agent_output\"\n \"no_layout\"\n when \"agent_performance\"\n \"no_layout\"\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n else\n \"admin\"\n end\n end", "def initial_columns(with_excluded = false)\n # Normalize here, as from the config we can get symbols (names) instead of hashes\n columns_from_config = config[:columns] && normalize_attrs(config[:columns])\n\n\n if columns_from_config\n # automatically add a column that reflects the primary key (unless specified in the config)\n columns_from_config.insert(0, {:name => data_class.primary_key}) unless columns_from_config.any?{ |c| c[:name] == data_class.primary_key }\n\n # reverse-merge each column hash from config with each column hash from exposed_attributes\n # (columns from config have higher priority)\n for c in columns_from_config\n corresponding_default_column = default_columns.find{ |k| k[:name] == c[:name] }\n c.reverse_merge!(corresponding_default_column) if corresponding_default_column\n end\n columns_for_create = columns_from_config\n else\n # we didn't have columns configured in component's config, so, use the columns from the data class\n columns_for_create = default_columns\n end\n\n filter_out_excluded_columns(columns_for_create) unless with_excluded\n\n # Make the column config complete with the defaults\n columns_for_create.each do |c|\n detect_association(c)\n set_default_virtual(c)\n set_default_header(c)\n set_default_editor(c)\n set_default_width(c)\n set_default_hidden(c)\n set_default_editable(c)\n set_default_sortable(c)\n set_default_filterable(c)\n end\n\n columns_for_create\n end", "def width\n @column_widths.inject(0) { |s,r| s + r }\n end", "def compact_columns!\n ensure_shape\n @data = @data.transpose.delete_if { |ar| ar.all? { |el| el.to_s.empty? } || ar.empty? }.transpose\n calc_dimensions\n end", "def columns!\n @columns = nil\n columns\n end", "def column_display param, column_name\n defined?(param[:searchable][:col]).nil? ? true : param[:searchable][:col].include?(column_name) ? true : false\n end", "def grid_row_undisplayed_columns\n []\n end", "def columnCount(parent)\n return 1\n end", "def content_cols\n longest = @content.max_by(&:length)\n ## 2013-03-06 - 20:41 crashes here for some reason when man gives error message no man entry\n return 0 unless longest\n longest.length\n end", "def adapt_design_size \n hits = 0\n while space_factor < Constants::Min_allowed_factor and hits < 3\n if @vertical \n @height /= Constants::Shrink_factor\n @height += @height%20 == 0 ? 0 : 20-@height%20\n elsif not @vertical\n @width /= Constants::Shrink_factor\n @width += @width%20 == 0 ? 0 : 20-@width%20\n end\n composite_main_image_position\n generate_white_spaces\n white_space_area = white_space_w * white_space_h\n hits +=1\n end\n end" ]
[ "0.6297525", "0.6269125", "0.5987522", "0.58625585", "0.57018286", "0.56802577", "0.56232363", "0.5596027", "0.55496496", "0.5507414", "0.5501593", "0.546916", "0.5468187", "0.54566157", "0.54216945", "0.54158646", "0.53891265", "0.5380275", "0.53673005", "0.5358285", "0.53458714", "0.533503", "0.5320509", "0.53137064", "0.5313673", "0.53099436", "0.53072494", "0.52867126", "0.5278852", "0.5278852", "0.5267685", "0.5267653", "0.5245411", "0.5242114", "0.52270263", "0.5202088", "0.520164", "0.51808786", "0.51745737", "0.51662457", "0.5150521", "0.5147961", "0.5146865", "0.5139632", "0.51321036", "0.5124603", "0.51056784", "0.51014423", "0.5099483", "0.5091497", "0.5086808", "0.50816566", "0.5071583", "0.5047238", "0.5034027", "0.50280786", "0.5013645", "0.50084364", "0.50004864", "0.49955857", "0.49935374", "0.4991055", "0.49893022", "0.4988761", "0.49854404", "0.49821362", "0.49680465", "0.49592766", "0.494976", "0.49490675", "0.49374148", "0.49324667", "0.49318057", "0.4929596", "0.4929596", "0.49285662", "0.49284586", "0.49128583", "0.49128583", "0.49090514", "0.49014485", "0.48996863", "0.4894301", "0.48897117", "0.48852712", "0.48840576", "0.48807868", "0.48798415", "0.48737437", "0.48697203", "0.48683515", "0.4850714", "0.48502165", "0.48466936", "0.48364645", "0.48334894", "0.483182", "0.48274288", "0.4822537", "0.48216596" ]
0.5603516
7
Aggregate RUM events. The API endpoint to aggregate RUM events into buckets of computed metrics and timeseries.
def aggregate_rum_events_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RUMAPI.aggregate_rum_events ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RUMAPI.aggregate_rum_events" end # resource path local_var_path = '/api/v2/rum/analytics/aggregate' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'RUMAnalyticsAggregateResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :aggregate_rum_events, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RUMAPI#aggregate_rum_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregateData(aggregator)\n @timeStamps = aggregator.aggregate(@timeStamps, ChartDirector::AggregateFirst)\n @highData = aggregator.aggregate(@highData, ChartDirector::AggregateMax)\n @lowData = aggregator.aggregate(@lowData, ChartDirector::AggregateMin)\n @openData = aggregator.aggregate(@openData, ChartDirector::AggregateFirst)\n @closeData = aggregator.aggregate(@closeData, ChartDirector::AggregateLast)\n @volData = aggregator.aggregate(@volData, ChartDirector::AggregateSum)\n end", "def aggregate(request)\n end", "def handle_aggregate_event(event)\n handle_recursively event\n end", "def revenue\n user = revenue_params[:user_id].present? ? User.find(revenue_params[:user_id]) : @resource\n search = params[:event_name].strip unless params[:event_name].nil?\n column = params[:column].nil? ? 'event_name' : params[:column]\n direction = params[:direction].nil? ? 'asc' : params[:direction]\n items = Event.my_order(column, direction).only_creator(user.id)\n .title_like(search).select(\"events.id AS event_id, events.title AS event_name,\"+\n \"(SELECT COUNT(sch.id) FROM event_schedules AS sch WHERE sch.event_id = events.id) AS number_agenda_item,\"+\n \"COALESCE((SELECT SUM(pym1.amount) FROM payment_transactions AS pym1 WHERE pym1.event_id = events.id AND pym1.description = 'SchedulePayment'), 0) AS net_revenue\")\n .group(\"events.id\")\n json_response_serializer_collection items, RevenueReportSerializer\n end", "def aggregate\n public_send aggregate_name\n end", "def get_hist_stats_aggregated_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_hist_stats_aggregated ...'\n end\n # unbox the parameters from the hash\n allowable_values = [\"hour\", \"minute\", \"day\"]\n if @api_client.config.client_side_validation && opts[:'by'] && !allowable_values.include?(opts[:'by'])\n fail ArgumentError, \"invalid value for \\\"by\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"usa\", \"europe\", \"asia\", \"asia_india\", \"asia_southkorea\", \"africa_std\", \"southamerica_std\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/stats/aggregate'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'by'] = opts[:'by'] if !opts[:'by'].nil?\n query_params[:'region'] = opts[:'region'] if !opts[:'region'].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\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HistoricalAggregateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"HistoricalApi.get_hist_stats_aggregated\",\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: HistoricalApi#get_hist_stats_aggregated\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def aggregate\n []\n end", "def index\n @event_aggs = EventAgg.all\n end", "def collect(event)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'event', event);\n\t\t\tclient.queue_service_action_call('stats', 'collect', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def aggregate_sum(aggr)\n sum = {}\n aggr.each do |ts, counterVals|\n sum[ts] = {} unless sum.has_key?ts\n counterVals.each do |obj, count|\n if obj.respond_to?(:enterprise_id)\n eid = obj.public_send(:enterprise_id).to_s\n sum[ts][eid] = sum[ts].fetch(eid, 0) + count\n end\n end\n end\n sum\n end", "def aggregate(type, ts)\n Octo::Enterprise.each do |enterprise|\n aggregate_baseline enterprise.id, type, ts\n end\n end", "def build_usage_by_resource\n usage_by_model_event = FedoraAccessEvent.item_usage_by_type(\n start_date: metrics.report_start_date,\n end_date: metrics.report_end_date\n )\n accumulator = {}\n usage_by_model_event.each do |fedora_object|\n accumulator[fedora_object.item_type.to_sym] ||= {}\n accumulator[fedora_object.item_type.to_sym][fedora_object.event.to_sym] ||= 0\n accumulator[fedora_object.item_type.to_sym][fedora_object.event.to_sym] += fedora_object.object_count\n end\n metrics.item_usage_by_resource_type_events = accumulator\n end", "def aggregate\n #response = Result.collection.map_reduce(self.map_fn(), _reduce(), :raw => true, :out => {:inline => true}, :query => {:execution_id => id})\n response = Result.where(execution_id: id).map_reduce(self.map_fn(), self.query.reduce).out(inline: true).raw()\n results = response['results']\n if results\n self.aggregate_result = {}\n results.each do |result|\n result = prettify_generated_result(result) if self.query.generated? && result['value']['rereduced']\n self.aggregate_result[result['_id']] = result['value']\n end\n save!\n end\n end", "def list_rum_events(opts = {})\n data, _status_code, _headers = list_rum_events_with_http_info(opts)\n data\n end", "def aggregate op, type = :fixnum\n check_closed\n\n aggregation_impl op, type\n end", "def process_aggregates\n aggregates = new_collection\n\n unless assessment_group.scoring_type == 2 # do except for scoring type 'grades'\n aggregates.push new_aggregate('score','Total Score',@total_score)\n percentage = @total_score.zero? ? nil : ((@total_score / @total_max) * 100).round(2)\n aggregates.push new_aggregate('percentage','Total Percentage', percentage)\n aggregates.push new_aggregate('grade','Overall Grade',overall_grade_set.grade_string_for(percentage)) if overall_grade_set.present?\n end\n\n aggregates\n end", "def aggregates\n self.class.instance_variable_get(:@aggregates) || {}\n end", "def list_rum_events_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.list_rum_events ...'\n end\n allowable_values = ['timestamp', '-timestamp']\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_limit\"]\" when calling RUMAPI.list_rum_events, must be smaller than or equal to 1000.'\n end\n # resource path\n local_var_path = '/api/v2/rum/events'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil?\n query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?\n query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil?\n query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].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\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMEventsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_rum_events,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#list_rum_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def aggregation(*args, &block)\n @aggregations ||= AggregationsCollection.new\n @aggregations.update args.first => Aggregation.new(*args, &block)\n self\n end", "def aggregates\n @aggregates\n end", "def aggregate_tags!\n map = \"function() {\n if (!this.#{tags_field}) {\n return;\n }\n\n for (index in this.#{tags_field}) {\n emit(this.#{tags_field}[index], 1);\n }\n }\"\n\n reduce = \"function(previous, current) {\n var count = 0;\n\n for (index in current) {\n count += current[index]\n }\n\n return count;\n }\"\n\n map_reduce_options = { :out => tags_aggregation_collection }.\n merge(tag_aggregation_options)\n collection.master.map_reduce(map, reduce, map_reduce_options)\n end", "def add_aggregations\n add_collection_aggregation\n add_tag_aggregations\n end", "def aggregates\n Rails.cache.fetch(\"aggregates_#{interval}_#{cache_time}\", expires_in: self.cache_time) {\n ActiveRecord::Base.connection.exec_query(\"\n select\n stddev(sum_downvotes) as stddev,\n sum(sum_downvotes) as sum,\n avg(sum_downvotes) as avg,\n avg(n_comments) as n_comments,\n count(*) as n_commenters\n from (\n select\n sum(downvotes) as sum_downvotes,\n count(*) as n_comments\n from comments join users on comments.user_id = users.id\n where\n (comments.created_at >= '#{period}') and\n users.banned_at is null and\n users.deleted_at is null\n GROUP BY comments.user_id\n ) sums;\n \").first.symbolize_keys!\n }\n end", "def aggregate(source, options={})\n return send_message(SkyDB::Message::Lua::Aggregate.new(source, options))\n end", "def each_aggregate(&block)\n if block_given?\n @aggregates.each_function(&block)\n self\n else\n @aggregates.functions\n end\n end", "def get_cache_aggregation\n redis_data = []\n cache_result = []\n redis_cache = $redis.keys\n unless redis_cache.empty?\n redis_cache.each do |k|\n reading = eval($redis.get(k))\n next if !reading[\"household_token\"].eql?(params[:household_token])\n redis_data << { \"temperature\" => reading[\"temperature\"], \"humidity\" => reading[\"humidity\"], \"battery_charge\" => reading[\"battery_charge\"] }\n end\n end\n\n unless redis_data.blank?\n thermostat_attr = [\"temperature\", \"humidity\", \"battery_charge\"]\n avg_data = get_avg_data(thermostat_attr, redis_data)\n min_data = get_min_data(thermostat_attr, redis_data)\n max_data = get_max_data(thermostat_attr, redis_data)\n cache_result << {\"temperature\" => {\"avg\" => avg_data[0].round(2), \"min\" => min_data[0], \"max\" => max_data[0]}}\n cache_result << {\"humidity\" => {\"avg\" => avg_data[1].round(2), \"min\" => min_data[1], \"max\" => max_data[1]}}\n cache_result << {\"battery_charge\" => {\"avg\" => avg_data[2].round(2), \"min\" => min_data[2], \"max\" => max_data[2]}}\n end\n return cache_result\n end", "def method_missing(method_sym, *arguments, &block)\n if event_method?(method_sym)\n send_event_to_aggregate(method_sym, *arguments, &block)\n else\n @_aggregate.send method_sym, *arguments, &block\n end\n end", "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "def summarize_stats(events)\n mawing_incidents = events.count(:lumberjack_mawed)\n lumber_collected = events.map { |event| \n if event == :tree_chopped\n 1\n elsif event == :elder_tree_chopped\n 2\n else\n 0\n end\n }.reduce(0, :+)\n saplings_created = events.count(:sapling_planted)\n saplings_aged = events.count(:sapling_to_tree)\n trees_aged = events.count(:tree_to_elder)\n\n {\n saplings_created: saplings_created,\n saplings_aged: saplings_aged,\n trees_aged: trees_aged,\n lumber_collected: lumber_collected,\n mawing_incidents: mawing_incidents \n }\n end", "def post_analytics_flows_aggregates_query(body, opts = {})\n data, _status_code, _headers = post_analytics_flows_aggregates_query_with_http_info(body, opts)\n return data\n end", "def aggregate!(ts = Time.now.floor)\n unless self.ancestors.include?MongoMapper::Document\n raise NoMethodError, 'aggregate! not defined for this counter'\n end\n\n aggr = aggregate(ts)\n sum = aggregate_sum(aggr)\n aggr.each do |_ts, counterVals|\n counterVals.each do |obj, count|\n counter = self.new\n counter.enterprise_id = obj.enterprise.id\n counter.uid = obj.unique_id\n counter.count = count\n counter.type = Octo::Counter::TYPE_MINUTE\n counter.ts = _ts\n totalCount = sum[_ts][obj.enterprise_id.to_s].to_f\n counter.obp = (count * 1.0)/totalCount\n\n baseline_value = get_baseline_value(:TYPE_MINUTE, obj)\n counter.divergence = kl_divergence(counter.obp,\n baseline_value)\n counter.save!\n end\n end\n call_completion_hook(Octo::Counter::TYPE_MINUTE, ts)\n end", "def aggregations\n response['aggregations'] ? Hashie::Mash.new(response['aggregations']) : nil\n end", "def aggregate\n @aggregate ||= klass.build.tap do |aggregate|\n aggregate.instance_variable_set(:@id, id)\n aggregate.instance_variable_set(:@local_version, version)\n aggregate.instance_variable_set(:@persisted_version, version)\n events.each { |event| EventApplicator.apply_event!(aggregate, event) }\n end\n end", "def aggregate(query)\n client.search(\n index: name,\n body: query\n )\n end", "def add_event(event_name, tags = {})\n event_name = \"gitlab_transaction_event_#{event_name}_total\".to_sym\n metric = self.class.prometheus_metric(event_name, :counter) do\n label_keys tags.keys\n end\n\n metric.increment(filter_labels(tags))\n end", "def events\n response.present? ? response.totals_for_all_results['ga:totalEvents'] : 0\n end", "def retrieve_aggregates\n fail ArgumentError, \"Invalid range type '#{range_type}'\" unless %w(year month week day hour).include? range_type\n scope = LineAggregate.\n where(:function => function).\n where(:range_type => 'normal').\n where(:account => account.try(:to_s)).\n where(:partner_account => partner_account.try(:to_s)).\n where(:code => code.try(:to_s)).\n where(:filter => filter.inspect).\n where(LineAggregate.arel_table[range_type].not_eq(nil))\n @aggregates = scope.each_with_object({}) do |result, hash|\n hash[result.key] = formatted_amount(result.amount)\n end\n end", "def aggregated_over_time_query\n # TODO Remember to implement permitted parameters here\n query = @grouping_class.new(sanitized_attributes, params)\n @aggregated_over_time_data = Rails.cache.fetch(['aggregated_over_time_data', params], expires_in: 1.week) do\n query.aggregated_over_time_data\n end\n\n render json: @aggregated_over_time_data\n end", "def aggregate\n data_hash = MediaSourceSerializer.new(\n available_sources, is_collection: true\n ).aggregated_hash\n\n unless params_valid?\n data_hash[:errors] = 'One or more specified MediaSources do not exist'\n end\n\n render json: data_hash.to_json\n end", "def index\n @events = apply_scopes(Event).decorate.group_by(&:date)\n end", "def revenue\n end", "def events\n collection = Miasma::Models::Orchestration::Stack::Events.new(self)\n collection.define_singleton_method(:perform_population) { [] }\n collection\n end", "def fetch_analytics(collection)\n ga4 = ga4_analytics(collection)\n ua = ua_analytics(collection)\n \n analytics = (ga4+ua).map{|a| a.to_h }.group_by{|h| h[:object] }.map{|k,v| v.reduce({}, :merge)}\n \n analytics.each do |entry|\n entry[:users] = entry[:users].to_i + entry[:ga4_users].to_i if entry[:ga4_users].present?\n entry[:totalEvents] = entry[:totalEvents].to_i + entry[:ga4_totalEvents].to_i if entry[:ga4_totalEvents].present?\n entry[:totalHits] = entry[:totalHits].to_i + entry[:ga4_totalHits].to_i if entry[:ga4_totalHits].present? \n end\n\n object_hash = object_titles(collection)\n analytics.each{ |r| r[:title] = object_hash[r[:object]] }\n\n if sort_column == 'title'\n analytics.sort_by! { |hsh| hsh[sort_column.to_sym] }\n else\n analytics.sort_by! { |hsh| hsh[sort_column.to_sym].to_i }\n end\n analytics.reverse! if sort_direction == 'desc'\n\n analytics\n end", "def revenue\n time_key = Time.now.strftime \"%Y-%m-%dT%H\"\n raise ApiError, \"Parameter required: 'delta' or 'total\" unless params[:delta] or params[:total]\n raise ApiError, \"Please send only one of: 'delta' or 'total\" if params[:delta] and params[:total]\n\n $redis.sadd \"rvn:#{@account}:days\", Date.today\n if params[:total]\n $redis.set \"rvn:#{@account}:#{Date.today}\", params[:total].to_i\n elsif params[:delta]\n keys = (0..30).map { |i| \"rvn:#{@account}:#{Date.today - i}\" }\n current = $redis.mget(*keys).compact.first || 0\n $redis.set \"rvn:#{@account}:#{Date.today}\", current + params[:delta].to_i\n end\n\n render :json => { :status => \"Success\" }\n end", "def get_event_stats ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/stats\"\n end", "def aggregate(file)\n read_entries(file) do |data|\n ManageData.aggregate(data, file.file.chomp(File.extname(file.file)))\n end\n file.add_to_redis\n end", "def events\n @events = registered_application.events.group_by(&:name)\n end", "def aggregate_ci_app_pipeline_events_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CIVisibilityPipelinesAPI.aggregate_ci_app_pipeline_events ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling CIVisibilityPipelinesAPI.aggregate_ci_app_pipeline_events\"\n end\n # resource path\n local_var_path = '/api/v2/ci/pipelines/analytics/aggregate'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CIAppPipelinesAnalyticsAggregateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :aggregate_ci_app_pipeline_events,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CIVisibilityPipelinesAPI#aggregate_ci_app_pipeline_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def aggregate_f(*args)\n aggregate_function.f(*args)\n end", "def aggregate_logs_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.aggregate_logs ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling LogsAPI.aggregate_logs\"\n end\n # resource path\n local_var_path = '/api/v2/logs/analytics/aggregate'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'LogsAggregateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :aggregate_logs,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsAPI#aggregate_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_averages\n\n # Calculate the timestamps for the averages related to this metrics\n # timestamp.\n timestamp_5m = timestamp.floor(5.minutes)\n timestamp_1h = timestamp.change(:min => 0)\n timestamp_1d = timestamp.beginning_of_day\n timestamp_1w = timestamp.beginning_of_week\n\n # Write the averages using an upsert with $inc so we just increment the\n # value of any pre-defined average for the timespan, or create them if\n # they don't exist.\n conditions = { :node_id => node_id, :path => path }\n value = {\n '$set' => { :node_id => node_id, :path => path },\n '$inc' => { :total => counter, :count => 1 }\n }\n\n # Write the averages for the last 5 minutes.\n conditions_5m = conditions.merge(:timestamp => timestamp_5m)\n value_5m = value.merge('$set' => { :timestamp => timestamp_5m })\n Sherlock::Models::MetricAvg5m.collection.update(conditions_5m, value_5m, :upsert => true)\n calculate_metric_average(Sherlock::Models::MetricAvg5m, node_id, path, timestamp_5m)\n\n # Write the averages for the last hour.\n conditions_1h = conditions.merge(:timestamp => timestamp_1h)\n value_1h = value.merge('$set' => { :timestamp => timestamp_1h })\n Sherlock::Models::MetricAvg1h.collection.update(conditions_1h, value_1h, :upsert => true)\n calculate_metric_average(Sherlock::Models::MetricAvg1h, node_id, path, timestamp_1h)\n\n # Write the averages for the last day.\n conditions_1d = conditions.merge(:timestamp => timestamp_1d)\n value_1d = value.merge('$set' => { :timestamp => timestamp_1d })\n Sherlock::Models::MetricAvg1d.collection.update(conditions_1d, value_1d, :upsert => true)\n calculate_metric_average(Sherlock::Models::MetricAvg1d, node_id, path, timestamp_1d)\n \n # Write the averages for the last week.\n conditions_1w = conditions.merge(:timestamp => timestamp_1w)\n value_1w = value.merge('$set' => { :timestamp => timestamp_1w })\n Sherlock::Models::MetricAvg1w.collection.update(conditions_1w, value_1w, :upsert => true)\n calculate_metric_average(Sherlock::Models::MetricAvg1w, node_id, path, timestamp_1w)\n\n end", "def get_hist_stats_aggregated(opts = {})\n data, _status_code, _headers = get_hist_stats_aggregated_with_http_info(opts)\n data\n end", "def post_analytics_flows_aggregates_query_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.post_analytics_flows_aggregates_query ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling AnalyticsApi.post_analytics_flows_aggregates_query\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/flows/aggregates/query\".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 => 'FlowAggregateQueryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#post_analytics_flows_aggregates_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def post_analytics_evaluations_aggregates_query(body, opts = {})\n data, _status_code, _headers = post_analytics_evaluations_aggregates_query_with_http_info(body, opts)\n return data\n end", "def aggregations\n @aggregations ||= AggregationSet.new\n end", "def aggregate_calls(metrics,parent_meta)\n categories = categories(metrics)\n aggregates = {}\n categories.each do |cat|\n agg_meta=ScoutRails::MetricMeta.new(\"#{cat}/all\")\n agg_meta.scope = parent_meta.metric_name\n agg_stats = ScoutRails::MetricStats.new\n metrics.each do |meta,stats|\n if meta.metric_name =~ /\\A#{cat}\\//\n agg_stats.combine!(stats) \n end\n end # metrics.each\n aggregates[agg_meta] = agg_stats unless agg_stats.call_count.zero?\n end # categories.each \n aggregates\n end", "def search_rum_events_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.search_rum_events ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling RUMAPI.search_rum_events\"\n end\n # resource path\n local_var_path = '/api/v2/rum/events/search'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMEventsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :search_rum_events,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#search_rum_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def aggregate(value)\n @query_hash[AGGREGATE][value] = value\n self\n end", "def baselineable\n key :type, Integer\n key :ts, Time\n key :uid, String\n\n key :val, Float\n\n # Generate the aggregator methods\n generate_aggregators { |ts, method|\n type = method_names_type_counter(method)\n aggregate type, ts\n }\n end", "def aggregate_class_lifelines events\n lifelines = method_events(events).group_by(&:class_name).map {|cn,es| class_commit_monthly_timeline(cn,es).map(&:second) }\n lifelines.reduce {|aggregate,es| aggregate.zip(es).map { |x,y| [x || 0, y || 0] }.map {|x,y| x + y }}\nend", "def aggregate(property, resolution)\n # Look up the date/time dimensions for the resolution.\n date_time_dimensions = date_time_dimensions_for_resolution(resolution)\n\n # Build the timestamp from the date/time dimensions.\n timestamp = Sequel::SQL::NumericExpression.new(:+, *date_time_dimensions).cast(:timestamp).as(:timestamp)\n\n # Build a window function to sum the counts.\n count_window_function = Sequel::SQL::Function.new(:sum, :count).over(partition: date_time_dimensions).as(:count)\n\n # Build the aggregation window functions.\n aggregation_window_functions = AGGREGATIONS.map do |aggregation|\n Sequel::SQL::Function.new(aggregation, :\"#{property}\").over(partition: date_time_dimensions).as(:\"#{aggregation}_#{property}\")\n end\n\n facts_dataset\n .join(:dimension_dates, date: Sequel.cast(:timestamp, :date))\n .join(:dimension_times, time: Sequel.cast(:timestamp, :time))\n .distinct(*date_time_dimensions)\n .select(timestamp, count_window_function, *aggregation_window_functions)\n end", "def process_events events\n @events = Hash.new\n\n # Organize the event based on type\n # http://developer.github.com/v3/activity/events/types/ lists event types.\n events.each do |event|\n @events[event.type] ||= Array.new\n @events[event.type] << event\n end\n @event_types = Hash.new\n @events.each do |key,value|\n @event_types[key.underscore.humanize.sub(' event', '')] = value.count\n end\n end", "def revenue(date)\n end", "def get_db_aggregation\n db_data_all = []\n aggregation = @thermostat.readings.pluck('Avg(temperature)', 'Min(temperature)', 'Max(temperature)', 'Avg(humidity)', 'Min(humidity)', 'Max(humidity)', 'Avg(battery_charge)', 'Min(battery_charge)', 'Max(battery_charge)').first\n unless aggregation.empty?\n db_data_all << {\"temperature\" => {\"avg\" => aggregation[0].round(2), \"min\" => aggregation[1], \"max\" => aggregation[2]}}\n db_data_all << {\"humidity\" => {\"avg\" => aggregation[3].round(2), \"min\" => aggregation[4], \"max\" => aggregation[5]}}\n db_data_all << {\"battery_charge\" => {\"avg\" => aggregation[6].round(2), \"min\" => aggregation[7], \"max\" => aggregation[8]}}\n end\n return db_data_all\n end", "def visit_axiom_aggregate_sum(sum)\n aggregate_function_sql(SUM, sum)\n end", "def get_aggregate aggregate_query\n ensure_not_closed!\n ensure_service!\n\n return enum_for :get_aggregate, aggregate_query unless block_given?\n\n results = service.run_aggregate_query aggregate_query.parent_path,\n aggregate_query.to_grpc,\n transaction: transaction_or_create\n results.each do |result|\n extract_transaction_from_result! result\n next if result.result.nil?\n yield AggregateQuerySnapshot.from_run_aggregate_query_response result\n end\n end", "def post_analytics_evaluations_aggregates_query_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.post_analytics_evaluations_aggregates_query ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling AnalyticsApi.post_analytics_evaluations_aggregates_query\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/evaluations/aggregates/query\".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 => 'EvaluationAggregateQueryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#post_analytics_evaluations_aggregates_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add(event)\n @redis.rpush @key, event\n end", "def build\n if %w[avg_first_response_time avg_resolution_time].include?(params[:metric])\n timeseries.each_with_object([]) do |p, arr|\n arr << { value: p[1], timestamp: p[0].in_time_zone(@timezone).to_i, count: @grouped_values.count[p[0]] }\n end\n else\n timeseries.each_with_object([]) do |p, arr|\n arr << { value: p[1], timestamp: p[0].in_time_zone(@timezone).to_i }\n end\n end\n end", "def report_metrics\n metadata = {\n 'sourcetype' => 'json',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n\n # We're creating a new Hash b/c 'node' and 'all_resources' in run_status\n # are just TOO large.\n event = {\n :failed => run_status.failed?,\n :start_time => run_status.start_time,\n :end_time => run_status.end_time,\n :elapsed_time => run_status.elapsed_time,\n :exception => run_status.formatted_exception\n }.to_json\n\n splunk_post(event, metadata)\n end", "def aggregate_values(rows)\n # Convert rows into hash where each key is a column name and the each\n # value is an array of values for that column\n cols = OrderedHash.new\n rows.each do |row|\n row.each do |k,v|\n cols[k] ||= []\n cols[k] << v\n end\n end\n\n # Loop through each column, applying an aggregate proc if one exists\n # to the array of column values. If a proc does not exist we take the\n # last value from the array.\n result = cols.inject(OrderedHash.new) do |hsh, (col, vals)|\n hsh[col] = if @aggregators[col]\n @aggregators[col].call(vals)\n else\n vals.last\n end\n hsh\n end\n\n Row[result]\n end", "def aggregate profile_name, interface=nil\n extend TCD::Common\n count=0\n Dir.glob(File.expand_path(\"~/.tcd/stats/#{profile_name}/#{interface || '*'}/*\")).each {|path|\n next unless TCD::Profiles.needsAggregating(path)\n day= getDateFromPath(path)\n interface= File.basename(File.dirname(path))\n stats= TCD::Storage.readStats(profile_name, interface) {|p| TCD::Profiles.isDay(day,p) }\n in_sum= out_sum= 0\n stats[:in].each {|size, date| in_sum+=size }\n stats[:out].each {|size, date| out_sum+=size }\n stats[:in]= [[in_sum, :sum]] + stats[:in]\n stats[:out]=[[out_sum,:sum]] + stats[:out]\n writeFile YAML.dump(stats), '00-00-00_aggr.txt', path+'/'\n TCD::Storage.postAggDeletion( path )\n count+=1\n }\n count\n end", "def set_event_agg\n @event_agg = EventAgg.find(params[:id])\n end", "def store_aggregates\n raise NotImplementedError\n end", "def reduction_multiple events\n event_list = method_events(events)\n event_list.group_by {|e| e.method_name }\n .select {|_,es| es.map(&:committer).uniq.count != 1 }\n .map {|_,es| percent_reduction(es) }\n .mean\nend", "def process_aggregates(aggregates, occupancy_status, last_detected, exchange)\n aggregates.each do |name, agg_sensors|\n occupied = false \n sensors_included = agg_sensors.split(\",\")\n sensors_included.each do |sensor|\n occupied = true if occupancy_status[sensor] && occupancy_status[sensor] == 'occupied'\n end\n update_sensor_status name, occupied, occupancy_status, last_detected, exchange\n end \nend", "def create_aggregates(db: EventSourcery::Postgres.config.event_store_database,\n table_name: EventSourcery::Postgres.config.aggregates_table_name)\n db.create_table(table_name) do\n uuid :aggregate_id, primary_key: true\n column :version, :bigint, default: 1\n end\n end", "def methods_profile_norm_committer events\n events.group_by {|e| week_from_date(e.date) }\n .map {|week,es| [week, method_count(es, :added) / c_count(es).to_f, method_count(es, :changed) / c_count(es).to_f, method_count(es, :deleted) / c_count(es).to_f] }\nend", "def collect(metrics)\n metrics\n end", "def summarize()\n fields.each do |name, metric|\n params = {}\n params[:service] = \"process;#{pid};#{name}\"\n params[:description] = name\n params[:pname] = comm\n if name == \"State\"\n params[:state] = riemann_statemap(metric)\n params[:value] = metric\n # elsif name.end_with?(\"time\")\n # params[:metric] = time_of(name)\n elsif metric.is_a?(Numeric)\n params[:metric] = metric\n else\n params[:value] = metric\n end\n yield(params)\n end\n end", "def aggregation(operation)\n return self unless operation\n clone.tap do |query|\n unless aggregating?\n query.pipeline.concat(query.selector.to_pipeline)\n query.pipeline.concat(query.options.to_pipeline)\n query.aggregating = true\n end\n yield(query.pipeline)\n end\n end", "def aggregate(array, type = 'normal')\n raise \"Need Array not #{array.class}\" unless array.class == Array\n raise 'Two Arrays are not the same size' unless size == array.size\n\n case type\n when 'normal'\n return aggregate_normal(array)\n when 'max'\n return aggregate_max(array)\n when 'min'\n return aggregate_min(array)\n when 'avg'\n return aggregate_avg(array)\n when 'median'\n return aggregate_median(array)\n end\n end", "def fetch_all_events(params={}, save_to_db=true)\n params = setup_params(params)\n self.model_class = ::Mixpanel::Event\n \n event_names = []\n if params[:event]\n if params[:event].is_a?(Array)\n event_names += params[:event]\n else\n event_names << params[:event]\n end\n else\n # Get names of events.\n event_names = self.fetch_event_names(params, false)\n end\n \n # Get events data.\n method_url = get_method_url('events')\n \n request_params = self.select_params(params, [:type, :unit, :interval, :format, :bucket])\n request_params[:resource] = method_url\n request_params[:event] = event_names.to_json\n puts \">>>>>>>>>>>>>>>>> #{request_params.inspect}\" \n event_data = send_request(request_params)\n puts \">>>>>>>>>>>>>>>>> #{event_data}\"\n # Detect event data is empty or not\n is_empty = (event_data.blank? || event_data[RESPONSE_KEYS[:legend_size]].to_i <= 0)\n if save_to_db && !is_empty\n self.model_class.transaction do \n # Get all target ids existing in DB, in order to detect data was changed or not.\n target_ids = get_target_ids(params)\n \n # Sample data:\n # {'data': {'series': ['2010-05-29',\n # '2010-05-30',\n # '2010-05-31',\n # ],\n # 'values': {'account-page': {'2010-05-30': 1,},\n # 'splash features': {'2010-05-29': 6,\n # '2010-05-30': 4,\n # '2010-05-31': 5,\n # }\n # }\n # },\n # 'legend_size': 2}\n\n # Goal: Store each event in a single record in DB. \n series_data = event_data['data']['series']\n values_data = event_data['data']['values']\n event_names.each do |event_name|\n event_values = values_data[event_name]\n next if event_values.blank?\n \n # Get only series related to the event.\n event_series = event_values.keys & series_data\n\n # Keep the original format of the event data (based on Mixpanel API spec).\n origin_data = {\n :data => {\n :series => event_series, \n :values => {event_name => event_values}\n },\n :legend_size => 1\n }\n \n # Format hash to JSON.\n json_data = origin_data.to_json\n \n self.insert_or_update(params, target_ids, \n event_name, json_data)\n end\n end\n end\n return event_data\n end", "def evaluate_and_dispatch_events\n non_successful_events = []\n\n @events.reverse_each do |event|\n # skipping events that are not whitelisted\n if @config['config'].key?('whitelist') && event['source'] !~ /#{@config['config']['whitelist']}/\n @events.delete(event)\n log.debug(\n \"Skipping event! Source '#{event['source']}' does not \" \\\n \"match /#{@config['config']['whitelist']}/\"\n )\n next\n end\n # removing source key to use local's sensu source name (hostname)\n if @config.key?('config') && \\\n @config['config'].key?('use_default_source') && \\\n @config['config']['use_default_source']\n log.debug(\"Removing 'source' from event, using Sensu's default\")\n event.delete('source')\n end\n # selecting the non-succesful events\n non_successful_events << event if event['status'] != 0\n # dispatching event to Sensu\n @dispatcher.dispatch(event)\n end\n\n # setting up final status and output message\n amount_checks = @config['checks'].length + @config['custom'].length\n amount_events = @events.length\n\n if non_successful_events.empty?\n @status = 0\n @output = \\\n \"OK: Ran #{amount_checks} checks succesfully on #{amount_events} events!\"\n else\n log.debug(\"#{non_successful_events.length} failed events\")\n @status = 1\n non_successful_events.sort_by { |e| e['status'] } .reverse.each do |event|\n @output << ' | ' unless @output.empty?\n @output << \"Source: #{event['source']}, \" \\\n \"Check: #{event['name']}, \" \\\n \"Output: #{event['output']}, \" \\\n \"Status: #{event['status']}\"\n end\n end\n\n log.debug(\"Ran #{amount_checks}, and collected #{amount_events} events\")\n log.debug(\"Final Status: #{@status}\")\n log.debug(\"Final Output: #{@output}\")\n end", "def reductions_by_commit events\n events.group_by(&:method_name).map do |name, method_events|\n [name, percent_reduction(method_events), method_events.count]\n end\nend", "def aggregate\n data = {}\n data[:path] = self.path\n data[:name] = self.name\n data[:remotes] = self.remotes.map(&:name)\n data[:remote_urls] = self.remotes.map(&:url)\n data[:remote_branches] = self.remote_branches\n data[:project_identifier] = self.identifier\n data\n end", "def run_aggregation\n GRADES.each_with_index do |grade, idx|\n classifier[grade].each_pair do |metric, values|\n all_values = values\n all_values += classifier[GRADES[idx + 1]][metric] if (idx + 1) < GRADES.count\n\n classifier[grade][metric] =\n if all_values.count <= 2\n values.max || 0\n else\n (all_values.sum / all_values.count).round(2)\n end\n end\n end\n end", "def post_analytics_users_aggregates_query_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.post_analytics_users_aggregates_query ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling AnalyticsApi.post_analytics_users_aggregates_query\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/users/aggregates/query\".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 => 'UserAggregateQueryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#post_analytics_users_aggregates_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def events\n metadata['events'].sort_by! { |event| event['timestamp'] }\n end", "def monitoring_stats(region = current_region)\n redis = Redis.new :host => \"localhost\"\n today = \"2012-02-14\" # TODO(philc): \n request_count = redis.get(\"#{region.name}_request_count\").to_i\n errors = redis.get(\"html5player:error_count:#{today}\").to_i\n error_rate = (request_count == 0) ? 0 : (errors / request_count.to_f * 100)\n latency = (request_count == 0) ? 0 : redis.get(\"#{region.name}_latency\").to_i / request_count\n {\n :request_count => request_count,\n :average_latency => latency,\n :error_count => errors,\n :error_rate => error_rate\n }\n end", "def histogram(series, control, buckets=10, agg=\"add\", *args)\n each_subseries_in series, control do |name, subseries|\n new_subseries = {}\n bucket_counts = {}\n\n # rely on request timestamps provided in control - especially with counters,\n # there will be variable numbers of samples available so ranges will be inconsistent\n min_ts = control[:start_ts]\n max_ts = control[:end_ts]\n\n range = max_ts - min_ts\n bucket_usecs = (range / buckets).floor\n\n # initialize the buckets - all buckets should exist in output\n 0.upto(buckets-1).map do |bucket|\n key = min_ts + bucket * bucket_usecs\n new_subseries[key] = 0\n bucket_counts[key] = 0\n end\n\n bucket = min_ts\n subseries.keys.sort.each do |ts|\n # advance to the next bucket if necessary\n until ts.between?(bucket, bucket + bucket_usecs - 1) do\n bucket = bucket + bucket_usecs\n end\n\n new_subseries[bucket] = new_subseries[bucket] + subseries[ts]\n bucket_counts[bucket] = bucket_counts[bucket] + 1\n end\n\n case agg\n when \"avg\"\n new_subseries.keys.each do |bucket|\n if bucket_counts[bucket] > 0\n new_subseries[bucket] = new_subseries[bucket] / bucket_counts[bucket]\n end\n end\n when \"cnt\"\n new_subseries.keys.each do |bucket|\n new_subseries[bucket] = bucket_counts[bucket]\n end\n when \"add\"\n # nothing to do for \"add\", it's already done\n end\n\n new_subseries\n end\n end", "def collect_metrics(*)\n raise NotImplementedError, 'Must implement collect_metrics'\n end", "def reduction_single events\n event_list = method_events(events)\n event_list.group_by {|e| e.method_name }\n .select {|_,es| es.map(&:committer).uniq.count == 1 }\n .map {|_,es| percent_reduction(es) }\n .mean\nend", "def summarize(data, summarization_method, variable=nil)\n case summarization_method\n when 'sum'\n data = data.sum(variable)\n when 'max'\n data = data.maximum(variable)\n when 'count'\n data = data.count(variable)\n end\n end", "def group(name, args)\n raise \":data is needed as an argument to group metrics\" unless args[:data]\n raise \":subgroup is needed as an argument to group metrics\" unless args.include?(:subgroup)\n\n args[:aggregator] = \"sumSeries\" unless args[:aggregator]\n\n group_args = args.clone\n group_args[:data] = \"groupByNode(#{group_args[:data]},#{group_args[:subgroup]},\\\"#{group_args[:aggregator]}\\\")\"\n field \"#{name}_group\", group_args\n\n end", "def flattened_events\n _result = []\n _events = events\n\n while event = _events.pop do\n match = _events.find { |e| e == event }\n if match.nil?\n _result << event\n else\n match.increment_frequency\n end\n end\n\n _result\n end", "def global_metrics # rubocop: disable AbcSize\n report_metric 'Global Queue Size/Total', 'messages', overview['queue_totals']['messages']\n report_metric 'Global Queue Size Components/Ready', 'messages', overview['queue_totals']['messages_ready']\n report_metric 'Global Queue Size Components/Unacked', 'messages', overview['queue_totals']['messages_unacknowledged']\n\n report_metric 'Global Message Rate/Deliver', 'messages/sec', rate_for('deliver')\n report_metric 'Global Message Rate/Acknowledge', 'messages/sec', rate_for('ack')\n report_metric 'Global Message Rate/Return', 'messages/sec', rate_for('return_unroutable')\n\n overview['object_totals'].each do |obj|\n report_metric \"Global Object Totals/#{obj[0].capitalize}\", nil, obj[1]\n end\n end", "def push_metrics!\n metrics = Prometheus::Client.registry\n url = Rails.application.secrets.prometheus_push_gateway_url\n\n Prometheus::Client::Push.new(\"push-gateway\", nil, url).add(metrics)\n end", "def realtime_metrics\n current_user = @controller.current_user\n tp = TimeProfile.profile_for_user_tz(current_user.id, current_user.get_timezone) || TimeProfile.default_time_profile\n Metric::Helper.find_for_interval_name('realtime', tp)\n .where(:resource => @ems.try(:all_container_nodes) || ContainerNode.all)\n .where('timestamp > ?', REALTIME_TIME_RANGE.minutes.ago.utc).order('timestamp')\n end", "def push_fabrication_stats\n data = Tools::TestResourceDataProcessor.resources.flat_map do |resource, values|\n values.map { |v| fabrication_stats(resource: resource, **v) }\n end\n return if data.empty?\n\n write_api.write(data: data)\n log(:debug, \"Pushed #{data.length} resource fabrication entries to influxdb\")\n rescue StandardError => e\n log(:error, \"Failed to push fabrication stats to influxdb, error: #{e}\")\n end" ]
[ "0.58588624", "0.5748628", "0.5659503", "0.5616125", "0.5546494", "0.5440958", "0.5415336", "0.53665394", "0.5350344", "0.5343511", "0.5333449", "0.53042156", "0.5278566", "0.5257578", "0.5244984", "0.51538444", "0.51509553", "0.5149936", "0.51383156", "0.5130531", "0.51213974", "0.50703686", "0.506759", "0.50570524", "0.50423104", "0.5032155", "0.50235033", "0.498958", "0.49742505", "0.496224", "0.49575332", "0.4940489", "0.49202883", "0.4919052", "0.49134716", "0.48546457", "0.48541117", "0.48384643", "0.48332298", "0.48269844", "0.47895736", "0.47744778", "0.475315", "0.4750892", "0.47494352", "0.47475827", "0.47397277", "0.4732786", "0.4731706", "0.47251067", "0.47228485", "0.4697671", "0.46898636", "0.46847308", "0.4684461", "0.467827", "0.46658412", "0.46558473", "0.46537462", "0.4650758", "0.4640541", "0.46369728", "0.46280295", "0.46134236", "0.46122667", "0.46075282", "0.46051058", "0.45975813", "0.45964766", "0.45916077", "0.45876682", "0.45810944", "0.457741", "0.45696956", "0.4565818", "0.4564051", "0.45526123", "0.45492762", "0.453764", "0.451513", "0.45119956", "0.45101112", "0.44864637", "0.44829005", "0.4477713", "0.44738263", "0.44693494", "0.44662604", "0.44630247", "0.44602525", "0.445736", "0.44498453", "0.444781", "0.4446939", "0.4446502", "0.44421023", "0.44363314", "0.44354072", "0.44342688", "0.44297814" ]
0.6942496
0
Create a new RUM application.
def create_rum_application(body, opts = {}) data, _status_code, _headers = create_rum_application_with_http_info(body, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end", "def create(optional_params = {})\n response = Network.post(['Applications'], optional_params)\n Application.new(response)\n end", "def new\n puts \"Creating new blank Praxis app under #{app_name}\"\n create_root_files\n create_config\n create_app\n create_design\n create_spec\n create_docs\n end", "def create_new_app\n rake 'install --trace'\n FileUtils.rm_rf(rails_app)\n sh \"relevance_rails new #{rails_app} --database=#{database} --relevance-dev\"\n end", "def create_app(opts)\n app = nil\n scope = select_scope(opts[:scope])\n\n assets = Asset.accessible_by_user(user).\n where(\n state: Asset::STATE_CLOSED,\n uid: opts[:ordered_assets],\n )\n\n App.transaction do\n app_series = create_app_series(opts[:name], scope)\n release = opts.fetch(:release, UBUNTU_16)\n revision = app_series.latest_revision_app.try(:revision).to_i + 1\n\n applet_dxid = new_applet(\n opts.slice(\n :input_spec,\n :output_spec,\n :code,\n :instance_type,\n :packages,\n :internet_access,\n ),\n release,\n )\n\n app_dxid = new_app(\n opts.slice(\n :name,\n :title,\n :internet_access,\n :readme,\n ).merge(\n applet_dxid: applet_dxid,\n asset_dxids: assets.map(&:dxid),\n revision: revision,\n scope: scope,\n ),\n )\n\n api.project_remove_objects(project, [applet_dxid])\n\n app = App.create!(\n dxid: app_dxid,\n version: nil,\n revision: revision,\n title: opts[:title],\n readme: opts[:readme],\n entity_type: opts[:entity_type] || App::TYPE_REGULAR,\n user: user,\n scope: scope,\n app_series: app_series,\n input_spec: opts[:input_spec],\n output_spec: opts[:output_spec],\n internet_access: opts[:internet_access],\n instance_type: opts[:instance_type],\n ordered_assets: opts[:ordered_assets],\n packages: opts[:packages],\n code: opts[:code].strip,\n assets: assets,\n release: release,\n )\n\n app_series.update!(latest_revision_app: app)\n app_series.update!(latest_version_app: app) if Space.valid_scope?(scope)\n app_series.update!(deleted: false) if app_series.deleted?\n\n Event::AppCreated.create_for(app, user)\n end\n\n app\n end", "def create(name=nil, options={})\n\t\toptions[:name] = name if name\n\t\txml(post('/apps', :app => options)).elements[\"//app/name\"].text\n\tend", "def create(name=nil, options={})\n\t\tparams = {}\n\t\tparams['app[name]'] = name if name\n\t\txml(post('/apps', params)).elements[\"//app/name\"].text\n\tend", "def create(cli = false)\n $logger.info(\"Creating new gear #{@uuid} for application #{@app.name}\")\n\n if cli\n command = %Q(oo-devel-node app-create -c #{uuid} -a #{@app.uuid} --with-namespace #{@app.account.domain} --with-app-name #{@app.name} --with-secret-token=DEADBEEFDEADBEEFDEADBEEFDEADBEEF)\n $logger.info(%Q(Running #{command}))\n results = %x[#{command}]\n assert_equal(0, $?.exitstatus, %Q(#{command}\\n #{results}))\n end\n\n # Create the container object for use in the event listener later\n begin\n @container = OpenShift::Runtime::ApplicationContainer.new(@app.uuid, @uuid, nil, @app.name, @app.name, @app.account.domain, nil, nil)\n rescue Exception => e\n $logger.error(\"#{e.message}\\n#{e.backtrace}\")\n raise\n end\n\n unless cli\n @container.create('DEADBEEFDEADBEEFDEADBEEFDEADBEEF')\n end\n end", "def create_application(name)\n store_dir = File.join(@path, name)\n FileUtils.mkdir_p store_dir\n \n ApplicationConfiguration.new name, store_dir\n end", "def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)\n # First, we need to fetch the data from Apple, which we then modify with the user's values\n r = request(:get, 'ra/apps/create/?appType=ios')\n data = parse_response(r, 'data')\n\n # Now fill in the values we have\n data['versionString']['value'] = version\n data['newApp']['name']['value'] = name\n data['newApp']['bundleId']['value'] = bundle_id\n data['newApp']['primaryLanguage']['value'] = primary_language || 'English'\n data['newApp']['vendorId']['value'] = sku\n data['newApp']['bundleIdSuffix']['value'] = bundle_id_suffix\n data['companyName']['value'] = company_name if company_name\n\n # Now send back the modified hash\n r = request(:post) do |req|\n req.url 'ra/apps/create/?appType=ios'\n req.body = data.to_json\n req.headers['Content-Type'] = 'application/json'\n end\n\n data = parse_response(r, 'data')\n handle_itc_response(data)\n end", "def new_app(opts)\n api.app_new(\n applet: opts[:applet_dxid],\n name: AppSeries.construct_dxname(user.username, opts[:name], opts[:scope]),\n title: \"#{opts[:title]} \",\n summary: \" \",\n description: \"#{opts[:readme]} \",\n version: \"r#{opts[:revision]}-#{SecureRandom.hex(3)}\",\n resources: opts[:asset_dxids],\n details: { ordered_assets: opts[:asset_dxids] },\n openSource: false,\n billTo: bill_to,\n access: opts[:internet_access] ? { network: [\"*\"] } : {},\n )[\"id\"]\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def create_app_root\n puts \"Create app root named #{name}\"\n end", "def create_rum_application_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.create_rum_application ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling RUMAPI.create_rum_application\"\n end\n # resource path\n local_var_path = '/api/v2/rum/applications'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'RUMApplicationResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :create_rum_application,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#create_rum_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n\t\t@application = Application.new\t\t\n\tend", "def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create_app(name, redirect_uri, scopes = 'read', website = nil)\n perform_request_with_object(:post, '/api/v1/apps',\n {\n client_name: name,\n redirect_uris: redirect_uri,\n scopes: scopes,\n website: website\n }, Mastodon::App)\n end", "def create(*args)\n if !self.is_?(App)\n self.app_name = HesCentral.application_repository_name\n end\n super(*args)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create\n\t\tbegin\n\t\t\tActiveRecord::Base.transaction do\n\t\t\t\t@application = Application.create!(name: params[:name])\n end\n rescue => e #ActiveRecord::RecordNotUnique\n p e.message\n p e.backtrace\n\t\t\tActiveRecord::Rollback\n\t\t\trender plain: e.message, status: :unprocessable_entity and return\n end\n render json:\" Application created with token = #{@application.token}\", status: :created\n end", "def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end", "def application(name, options = {}, &blk)\n add_child(:applications, Hubcap::Application.new(self, name, options, &blk))\n end", "def create\n megam_rest.post_appreq(to_hash)\n end", "def create\n return if !check_max\n @ruby_application = RubyApplication.new(ruby_application_params)\n @ruby_application.user = current_user\n if CONFIG['GITHUB_INTEGRATION']\n @ruby_application.filename = \"https://raw.github.com/#{current_user.name}/#{@ruby_application.name}/master/Gemfile.lock\"\n end\n\n respond_to do |format|\n if @ruby_application.save\n @ruby_application.delay.run_report\n format.html { redirect_to @ruby_application.user, notice: 'Ruby application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ruby_application }\n else\n format.html { render action: 'new' }\n format.json { render json: @ruby_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_application(client, options)\n if options[:name].nil? or options[:description].nil?\n puts \"Missing arguments\"\n end\n \n application = client.applications.create({\n name: options[:name],\n description: options[:description]\n })\n puts \"Application created.\"\n\n #TODO: Add exception handling\nend", "def create\n @application = Oread::Application.new(application_params)\n @application.owner = current_user\n respond_to do |format|\n if @application.save\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # check if we are missing the required force\n required_force_is_missing?\n\n # apply some force, when we are boosted with one\n apply_force\n\n # download or update local cache\n download_or_update_local_cache\n\n # copy the framework files from the cache\n copy_over_cache_files\n\n # make necessary changes for the new app, if we were successful in\n # download otherwise, remove the downloaded source\n if has_laravel?\n say_success \"Cloned Laravel repository.\"\n\n # update permissions on storage/ directory (this is the default)\n update_permissions_on_storage if @options[:perms]\n\n # configure this new application, as required\n configure_from_options\n\n say_success \"Hurray! Your Laravel application has been created!\"\n else\n say_failed \"Downloaded source is not Laravel framework or its fork.\"\n show_info \"Cleaning up..\"\n # remove all directories that we created, as well as the cache.\n clean_up\n # raise an error since we failed.. :(\n raise LaravelError, \"Source for downloading repository is corrupt!\"\n end\n end", "def find_or_create_app(app_name)\n create_app(app_name)\n rescue\n @heroku.app.info(app_name)\n end", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_rails3_app rails_version, arel_version = nil\n app = app_path rails_version\n clone AREL_REPO, AREL_CLONE_PATH\n FileUtils.cd AREL_CLONE_PATH do\n if arel_version\n run 'git', 'reset', '--hard', \"v#{arel_version}\"\n else # \"Edge\"\n run 'git', 'reset', '--hard', 'origin/master'\n end\n run 'git', 'clean', '-f'\n end\n\n clone RAILS_REPO, RAILS_CLONE_PATH\n FileUtils.cd RAILS_CLONE_PATH do\n if rails_version\n run 'git', 'reset', '--hard', \"v#{rails_version}\"\n else # \"Edge\"\n run 'git', 'reset', '--hard', 'origin/master'\n end\n run 'git', 'clean', '-f'\n\n begin\n clean_bundler_environment\n run 'env', \"AREL=#{AREL_CLONE_PATH}\",\n 'bundle', 'install', '--path', '../bundle', '--without', 'db'\n FileUtils.rm_r(app) if File.exist?(app)\n run 'env', \"AREL=#{AREL_CLONE_PATH}\",\n 'bundle', 'exec', 'bin/rails', 'new', app, '--skip-activerecord', '--dev'\n ensure\n restore_bundler_environment\n end\n end\n\n create_gemfile app\n bundlerize app\n end", "def create_application\n unless self.has_current_application?\n Application.create_for_student self\n end\n end", "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create_app app_name, dev_name, dev_email\n data[:app_name] = app_name\n data[:dev_name] = dev_name\n data[:dev_email] = dev_email\n end", "def create_application(application_entity)\n # handle runtimes / cartridges\n fail_with(:only_one_runtime) if application_entity[:runtimes].length > 1\n fail_with(:must_have_runtime) if application_entity[:runtimes].empty?\n application_entity[:cartridge] = cartridge(application_entity.delete(:runtimes)[0])\n\n # updates the application with a valid region identity\n retrieve_region(application_entity) if application_entity.key?(:region)\n\n # enable application scaling by default\n application_entity[:scale] = true unless application_entity.key?(:scale)\n created_application = post(\"/domains/#{app_domain}/applications\", body: application_entity).body\n # now make sure we keep at least 2 deployments, allows proper identification of application state\n updated_application = put(\"/application/#{created_application[:data][:id]}\",\n body: { keep_deployments: 2, auto_deploy: false }).body\n to_nucleus_app(updated_application[:data])\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def exec(name)\n create_resource(name, type: 'application', binary_path: name)\n\n e_uid = SecureRandom.uuid\n\n e_name = \"#{self.name}_application_#{name}_created_#{e_uid}\"\n\n resource_group_name = \"#{self.id}_application\"\n\n def_event e_name do |state|\n state.find_all { |v| v[:hrn] == name && v[:membership] && v[:membership].include?(resource_group_name)}.size >= self.members.uniq.size\n end\n\n on_event e_name do\n resources[type: 'application', name: name].state = :running\n end\n end", "def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil)\n puts(\"The `version` parameter is deprecated. Use `ensure_version!` method instead\") if version\n client.create_application!(name: name,\n primary_language: primary_language,\n sku: sku,\n bundle_id: bundle_id,\n bundle_id_suffix: bundle_id_suffix,\n company_name: company_name,\n platform: platform,\n platforms: platforms,\n itunes_connect_users: itunes_connect_users)\n end", "def create_android\n `android create project -t 5 -k #{ @pkg } -a #{ @name } -n #{ @name } -p #{ @path }`\n end", "def create\n params[:app][:user_id] = current_user.id\n @app = App.create(params[:app])\n if @app.save\n redirect_to source_app_path(@app), notice: 'app was successfully created.'\n else\n render :new\n end\n end", "def app(*args)\n\t\tif args == []\n\t\t\treturn MRA_App\n\t\telse\n\t\t\treturn MRA_App.by_name(*args)\n\t\tend\n\tend", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if not view_context.can_apply?\n flash[:error] = 'You are not allowed to create new applications. If you have already applied to the guild, you can find a link to your application on your profile page.'\n redirect_to root_path\n return\n end\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new(name)\n ARGV.shift\n #@log.debug \"command 'new' with arguments: #{ARGV.join(', ')}\"\n Generator::Application.start ARGV\n end", "def create\n @application = current_user.build_application(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, alert: 'Your application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_application(application_name, opts = {})\n data, _status_code, _headers = create_application_with_http_info(application_name, opts)\n data\n end", "def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend", "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), 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", "def create\n @app = App.new(params[:app])\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 json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def create\n create_role_directory\n generate_manifests_file\n end", "def create\n @application = Application.create(params[:application])\n\n unless @application.new_record?\n flash[:notice] = 'Application was successfully created.'\n end\n\n respond_with @application\n end", "def create\n @application = Application.new()\n @application.name = params[:application][:name].to_s.downcase\n # true - доступ запрещен, false - разрешен\n @application.default = true\n respond_to do |format|\n if @application.save\n format.html { redirect_to applications_path, notice: 'Приложение создано.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@app \t\t\t\t= find_deployable_application_by(\"public_token\", params[:deployment][:deployable_application_id])\n\n\t\t# Chech if the branch and the environment are correct, otherwise kill the request with raise HTTPUnauthorized\n\t\tvalidate_branch_and_environment(@app, params)\n\n\n\t\t# CREATE NEW RAKE DEPLOY\n\t\t@deployment \t\t= @app.deployments.create!(deployment_params)\n\n\t\tRakeInvoker.run(pull_requests: :fetch_for_app, PUBLIC_TOKEN: @app.public_token, APP_ID: @app.id, DEPLOYMENT_ID: @deployment.id)\n\n\t\t# @deployment.user \t= User.first\n\n\t\tif @deployment.save\n\t\t\trender :json => \"Done\"\n\t\telse\n\t\t\trender :json => \"Errors\"\n\t\tend\n\tend", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def heroku\n puts Rainbow(\"Step 1. Create new Heroku application\").foreground(:green)\n\n puts \"Please enter the name of the new Heroku application:\"\n name = STDIN.gets.gsub(\"\\n\", \"\")\n\n createapp = nil\n Bundler.with_clean_env do\n createapp = `heroku create #{name}`\n end\n\n if !createapp.include?(\"done, stack is cedar\")\n puts createapp\n choose do |menu|\n menu.prompt = \"Continue?\"\n\n menu.choice \"Yes\" do \n end\n \n menu.choice \"No\" do\n return\n end\n end\n end\n\n environment(name)\n collaborators(name)\n database(name)\n domains(name)\n email(name)\n asset_sync(name)\n end", "def add_application(name, options)\n debug \"Adding application #{name} to domain #{id}\"\n\n payload = {:name => name}\n options.each{ |key, value| payload[key.to_sym] = value }\n\n cartridges = Array(payload.delete(:cartridge)).concat(Array(payload.delete(:cartridges))).map do |cart|\n if cart.is_a? String or cart.respond_to? :[]\n cart\n else\n cart.url ? {:url => cart.url} : cart.name\n end\n end.compact.uniq\n\n if cartridges.any?{ |c| c.is_a?(Hash) and c[:url] } and !has_param?('ADD_APPLICATION', 'cartridges[][url]')\n raise RHC::Rest::DownloadingCartridgesNotSupported, \"The server does not support downloading cartridges.\"\n end\n\n if client.api_version_negotiated >= 1.3\n payload[:cartridges] = cartridges\n else\n raise RHC::Rest::MultipleCartridgeCreationNotSupported, \"The server only supports creating an application with a single web cartridge.\" if cartridges.length > 1\n payload[:cartridge] = cartridges.first\n end\n\n if payload[:initial_git_url] and !has_param?('ADD_APPLICATION', 'initial_git_url')\n raise RHC::Rest::InitialGitUrlNotSupported, \"The server does not support creating applications from a source repository.\"\n end\n\n options = {:timeout => options[:scale] && 0 || nil}\n rest_method \"ADD_APPLICATION\", payload, options\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end", "def new_project \n require 'fileutils'\n dir = \"./\" + @arguments.first\n Dir.mkdir(dir)\n %w[app config experiments report results test tmp vendor].each do |d|\n Dir.mkdir(dir + \"/\" + d)\n end\n basedir = File.dirname(__FILE__)\n File.open(File.join(dir, \"config\", \"config.yaml\"), \"w\") do |f|\n f << \"---\\nenvironments:\\n development:\\n compute:\\n\"\n end\n File.open(File.join(dir, \".gitignore\"), \"w\") do |f|\n f << \"tmp/*\"\n end\n FileUtils::cp File.join(basedir, \"generator/readme_template.txt\"), File.join(dir, \"README\")\n FileUtils::cp File.join(basedir, \"generator/Rakefile\"), File.join(dir, \"Rakefile\")\n FileUtils::cp File.join(basedir, \"generator/experiment_template.rb.txt\"), File.join(dir, \"experiments\", \"experiment.rb\")\n end", "def create\n @app = App.new(app_params)\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", "def create\n @app = App.new(app_params)\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", "def app_with_name name\n AX::Application.new name\n end", "def create_application_record\n template \"application_record.rb\", application_record_file_name\n end", "def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end", "def create_version\n Milkrun.say \"Creating new version of app in HockeyApp\"\n\n body = {}.tap do |json|\n json[:bundle_version] = version_code\n json[:bundle_short_version] = version_name\n json[:status] = 1\n end\n\n headers = {}.tap do |h|\n h[\"X-HockeyAppToken\"] = token\n h[\"Accept\"] = \"application/json\"\n h[\"Content-Type\"] = \"application/json\"\n end\n\n url = \"#{base_url}/#{app_id}/app_versions/new\"\n response = Excon.post(url, body: body.to_json, connect_timeout: 10, headers: headers)\n if response.status != 201\n Milkrun.error response.data.to_s\n raise \"Failed to post new version to HockeyApp!\"\n end\n\n Milkrun.say \"New version created in HockeyApp\"\n end", "def generate_app(os, type = nil, template = nil, sfdx = nil)\n UI.crash!('Error: Cannot generate app without type or template.') unless(type or template)\n\n system('rm -rf tmp*/')\n system('rm -rf Android/app/build/')\n generate_command = \"./SalesforceMobileSDK-Package/test/test_force.js --os=#{os}\"\n if type\n UI.header \"Generating #{type} App\"\n generate_command.concat(\" --apptype=#{type}\")\n\n if type.start_with?('hybrid')\n generate_command.concat(' --no-plugin-update')\n end\n else\n UI.header 'Generating App from Template'\n generate_command.concat(\" --templaterepouri=#{template}\")\n end\n\n if sfdx\n generate_command.concat(' --use-sfdx')\n end\n \n result = silence_output(true) { system(generate_command) }\n UI.user_error!('Test app was not successfully created.') unless(result)\nend", "def gen_app\n unless File.exists?(app_dir)\n original_dir = FileUtils.pwd\n Dir.mkdir(root_dir) unless (!root_dir or File.exists?(root_dir))\n FileUtils.cd(root_dir) if root_dir\n `#{rails_str}`\n FileUtils.cd(original_dir)\n true\n end\n end", "def create\n application = Application.new(app_params)\n if application.save\n flash[:success] = 'Application was successfully created.'\n redirect_to application_path(application)\n else\n error_message = application.errors.full_messages.to_sentence\n flash[:alert] = 'Application could not be created. Do better'\n #another option would be render :new\n redirect_to new_application_path\n end\n end", "def execute(request)\n Doorkeeper::Application.create(params)\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app()\n file=File.open(\"app.rb\", \"w\")\n file.puts(\"require 'bundler'\")\n file.puts(\"Bundler.require\")\n file.puts(\"\")\n file.puts(\"require_relative 'lib/...'\")\n file.close\n create_readme()\nend", "def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask_public(is_public)\n end \n validate_project_name(name)\n project_id = register_api_call(name,is_public) \n Mortar::Command::run(\"generate:project\", [name])\n FileUtils.cd(name)\n is_embedded = false\n if options[:embedded]\n is_embedded = true\n register_do(name, is_public, is_embedded, project_id)\n else\n git.git_init\n git.git(\"add .\")\n git.git(\"commit -m \\\"Mortar project scaffolding\\\"\") \n register_do(name, is_public, is_embedded, project_id)\n display \"NOTE: You'll need to change to the new directory to use your project:\\n cd #{name}\\n\\n\"\n end\n end", "def create\n authorize! :create, @app\n @app = App.new(app_params)\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", "def create_app_project\n app_project = open_app_project(recreate: !configuration.incremental_installation?)\n\n spec_platforms = spec.available_platforms.flatten.reject do |platform|\n !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)\n end\n\n if spec_platforms.empty?\n Pod::Command::Gen.help! Pod::StandardError.new \"No available platforms in #{spec.name}.podspec match requested platforms: #{configuration.platforms}\"\n end\n\n spec_platforms\n .map do |platform|\n consumer = spec.consumer(platform)\n target_name = \"App-#{Platform.string_name(consumer.platform_name)}\"\n next if app_project.targets.map(&:name).include? target_name\n native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,\n deployment_target(consumer), target_name)\n # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.\n # It will then be re-set again within #perform_post_install_steps.\n Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)\n native_app_target\n end\n .compact.tap do\n app_project.recreate_user_schemes do |scheme, target|\n installation_result = installation_result_from_target(target)\n next unless installation_result\n installation_result.test_native_targets.each do |test_native_target|\n scheme.add_test_target(test_native_target)\n end\n end\n end\n .each do |target|\n Xcodeproj::XCScheme.share_scheme(app_project.path, target.name) if target\n end\n app_project.save\n end", "def create_project(args)\n system %{#{bin} create #{args.join(' ')}}\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n respond_with( :oauth, @application, location: oauth_application_url( @application ) )\n else\n render :new\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to app_activities_path(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @mobile_app = create_app\n if @mobile_app.present? && @mobile_app['identifier'].present?\n @api_key = create_api_key @mobile_app['identifier']\n end\n redirect_to \"/\", flash: { error_message: @error_message }\n end", "def create\n create_params = application_params\n if applicant_signed_in?\n create_params[:applicant_id] = current_applicant.id\n end\n @application = Application.new(create_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: \"Application was successfully created.\" }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Apparel.create!(apparel_params)\n json_response({success: true, message: Message.created_successfuly('Apparel record')}, :created)\n end", "def create\n @app = Mms::App.new(params[:mms_app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = '新建组件成功!'\n format.html { redirect_to(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n flash[:notice] = '新建组件失败!'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(*args)\n argv = to_pointer([\"create\"] + args)\n rrd_create(args.size+1, argv) == 0\n ensure\n free_pointers\n end", "def app_with_pid pid\n AX::Application.new pid\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create_application_token!(user)\n ApplicationToken.create_token(\n current_user: current_user,\n user_id: user.id,\n params: { application: \"default\" }\n )\n end", "def create_appliction_set(application_name, keys)\n results = {}\n code = unlock_vault(keys)\n return code, nil if code > 399\n code = init_application(application_name)\n return code, nil if code > 399\n results[:app_id], code = create_application_id application_name\n return code, results if code > 399\n results[:user_id], code = create_user(application_name, results[:app_id])\n return code, results if code > 399\n results[:user_data], code = create_user_token(results[:user_id], results[:app_id], application_name)\n return code, results if code > 399\n [200, results]\n end", "def init(app_name=\"rum\", argv = ARGV)\n super \"rum\", argv\n end", "def create\n @app = App.new(params[:app])\n \n # This is not right. I should write a dashboard view that talks to the controllers restfully\n if @app.auto_generate_database || [email protected]_id.empty?\n # when valid? is call, self-generated app attibues are populated\n if @app.valid?\n if generate_database\n @app.save\n redirect_to @app, notice: 'App was successfully created.' \n end\n else\n render action: \"new\" \n end\n else\n if @app.save\n redirect_to @app, notice: 'App was successfully created.' \n else\n render action: \"new\" \n end\n end\n end", "def new_application(application)\n load_resources(application)\n @title = 'New Job Applicant'\n mail( subject: 'New Applicant', to: company_administrators, track_opens: 'true' )\n end", "def post_app_generate(application_id, type, opts={})\n # \n # default_options = {\n # \"name\" => \"\",\n # \"author\" => \"\",\n # \"description\" => \"\",\n # \"guid\" => \"\",\n # \"datasets\" => \"\",\n # \"env\" => \"prod\",\n # \"image_url\" => \"http://appresource.s3.amazonaws.com/apiappimages/missing_icard.jpg\",\n # \"runtime\" => \"\"\n # }\n # options = default_options.merge(opts)\n return post_response(\"app/#{application_id}/generate/#{type}\", opts,:json)\n end", "def generate\n $VERBOSE = !options[:verbose].nil?\n name = shift_argument || generate_app_name\n project_dir = \"#{CURR_DIR}/#{name}\"\n overwrite = !options[:overwrite].nil?\n if File.directory? project_dir\n if overwrite\n FileUtils.rm_r project_dir\n else\n if confirm \"Project #{name} already exists. Should I replace it?\"\n if confirm \"This will delete ALL existing files. Are you ABSOLUTELY sure?\"\n FileUtils.rm_r project_dir\n else \n return\n end\n else\n return\n end\n end\n end\n version = options[:version]\n version = DEF_OBD_VERSION if version == nil\n unless OK_OBD_VERSIONS.include?(version)\n throw \"Specified version \\\"#{version}\\\" isn't supported.\\nTry one of the following:\\n #{OK_OBD_VERSIONS.join(\"\\n \")}\"\n end\n rebuild = !options[:rebuild].nil?\n full_engine = !options[:full_engine].nil?\n no_git = !options[:no_git].nil?\n download_openbd(version, rebuild)\n update_project(name, version, full_engine, false, false)\n put_into_git(name) unless no_git or ENV['OPENBD_HEROKU_NO_GIT']\n display \"-----> Project '#{name}' created successfully.\\nType 'cd #{name}' to change to your project folder.\\nType 'foreman start' to run the server locally\"\n end", "def generate\n require_relative \"resume/ruby_version_checker\"\n RubyVersionChecker.check_ruby_version\n require_relative \"resume/cli/application\"\n CLI::Application.start\n end", "def new(app_path, generator: Project.new(cli: self, app_path: app_path))\n app = generator.generate\n say <<~SAY\n\n Success! Created #{app.camelized_name} at #{app.absolute_app_path}\n Inside that directory, you can run several commands:\n\n #{cmd :server}\n Starts the development server\n\n #{cmd :test}\n Starts the test runner\n\n #{cmd :generate}\n Add elements you may have skipped, like RSpec or Webpack\n\n We suggest that you begin by typing:\n\n #{cmd :cd, path: app_path}#{cmd :server}\n\n and visiting localhost:3000 in your browser.\n For more information, check out the generated readme file.\n\n SAY\n end", "def new\n @mobile_app = MobileApp.new\n @mobile_app.language = \"English\"\n if current_user.agency\n @mobile_app.primary_agency_id = current_user.agency.id\n end\n @mobile_app.primary_contact_id = current_user.id\n @mobile_app.mobile_app_versions.build\n end", "def create_app_structure(root_path, arg_app_name, quiet = false, gem_path = nil)\n # create directory structure\n dirs = [\n Hailstorm.db_dir,\n Hailstorm.app_dir,\n Hailstorm.log_dir,\n Hailstorm.tmp_dir,\n Hailstorm.reports_dir,\n Hailstorm.config_dir,\n Hailstorm.vendor_dir,\n Hailstorm.script_dir\n ]\n\n dirs.each do |dir|\n FileUtils.mkpath(File.join(root_path, dir))\n puts \" created directory: #{File.join(arg_app_name, dir)}\" unless quiet\n end\n\n skeleton_path = File.join(Hailstorm.templates_path, 'skeleton')\n\n # Process Gemfile - add additional platform specific gems\n engine = ActionView::Base.new\n engine.assign(jruby_pageant: !File::ALT_SEPARATOR.nil?, # File::ALT_SEPARATOR is nil on non-windows\n gem_path: gem_path)\n File.open(File.join(root_path, 'Gemfile'), 'w') do |f|\n f.print(engine.render(file: File.join(skeleton_path, 'Gemfile')))\n end\n puts \" wrote #{File.join(arg_app_name, 'Gemfile')}\" unless quiet\n\n # Copy to script/hailstorm\n hailstorm_script = File.join(root_path, Hailstorm.script_dir, 'hailstorm')\n FileUtils.copy(File.join(skeleton_path, 'hailstorm'), hailstorm_script)\n FileUtils.chmod(0o775, hailstorm_script) # make it executable\n puts \" wrote #{File.join(arg_app_name, Hailstorm.script_dir, 'hailstorm')}\" unless quiet\n\n # Copy to config/environment.rb\n FileUtils.copy(File.join(skeleton_path, 'environment.rb'),\n File.join(root_path, Hailstorm.config_dir))\n puts \" wrote #{File.join(arg_app_name, Hailstorm.config_dir, 'environment.rb')}\" unless quiet\n\n # Copy to config/database.properties\n FileUtils.copy(File.join(skeleton_path, 'database.properties'),\n File.join(root_path, Hailstorm.config_dir))\n puts \" wrote #{File.join(arg_app_name, Hailstorm.config_dir, 'database.properties')}\" unless quiet\n\n # Process to config/boot.rb\n engine = ActionView::Base.new\n engine.assign(app_name: arg_app_name)\n File.open(File.join(root_path, Hailstorm.config_dir, 'boot.rb'), 'w') do |f|\n f.print(engine.render(file: File.join(skeleton_path, 'boot')))\n end\n puts \" wrote #{File.join(arg_app_name, Hailstorm.config_dir, 'boot.rb')}\" unless quiet\n end" ]
[ "0.7186294", "0.70547825", "0.70338064", "0.701831", "0.6746834", "0.66851354", "0.66716146", "0.66530585", "0.66254103", "0.65305746", "0.6517017", "0.6496818", "0.6442749", "0.6436371", "0.6429101", "0.6402991", "0.640036", "0.6330293", "0.63262284", "0.63206416", "0.6301038", "0.628246", "0.6277665", "0.6226477", "0.62253636", "0.62236434", "0.62004656", "0.6155816", "0.6138605", "0.61358255", "0.6064874", "0.60258263", "0.6021098", "0.60056204", "0.5989265", "0.59857976", "0.5970734", "0.5962735", "0.59507257", "0.594769", "0.59473455", "0.5926744", "0.59059477", "0.58871406", "0.5883322", "0.5870569", "0.58679575", "0.5866921", "0.58522516", "0.5841844", "0.58304673", "0.58211946", "0.58158773", "0.5799188", "0.5795663", "0.5777832", "0.5766726", "0.57638645", "0.57638645", "0.5760821", "0.57567626", "0.5748465", "0.5747817", "0.5735939", "0.5735939", "0.57152474", "0.5710401", "0.56806207", "0.5677398", "0.5667494", "0.56671697", "0.56668943", "0.5664877", "0.5658793", "0.5642945", "0.56345165", "0.5628989", "0.56248975", "0.56178427", "0.5616627", "0.5616443", "0.5610415", "0.5605956", "0.5600988", "0.55931884", "0.5589505", "0.5576893", "0.5566828", "0.55573475", "0.5544703", "0.5541828", "0.55349696", "0.5525237", "0.5522057", "0.55098236", "0.5504613", "0.5503956", "0.55037594", "0.55016947", "0.5498689" ]
0.7512464
0
Create a new RUM application. Create a new RUM application in your organization.
def create_rum_application_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RUMAPI.create_rum_application ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RUMAPI.create_rum_application" end # resource path local_var_path = '/api/v2/rum/applications' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'RUMApplicationResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :create_rum_application, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RUMAPI#create_rum_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rum_application(body, opts = {})\n data, _status_code, _headers = create_rum_application_with_http_info(body, opts)\n data\n end", "def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end", "def create(optional_params = {})\n response = Network.post(['Applications'], optional_params)\n Application.new(response)\n end", "def create\n @application = Oread::Application.new(application_params)\n @application.owner = current_user\n respond_to do |format|\n if @application.save\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_app\n rake 'install --trace'\n FileUtils.rm_rf(rails_app)\n sh \"relevance_rails new #{rails_app} --database=#{database} --relevance-dev\"\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)\n # First, we need to fetch the data from Apple, which we then modify with the user's values\n r = request(:get, 'ra/apps/create/?appType=ios')\n data = parse_response(r, 'data')\n\n # Now fill in the values we have\n data['versionString']['value'] = version\n data['newApp']['name']['value'] = name\n data['newApp']['bundleId']['value'] = bundle_id\n data['newApp']['primaryLanguage']['value'] = primary_language || 'English'\n data['newApp']['vendorId']['value'] = sku\n data['newApp']['bundleIdSuffix']['value'] = bundle_id_suffix\n data['companyName']['value'] = company_name if company_name\n\n # Now send back the modified hash\n r = request(:post) do |req|\n req.url 'ra/apps/create/?appType=ios'\n req.body = data.to_json\n req.headers['Content-Type'] = 'application/json'\n end\n\n data = parse_response(r, 'data')\n handle_itc_response(data)\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def new\n puts \"Creating new blank Praxis app under #{app_name}\"\n create_root_files\n create_config\n create_app\n create_design\n create_spec\n create_docs\n end", "def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end", "def create(name=nil, options={})\n\t\tparams = {}\n\t\tparams['app[name]'] = name if name\n\t\txml(post('/apps', params)).elements[\"//app/name\"].text\n\tend", "def create\n\t\tbegin\n\t\t\tActiveRecord::Base.transaction do\n\t\t\t\t@application = Application.create!(name: params[:name])\n end\n rescue => e #ActiveRecord::RecordNotUnique\n p e.message\n p e.backtrace\n\t\t\tActiveRecord::Rollback\n\t\t\trender plain: e.message, status: :unprocessable_entity and return\n end\n render json:\" Application created with token = #{@application.token}\", status: :created\n end", "def create(name=nil, options={})\n\t\toptions[:name] = name if name\n\t\txml(post('/apps', :app => options)).elements[\"//app/name\"].text\n\tend", "def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end", "def create_application(client, options)\n if options[:name].nil? or options[:description].nil?\n puts \"Missing arguments\"\n end\n \n application = client.applications.create({\n name: options[:name],\n description: options[:description]\n })\n puts \"Application created.\"\n\n #TODO: Add exception handling\nend", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create\n @application = current_user.build_application(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, alert: 'Your application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app(name, redirect_uri, scopes = 'read', website = nil)\n perform_request_with_object(:post, '/api/v1/apps',\n {\n client_name: name,\n redirect_uris: redirect_uri,\n scopes: scopes,\n website: website\n }, Mastodon::App)\n end", "def create_app_root\n puts \"Create app root named #{name}\"\n end", "def create_application(name)\n store_dir = File.join(@path, name)\n FileUtils.mkdir_p store_dir\n \n ApplicationConfiguration.new name, store_dir\n end", "def create_application(application_entity)\n # handle runtimes / cartridges\n fail_with(:only_one_runtime) if application_entity[:runtimes].length > 1\n fail_with(:must_have_runtime) if application_entity[:runtimes].empty?\n application_entity[:cartridge] = cartridge(application_entity.delete(:runtimes)[0])\n\n # updates the application with a valid region identity\n retrieve_region(application_entity) if application_entity.key?(:region)\n\n # enable application scaling by default\n application_entity[:scale] = true unless application_entity.key?(:scale)\n created_application = post(\"/domains/#{app_domain}/applications\", body: application_entity).body\n # now make sure we keep at least 2 deployments, allows proper identification of application state\n updated_application = put(\"/application/#{created_application[:data][:id]}\",\n body: { keep_deployments: 2, auto_deploy: false }).body\n to_nucleus_app(updated_application[:data])\n end", "def create_app(opts)\n app = nil\n scope = select_scope(opts[:scope])\n\n assets = Asset.accessible_by_user(user).\n where(\n state: Asset::STATE_CLOSED,\n uid: opts[:ordered_assets],\n )\n\n App.transaction do\n app_series = create_app_series(opts[:name], scope)\n release = opts.fetch(:release, UBUNTU_16)\n revision = app_series.latest_revision_app.try(:revision).to_i + 1\n\n applet_dxid = new_applet(\n opts.slice(\n :input_spec,\n :output_spec,\n :code,\n :instance_type,\n :packages,\n :internet_access,\n ),\n release,\n )\n\n app_dxid = new_app(\n opts.slice(\n :name,\n :title,\n :internet_access,\n :readme,\n ).merge(\n applet_dxid: applet_dxid,\n asset_dxids: assets.map(&:dxid),\n revision: revision,\n scope: scope,\n ),\n )\n\n api.project_remove_objects(project, [applet_dxid])\n\n app = App.create!(\n dxid: app_dxid,\n version: nil,\n revision: revision,\n title: opts[:title],\n readme: opts[:readme],\n entity_type: opts[:entity_type] || App::TYPE_REGULAR,\n user: user,\n scope: scope,\n app_series: app_series,\n input_spec: opts[:input_spec],\n output_spec: opts[:output_spec],\n internet_access: opts[:internet_access],\n instance_type: opts[:instance_type],\n ordered_assets: opts[:ordered_assets],\n packages: opts[:packages],\n code: opts[:code].strip,\n assets: assets,\n release: release,\n )\n\n app_series.update!(latest_revision_app: app)\n app_series.update!(latest_version_app: app) if Space.valid_scope?(scope)\n app_series.update!(deleted: false) if app_series.deleted?\n\n Event::AppCreated.create_for(app, user)\n end\n\n app\n end", "def create\n\t\t@app \t\t\t\t= find_deployable_application_by(\"public_token\", params[:deployment][:deployable_application_id])\n\n\t\t# Chech if the branch and the environment are correct, otherwise kill the request with raise HTTPUnauthorized\n\t\tvalidate_branch_and_environment(@app, params)\n\n\n\t\t# CREATE NEW RAKE DEPLOY\n\t\t@deployment \t\t= @app.deployments.create!(deployment_params)\n\n\t\tRakeInvoker.run(pull_requests: :fetch_for_app, PUBLIC_TOKEN: @app.public_token, APP_ID: @app.id, DEPLOYMENT_ID: @deployment.id)\n\n\t\t# @deployment.user \t= User.first\n\n\t\tif @deployment.save\n\t\t\trender :json => \"Done\"\n\t\telse\n\t\t\trender :json => \"Errors\"\n\t\tend\n\tend", "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end", "def create\n if not view_context.can_apply?\n flash[:error] = 'You are not allowed to create new applications. If you have already applied to the guild, you can find a link to your application on your profile page.'\n redirect_to root_path\n return\n end\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n return if !check_max\n @ruby_application = RubyApplication.new(ruby_application_params)\n @ruby_application.user = current_user\n if CONFIG['GITHUB_INTEGRATION']\n @ruby_application.filename = \"https://raw.github.com/#{current_user.name}/#{@ruby_application.name}/master/Gemfile.lock\"\n end\n\n respond_to do |format|\n if @ruby_application.save\n @ruby_application.delay.run_report\n format.html { redirect_to @ruby_application.user, notice: 'Ruby application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ruby_application }\n else\n format.html { render action: 'new' }\n format.json { render json: @ruby_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend", "def create_application\n unless self.has_current_application?\n Application.create_for_student self\n end\n end", "def create(cli = false)\n $logger.info(\"Creating new gear #{@uuid} for application #{@app.name}\")\n\n if cli\n command = %Q(oo-devel-node app-create -c #{uuid} -a #{@app.uuid} --with-namespace #{@app.account.domain} --with-app-name #{@app.name} --with-secret-token=DEADBEEFDEADBEEFDEADBEEFDEADBEEF)\n $logger.info(%Q(Running #{command}))\n results = %x[#{command}]\n assert_equal(0, $?.exitstatus, %Q(#{command}\\n #{results}))\n end\n\n # Create the container object for use in the event listener later\n begin\n @container = OpenShift::Runtime::ApplicationContainer.new(@app.uuid, @uuid, nil, @app.name, @app.name, @app.account.domain, nil, nil)\n rescue Exception => e\n $logger.error(\"#{e.message}\\n#{e.backtrace}\")\n raise\n end\n\n unless cli\n @container.create('DEADBEEFDEADBEEFDEADBEEFDEADBEEF')\n end\n end", "def new_app(opts)\n api.app_new(\n applet: opts[:applet_dxid],\n name: AppSeries.construct_dxname(user.username, opts[:name], opts[:scope]),\n title: \"#{opts[:title]} \",\n summary: \" \",\n description: \"#{opts[:readme]} \",\n version: \"r#{opts[:revision]}-#{SecureRandom.hex(3)}\",\n resources: opts[:asset_dxids],\n details: { ordered_assets: opts[:asset_dxids] },\n openSource: false,\n billTo: bill_to,\n access: opts[:internet_access] ? { network: [\"*\"] } : {},\n )[\"id\"]\n end", "def create\n megam_rest.post_appreq(to_hash)\n end", "def create(*args)\n if !self.is_?(App)\n self.app_name = HesCentral.application_repository_name\n end\n super(*args)\n end", "def application(name, options = {}, &blk)\n add_child(:applications, Hubcap::Application.new(self, name, options, &blk))\n end", "def add_application(name, options)\n debug \"Adding application #{name} to domain #{id}\"\n\n payload = {:name => name}\n options.each{ |key, value| payload[key.to_sym] = value }\n\n cartridges = Array(payload.delete(:cartridge)).concat(Array(payload.delete(:cartridges))).map do |cart|\n if cart.is_a? String or cart.respond_to? :[]\n cart\n else\n cart.url ? {:url => cart.url} : cart.name\n end\n end.compact.uniq\n\n if cartridges.any?{ |c| c.is_a?(Hash) and c[:url] } and !has_param?('ADD_APPLICATION', 'cartridges[][url]')\n raise RHC::Rest::DownloadingCartridgesNotSupported, \"The server does not support downloading cartridges.\"\n end\n\n if client.api_version_negotiated >= 1.3\n payload[:cartridges] = cartridges\n else\n raise RHC::Rest::MultipleCartridgeCreationNotSupported, \"The server only supports creating an application with a single web cartridge.\" if cartridges.length > 1\n payload[:cartridge] = cartridges.first\n end\n\n if payload[:initial_git_url] and !has_param?('ADD_APPLICATION', 'initial_git_url')\n raise RHC::Rest::InitialGitUrlNotSupported, \"The server does not support creating applications from a source repository.\"\n end\n\n options = {:timeout => options[:scale] && 0 || nil}\n rest_method \"ADD_APPLICATION\", payload, options\n end", "def create\n params[:app][:user_id] = current_user.id\n @app = App.create(params[:app])\n if @app.save\n redirect_to source_app_path(@app), notice: 'app was successfully created.'\n else\n render :new\n end\n end", "def create_app app_name, dev_name, dev_email\n data[:app_name] = app_name\n data[:dev_name] = dev_name\n data[:dev_email] = dev_email\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n respond_with( :oauth, @application, location: oauth_application_url( @application ) )\n else\n render :new\n end\n end", "def find_or_create_app(app_name)\n create_app(app_name)\n rescue\n @heroku.app.info(app_name)\n end", "def create\n\t\t@application = current_user.collaboration_applications.build(application_params)\n\t\t\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n else\n format.html { render partial: 'errors' }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n current_user.application = @application\n current_user.save\n format.html { redirect_to @application, notice: 'Application successfully sent in.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end", "def new\n\t\t@application = Application.new\t\t\n\tend", "def create\n create_params = application_params\n if applicant_signed_in?\n create_params[:applicant_id] = current_applicant.id\n end\n @application = Application.new(create_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: \"Application was successfully created.\" }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end", "def new_application(application)\n load_resources(application)\n @title = 'New Job Applicant'\n mail( subject: 'New Applicant', to: company_administrators, track_opens: 'true' )\n end", "def create_rails3_app rails_version, arel_version = nil\n app = app_path rails_version\n clone AREL_REPO, AREL_CLONE_PATH\n FileUtils.cd AREL_CLONE_PATH do\n if arel_version\n run 'git', 'reset', '--hard', \"v#{arel_version}\"\n else # \"Edge\"\n run 'git', 'reset', '--hard', 'origin/master'\n end\n run 'git', 'clean', '-f'\n end\n\n clone RAILS_REPO, RAILS_CLONE_PATH\n FileUtils.cd RAILS_CLONE_PATH do\n if rails_version\n run 'git', 'reset', '--hard', \"v#{rails_version}\"\n else # \"Edge\"\n run 'git', 'reset', '--hard', 'origin/master'\n end\n run 'git', 'clean', '-f'\n\n begin\n clean_bundler_environment\n run 'env', \"AREL=#{AREL_CLONE_PATH}\",\n 'bundle', 'install', '--path', '../bundle', '--without', 'db'\n FileUtils.rm_r(app) if File.exist?(app)\n run 'env', \"AREL=#{AREL_CLONE_PATH}\",\n 'bundle', 'exec', 'bin/rails', 'new', app, '--skip-activerecord', '--dev'\n ensure\n restore_bundler_environment\n end\n end\n\n create_gemfile app\n bundlerize app\n end", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), 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", "def create\n @application = Application.create(params[:application])\n\n unless @application.new_record?\n flash[:notice] = 'Application was successfully created.'\n end\n\n respond_with @application\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def create\n @agent_application = AgentApplication.new(agent_application_params)\n @agent_application.user = current_user\n\n respond_to do |format|\n if @agent_application.save\n format.html { redirect_to @agent_application, notice: 'Agent application was successfully created.' }\n format.json { render :show, status: :created, location: @agent_application }\n else\n format.html { render :new }\n format.json { render json: @agent_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new()\n @application.name = params[:application][:name].to_s.downcase\n # true - доступ запрещен, false - разрешен\n @application.default = true\n respond_to do |format|\n if @application.save\n format.html { redirect_to applications_path, notice: 'Приложение создано.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @mobile_app = create_app\n if @mobile_app.present? && @mobile_app['identifier'].present?\n @api_key = create_api_key @mobile_app['identifier']\n end\n redirect_to \"/\", flash: { error_message: @error_message }\n end", "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to \"/applications/#{@application.id}/step2\", notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n format.html {\n flash[:success] = 'Application ' + @application.name + ' was successfully created.'\n redirect_to [:admin, @application]\n }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"new\"\n }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil)\n puts(\"The `version` parameter is deprecated. Use `ensure_version!` method instead\") if version\n client.create_application!(name: name,\n primary_language: primary_language,\n sku: sku,\n bundle_id: bundle_id,\n bundle_id_suffix: bundle_id_suffix,\n company_name: company_name,\n platform: platform,\n platforms: platforms,\n itunes_connect_users: itunes_connect_users)\n end", "def create\n create_role_directory\n generate_manifests_file\n end", "def create_application(application_name, opts = {})\n data, _status_code, _headers = create_application_with_http_info(application_name, opts)\n data\n end", "def create_application_token!(user)\n ApplicationToken.create_token(\n current_user: current_user,\n user_id: user.id,\n params: { application: \"default\" }\n )\n end", "def create\n # check if we are missing the required force\n required_force_is_missing?\n\n # apply some force, when we are boosted with one\n apply_force\n\n # download or update local cache\n download_or_update_local_cache\n\n # copy the framework files from the cache\n copy_over_cache_files\n\n # make necessary changes for the new app, if we were successful in\n # download otherwise, remove the downloaded source\n if has_laravel?\n say_success \"Cloned Laravel repository.\"\n\n # update permissions on storage/ directory (this is the default)\n update_permissions_on_storage if @options[:perms]\n\n # configure this new application, as required\n configure_from_options\n\n say_success \"Hurray! Your Laravel application has been created!\"\n else\n say_failed \"Downloaded source is not Laravel framework or its fork.\"\n show_info \"Cleaning up..\"\n # remove all directories that we created, as well as the cache.\n clean_up\n # raise an error since we failed.. :(\n raise LaravelError, \"Source for downloading repository is corrupt!\"\n end\n end", "def create\n @app = App.new(params[:app])\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 json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def init_application(application_name)\n if application_name.nil? || application_name == ''\n throw 'Bad application name'\n end\n res = nil\n applicaiton_init_uri = URI(@url + \"sys/auth/#{application_name}\")\n req = Net::HTTP::Post.new(applicaiton_init_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_init_uri.hostname, applicaiton_init_uri.port) do |http|\n req.body = { 'type' => 'app-id' }.to_json\n http.request(req)\n end\n res.code.to_i\n end", "def create\n @user_application = UserApplication.new(user_application_params)\n\n respond_to do |format|\n if @user_application.save\n format.html { redirect_to @user_application, notice: 'User application was successfully created.' }\n format.json { render :show, status: :created, location: @user_application }\n else\n format.html { render :new }\n format.json { render json: @user_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\n end", "def create_appliction_set(application_name, keys)\n results = {}\n code = unlock_vault(keys)\n return code, nil if code > 399\n code = init_application(application_name)\n return code, nil if code > 399\n results[:app_id], code = create_application_id application_name\n return code, results if code > 399\n results[:user_id], code = create_user(application_name, results[:app_id])\n return code, results if code > 399\n results[:user_data], code = create_user_token(results[:user_id], results[:app_id], application_name)\n return code, results if code > 399\n [200, results]\n end", "def exec(name)\n create_resource(name, type: 'application', binary_path: name)\n\n e_uid = SecureRandom.uuid\n\n e_name = \"#{self.name}_application_#{name}_created_#{e_uid}\"\n\n resource_group_name = \"#{self.id}_application\"\n\n def_event e_name do |state|\n state.find_all { |v| v[:hrn] == name && v[:membership] && v[:membership].include?(resource_group_name)}.size >= self.members.uniq.size\n end\n\n on_event e_name do\n resources[type: 'application', name: name].state = :running\n end\n end", "def create\n authorize! :create, @app\n @app = App.new(app_params)\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", "def create\n application = Application.new(app_params)\n if application.save\n flash[:success] = 'Application was successfully created.'\n redirect_to application_path(application)\n else\n error_message = application.errors.full_messages.to_sentence\n flash[:alert] = 'Application could not be created. Do better'\n #another option would be render :new\n redirect_to new_application_path\n end\n end", "def execute(request)\n Doorkeeper::Application.create(params)\n end", "def create_application \n @user = current_user(session)\n @business = Business.find_by(id: params[:id])\n if [email protected]\n @application = Application.create(business_id: @business.id, user_id: current_user(session).id)\n # binding.pry\n flash[:notice] = \"Your application hass been successfully submitted to #{@business.name} business\"\n else \n flash[:notice] = \"You are an administrator. Please log in without you admin account to apply to '#{@business.name}' business\"\n end\n redirect_to \"/businesses\"\n end", "def create\n @app = App.new(app_params)\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", "def create\n @app = App.new(app_params)\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", "def create\n Apparel.create!(apparel_params)\n json_response({success: true, message: Message.created_successfuly('Apparel record')}, :created)\n end", "def create\n @residential_application = ResidentialApplication.new(residential_application_params)\n\n respond_to do |format|\n if @residential_application.save\n format.html { redirect_to @residential_application, notice: 'Residential application was successfully created.' }\n format.json { render :show, status: :created, location: @residential_application }\n else\n format.html { render :new }\n format.json { render json: @residential_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to app_activities_path(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_app_generate(application_id, type, opts={})\n # \n # default_options = {\n # \"name\" => \"\",\n # \"author\" => \"\",\n # \"description\" => \"\",\n # \"guid\" => \"\",\n # \"datasets\" => \"\",\n # \"env\" => \"prod\",\n # \"image_url\" => \"http://appresource.s3.amazonaws.com/apiappimages/missing_icard.jpg\",\n # \"runtime\" => \"\"\n # }\n # options = default_options.merge(opts)\n return post_response(\"app/#{application_id}/generate/#{type}\", opts,:json)\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def new\n @app = current_user.apps.new\n @app.app_versions << AppVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", "def create_application_with_http_info(application_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.create_application ...'\n end\n # verify the required parameter 'application_name' is set\n if @api_client.config.client_side_validation && application_name.nil?\n fail ArgumentError, \"Missing the required parameter 'application_name' when calling ApplicationManagementApi.create_application\"\n end\n # resource path\n local_var_path = '/appManagement/applications'\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(application_name)\n auth_names = ['APP_MANAGEMENT', '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 => 'ApplicationSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#create_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def heroku\n puts Rainbow(\"Step 1. Create new Heroku application\").foreground(:green)\n\n puts \"Please enter the name of the new Heroku application:\"\n name = STDIN.gets.gsub(\"\\n\", \"\")\n\n createapp = nil\n Bundler.with_clean_env do\n createapp = `heroku create #{name}`\n end\n\n if !createapp.include?(\"done, stack is cedar\")\n puts createapp\n choose do |menu|\n menu.prompt = \"Continue?\"\n\n menu.choice \"Yes\" do \n end\n \n menu.choice \"No\" do\n return\n end\n end\n end\n\n environment(name)\n collaborators(name)\n database(name)\n domains(name)\n email(name)\n asset_sync(name)\n end", "def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask_public(is_public)\n end \n validate_project_name(name)\n project_id = register_api_call(name,is_public) \n Mortar::Command::run(\"generate:project\", [name])\n FileUtils.cd(name)\n is_embedded = false\n if options[:embedded]\n is_embedded = true\n register_do(name, is_public, is_embedded, project_id)\n else\n git.git_init\n git.git(\"add .\")\n git.git(\"commit -m \\\"Mortar project scaffolding\\\"\") \n register_do(name, is_public, is_embedded, project_id)\n display \"NOTE: You'll need to change to the new directory to use your project:\\n cd #{name}\\n\\n\"\n end\n end", "def create\n @registered_app = RegisteredApp.new(registered_app_params)\n\n respond_to do |format|\n if @registered_app.save\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registered_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Application.new(application_params)\n @application.offer = current_user.offers.find(params.require(:offer)[:id])\n\n # @application.company = Company.new(company_params)\n # @application.contact = Contact.new(contact_params)\n # @application.agent = Agent.find_by(agent_params)\n #\n respond_to do |format|\n if @application.save\n # current_user.applications << @application\n format.html { redirect_to action: :index, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @mobile_app = MobileApp.new\n @mobile_app.language = \"English\"\n if current_user.agency\n @mobile_app.primary_agency_id = current_user.agency.id\n end\n @mobile_app.primary_contact_id = current_user.id\n @mobile_app.mobile_app_versions.build\n end", "def create_application_record\n template \"application_record.rb\", application_record_file_name\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def create\n @mobileapp = Mobileapp.new(params[:mobileapp])\n \n respond_to do |format|\n if @mobileapp.save\n format.html { redirect_to @mobileapp, notice: 'Mobileapp was successfully created.' }\n format.json { render json: @mobileapp, status: :created, location: @mobileapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mobileapp.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7178384", "0.70147586", "0.6815873", "0.67622834", "0.67521447", "0.6642485", "0.66129655", "0.6612849", "0.6588232", "0.6549338", "0.65411854", "0.6528765", "0.6524624", "0.65147203", "0.6514295", "0.64808077", "0.64531267", "0.6380511", "0.6323178", "0.6299824", "0.62997824", "0.6297466", "0.62815595", "0.6251309", "0.6231452", "0.6203078", "0.6173295", "0.6171321", "0.61672586", "0.61547244", "0.6139698", "0.6138016", "0.6109144", "0.61069244", "0.60945684", "0.60864156", "0.6052749", "0.6049229", "0.60425895", "0.6035853", "0.602929", "0.6016986", "0.60084593", "0.6003146", "0.59887564", "0.5976823", "0.59719145", "0.59702915", "0.59563345", "0.5939532", "0.5922072", "0.59121764", "0.58918977", "0.5886455", "0.58814585", "0.58598596", "0.5848991", "0.5848517", "0.5843267", "0.5843079", "0.58412004", "0.58343995", "0.58329004", "0.5818961", "0.58189493", "0.5805482", "0.5787241", "0.5780389", "0.5779444", "0.5767421", "0.5763068", "0.576011", "0.576011", "0.574997", "0.5742301", "0.5725519", "0.5718429", "0.5717545", "0.57124776", "0.5710408", "0.5710408", "0.57100755", "0.56916887", "0.5685035", "0.5685035", "0.5660342", "0.5656947", "0.56550056", "0.5650453", "0.5650453", "0.56170815", "0.5597925", "0.5591075", "0.5583762", "0.55836314", "0.55662596", "0.55639005", "0.55543303", "0.55479735", "0.5546066" ]
0.6462561
16
Delete a RUM application.
def delete_rum_application(id, opts = {}) delete_rum_application_with_http_info(id, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_application\n node.rm(new_resource.node_attribute, new_resource.resource_name, new_resource.name)\n end", "def delete\n @bot.delete_application_command(@id, server_id: @server_id)\n end", "def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end", "def delete_application(client, options)\n if !options[:application].nil?\n application = client.applications.get options[:application]\n application.delete\n puts \"Application deleted.\"\n return\n else\n puts \"Missing arguments\"\n return\n end \nend", "def delete_application(opts)\n opts = check_params(opts,[:applications])\n super(opts)\n end", "def destroy\n @application.destroy\n end", "def destroy\n @application.destroy\n end", "def remove_app(app_id, keep_data: nil, timeout: nil)\n @bridge.remove_app(app_id, keep_data: keep_data, timeout: timeout)\n end", "def delete(id)\n response = Network.delete(['Applications', id])\n Application.new(response)\n end", "def destroy\n @app.destroy\n redirect_to apps_url, notice: 'app was successfully deleted.'\n end", "def uninstall_app(app_name)\n @apps.delete(app_name) if @apps[app_name]\n end", "def delete\n @exists = apps.include?(params[:app])\n @app = params[:app] unless @exists == false\n\n if @exists\n `rm #{File.expand_path(\"~/.pow/#{@app}\")}`\n redirect_to root_path, :notice => \"Pow app deleted\"\n else\n render :text => \"Given app is not a Pow app\"\n end\n end", "def delete_appdata\n @restv9.delete_appdata(person_id, appId, field)\n end", "def destroy(name)\n delete(\"/apps/#{name}\").to_s\n end", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy\n @app = current_user.apps.find(params[:id])\n @app.destroy\n flash[:notice] = \"The #{@app.name} app was successfully deleted\"\n respond_to do |format|\n format.html { redirect_to apps_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @ruby_application = RubyApplication.find(params[:id])\n @ruby_application.destroy\n respond_to do |format|\n format.html { redirect_to home_path }\n format.json { head :no_content }\n end\n end", "def action_remove\n app_dir = Chef::Resource::Directory.new(\"#{@current_resource.apps_dir}/#{@current_resource.app}\", run_context)\n app_dir.path(\"#{@current_resource.apps_dir}/#{@current_resource.app}\")\n app_dir.recursive(true)\n app_dir.run_action(:delete)\n new_resource.updated_by_last_action(app_dir.updated_by_last_action?)\n end", "def destroy\n @mobileapp = Mobileapp.find(params[:id])\n @mobileapp.destroy\n \n respond_to do |format|\n format.html { redirect_to mobileapps_url }\n format.json { head :no_content }\n end\n end", "def remove\n get_credentials\n begin\n response = resource[\"/remove/#{app}\"].post(:apikey => @credentials[1])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def destroy\n @app.destroy\n\n head :no_content\n end", "def destroy\n display\n if confirm [\"Are you totally completely sure you want to delete #{app} forever and ever?\", \"THIS CANNOT BE UNDONE! (y/n)\"]\n display \"+> Destroying #{app}\"\n client.app_destroy(app)\n display \"+> #{app} has been successfully destroyed. RIP #{app}.\"\n remove_app(app)\n end\n display\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :ok }\n end\n end", "def delete_vapp(id)\n fog_service_interface.delete_vapp(id)\n end", "def delete_application(application_aid)\n select_application gp_card_manager_aid\n secure_channel\n \n files = gp_get_status :files_modules\n app_file_aid = nil\n files.each do |file|\n next unless modules = file[:modules]\n next unless modules.any? { |m| m[:aid] == application_aid }\n gp_delete_file file[:aid]\n app_file_aid = file[:aid]\n end \n app_file_aid\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = Mms::App.find(params[:id])\n if @app.destroy\n flash[:notice] = \"删除组件成功\"\n redirect_to :action => :index\n else\n flash[:notice] = \"删除组件失败\"\n redirect_to :action => :index\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def uninstall(app_id)\n runcmd 'uninstall', app_id\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html {\n flash[:notice] = 'Application was successfully destroyed.'\n redirect_to admin_applications_url\n }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to(applications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id], :conditions => conditions)\n @app.destroy\n flash[:notice] = \"#{@app.name}删除成功\"\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def deregister_application(app_name, namespace)\n # delete the CNAME record for the application in the domain\n fqdn = \"#{app_name}-#{namespace}.#{@domain_suffix}\"\n\n # Get the record you mean to delete.\n # We need the TTL and value to delete it.\n record = get_record(fqdn)\n\n # If record is nil, then we're done. Raise an exception for trying?\n return if record == nil\n ttl = record[:ttl]\n public_hostname = record[:resource_records][0][:value]\n\n delete = {\n :comment => \"Delete an application record for #{fqdn}\",\n :changes => [change_record(\"DELETE\", fqdn, @ttl, public_hostname)]\n }\n \n res = r53.change_resource_record_sets({\n :hosted_zone_id => @aws_hosted_zone_id,\n :change_batch => delete\n })\n end", "def destroy\n @app.destroy\n respond_to do |format|\n flash[:success] = 'App was successfully destroyed.'\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n app = extract_app\n info = heroku.info(app)\n url = info[:domain_name] || \"http://#{info[:name]}.#{heroku.host}/\"\n\n if confirm_command(app)\n redisplay \"Destroying #{app} (including all add-ons)... \"\n heroku.destroy(app)\n if remotes = git_remotes(Dir.pwd)\n remotes.each do |remote_name, remote_app|\n next if app != remote_app\n git \"remote rm #{remote_name}\"\n end\n end\n display \"done\"\n end\n end", "def destroy\n @user_app = UserApp.find(params[:id])\n @user_app.destroy\n\n respond_to do |format|\n format.html { redirect_to user_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @userapp = Userapp.find(params[:id])\n @userapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(userapps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def deregister_application(app_name, namespace)\n # delete the CNAME record for the application in the domain\n fqdn = \"#{app_name}-#{namespace}.#{@domain_suffix}\"\n\n # Get the record you mean to delete.\n # We need the TTL and value to delete it.\n record = get_record(fqdn)\n\n # If record is nil, then we're done. Raise an exception for trying?\n return if record == nil\n ttl = record[:ttl]\n public_hostname = record[:resource_records][0][:value]\n\n delete = {\n :comment => \"Delete an application record for #{fqdn}\",\n :changes => [change_record(\"DELETE\", fqdn, @ttl, public_hostname)]\n }\n \n #res = r53.change_resource_record_sets({\n # :hosted_zone_id => @aws_hosted_zone_id,\n # :change_batch => delete\n # })\n\n url = \"https://dnsapi.cn/Record.Remove\"\n\n h = HTTPClient.new()\n\n default_params = {\n :login_email => \"\"\n }\n params = {\n\n }.merge(default_params)\n\n res = h.post(url, params)\n status_code = JSON.parse(res.body)['status']['code']\n if status_code == '1'\n\n end\n end", "def destroy\n @app = App.find(params[:id])\n \n if params[:app_delete_cancel]\n redirect_to apps_url\n return\n end\n\n respond_to do |format|\n if @app.destroy\n format.html do\n flash[:notice] = \"App '#{@app}' successfully deleted\"\n redirect_to apps_url\n end\n format.xml { head :ok }\n else\n format.html { render :action => 'delete' }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "def destroy\n @application = Application.find(params[:id])\n User.allow_to_all(@application.id) # перед удалением снимаем все запреты для данного приложения.\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Приложение удалено.' }\n format.json { head :ok }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_with @application\n end", "def destroy\n @newapp = Newapp.find(params[:id])\n @newapp.destroy\n\n respond_to do |format|\n format.html { redirect_to newapps_url }\n format.json { head :no_content }\n end\n end", "def deregister_application(app_name, namespace)\n end", "def destroy\n\t\tapp_api_key = ApiKey.find_by_application_id(params[:id])\n\n\t\tif app_api_key\n\t\t\tapp_api_key.destroy\n\t\t\tflash[:developer] = \"The app was successfully deleted.\"\n\t\telse\n\t\t\tflash[:developer] = \"Something went wrong and the app is not deleted\"\n\t\tend\t\n\t\tredirect_to developer_home_path\t\t\t\n\tend", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to admin2017_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_app.destroy\n end", "def destroy\n stop_stats\n @@applications.delete @api_id\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def uninstall_app(*args)\n # remove files based on pkg info (boms)\n # or\n # just remove the app directory\n # check munki for tips on how to do this cleanly.\n # i'm inclined to skip this for now.\n end", "def delete_app_group(group,app)\n\t\t\tresults = submit_cmd('delete app group',:db,\" -env #{self.env} -domain #{self.domain} -plant #{self.plant} -group #{group} -app_instance #{app}\")\n\t\t\tputs results\n\tend", "def delete_rum_application_with_http_info(id, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RUMAPI.delete_rum_application ...'\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 RUMAPI.delete_rum_application\"\n end\n # resource path\n local_var_path = '/api/v2/rum/applications/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :delete_rum_application,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RUMAPI#delete_rum_application\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy(name)\n deprecate # 07/26/2012\n delete(\"/apps/#{name}\").to_s\n end", "def destroy\n @herga_application.destroy\n respond_to do |format|\n format.html { redirect_to herga_applications_url, notice: 'Herga application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @registered_app.destroy\n respond_to do |format|\n format.html { redirect_to registered_apps_url }\n format.json { head :no_content }\n end\n end", "def delete_program_application(program_id, adspace_id)#TODO test\n resource = ['programs', 'program', program_id.to_s, 'adspace', adspace_id.to_s]\n \n @rest_action = 'DELETE'\n enable_api_security\n\n if send_request(resource)\n return true\n end\n\n return false\n end", "def admin_delete_app\n\n # Get Current App\n app = MailfunnelsUtil.get_app\n\n # If the User is not an admin redirect to error page\n if !app.is_admin or app.is_admin === 0\n response = {\n success: false\n }\n\n render json: response and return\n end\n\n # Get App to be deleted\n del_app = App.find(params[:app_id])\n\n unless del_app\n response = {\n success: false\n }\n\n render json: response and return\n end\n\n\n # Delete App\n del_app.destroy\n\n\n response = {\n success: true\n }\n\n render json: response and return\n\n\n end", "def destroy\n @papp = Rapns::Apns::App.find(params[:id])\n @papp.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @app\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_app_data\n command = P::DeleteCustomerAppDataCommand.new(**id_or_number)\n send_command(:delete_customer_app_data, command)\n end", "def disconnect!\n response = delete(PATH.call(id) + \"/application\")\n response['status'] == SUCCESS\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile_app.destroy\n respond_to do |format|\n format.html { redirect_to mobile_apps_url, notice: 'Mobile app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n return unless appAccess?(@application.job.id)\n id = @application.job.id\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to show_apps_path(:id=>id) }\n format.json { head :no_content }\n end\n end", "def destroy\n unless user_signed_in? and @application == current_user.application or current_user.is_admin?\n redirect_to root_path, notice: \"You can't do that dude\"\n end\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to dynamic_url(:applications), notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html {redirect_to applications_url, notice: 'Application was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @program.destroy\n end", "def destroy\n @agent_application.destroy\n respond_to do |format|\n format.html { redirect_to agent_applications_url, notice: 'Agent application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_app.destroy\n respond_to do |format|\n format.html { redirect_to admin_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dev = @app.developers.first.id\n @app.destroy\n respond_to do |format|\n format.html { redirect_to developer_path(@dev), notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_account_app = User.find(params[:id])\n @user_account_app.destroy\n\n respond_to do |format|\n format.html { redirect_to user_account_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wine_app.destroy\n respond_to do |format|\n format.html { redirect_to wine_apps_url }\n format.json { head :no_content }\n end\n end", "def delete_program_by_id(item_id)\n item = get_program_by_id(item_id)\n item.destroy\n end", "def destroy\n @user_application.destroy\n respond_to do |format|\n format.html { redirect_to user_applications_url, notice: 'User application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.78835434", "0.7242512", "0.71606386", "0.715505", "0.7117837", "0.7070221", "0.7070221", "0.7031122", "0.69717515", "0.6920511", "0.6856351", "0.6852581", "0.6850262", "0.6838399", "0.6823661", "0.6823661", "0.67469877", "0.6683238", "0.6588499", "0.658119", "0.6567872", "0.6560747", "0.65461046", "0.65373284", "0.65373284", "0.6515865", "0.64947075", "0.64918023", "0.64918023", "0.64918023", "0.64672816", "0.6445895", "0.64446735", "0.64446735", "0.64446735", "0.6439961", "0.6423833", "0.6404832", "0.6403742", "0.63996696", "0.63817686", "0.6356651", "0.6347535", "0.6331503", "0.632972", "0.63173115", "0.63173115", "0.6307329", "0.6297073", "0.62920755", "0.629196", "0.6282174", "0.6276653", "0.6266793", "0.62656534", "0.62650084", "0.6235152", "0.62228894", "0.62221086", "0.62213755", "0.6215719", "0.6215719", "0.6215719", "0.6215719", "0.61972964", "0.6195201", "0.61650383", "0.6160688", "0.6160688", "0.6160688", "0.6157303", "0.6126762", "0.6125694", "0.6114133", "0.60767585", "0.6071606", "0.6046049", "0.6034706", "0.60290813", "0.60236716", "0.60236716", "0.60236716", "0.60236716", "0.60236716", "0.60236716", "0.60236716", "0.60236716", "0.60007834", "0.5987529", "0.5983449", "0.5956036", "0.5942415", "0.5935933", "0.5934787", "0.59299207", "0.59147143", "0.59126616", "0.5906455", "0.58898544", "0.5872147" ]
0.7144373
4
Delete a RUM application. Delete an existing RUM application in your organization.
def delete_rum_application_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RUMAPI.delete_rum_application ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling RUMAPI.delete_rum_application" end # resource path local_var_path = '/api/v2/rum/applications/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :delete_rum_application, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RUMAPI#delete_rum_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_application\n node.rm(new_resource.node_attribute, new_resource.resource_name, new_resource.name)\n end", "def delete_application(client, options)\n if !options[:application].nil?\n application = client.applications.get options[:application]\n application.delete\n puts \"Application deleted.\"\n return\n else\n puts \"Missing arguments\"\n return\n end \nend", "def delete_application(opts)\n opts = check_params(opts,[:applications])\n super(opts)\n end", "def destroy\n @application.destroy\n end", "def destroy\n @application.destroy\n end", "def delete\n @bot.delete_application_command(@id, server_id: @server_id)\n end", "def delete_appdata\n @restv9.delete_appdata(person_id, appId, field)\n end", "def delete_rum_application(id, opts = {})\n delete_rum_application_with_http_info(id, opts)\n nil\n end", "def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end", "def destroy\n @app = current_user.apps.find(params[:id])\n @app.destroy\n flash[:notice] = \"The #{@app.name} app was successfully deleted\"\n respond_to do |format|\n format.html { redirect_to apps_path }\n format.xml { head :ok }\n end\n end", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy\n @ruby_application = RubyApplication.find(params[:id])\n @ruby_application.destroy\n respond_to do |format|\n format.html { redirect_to home_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n redirect_to apps_url, notice: 'app was successfully deleted.'\n end", "def delete(id)\n response = Network.delete(['Applications', id])\n Application.new(response)\n end", "def destroy(name)\n delete(\"/apps/#{name}\").to_s\n end", "def destroy\n @mobileapp = Mobileapp.find(params[:id])\n @mobileapp.destroy\n \n respond_to do |format|\n format.html { redirect_to mobileapps_url }\n format.json { head :no_content }\n end\n end", "def uninstall_app(app_name)\n @apps.delete(app_name) if @apps[app_name]\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html {\n flash[:notice] = 'Application was successfully destroyed.'\n redirect_to admin_applications_url\n }\n format.json { head :no_content }\n end\n end", "def delete_application(application_aid)\n select_application gp_card_manager_aid\n secure_channel\n \n files = gp_get_status :files_modules\n app_file_aid = nil\n files.each do |file|\n next unless modules = file[:modules]\n next unless modules.any? { |m| m[:aid] == application_aid }\n gp_delete_file file[:aid]\n app_file_aid = file[:aid]\n end \n app_file_aid\n end", "def delete\n @exists = apps.include?(params[:app])\n @app = params[:app] unless @exists == false\n\n if @exists\n `rm #{File.expand_path(\"~/.pow/#{@app}\")}`\n redirect_to root_path, :notice => \"Pow app deleted\"\n else\n render :text => \"Given app is not a Pow app\"\n end\n end", "def deregister_application(app_name, namespace)\n # delete the CNAME record for the application in the domain\n fqdn = \"#{app_name}-#{namespace}.#{@domain_suffix}\"\n\n # Get the record you mean to delete.\n # We need the TTL and value to delete it.\n record = get_record(fqdn)\n\n # If record is nil, then we're done. Raise an exception for trying?\n return if record == nil\n ttl = record[:ttl]\n public_hostname = record[:resource_records][0][:value]\n\n delete = {\n :comment => \"Delete an application record for #{fqdn}\",\n :changes => [change_record(\"DELETE\", fqdn, @ttl, public_hostname)]\n }\n \n res = r53.change_resource_record_sets({\n :hosted_zone_id => @aws_hosted_zone_id,\n :change_batch => delete\n })\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to(applications_url) }\n format.xml { head :ok }\n end\n end", "def deregister_application(app_name, namespace)\n # delete the CNAME record for the application in the domain\n fqdn = \"#{app_name}-#{namespace}.#{@domain_suffix}\"\n\n # Get the record you mean to delete.\n # We need the TTL and value to delete it.\n record = get_record(fqdn)\n\n # If record is nil, then we're done. Raise an exception for trying?\n return if record == nil\n ttl = record[:ttl]\n public_hostname = record[:resource_records][0][:value]\n\n delete = {\n :comment => \"Delete an application record for #{fqdn}\",\n :changes => [change_record(\"DELETE\", fqdn, @ttl, public_hostname)]\n }\n \n #res = r53.change_resource_record_sets({\n # :hosted_zone_id => @aws_hosted_zone_id,\n # :change_batch => delete\n # })\n\n url = \"https://dnsapi.cn/Record.Remove\"\n\n h = HTTPClient.new()\n\n default_params = {\n :login_email => \"\"\n }\n params = {\n\n }.merge(default_params)\n\n res = h.post(url, params)\n status_code = JSON.parse(res.body)['status']['code']\n if status_code == '1'\n\n end\n end", "def destroy\n @application = Application.find(params[:id])\n User.allow_to_all(@application.id) # перед удалением снимаем все запреты для данного приложения.\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Приложение удалено.' }\n format.json { head :ok }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def remove_app(app_id, keep_data: nil, timeout: nil)\n @bridge.remove_app(app_id, keep_data: keep_data, timeout: timeout)\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id], :conditions => conditions)\n @app.destroy\n flash[:notice] = \"#{@app.name}删除成功\"\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @userapp = Userapp.find(params[:id])\n @userapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(userapps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_app = UserApp.find(params[:id])\n @user_app.destroy\n\n respond_to do |format|\n format.html { redirect_to user_apps_url }\n format.json { head :no_content }\n end\n end", "def action_remove\n app_dir = Chef::Resource::Directory.new(\"#{@current_resource.apps_dir}/#{@current_resource.app}\", run_context)\n app_dir.path(\"#{@current_resource.apps_dir}/#{@current_resource.app}\")\n app_dir.recursive(true)\n app_dir.run_action(:delete)\n new_resource.updated_by_last_action(app_dir.updated_by_last_action?)\n end", "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_with @application\n end", "def destroy\n @app.destroy\n\n head :no_content\n end", "def remove\n get_credentials\n begin\n response = resource[\"/remove/#{app}\"].post(:apikey => @credentials[1])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end", "def deregister_application(app_name, namespace)\n end", "def uninstall_app(*args)\n # remove files based on pkg info (boms)\n # or\n # just remove the app directory\n # check munki for tips on how to do this cleanly.\n # i'm inclined to skip this for now.\n end", "def destroy\n @app = Mms::App.find(params[:id])\n if @app.destroy\n flash[:notice] = \"删除组件成功\"\n redirect_to :action => :index\n else\n flash[:notice] = \"删除组件失败\"\n redirect_to :action => :index\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @herga_application.destroy\n respond_to do |format|\n format.html { redirect_to herga_applications_url, notice: 'Herga application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n ELASTIC_SEARCH_CLIENT.delete index: 'mobile_apps', type: 'mobile_app', id: @mobile_app.id\n @mobile_app.destroy!\n respond_to do |format|\n format.html { redirect_to admin_mobile_apps_url, notice: 'Mobile Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @agent_application.destroy\n respond_to do |format|\n format.html { redirect_to agent_applications_url, notice: 'Agent application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n flash[:success] = 'App was successfully destroyed.'\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "def uninstall(app_id)\n runcmd 'uninstall', app_id\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to admin2017_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_app.destroy\n end", "def admin_delete_app\n\n # Get Current App\n app = MailfunnelsUtil.get_app\n\n # If the User is not an admin redirect to error page\n if !app.is_admin or app.is_admin === 0\n response = {\n success: false\n }\n\n render json: response and return\n end\n\n # Get App to be deleted\n del_app = App.find(params[:app_id])\n\n unless del_app\n response = {\n success: false\n }\n\n render json: response and return\n end\n\n\n # Delete App\n del_app.destroy\n\n\n response = {\n success: true\n }\n\n render json: response and return\n\n\n end", "def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n unless user_signed_in? and @application == current_user.application or current_user.is_admin?\n redirect_to root_path, notice: \"You can't do that dude\"\n end\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_account_app = User.find(params[:id])\n @user_account_app.destroy\n\n respond_to do |format|\n format.html { redirect_to user_account_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @newapp = Newapp.find(params[:id])\n @newapp.destroy\n\n respond_to do |format|\n format.html { redirect_to newapps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n app = extract_app\n info = heroku.info(app)\n url = info[:domain_name] || \"http://#{info[:name]}.#{heroku.host}/\"\n\n if confirm_command(app)\n redisplay \"Destroying #{app} (including all add-ons)... \"\n heroku.destroy(app)\n if remotes = git_remotes(Dir.pwd)\n remotes.each do |remote_name, remote_app|\n next if app != remote_app\n git \"remote rm #{remote_name}\"\n end\n end\n display \"done\"\n end\n end", "def destroy\n @registered_app.destroy\n respond_to do |format|\n format.html { redirect_to registered_apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile_app.destroy\n respond_to do |format|\n format.html { redirect_to mobile_apps_url, notice: 'Mobile app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to applications_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_app_group(group,app)\n\t\t\tresults = submit_cmd('delete app group',:db,\" -env #{self.env} -domain #{self.domain} -plant #{self.plant} -group #{group} -app_instance #{app}\")\n\t\t\tputs results\n\tend", "def destroy\n @papp = Rapns::Apns::App.find(params[:id])\n @papp.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to dynamic_url(:applications), notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_application.destroy\n respond_to do |format|\n format.html { redirect_to user_applications_url, notice: 'User application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @residential_application.destroy\n respond_to do |format|\n format.html { redirect_to residential_applications_url, notice: 'Residential application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application = Application.find(params[:id])\n return unless appAccess?(@application.job.id)\n id = @application.job.id\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to show_apps_path(:id=>id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_role = AppRole.find(params[:id])\n @app_role.destroy\n\n respond_to do |format|\n format.html { redirect_to app_roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app = App.find(params[:id])\n \n if params[:app_delete_cancel]\n redirect_to apps_url\n return\n end\n\n respond_to do |format|\n if @app.destroy\n format.html do\n flash[:notice] = \"App '#{@app}' successfully deleted\"\n redirect_to apps_url\n end\n format.xml { head :ok }\n else\n format.html { render :action => 'delete' }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n format.html {redirect_to applications_url, notice: 'Application was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @admin_app.destroy\n respond_to do |format|\n format.html { redirect_to admin_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @merchant_application.destroy\n respond_to do |format|\n format.html { redirect_to merchant_applications_url, notice: 'Merchant application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\tapp_api_key = ApiKey.find_by_application_id(params[:id])\n\n\t\tif app_api_key\n\t\t\tapp_api_key.destroy\n\t\t\tflash[:developer] = \"The app was successfully deleted.\"\n\t\telse\n\t\t\tflash[:developer] = \"Something went wrong and the app is not deleted\"\n\t\tend\t\n\t\tredirect_to developer_home_path\t\t\t\n\tend", "def destroy\n authorize! :destroy, @app\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n display\n if confirm [\"Are you totally completely sure you want to delete #{app} forever and ever?\", \"THIS CANNOT BE UNDONE! (y/n)\"]\n display \"+> Destroying #{app}\"\n client.app_destroy(app)\n display \"+> #{app} has been successfully destroyed. RIP #{app}.\"\n remove_app(app)\n end\n display\n end", "def destroy\n stop_stats\n @@applications.delete @api_id\n end", "def destroy\n @userapplication = Userapplication.find(params[:id])\n @userapplication.destroy\n respond_to do |format|\n format.html { redirect_to users_path(:id), info: 'Aplicación usuario a sido destruida correctamente.'}\n format.json { head :no_content }\n end\n end", "def destroy\n @application.destroy\n respond_to do |format|\n if admin_signed_in?\n format.html { redirect_to show_applications_path, notice: \"Application was successfully destroyed.\" }\n else\n format.html { redirect_to applicants_path, notice: \"Application was successfully destroyed.\" }\n end\n format.json { head :no_content }\n end\n end", "def destroy(name)\n deprecate # 07/26/2012\n delete(\"/apps/#{name}\").to_s\n end", "def delete_vapp(id)\n fog_service_interface.delete_vapp(id)\n end", "def remove_app_target_from_app_admin_role(user_id, role_id, app_name, options = {})\n delete(\"/users/#{user_id}/roles/#{role_id}/targets/catalog/apps/#{app_name}\", options)\n end" ]
[ "0.7603353", "0.7136893", "0.6951597", "0.6941908", "0.6941908", "0.6932715", "0.6810071", "0.67844975", "0.672111", "0.66989803", "0.6688652", "0.6688652", "0.66876274", "0.6666599", "0.6654056", "0.659689", "0.6592407", "0.6591459", "0.6558766", "0.65534645", "0.65356797", "0.6491679", "0.6486619", "0.64835334", "0.64548516", "0.64509165", "0.64244765", "0.64149624", "0.6380865", "0.6380865", "0.6373712", "0.6373712", "0.6345283", "0.63438916", "0.63438916", "0.63438916", "0.63372767", "0.63201463", "0.63201463", "0.63201463", "0.6315401", "0.6278125", "0.62772286", "0.6276422", "0.62720084", "0.62668806", "0.62668806", "0.62668806", "0.6256592", "0.62518024", "0.6243138", "0.62405074", "0.6237669", "0.62280464", "0.62088144", "0.61994815", "0.6199044", "0.6196883", "0.6196166", "0.6190902", "0.6189062", "0.61695284", "0.6153293", "0.6141654", "0.6137789", "0.6128081", "0.6124246", "0.6120813", "0.61059654", "0.61059654", "0.61059654", "0.61059654", "0.61059654", "0.61059654", "0.61059654", "0.61059654", "0.61054295", "0.61054295", "0.61054295", "0.61054295", "0.61042786", "0.6075608", "0.6072101", "0.6046646", "0.60429597", "0.60370404", "0.60276794", "0.60184103", "0.60170025", "0.59974027", "0.59919184", "0.59888667", "0.5974691", "0.5974601", "0.59675413", "0.5965455", "0.5955157", "0.59416986", "0.5938977", "0.59300345" ]
0.61046046
80