query
stringlengths 7
6.41k
| document
stringlengths 12
28.8k
| metadata
dict | negatives
listlengths 30
30
| negative_scores
listlengths 30
30
| document_score
stringlengths 5
10
| document_rank
stringclasses 2
values |
---|---|---|---|---|---|---|
Description Main page of the section 'elements'. When it's called via ajax it's because of the application of filters, paginations, or after an operation that changed the number of items in the page. Mode Html + Ajax Specific filters ApplicationControllerinitialize_layout MediaElementsControllerinitialize_paginator | def index
get_own_media_elements
if @page > @pages_amount && @pages_amount != 0
@page = @pages_amount
get_own_media_elements
end
render_js_or_html_index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @page_elements = @page.page_elements\n if (@page)\n @mainelements = @page.page_elements.where(visible: true,sidebar: false)\n @sidebarelements = @page.page_elements.where(visible:true,sidebar: true)\n end\n if(@mainelemnents) && (@mainelements.count > 1)\n @mainelements = @mainelements.sort_by{ |x| x[:displayIndex]}\n end\n @poster = @council.posts\n @rest = @page.page_elements.where(visible: false)\n end",
"def index\n\t @robot_img = 'http://www.bia.or.th/en/images/photo/08dec.jpg'\n\t @title = 'Articles - Suan Mokkh'\n\t # @featured_books = Book.includes(:authors, :groups, :languages).where(featured: true, draft: false).order('created_at DESC').limit(10)\n\t # @recommended_books = Book.includes(:authors).where(recommended: true, draft: false).order('created_at DESC').limit(15)\n\t @filterrific = initialize_filterrific(\n\t Article,\n\t params[:filterrific],\n\t :select_options => {\n\t with_language_id: Language.options_for_select,\n\t with_author_id: Author.options_for_select,\n\t with_series: Article.options_for_series,\n\t },\n\t # default_filter_params: [],\n\t # persistence_id: 'shared_key',\n\t # available_filters: [],\n\t ) or return\n\t @articles = @filterrific.find.page(params[:page]).where(draft: false)\n\n\t respond_to do |format|\n\t format.html\n\t format.js\n\t end\n\tend",
"def initialize_paginator\n @page = correct_integer?(params[:page]) ? params[:page].to_i : 1\n @display = [MediaElement::DISPLAY_MODES[:compact], MediaElement::DISPLAY_MODES[:expanded]].include?(params[:display]) ? params[:display] : MediaElement::DISPLAY_MODES[:expanded]\n if @display == MediaElement::DISPLAY_MODES[:expanded]\n @for_row = correct_integer?(params[:for_row]) ? params[:for_row].to_i : 1\n @for_row = 1 if @for_row > 50\n @for_page = @for_row * 2\n else\n @for_page = FOR_PAGE\n end\n @filter = params[:filter]\n @filter = Filters::ALL_MEDIA_ELEMENTS if !Filters::MEDIA_ELEMENTS_SET.include?(@filter)\n @just_resizing = params[:resizing].present?\n end",
"def advance_search \n if params[:entity_type]==\"static-fragment\"\n @page_properties={:selected_menu=>'static_fragment',:menu_title=>'Static Fragment List'}\n else\n @page_properties={:selected_menu=>'static_articles',:menu_title=>'Static Page List'}\n end \n @search=true \n @search_data=SearchData.new(params[:search_data]) if params[:search_data] \n @article_path=\"static_page\" \n @[email protected]_sections.find(params[:search_data][:section_id]) if params[:search_data] and params[:search_data][:section_id]!=\"\"\n session[:per_page]=params[:per_page] if params[:per_page]!=nil\n sort_init \"updated_at\"\n sort_update\n respond_to do |format|\n format.html do \n render :action=>\"index\" ,:entity_type => params[:entity_type]\n end\n format.js do\n render :update do |page| \n page.replace_html 'article_list',component_table_list(@site.find_component_by_name(\"static_article_search\"))\n end\n end\n end \n end",
"def page\n @data_management_plans = paginate_response(results: search_filter_and_sort)\n render layout: false\n end",
"def index\n get_own_documents\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_documents\n end\n render_js_or_html_index\n end",
"def index\n #@articles = Article.all\n # @article = Article.friendly.find(params[:id])\n # impressionist(@article)\n @articleOrder = Article.article_order(params[:page])\n # @jasonObject = render json: @articleOrder\n # puts JSON.pretty_generate(@articleOrder)\n if params[:tag]\n @articles = Article.tagged_with(params[:tag])\n else\n @articles = Article.order('created_at DESC').paginate(page: params[:page], :per_page => 4)\n end\n # @articles = Article.order('created_at DESC').paginate(page: params[:page], :per_page => 4)\n # all.page(params[:page]).per(4)\n @articles_corousal = Article.all\n # use scope\n @article_paginate = Article.paginate(page: params[:page], :per_page => 4)\n @widgetArticle = Article.widget_article(params[:page])\n \n end",
"def index\n #p = logged_in? ? logged_in_person : nil\n per_page = 12\n conditions = []\n condition_vars = {}\n if params[:title] and params[:title] != ''\n conditions.push(\"lower(title) like :title\")\n condition_vars[:title] =\"%#{params[:title].downcase}%\"\n end\n find_conditions = [conditions.join(\" and \"), condition_vars]\n permitted_questionnaires = Questionnaire.all(:conditions => find_conditions, :order => 'id DESC')\n pager = ::Paginator.new(permitted_questionnaires.size, per_page) do |offset, pp|\n permitted_questionnaires[offset, pp]\n end\n @questionnaires = returning WillPaginate::Collection.new(params[:page] || 1, per_page, permitted_questionnaires.size) do |paginator|\n paginator.replace pager.page(params[:page]).items\n end\n \n\n respond_to do |format|\n format.html { }\n format.js do\n render :update do |page|\n page.replace_html 'questionnaire_list', :partial => 'paged_results'\n end\n end\n end\n end",
"def show\n @page = @question_sheet.pages.find(params[:id])\n @elements = @page.elements\n\n respond_to do |format|\n format.js\n end\n end",
"def index\n block_pagination\n respond_to do |format|\n format.html {\n @action_nav = CW::ActionNav::Controller::Base.new.section('Change') {|s|\n s.link 'add show episode ordering', { :action => 'new', :type => 'HomePageBlockShowDl' }, { :title => 'Add a Show DL Episode ordered block to the home page' }\n s.link 'add show filtered ordering', { :action => 'new', :type => 'HomePageBlockFiltered' }, { :title => 'Add a block filtered by show id and order to the home page' }\n }\n render :action => 'index'\n }\n end\n end",
"def show\n @attachable_comments = Comment.order(created_at: :desc).where(\"article_id <> #{@article.id}\").paginate(page: params[:page_attach_comm], per_page: 5)\n if params[:page_attach_comm]\n render partial: 'shared/append_items', locals:\n { appendable_body: '.attachable-comments tbody', partial: 'shared/attachable_item', collection: @attachable_comments,\n item: :item, scrollable_div: '#attachable-comments-pagination .pagination', param_name: 'page_attach_comm' } and return\n end\n @attachable_articles = Article.order(created_at: :desc).paginate(page: params[:page_attach_art], per_page: 5)\n if params[:page_attach_art]\n render partial: 'shared/append_items', locals:\n { appendable_body: '.attachable-articles tbody', partial: 'shared/attachable_item', collection: @attachable_articles,\n item: :item, scrollable_div: '#attachable-articles-pagination .pagination', param_name: 'page_attach_art' } and return\n end\n @article_comments = @article.comments.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n @comment = current_user.comments.new if current_user\n @attachment = Attachment.new\n @attachments = Attachment.paginate(page: params[:page_attachment], per_page: 5)\n respond_to do |format|\n format.html\n format.js { render partial: 'shared/append_items', locals:\n { appendable_body: '.table-comments tbody', partial: 'articles/comment', collection: @article_comments,\n item: :comment, scrollable_div: '#infinite-scrolling .pagination', param_name: 'page' }\n }\n end\n end",
"def index\n get_own_lessons\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_lessons\n end\n render_js_or_html_index\n end",
"def page_elements\n []\n end",
"def configure\n # fetching page via before filter\n if @page.redirects_to_external?\n render action: 'configure_external', layout: !request.xhr?\n else\n @page_layouts = PageLayout.layouts_with_own_for_select(@page.page_layout, session[:language_id], @page.layoutpage?)\n render layout: !request.xhr?\n end\n end",
"def partial_html_sections\n # Tell our application_helper#url_for to generate urls with hostname\n @generate_urls_with_host = true\n # Force background status to be the spinner--default js way of putting\n # spinner in does not generally work through ajax techniques.\n @force_bg_progress_spinner = true\n # Mark that we're doing a partial generation, because it might\n # matter later.\n @generating_embed_partials = true\n # Run the request if neccesary.\n self.service_dispatch()\n @user_request.save!\n self.api_render()\n end",
"def show\n @page = Page.find(params[:id])\n @page.images.build\n @description = @page.description ? @page.description : @page.body[0..150]\n \n get_sidebar(@page)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def render(options = nil, extra_options = {}, &block)\n # your code goes here\n prep_pagination_info(@results_h[:pagination_info]) if @results_h && @results_h[:pagination_info]\n \n # call the ActionController::Base render to show the page\n super\n end",
"def index\n # config de layout \n @layout = Array.new()\n @layout[0] = \"produto\" # menu \n @layout[1] = \"Produtos\" # titulos \n @layout[2] = \"sloganD2\" # subtitulo_css \n @layout[3] = \"Adicionar um produto\" # subtitulo_css \n @layout[4] = \"produtos/new\" #subtitulo_url\n @layout[5] = \"produtos/search\" #busca_url\n\n # paginacao\n if params[:pag]\n @offset = params[:pag].to_i\n else\n @offset = 0\n end\n \n # criando a lista\n @adm_produtos_full = Adm::Produto.limit(20).offset(@offset).all\n\n # filtrando pela permissao do usuário os registros que ele pode ver\n if session[:usuario].status.area.codigo != '0'\n @adm_produtos = @adm_produtos_full.find_all {|p| p.status.codigo == '0' or p.status.codigo == '1' }\n else\n @adm_produtos = @adm_produtos_full\n end\n\n if @adm_produtos.length == 0 and params[:pag]\n redirect_to(adm_produtos_path, :notice => 'Não ha mais produtos')\n else\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @adm_produtos }\n end \n end\n end",
"def index\n @all_knowledgement_areas = Periodic.distinct.pluck(:knowledgement_area).compact.each(&:strip!)\n @all_qualis = Periodic.distinct.pluck(:qualis).compact.each(&:strip!)\n @periodics_count = Periodic.all.count\n\n if params[:selected_knowledgement_area] && params[:selected_qualis]\n @listage_title = 'Listagem de periódicos pesquisados'\n @periodics = find_periodic(params[:selected_knowledgement_area], params[:selected_qualis]).paginate(page: params[:page], per_page: 80).order('created_at ASC')\n @returned_results_txt = \"Total de Periódicos retornados na consulta: #{@periodics.size}\"\n else\n @listage_title = 'Listagem de todos os periódicos'\n @returned_results_txt = \"Você ainda não realizou uma filtragem na busca\"\n @periodics = Periodic.paginate(page: params[:page], per_page: 39).order('created_at ASC')\n respond_to do |format|\n format.html\n format.js\n end\n end\n end",
"def page_load; end",
"def full_page\n end",
"def kopal_layout_after_page_meta\n\n end",
"def render_pagination\n num_pages = Document.num_results.to_f / @per_page.to_f\n num_pages = Integer(num_pages.ceil)\n return '' if num_pages == 0\n\n content_tag :div, :class => 'ui-grid-c' do\n content = content_tag(:div, :class => 'ui-block-a') do\n if @page != 0\n page_link(I18n.t(:'search.index.first_button'), 0, 'back')\n end\n end\n content << content_tag(:div, :class => 'ui-block-b') do\n if @page != 0\n page_link(I18n.t(:'search.index.previous_button'), @page - 1, 'arrow-l')\n end\n end\n\n content << content_tag(:div, :class => 'ui-block-c') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.next_button'), @page + 1, 'arrow-r', true)\n end\n end\n content << content_tag(:div, :class => 'ui-block-d') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.last_button'), num_pages - 1, 'forward', true)\n end\n end\n\n content\n end\n end",
"def index\n # @posts = Post.order(created_at: :desc)\n @smalls = Post.of_small.order(created_at: :DESC).paginate(:page => params[:page], :per_page => 15)\n @covers = Post.of_cover.order(created_at: :DESC)\n @slides = Post.of_slide.order(created_at: :DESC).limit(5)\n @tops = Post.of_top.order(created_at: :DESC).limit(1)\n @reports = Post.order(created_at: :DESC)\n @bots = Post.of_bottom.order(created_at: :DESC).limit(1)\n @bigs = Post.of_big.order(created_at: :DESC).limit(1)\n @defaults = Post.of_default.paginate(page: params[:page], :per_page => 15)\n if request.xhr?\n render :partial=>\"default\"\n end\n end",
"def show\n # config de layout \n @layout = Array.new \n @layout[0] = \"produto\" \n @layout[1] = \"Ficha do Produto\" \n @layout[2] = \"slogan\" \n @layout[3] = \"COD: \" + \"%07d\" % params[:id] \n @layout[4] = \"\"\n @layout[5] = \"/adm/produtos/search\" \n \n @adm_produto = Adm::Produto.find(params[:id])\n \n # LEMBRETE\n # Para a edicao dos modelos produto_extra funcione, eh preciso \n # criar uma funcao do application_helper que possibilita ativar ou\n # não o java script que abre o form de edicao.\n # Inclusive eh tb por isso que o DIV que faz o efeito light box fica\n # criado na pagina e não dinamicamente como o de costume.\n \n # obtendo registros\n @arquivos_full = Arquivo.where(['fl_sistema = 1 AND produto_id = ?', @adm_produto.id]).all\n @adm_produto_extras_full = Adm::ProdutoExtra.where(['produto_id = ?', @adm_produto.id]).all\n \n # filtrando pela permissao do usuário os registros que ele pode ver\n if session[:usuario].status.area.codigo == '0'\n @arquivos = @arquivos_full\n @adm_produto_extras = @adm_produto_extras_full\n else\n @arquivos = @arquivos_full.find_all {|a| a.status.codigo == '0' }\n @adm_produto_extras = @adm_produto_extras_full.find_all {|p| p.status.codigo == '0' }\n end\n\n # verificando se é uma edição de Produto Extra\n if params[:id_produto_extras]\n @adm_produto_extra = Adm::ProdutoExtra.find(params[:id_produto_extras])\n else\n @adm_produto_extra = Adm::ProdutoExtra.new\n end\n \n # obtendo dados extras\n @historico = LogProduto.order(\"created_at DESC\").limit(10).where([\"produto_id = ?\", @adm_produto.id]).all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adm_produto }\n end\n end",
"def show \n meta :title => \"Parlio - Iniciativas relacionadas con #{@topic.name}\"\n @initiatives = @topic.initiatives.paginate :per_page => 5, :page => params[:page]\n @tags = @topic.initiatives.map{|i| i.tags}.flatten.uniq\n @most_active_parliamentarians = @topic.most_active_parliamentarians\n \n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @topic }\n wants.atom { render(:layout => false) }\n end\n end",
"def pages; end",
"def set_elements\n super\n element(:message) {b.li(:class => 'uif-infoMessageItem')}\n element(:messages) {b.lis(:class => 'uif-infoMessageItem')}\n element(:message_header) {b.h3(:class => 'uif-pageValidationHeader')}\n element(:submit_button) {b.button(:id => \"submitEditor\")}\n element(:cancel_button) {b.button(:id => \"cancelEditor\")}\n element(:close_button) {b.button(:id => \"closeEditor\")}\n element(:return_to_search_button) {b.button(:id => \"returnToSearch_button\")}\n # Navigation Area Elements\n element(:delete_bib_button) {b.button(:title => 'Delete Bib')}\n element(:add_instance_button) {b.button(:title => 'Add Instance')}\n element(:add_einstance_button) {b.button(:title => 'Add EInstance')}\n # @note Vakata Context Menu items are only present on the screen after the containing menu header has been right-clicked.\n element(:delete_instance_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => \"Delete\")}\n element(:add_item_button) {b.button(:title => 'Add Item')}\n element(:delete_item_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => 'Delete')}\n end",
"def load_edit_component_page\n @all_groups = Group.all\n @all_properties = Property.all\n @all_categories = Category.all\n @all_components = Component.all\n @all_products = Product.all\n @all_images = Image.all\n @all_datafiles = DataFile.all\n @component = Component.find(params[:component_id])\n\n @component_components = @component.components\n @component_valuefields = @component.valuefields\n @component_properties = @component.properties\n @component_images = @component.images\n @component_datafiles = @component.data_files\n @component_products = @component.products\n @component_group = @component.group\n respond_to do |format|\n format.js\n end\n end",
"def kopal_layout_after_page_sidebar\n\n end"
]
| [
"0.625409",
"0.61387765",
"0.6132003",
"0.6017818",
"0.59001946",
"0.5831664",
"0.5740247",
"0.5725626",
"0.5712588",
"0.5699596",
"0.5685144",
"0.5675316",
"0.56638634",
"0.5645248",
"0.55774915",
"0.5576835",
"0.5566876",
"0.55541265",
"0.5545101",
"0.55389386",
"0.55271435",
"0.5524155",
"0.5518908",
"0.5518693",
"0.55118215",
"0.54955405",
"0.5463709",
"0.546316",
"0.54571277",
"0.5456518"
]
| 0.64609236 | 0 |
Description Opens the general page of the elements editor: the video icon redirects to VideoEditorControllernew the audio icon redirects to AudioEditorControllernew the image icon redirects to GalleriesControllerimage_for_image_editor (and successively to ImageEditorControlleredit) Mode Html | def new
render :layout => 'media_element_editor'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview\n \n # @lg = PageTag::PageGenerator.previewer( @menu, @theme, {:resource=>(@resource.nil? ? nil:@resource),:controller=>self})\n # html = @lg.generate\n # css,js = @lg.generate_assets \n #insert css to html\n # style = %Q!<style type=\"text/css\">#{css}</style>!\n #editor_panel require @theme, @editors, @editor ...\n # html.insert(html.index(\"</head>\"),style)\n # html.insert(html.index(\"</body>\"),@editor_panel)\n # respond_to do |format|\n # format.html {render :text => html}\n # end\n \n end",
"def new\n @editor = Editor.new\n @editor.build_logo\n @title = \"Creer un editeur\"\n ariane.add \"Nouvel editeur\", new_editor_path\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @editor }\n end\n end",
"def editing_help(editing_help_type)\n case editing_help_type\n when 'Partial'\n help = '<h4>Useful tags</h4>'\n help << '<p><code><%= navigation %></code><br />'\n help << '<code><%= page.page_title %><c/ode><br />' \n help << '<code><%= stylesheet_link_tag \"stylename\" %></code><br />' \n help << '<code><%= javascript_include_tag \"scriptname\" %></code><br />' \n help << '<code><%= region :example %></code></p>' \n # help << '<h4>Tags for this Custom Type</h4>'\n when 'Layout' \n help = '<h4>Useful tags</h4>'\n help << '<p><code><%= navigation %></code><br />'\n help << '<code><%= page.page_title %><c/ode><br />' \n help << '<code><%= stylesheet_link_tag \"stylename\" %></code><br />' \n help << '<code><%= javascript_include_tag \"scriptname\" %></code><br />' \n help << '<code><%= region :example %></code></p>' \n end\n end",
"def edit_description\n end",
"def lcr_edit\n @page_title = _('LCR_edit')\n @page_icon = \"edit.png\"\n end",
"def fleximage_editor\n \n ar_object = Kernel::const_get(params[:ar_object_class]).find(params[:ar_object_id])\n display_editor = (params[:display_editor] == \"false\")\n display_thumbnail = (params[:display_thumbnail] == \"true\")\n \n render :update do |page| \n page.replace(MainController.fleximage_domid(ar_object),\n render(:partial => \"/main/media_edit\", \n :locals => {:ar_object => ar_object, \n :timestamp => nil,\n :display_thumbnail => display_thumbnail, \n :display_editor => display_editor})\n )\n\t\tend\n end",
"def render_editor(element)\n render_element(element, :editor)\n end",
"def render_editor(element)\n render_element(element, :editor)\n end",
"def preview\n #for debug\n params[:d] = 'www.rubyecommerce.com'\n editor = params[:editor]\n website=menu=layout=theme = resource = nil\n website = Website.find_by_url(params[:d])\n if params[:c]\n menu = Menu.find_by_id(params[:c])\n if params[:r]\n resource = BlogPost.find_by_id(params[:r])\n end \n else\n menu = Menu.find_by_id(website.index_page) \n end\n theme = TemplateTheme.find(menu.find_theme_id(is_preview=true))\n html,css = do_preview(theme, menu, {:blog_post_id=>(resource.nil? ? nil:resource.id),:editor=>editor})\n #insert css to html\n style = %Q!<style type=\"text/css\">#{css}</style>!\n \n #editor_panel require @theme, @editors, @editor ...\n prepare_params_for_editors(theme)\n editor_panel = render_to_string :partial=>'layout_editor_panel'\n html.insert(html.index(\"</head>\"),style)\n html.insert(html.index(\"</body>\"),editor_panel)\n render :text => html\n end",
"def edit\n\t\traise NotImplementedError, \"FIXME: Implement editing comments.\"\n\t\t#respond_to do |format|\n\t\t#\tformat.html # edit.html.erb\n\t\t#end\n\tend",
"def edit\n\t\t@page_name = \" - Edit Show\"\n\tend",
"def new\n @header_tab = \"media\"\n @medium = Media.new\n render :layout => \"admin\"\n\n end",
"def content_preview\n self.description.present? ? self.description : self.main_content\n end",
"def edit_gallery_title_desc(gallery_name = \"test\", gallery_title = \"samplegallery\", gallery_desc = \"Its a sample gallery\",_browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Editing '#{gallery_name}' Gallery properties (Title + Desc).\")\n self.open_gallery(gallery_name)\n wait.until { _browser.find_element(:xpath => @galmgr.edit_gallery) }.click\n frame = wait.until { _browser.find_element(:xpath => @galmgr.edit_overlay_frame) }\n _browser.switch_to.frame(frame)\n temp = wait.until { _browser.find_element(:xpath => @galmgr.gallery_title) }\n temp.clear\n temp.send_keys(gallery_title)\n wait.until { _browser.find_element(:xpath => @galmgr.gallery_desc) }\n self.type_text_in_wysiwyg_editor(gallery_desc)\n ## we need to be on the overlay at this point of execution\n wait.until { _browser.find_element(:xpath => @galmgr.save_gallery_btn) }.click\n _browser.switch_to.default_content\n end",
"def initialize\n @klass = TOOLBAR_EDITOR\n @description = nil\n # Wait for the page to be displayed with MAX_WAIT_ON_LOAD seconds timeout\n raise 'The page was not loaded' unless self.displayed?($janus::MAX_WAIT_ON_LOAD)\n end",
"def message_editor\n frm.frame(:id, \"description___Frame\").td(:id, \"xEditingArea\").frame(:index=>0)\n end",
"def set_elements\n super\n element(:message) {b.li(:class => 'uif-infoMessageItem')}\n element(:messages) {b.lis(:class => 'uif-infoMessageItem')}\n element(:message_header) {b.h3(:class => 'uif-pageValidationHeader')}\n element(:submit_button) {b.button(:id => \"submitEditor\")}\n element(:cancel_button) {b.button(:id => \"cancelEditor\")}\n element(:close_button) {b.button(:id => \"closeEditor\")}\n element(:return_to_search_button) {b.button(:id => \"returnToSearch_button\")}\n # Navigation Area Elements\n element(:delete_bib_button) {b.button(:title => 'Delete Bib')}\n element(:add_instance_button) {b.button(:title => 'Add Instance')}\n element(:add_einstance_button) {b.button(:title => 'Add EInstance')}\n # @note Vakata Context Menu items are only present on the screen after the containing menu header has been right-clicked.\n element(:delete_instance_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => \"Delete\")}\n element(:add_item_button) {b.button(:title => 'Add Item')}\n element(:delete_item_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => 'Delete')}\n end",
"def default\r\n can_view, msg = dc_user_can_view(@parent, @page)\r\n return msg unless can_view\r\n\r\n html = \"<div class=\\\"#{@page.div_class} #{@opts[:div_class]}\\\">\"\r\n html << dc_page_edit_menu() if @opts[:edit_mode] > 1\r\n @parent.page_title = @page.title.blank? ? @page.subject : @page.title\r\n html << @page.body\r\n # render poll if defined\r\n if @page.dc_poll_id\r\n @opts.merge!(poll_id: @page.dc_poll_id, return_to: @parent.request.url, method: nil)\r\n comment = DcPollRenderer.new(@parent, @opts)\r\n html << \"<div class='wrap row'>#{comment.render_html}</div>\"\r\n @css << \"\\n#{comment.render_css}\"\r\n end\r\n # also add iframe\r\n html << iframe() << '</div>'\r\nend",
"def index\n @urls = ['index', 'fade_replace', 'simple_blind_ror', 'javascript']\n @descriptions = {'index' => \"listing of all demos/methods. This page\",\n \n 'fade_replace' => \"link triggers central page replacement. This will be used in the final project. Uses ror/rjs\",\n 'simple_blind_ror' => \"simplistic scriptaculous effects using ror. demo only.\",\n 'javascript' => \"uses javascript directly. demo only. straight from Scriptaculous site.\"\n }\n end",
"def link_4edit #:nodoc:\n html = ''\n return html unless @opts[:edit_mode] > 1\n \n @opts[:editparams].merge!( { table: 'dc_big_menu', controller: 'cmsedit', action: 'edit' } )\n title = \"#{t('drgcms.edit')}: \"\n @opts[:editparams].merge!( { id: @menu.id, title: \"#{title}#{@menu.name}\" } ) if @menu\n title << t('helpers.label.dc_big_menu.tabletitle')\n @opts[:editparams].merge!( { action: 'index', title: title }) if @menu.nil?\n html << dc_link_for_edit( @opts[:editparams] )\nend",
"def smart_edit(content_type=0,save_url)\n if content_type == 1\n render \"shared/wysihtml5_js\", {url: save_url}\n else\n render \"shared/autosave_js\", {url: save_url}\n end\n end",
"def render_new_content_link(element)\n\t\t\t\tlink_to_overlay_window(\n\t\t\t\t\trender_icon('create') + t('add new content'),\n\t\t\t\t\talchemy.new_admin_element_content_path(element),\n\t\t\t\t\t{\n\t\t\t\t\t\t:size => '335x70',\n\t\t\t\t\t\t:title => t('Select an content'),\n\t\t\t\t\t\t:overflow => true\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t\t:class => 'small button with_icon new_content_link'\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\tend",
"def initialize\n @commands = {\n edit: 'Write',\n preview: 'Preview'\n }\n @theme = {\n base: '/simple_form_epic_editor/default_theme/base.css',\n preview: '/simple_form_epic_editor/default_theme/preview.css',\n editor: '/simple_form_epic_editor/default_theme/editor.css'\n }\n end",
"def mokio_preview_link_in_edit_page\n self.path\n end",
"def show\n # Get the html, svg, css, and js code to render\n @code = get_article_code\n\n # The default layouts are not added as this page will be\n # embeded in an iframe\n render layout: false\n end",
"def editor\n NanoEditor\n end",
"def show\n render 'show', layout: \"detail_editor\"\n end",
"def render_picture_editor(element, options={})\n default_options = {\n :last_image_deletable => true,\n :maximum_amount_of_images => nil,\n :refresh_sortable => true\n }\n options = default_options.merge(options)\n picture_contents = element.all_contents_by_type(\"EssencePicture\")\n render(\n :partial => \"admin/elements/picture_editor\",\n :locals => {\n :picture_contents => picture_contents,\n :element => element,\n :options => options\n }\n )\n end",
"def preview\n end",
"def preview\n end"
]
| [
"0.6211096",
"0.5943301",
"0.584834",
"0.5838946",
"0.5833649",
"0.57943696",
"0.57561123",
"0.57561123",
"0.5717198",
"0.56711775",
"0.5628239",
"0.5617931",
"0.5597701",
"0.5596176",
"0.557289",
"0.55670696",
"0.55634266",
"0.5531548",
"0.5519143",
"0.5514199",
"0.5507684",
"0.55005485",
"0.54918003",
"0.54757494",
"0.546666",
"0.5462228",
"0.5457115",
"0.54291475",
"0.54216284",
"0.54216284"
]
| 0.63153374 | 0 |
Description Adds a link of this element to your section. found: reloads the element in compact mode compact: [this action doesn't occur] expanded: removes the element and reloads the whole page Mode Ajax + Json Specific filters ApplicationControllerinitialize_media_element ApplicationControllerinitialize_media_element_destination | def add
@ok_msg = t('other_popup_messages.correct.add.media_element')
if @ok
if !current_user.bookmark('MediaElement', @media_element_id)
@ok = false
@error = I18n.t('activerecord.errors.models.bookmark.problem_creating_for_media_element')
end
else
@error = I18n.t('activerecord.errors.models.bookmark.problem_creating_for_media_element')
end
if @destination == ButtonDestinations::FOUND_MEDIA_ELEMENT
prepare_media_element_for_js
@ok_msg = nil
render 'media_elements/reload.js'
else
render :json => {:ok => @ok, :msg => (@ok ? @ok_msg : @error)}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_new_content_link(element)\n\t\t\t\tlink_to_overlay_window(\n\t\t\t\t\trender_icon('create') + t('add new content'),\n\t\t\t\t\talchemy.new_admin_element_content_path(element),\n\t\t\t\t\t{\n\t\t\t\t\t\t:size => '335x70',\n\t\t\t\t\t\t:title => t('Select an content'),\n\t\t\t\t\t\t:overflow => true\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t\t:class => 'small button with_icon new_content_link'\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\tend",
"def create_expand_collapse_link(update_element_id, *args, &block)\n return '' if update_element_id.blank?\n \n options = args.extract_options!\n # default config options\n options.reverse_merge!(:link_text => update_element_id,\n :link_style => \"\",\n :style => \"\", \n :class => nil,\n :icon_left_margin => \"5px\",\n :icon_float => \"\")\n \n link_text = if block_given?\n capture(&block)\n else\n options[:link_text]\n end\n\n unless options[:icon_float].blank?\n expand_link = (expand_image(options[:icon_left_margin], options[:icon_float]) + link_text).html_safe\n collapse_link = (collapse_image(options[:icon_left_margin], options[:icon_float]) + link_text).html_safe\n else\n expand_link = (link_text + expand_image(options[:icon_left_margin])).html_safe\n collapse_link = (link_text + collapse_image(options[:icon_left_margin])).html_safe\n end\n\n expand_link_id = update_element_id + '_name_more_link'\n collapse_link_id = update_element_id + '_name_less_link'\n \n expand_link_content = link_to_function(expand_link, :id => expand_link_id, :style => \"vertical-align: baseline; #{options[:link_style]}\") do |page| \n page.toggle expand_link_id, collapse_link_id\n page.visual_effect :toggle_blind, update_element_id, :duration => '0.2'\n end.html_safe\n\n collapse_link_content = link_to_function(collapse_link, :id => collapse_link_id, :style => \"display:none; vertical-align: baseline; #{options[:link_style]}\") do |page| \n page.toggle expand_link_id, collapse_link_id\n page.visual_effect :toggle_blind, update_element_id, :duration => '0.2'\n end.html_safe\n \n span_content = expand_link_content + collapse_link_content\n \n content = content_tag(:span, span_content, :class => options[:class], :style => \"vertical-align: baseline; #{options[:style]}\")\n\n return content\n\n end",
"def render_create_content_link(element, options = {})\n\t\t\t\tdefaults = {\n\t\t\t\t\t:label => t('add new content')\n\t\t\t\t}\n\t\t\t\toptions = defaults.merge(options)\n\t\t\t\tlink_to(\n\t\t\t\t\toptions[:label],\n\t\t\t\t\talchemy.admin_contents_path(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t\t:name => options[:content_name],\n\t\t\t\t\t\t\t:element_id => element.id\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\t:method => 'post',\n\t\t\t\t\t:remote => true,\n\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t:class => 'button new_content_link'\n\t\t\t\t)\n\t\t\tend",
"def media_link &block\n ASObj.generate :media_link,true,&block\n end",
"def add_medium_link(opts)\n unless opts.keys.include?(:object) || \n opts.keys.include?(:context)\n raise \"Must give object and context\" \n end\n klass = opts[:object].class.to_s.underscore\n opts[:text]||= I18n.t('add_link', \n :medium_label => I18n.t(opts[:context], :scope => [:activerecord, :attributes, klass]),\n :scope => [:has_media, :form])\n link_to_function opts[:text] do |page| \n page.insert_html :bottom, generate_uid(\n :object => opts[:object], \n :context => opts[:context]\n ), \n :partial => 'has_media/medium_field', \n :locals => {\n :object => opts[:object], \n :context => opts[:context]\n }\n end \n end",
"def new_association_link(name, f, model, additional_javascript = \"\")\n fields = new_child_fields(f, model.to_sym)\n link_to_function(name, raw(\"replace_content(this, \\\"#{model}\\\", \\\"#{escape_javascript(fields)}\\\");$(\\\"#add-#{model}-select-link\\\").show();$(\\\"#add-#{model}-entry-link\\\").hide();#{additional_javascript}\"), :id=> \"add-#{model}-entry-link\", :class=>\"add-child-form-link admin-link\")\n end",
"def add_content\n self.link(:id=>\"navigation_create_and_add_link\").fire_event(\"onmouseover\")\n self.link(:text=>\"Add content\").click\n self.wait_until { @browser.text.include? \"Collected items\" }\n self.class.class_eval { include AddContentContainer }\n end",
"def add_href\n return if attributes.key?(\"href\")\n return unless attributes.key?(\"id\")\n attributes[\"href\"] = client.connection.api_path(\"#{collection.name}/#{attributes['id']}\")\n end",
"def respond_to_url_change\n return if apotomo_root.find_by_id('deep_link') # add only once.\n apotomo_root << widget(\"apotomo/deep_link_widget\", :setup, 'deep_link')\n end",
"def switcher_link_to(text, options={}, html_options={}, &block)\n id = html_options.delete(:id) || \"lm-#{rand(1000000)}\"\n inner_id = id + '_more'\n link_id = id + '_link'\n action_id = id + '_action'\n icon = boolean_default(options.delete(:icon), true)\n action_icon_id = id + '_action_icon'\n action_label_id = id + '_action_label'\n css_class = html_options.delete(:class)\n style = html_options.delete(:style)\n inner_css_class = html_options.delete(:inner_class)\n open = options.delete(:open) || false\n sticky = boolean_default(options.delete(:sticky), false)\n \n function = update_page do |page|\n page << \"if ($('#{inner_id}').style.display == 'none') {\"\n page[inner_id].visual_effect :blind_down, {:duration => 0.3}\n if sticky \n page << \"$('#{action_icon_id}').removeClassName('closed');\"\n page << \"$('#{action_icon_id}').addClassName('opened');\"\n else\n page[action_id].hide\n end\n page << \"} else {\"\n page[inner_id].visual_effect :blind_up, {:duration => 0.3}\n page[link_id].show\n if sticky \n page << \"$('#{action_icon_id}').removeClassName('opened');\"\n page << \"$('#{action_icon_id}').addClassName('closed');\"\n else\n page[action_id].show\n end\n page << \"}\"\n end\n\n onclick = \"#{\"#{html_options[:onclick]}; \" if html_options[:onclick]}#{function}; return false;\"\n href = html_options[:href] || '#'\n \n html = <<-HTML\n<div id=\"#{id}\" class=\"switcher #{css_class}\" style=\"#{style}\">\n <div id=\"#{action_id}\" class=\"switcherAction\">\n <a id=\"#{link_id}\" href=\"#{href}\" onclick=\"#{escape_once(onclick)};return false;\">\n <span id=\"#{action_icon_id}\" class=\"actionIcon #{open ? 'opened' : 'closed'}\" style=\"#{icon ? '' : 'display:none;'}\"></span>\n <span id=\"#{action_label_id}\" class=\"actionLabel\">#{text}</span>\n </a>\n </div>\n <div id=\"#{inner_id}\" class=\"#{inner_css_class}\" style=\"#{open ? '' : 'display:none;'}\">\n #{capture(&block)}\n </div>\n</div>\n HTML\n concat(html, block.binding)\n end",
"def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end",
"def show_add_section_to_item\n @item = Item.find(params[:id])\n @section = Section.new(\n :item_id => params[:id],\n :publish => true\n )\n respond_to do |format|\n format.html { render :action => \"show\", :id => @item }\n format.js\n end\n end",
"def add_iform_link(name, id, obj, locals={})\n link_to_function name do |page|\n page.insert_html :bottom, id, :partial => 'iform', :object => obj, :locals => locals\n end\n end",
"def publication_link\n h.link_to \"Read Now\" , object.publication_url , title: 'Read Now' , class: 'btn waves-effect waves-light btn-primary custom-btn' , target: '_blank'\n end",
"def add_link(el, href, title, alt_text = T.unsafe(nil), ial = T.unsafe(nil)); end",
"def add_media_action(gallery_name, media_url_list = [\"http://testimages.drupalgardens.com/sites/testimages.drupalgardens.com/files/styles/media_gallery_large/public/150x62XMasNeon.gif\"], _browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Adding New Images into the Gallery '#{gallery_name}'.\")\n # media_xpath = \"//div[contains(@id, 'media-gallery-media-')]//a[@href and contains(@class, 'media-gallery-thumb')]\"\n media_xpath = \"//div[contains(@class, 'media-gallery-sortable-processed ui-sortable')]/div[contains(@id, 'media-gallery-media-')]\"\n Log.logger.info(\"Opening Gallery #{gallery_name}\")\n self.open_gallery(gallery_name)\n media_url_list.each do |media_url|\n Log.logger.info(\"Working on media item: #{media_url}\")\n switch_to_last_pagination_page\n #Get the amount of items so we later know which ID something that gets added will get (IDs start at 0, so it will get the id 'nom')\n nom = Integer(_browser.find_elements(:xpath => media_xpath).size)\n Log.logger.info(\"Found #{nom} media item(s).\")\n\n Log.logger.info(\"Waiting for 'Add media' link.\")\n wait.until { _browser.find_element(:xpath => @galmgr.add_media) }\n #we have to wait for the WHOLE page to be loaded and it might even refresh itself for some reason.\n #if we don't sleep, we sometimes run into the page refreshing after we clicked on the add media link\n JQuery.wait_for_events_to_finish(_browser)\n Log.logger.info(\"Clicking on'Add media' link.\")\n _browser.find_element(:xpath => @galmgr.add_media).click\n Log.logger.info(\"Waiting for Overlay.\")\n wait.until { _browser.find_element(:xpath => \"//div[@class='ui-widget-overlay']\") }\n Log.logger.info(\"Waiting for media browser iframe.\")\n start_time = Time.now\n frame = wait.until { _browser.find_element(:xpath => @galmgr.media_upload_frame) }\n Log.logger.info(\"Found media browser iframe after #{Time.now - start_time} seconds.\")\n JQuery.wait_for_events_to_finish(_browser)\n if _browser.find_elements(:xpath => @galmgr.media_upload_frame).size > 0 #perhaps unnecessary?\n Log.logger.info(\"Switching to media browser iframe.\")\n _browser.switch_to.frame(_browser.find_element(:xpath => @galmgr.media_upload_frame))\n else\n raise \"Media Browser frame seems to have disappeared after we had waited for it!\"\n end\n Log.logger.info(\"Waiting for media upload tab link\")\n wait.until { _browser.find_element(:xpath => @galmgr.embed_image_video) }.click\n #Wait til the content of the tab is actually visible\n Log.logger.info(\"Waiting for media upload tab to be visible\")\n wait.until { _browser.find_element(:xpath => \"//div[@id='media-tab-upload' and not(@class='ui-tabs-hide')]\") }\n Log.logger.info(\"Waiting for text input field and entering media URL: (#{media_url})\")\n temp = wait.until { _browser.find_element(:xpath => @galmgr.url_textbox) }\n temp.clear\n temp.send_keys(media_url)\n Log.logger.info(\"Waiting for and clicking on submit button\")\n wait.until { _browser.find_element(:xpath => @galmgr.submit_url_btn) }.click\n Log.logger.info(\"Waiting for embed popup to disappear\")\n # wait.until { ! _browser.find_element(:xpath => @galmgr.embed_image_video) }\n Log.logger.info(\"Switching back to main frame.\")\n _browser.switch_to.default_content\n Log.logger.info(\"Waiting for overlay to disappear.\")\n wait.until { _browser.find_elements(:xpath => \"//div[@class='ui-widget-overlay']\").empty? }\n Log.logger.info(\"Overlay is gone.\")\n #Our newly inserted element will show up shortly EITHER on a new paginated page or within this context\n partial_file_name = media_url.split('/').last.split(\".\").first.gsub(\"watch?v=\", \"\")\n Log.logger.info(\"Waiting for the media-gallery-media-#{nom} we just added to show up (with a link inside and an img src that points to a file with #{partial_file_name.inspect}).\")\n #TODO: Find out if this can be handled by an \"OR\" in the xpath\n start_time = Time.now\n if switch_to_last_pagination_page()\n nom = Integer(_browser.find_elements(:xpath => media_xpath).size)\n Log.logger.info(\"Found #{nom} media items on the last page.\")\n end\n inserted_media_item_path = \"//img[contains(@src, '#{partial_file_name}')]\"\n #//div[contains(@id, 'media-gallery-media-#{nom}')].//div[contains(@class, 'media-gallery-draggable-processed')].//a[@href and contains(@class, 'media-gallery-thumb')].\n Log.logger.info(\"Waiting for #{inserted_media_item_path}\")\n wait.until { _browser.find_element(:xpath => inserted_media_item_path) }\n Log.logger.info(\"Inserted media item 'media-gallery-media-#{nom}' showed up (after #{Time.now - start_time} seconds).\")\n end #end each-loop\n JQuery.wait_for_events_to_finish(_browser)\n Log.logger.info(\"Done with media file insertion\")\n end",
"def add_element\n @inner_page = Embeddable::InnerPage.find(params['id'])\n @page = Page.find(params['page_id'])\n @container = params['container'] || 'elements_container'\n\n # dynamically instantiate the component based on its type.\n component_class = params['class_name'].constantize\n if component_class == Embeddable::DataCollector\n if probe_type_id = session[:last_saved_probe_type_id]\n probe_type = Probe::ProbeType.find(probe_type_id)\n @component = Embeddable::DataCollector.new\n @component.probe_type = probe_type\n @component.save\n else\n @component = Embeddable::DataCollector.create\n end\n session[:last_saved_probe_type_id] = @component.probe_type_id\n else\n @component = component_class.create\n end\n @component.pages << @page\n @component.user = current_visitor\n @component.save\n @element = @page.element_for(@component)\n @element.user = current_visitor\n @element.save\n # @element.update_investigation_timestamp\n @page.reload\n if params['static']\n render :partial => \"static_page\", :locals => {:page => @page, :inner_page => @inner_page}\n else\n render :partial => \"page\", :locals => {:page => @page, :inner_page => @inner_page}\n end\n end",
"def add_full_set_link(form_builder)\n link_to_function 'Extra Full Set' do |page|\n form_builder.fields_for :equipment, Equipment.new, :child_index => 'NEW_RECORD' do |f|\n html = render(:partial => 'laptop', :locals => { :form => f })\n page << \"$('#equipment_list').append('#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()));\"\n end\n form_builder.fields_for :equipment, Equipment.new, :child_index => 'NEW_RECORD' do |f|\n html = render(:partial => 'interface_box', :locals => { :form => f })\n page << \"$('#equipment_list').append('#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()));\"\n end\n form_builder.fields_for :equipment, Equipment.new, :child_index => 'NEW_RECORD' do |f|\n html = render(:partial => 'pads', :locals => { :form => f })\n page << \"$('#equipment_list').append('#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()));\"\n end\n end\n end",
"def set_elements\n super\n # View Related Documents Tab\n element(:view_related_tab_toggle) {b.input(:id => \"tab-ViewRelatedDocuments-imageToggle\")}\n element(:view_related_po_link) {b.a(:xpath => \"//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Purchase Order')]/a\")}\n element(:view_related_requisition_link) {b.a(:xpath => \"//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Requisition')]/a\")}\n # Delivery Tab\n element(:delivery_tab_toggle) {b.input(:id => \"tab-Delivery-imageToggle\")}\n element(:building_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]\")}\n element(:campus_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]\")}\n element(:closed_room_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[5]/td[1]\")}\n element(:closed_building_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]\")}\n element(:closed_campus_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]\")}\n element(:closed_address_1_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[1]\")}\n element(:closed_address_2_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[4]/th[1]/following-sibling::td[1]\")}\n element(:closed_city_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[6]/th[1]/following-sibling::td[1]\")}\n element(:closed_state_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[7]/th[1]/following-sibling::td[1]\")}\n element(:closed_postal_code_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[8]/th[1]/following-sibling::td[1]\")}\n element(:closed_country_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[9]/th[1]/following-sibling::td[1]\")}\n element(:closed_delivery_to_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[1]/th[1]/following-sibling::td[2]\")}\n element(:closed_delivery_phone_number_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[2]/th[1]/following-sibling::td[2]\")}\n element(:closed_email_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[2]\")}\n # Vendor Tab\n element(:vendor_tab_toggle) {b.input(:id => \"tab-Vendor-imageToggle\")}\n element(:closed_vendor_name_field) {b.td(:xpath => \"//tr/th[div[contains(text(),'Suggested Vendor:')]]/following-sibling::td[1]\")}\n # Route Log Tab\n element(:route_log_tab_toggle) {b.input(:id => \"tab-RouteLog-imageToggle\")}\n # element(:actions_taken) {b.bs(:xpath => \"//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[1]/b\")}\n # element(:actions_taken_by) {b.as(:xpath => \"//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[2]/a\")}\n end",
"def sections_augmented_link( obj )\n title = \"\"\n title << obj.code unless obj.try( :code ).blank?\n title << \"\\n\" unless title.empty? or obj.try( :description ).blank?\n title << obj.description unless obj.try( :description ).blank?\n\n content_tag(\n :span,\n link_to( h( obj.title ), obj ),\n :title => title\n )\n end",
"def initialize(media_elem)\n super()\n\n @id = nil\n @media_url = nil # メディアの URL\n @media_url_https = nil # メディアの SSL URL\n @url = nil # メディア URL(展開)\n @display_url = nil\n @expanded_url = nil\n @type = MEDIA_TYPE_PHOTO # only \"photo\" for now\n @sizes = nil\n @indices = nil\n end",
"def media_url_upload\n ar_object = Kernel.const_get(params[:ar_object_class]).find(params[:ar_object_id])\n ar_object.media_url = params[:media_url]\n if ar_object.save\n @messages = 'media updated'\n else\n @messages = 'Oups updating fleximage'\n ar_object.errors.each { |field, msg| puts \"********* field:#{field} --> #{msg}\" }\n end\n render :update do |page| \n page.replace(MainController.media_domid(ar_object),\n render(:partial => \"/main/media_editor\", :locals => {:title => params[:title], :ar_object => ar_object }))\n\t\tend\n end",
"def js_append_element_to(element, content)\n rjs_method :append_element, :element => element, :content => content\n end",
"def click(link); end",
"def create\n\n @link = Link.new(params[:link])\n @link.resource_id = @resource.id\n \n if [email protected]? \"http://\"\n @link.link = \"http://\" + @link.link\n end\n\n\n @resource.attachment = @link\n @resource.save\n\n @link.save\n\n\n\n respond_to do |format|\n if @link.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end \n end",
"def remove_link\n # cocoon JS needs class specifically remove_fields.dynamic, just treat em all\n # like dynamic, it seems okay.\n template.link_to(I18n.t(\"kithe.repeatable_input.remove\"), '#', class: \"remove_fields dynamic btn btn-secondary\")\n end",
"def initialize(media_elem)\n super()\n\n @id = nil\n @media_url = nil # メディアの URL\n @media_url_https = nil # メディアの SSL URL\n @url = nil # メディア URL(展開)\n @display_url = nil\n @expanded_url = nil\n @type = MEDIA_TYPE_ANIMATED_GIF\n @sizes = nil\n @indices = nil\n end",
"def expand_contract_section(arg_heading, id, options={}, &block)\n expanded = (params[\"umlaut.show_#{id}\"] == \"true\") || options[:initial_expand] || false\n icon = content_tag(:i, nil, :class => [] << ( expanded ? \"umlaut_icons-list-open\" : \"umlaut_icons-list-closed\"))\n heading = content_tag(:span,( expanded ? \"Hide \" : \"Show \"), :class=>'expand_contract_action_label') + arg_heading\n body_class = (expanded ? \"in\" : \"\")\n link_params = params.merge('umlaut.request_id' => @user_request.id,\n \"umlaut.show_#{id}\" => (! expanded).to_s,\n # Need to zero out format-related params for when we're coming\n # from a partial html api request, so the link we generate\n # is not to format json/xml/etc.\n :format => nil,\n 'umlaut.response_format' => nil,\n 'umlaut.jsonp'=>nil,\n # In Rails3, an :anchor param will actually be used for #fragmentIdentifier\n # on end of url\n :anchor => \"#{id}_toggle_link\"\n )\n # Make sure a self-referencing link from partial_html_sections\n # really goes to full HTML view.\n link_params[:action] = \"index\" if link_params[:action] == \"partial_html_sections\"\n return content_tag(:div, :class => \"collapsible\", :id => \"collapse_#{id}\") do\n link_to(icon + \" \" + heading, link_params, :class => \"collapse-toggle\", \"data-target\" => \"##{id}\", \"data-toggle\" => \"collapse\") +\n content_tag(:div, :id => id, :class => [\"collapse\"]<< body_class, &block)\n end\n end",
"def edit\n resource.prepare_links\n\n super\n end",
"def show\n @object = referenced_object\n @attribute = params[:attribute]\n @form_element = params[:form_element]\n close = params[:close] || false\n if @form_element == \"associated\"\n @sub_id = params[:sub_id]\n if @sub_id.to_i > 0\n @associated_record_id = @object.send(@attribute.to_s.singularize + \"_ids\").index(@sub_id.to_i)\n @associated_record = @object.send(@attribute)[@associated_record_id]\n end\n end\n if @form_element == \"has_one\"\n @associated_record = @object.send(@attribute)\n @associated_record_id = @associated_record.id\n end\n @update_span = params[:update]\n if @attribute.nil?\n respond_to do |format|\n @attributes = @object.inline_forms_attribute_list\n if close\n format.js { render :close }\n else\n format.js { }\n end\n end\n else\n respond_to do |format|\n format.html { } unless @Klass.not_accessible_through_html?\n format.js { render :show_element }\n end\n end\n end"
]
| [
"0.5843755",
"0.5815826",
"0.57196784",
"0.5506087",
"0.53053194",
"0.5248692",
"0.5224908",
"0.51986885",
"0.51724136",
"0.51460075",
"0.50608623",
"0.50183207",
"0.49998343",
"0.4998185",
"0.49402708",
"0.49364203",
"0.49209848",
"0.4889916",
"0.48832592",
"0.48704955",
"0.4864744",
"0.48481447",
"0.48474103",
"0.4845689",
"0.484383",
"0.48355004",
"0.48250583",
"0.4809909",
"0.48044825",
"0.47874594"
]
| 0.5955865 | 0 |
Description Removes the link of this element from your section. found: reloads the element in compact mode compact: removes the element and reloads the whole page expanded: removes the element and reloads the whole page Mode Ajax + Json Specific filters ApplicationControllerinitialize_media_element ApplicationControllerinitialize_media_element_destination | def remove
@ok_msg = t('other_popup_messages.correct.remove.media_element')
if @ok
bookmark = Bookmark.where(:user_id => current_user.id, :bookmarkable_type => 'MediaElement', :bookmarkable_id => @media_element_id).first
if bookmark.nil?
@ok = false
@error = I18n.t('activerecord.errors.models.bookmark.problem_destroying_for_media_element')
else
bookmark.destroy
if Bookmark.where(:user_id => current_user.id, :bookmarkable_type => 'MediaElement', :bookmarkable_id => @media_element_id).any?
@ok = false
@error = I18n.t('activerecord.errors.models.bookmark.problem_destroying_for_media_element')
end
end
else
@error = I18n.t('activerecord.errors.models.bookmark.problem_destroying_for_media_element')
end
if @destination == ButtonDestinations::FOUND_MEDIA_ELEMENT
prepare_media_element_for_js
render 'media_elements/reload.js'
else
render :json => {:ok => @ok, :msg => (@ok ? @ok_msg : @error)}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @element = @page.all_elements.find(params[:id])\n # Start by removing the element from the page\n page_element = Fe::PageElement.where(:element_id => @element.id, :page_id => @page.id).first\n page_element.destroy if page_element\n\n # If this element is not on any other pages, is not a question or has no answers, Destroy it\n if @element.reuseable? && (Fe::PageElement.where(:element_id => params[:id]).present? || @element.has_response?)\n @element.update_attributes(:question_grid_id => nil, :conditional_id => nil)\n else\n @element.destroy\n end\n\n respond_to do |format|\n format.js\n end\n end",
"def remove_link\n # cocoon JS needs class specifically remove_fields.dynamic, just treat em all\n # like dynamic, it seems okay.\n template.link_to(I18n.t(\"kithe.repeatable_input.remove\"), '#', class: \"remove_fields dynamic btn btn-secondary\")\n end",
"def remove_medium_link(opts)\n opts[:text] ||= I18n.t('remove_link', :scope => [:has_media, :form])\n link_to opts[:text], medium_url(opts[:medium]), :remote => true, :method => :delete\n end",
"def js_remove_element(element)\n rjs_method :remove_element, element\n end",
"def remove_elem\n elem =eval(params[:type]).find(params[:elem])\n elem.position= 0\n case params[:type]\n when \"Activity\"\n elem.model_id = -1\n when \"Action\"\n elem.activity_id = -1\n when 'PfTask'\n elem.action_id = -1\n end\n elem.update_attributes(elem.attributes)\n redirect_to :action => 'show_subs', :parent_id =>params[:parent_id], :parent_type =>eval(params[:type]).get_parent_name\n end",
"def destroy\n if @ok\n if !@media_element.check_and_destroy\n @ok = false\n @error = @media_element.get_base_error\n end\n else\n @error = I18n.t('activerecord.errors.models.media_element.problem_destroying')\n end\n render :json => {:ok => @ok, :msg => @error}\n end",
"def link_to_remove_section(linktext, form, class_of_section_to_remove=\"removeme\")\n form.hidden_field(:_destroy) + \"\\n\" +\n link_to_function(linktext, \"remove_section(this, \\\"#{class_of_section_to_remove}\\\")\")\n end",
"def cleared_linked_display\n h.content_tag(:div, linked_display, class:'images single clear').html_safe\n end",
"def cleared_linked_display\n h.content_tag(:div, linked_display, class: 'images single clear').html_safe\n end",
"def clear_link\n @link = nil\n @autolink = false\n end",
"def destroy\n run_callbacks :destroy do\n connection.delete(element_path, encode, self.class.headers)\n end\n end",
"def clear_link(skip_requesting = false)\n link.skip_requesting = skip_requesting\n self.link = nil\n end",
"def remove_media\n @media = Media.find_by_id(params[:media_id])\n remove_media_update\n end",
"def destroy\n @inform = @slide.inform\n if @slide.slide_tag[-1] != \"*\"\n\n @blocks = @inform.blocks.where(slide_tag: @slide.slide_tag) #Saco una coleccion de blocks asociadas al slide que voy a borrar\n\n @block = @blocks.first #Es para pasarla al render en JS\n\n @samples = @inform.samples.where(slide_tag: @slide.slide_tag, name: \"Extendido\") #Saco una coleccion de samples asociadas al slide que voy a borrar\n @sample = @samples.first #Es para pasarla al render en JS\n # @recipient = Recipient.where(inform_id: @sample.inform_id, tag: @sample.recipient_tag).first #Es para pasarla al render en JS\n @recipient = nil\n\n \n\n \n @samples.each do |sample|\n sample.update(slide_tag: nil) #Borro todas las asociaciones encontradas en las tags de samples\n end\n\n @blocks.each do |block|\n block.update(slide_tag: nil) #Borro todas las asociaciones encontradas en las tags de samples\n end\n\n end\n @samplesc = @inform.samples.where(name: \"Cassette\") #Saco una coleccion de samples asociadas al slide que voy a borrar\n @blocks = @inform.blocks #Recargo todos los block para renderizado\n @slide.destroy\n end",
"def destroy\n @page_element.destroy\n respond_to do |format|\n format.html { redirect_to council_page_page_elements_path(@council) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scraping_html_element.destroy\n respond_to do |format|\n format.html { redirect_to scraping_html_elements_url, notice: 'Scraping html element was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(element); end",
"def delete_element(element); end",
"def destroy\n @recommended_link.destroy\n\n head :no_content\n end",
"def clear_links ()\n\nend",
"def destroy\n @social_media_link.destroy\n\n head :no_content\n end",
"def remove\n\t\t\tself.make_request!({uri: self.to_uri, method: :delete})\n\t\tend",
"def destroy\n @pending_recommended_link.destroy\n\n head :no_content\n end",
"def api_remove_link(name, model, association, object, confirm, html_options = nil, &block)\n name, model, association, object, html_options = block, name, model, association, object if block_given?\n html_options ||= {}\n id, url, i18n_key = get_api_relationship_info(model, association, :remove)\n new_options = {\n title: t(i18n_key % 'button'),\n data: {\n remote: true, method: :delete, type: :jsonapi,\n params: [type: object.model_name.route_key, id: object.id],\n 'success-message': t((i18n_key % 'message') + 'Success',\n model: get_name_for(model), association: get_name_for(object))\n }\n }\n new_options[:data][:confirm] = t('general.message.confirmRemoveLong', subject: get_name_for(object)) if confirm\n render_button(name, :remove, i18n_key, url, html_options.deep_merge(new_options))\n end",
"def delete\n self.class.delete self.href\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @element.destroy\n respond_with :elements\n end",
"def remove_link\n\t\tfname = \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.info(\"#{self.class.name}.#{__method__}\") { \"params=#{params}\" }\n\t\t@link = Link.find(params[:id])\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t LOG.debug(fname) {\"session[:tree_object] =#{session[:tree_object]}\"}\n\t\t\tformat.html { redirect_to(session[:tree_object].nil? ? links_url : session[:tree_object]) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend",
"def remove_dimension_editor\n dimension_id = params[:id]\n render :update do |page| \n page.replace_html(\"div_dimension_extra_#{dimension_id}\", \"\")\n end\n end"
]
| [
"0.6071593",
"0.57807547",
"0.5600696",
"0.55835575",
"0.5526149",
"0.55047345",
"0.543671",
"0.5432676",
"0.5417777",
"0.53990537",
"0.5340022",
"0.5313041",
"0.5259157",
"0.52519363",
"0.5238161",
"0.5231691",
"0.52297837",
"0.5223814",
"0.5210044",
"0.5190807",
"0.5190292",
"0.51851755",
"0.5153365",
"0.5152205",
"0.513441",
"0.5129547",
"0.5129547",
"0.51122904",
"0.5111043",
"0.50850147"
]
| 0.67451316 | 0 |
Description Updates the general information of the element (title, description and tags) Mode Ajax Specific filters ApplicationControllerinitialize_media_element_with_owner_and_private | def update
if @ok
@media_element.title = params[:title]
@media_element.description = params[:description]
@media_element.tags = params[:tags_value]
@media_element.save_tags = true
if !@media_element.save
@errors = convert_media_element_error_messages @media_element.errors
else
@media_element.set_status current_user.id
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_description\n self.div(:id=>\"contentmetadata_description_container\").fire_event \"onmouseover\"\n self.div(:id=>\"contentmetadata_description_container\").fire_event \"onclick\"\n end",
"def update\n params[:description][:author_ids] ||= []\n @description = Description.find(params[:id])\n @authors = AuthenticatedSystem::Person.order('fullname')\n respond_to do |format|\n if @description.update_attributes(params[:description])\n flash[:notice] = 'Description was successfully updated.'\n format.html do\n\t if @category != @main_category # if request.xhr?\n\t redirect_to category_child_url(@main_category, @category)\n\t else\n\t redirect_to(@category)\n\t end\n\t end\n\t format.js { render 'categories/show' }\n\t format.xml { head :ok }\n else\n @languages = ComplexScripts::Language.order('title')\n @authors = AuthenticatedSystem::Person.order('fullname')\n format.html { render 'edit' }\n format.js { render 'edit' } #.js.erb\n format.xml { render :xml => @description.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit_description\n end",
"def set_description\n @description = Description.find_by(uuid: params[:id])\n end",
"def description\n\t\t# has this merchant uploaded an epub file yet?\n\t\tif is_ebook_options_selected?(description_params[:products_type_id]) && !temporary_epub_session_active?\n \t@epub_not_uploaded = true\n\n \t# respond to js and html\n\t respond_to do|format|\n\t format.js\n\t format.html\n\t end\n\t return\n\t\tend\n \n # Process form data\n check_member_details = TemporaryProductsDescription.find_by(merchant_id: session[:merchant_id])\n @temporary_products = if check_member_details != nil then check_member_details else TemporaryProductsDescription.new(description_params) end\n\n if check_member_details.nil?\n # save book description details temporarily\n @temporary_products.add_merchant_id = session[:merchant_id]\n if @temporary_products.save\n \tactivate_temporary_book_desc_session @temporary_products.id\n else\n @error = true\n end\n else\n \t # update previous record to save space\n \t if @temporary_products.update(description_params)\n \t \tactivate_temporary_book_desc_session @temporary_products.id\n \t else\n \t \t@error = true\n \t end\n end\n\n # respond to js and html\n respond_to do|format|\n format.js\n format.html\n end\n\tend",
"def update_description\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.description = params[:description]\n @photo.save()\n render :json => @photo\n end",
"def fleximage_editor\n \n ar_object = Kernel::const_get(params[:ar_object_class]).find(params[:ar_object_id])\n display_editor = (params[:display_editor] == \"false\")\n display_thumbnail = (params[:display_thumbnail] == \"true\")\n \n render :update do |page| \n page.replace(MainController.fleximage_domid(ar_object),\n render(:partial => \"/main/media_edit\", \n :locals => {:ar_object => ar_object, \n :timestamp => nil,\n :display_thumbnail => display_thumbnail, \n :display_editor => display_editor})\n )\n\t\tend\n end",
"def set_description\n @description = Description.find(params[:id])\n end",
"def set_description\n @description = Description.find(params[:id])\n end",
"def set_title_and_description\n \t\tresp = get_resp(self.url)\n \t\tself.title = resp.match(/<title>(.+)<\\/title>/)[1]\n \t\tself.description = resp.match(/<meta name=\"description\" content=\"([^\\\"]*)/)[1]\n \t\tself.save!\n \tend",
"def update_html_for_abstract\n return unless details\n self.details_filtered = textile_to_html( details )\n end",
"def edit\n @object = referenced_object\n @attribute = params[:attribute]\n @form_element = params[:form_element]\n @sub_id = params[:sub_id]\n @update_span = params[:update]\n respond_to do |format|\n format.html { } unless @Klass.not_accessible_through_html?\n format.js { }\n end\n end",
"def list_media_details(gallery_name = \"test\", _browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Listing Media properties and ids to edit it (for Gallery: #{gallery_name.inspect})\")\n self.open_gallery(gallery_name)\n wait.until { _browser.find_element(:xpath => @galmgr.edit_media) }.click\n frame = wait.until { _browser.find_element(:xpath => @galmgr.edit_overlay_frame) }\n _browser.switch_to.frame(frame)\n edit_media_ids = Hash.new\n i = 1\n wait.until { _browser.find_element(:xpath => \"//div[contains(@id, 'media-edit-')]\") }\n med_ct = Integer(_browser.find_elements(:xpath => \"//div[contains(@id, 'media-edit-')]\").size)\n Log.logger.info(\"Found editable images: #{med_ct}\")\n while i < med_ct+1\n media_url = _browser.find_element(:xpath => \"//div[contains(@id, 'media-edit-#{i}')]//img[contains(@class, '')]\").attribute(\"src\")\n Log.logger.info(\"Working on image number #{i}: #{media_url.inspect}\")\n if (i == 1)\n if(_browser.find_elements(:xpath => \"//select[@id = 'edit-field-license-und']\").size < 1)\n media_license_setting = \"\"\n media_type = \"video\"\n else\n media_license_setting = \"//select[@id = 'edit-field-license-und']\"\n media_type = \"image\"\n end\n media_title = \"//input[@id = 'edit-media-title-und-0-value']\"\n media_description = \"//textarea[@id = 'edit-media-description-und-0-value']\"\n media_tag = \"//input[@id = 'edit-field-tags-und']\"\n else\n if(_browser.find_elements(:xpath => \"//select[@id = 'edit-field-license-und--#{i}']\").size < 1)\n media_license_setting = \"\"\n media_type = \"video\"\n else\n media_license_setting = \"//select[@id = 'edit-field-license-und--#{i}']\"\n media_type = \"image\"\n end\n media_title = \"//input[@id = 'edit-media-title-und-0-value--#{i}']\"\n media_description = \"//textarea[@id = 'edit-media-description-und-0-value--#{i}']\"\n media_tag = \"//input[@id = 'edit-field-tags-und--#{i}']\"\n end\n\n Log.logger.info(\"image number #{i} media-type: #{media_type.inspect}\")\n Log.logger.info(\"image number #{i} media-title: #{media_title.inspect}\")\n edit_media_ids[media_url] = Hash.new() unless (edit_media_ids[media_url])\n edit_media_ids[media_url][:license] = media_license_setting\n edit_media_ids[media_url][:tag] = media_tag\n edit_media_ids[media_url][:desc] = media_description\n edit_media_ids[media_url][:title] = media_title\n edit_media_ids[media_url][:type] = media_type\n i += 1\n end\n return edit_media_ids\n end",
"def set_description\n @company = Company.find(params[:company_id])\n @description = @company.description\n end",
"def description\n element = Element.find(params[:element_id])\n \n respond_with(element.description.to_json)\n end",
"def set_admin_additional_description\n @admin_additional_description = AdditionalDescription.find(params[:id])\n end",
"def update\n json_response(@description.update!(description_params))\n end",
"def set_time_entry_description\n data=params\n @time_entry = TneInvoiceTimeEntry.find(data[:id])\n @time_entry.update_attribute(:description,data[:value])\n render :text => @time_entry.description\n end",
"def set_expense_entry_description\n data=params\n @tne_invoice_expense_entry = TneInvoiceExpenseEntry.find(data[:id])\n @tne_invoice_expense_entry.update_attribute(:description,data[:value])\n render :text => @tne_invoice_expense_entry.description\n end",
"def update\n @medium = Medium.find(params[:id])\n params_medium = params.require(:medium).permit(:recording_note, :resource_type_id, :photographer_id, :taken_on, :partial_taken_on, :capture_device_model_id,\n :quality_type_id, :private_note, :rotation, web_address_attributes: [:parent_resource_id, :url])\n respond_to do |format|\n params_web_address = params_medium.delete(:web_address_attributes)\n @medium.attributes = params_medium\n @medium.web_address.attributes = params_web_address if !params_web_address.nil?\n @medium.ingest_taken_on(params_medium)\n is_picture = @medium.instance_of? Picture\n redo_thumbs = @medium.rotation_changed? if is_picture\n if @medium.save # @medium.update_attributes(params[:medium])\n @medium.update_thumbnails if is_picture && redo_thumbs\n flash[:notice] = ts('edit.successful', :what => Medium.model_name.human.capitalize)\n format.html { redirect_to medium_url(@medium) }\n format.xml { head :ok }\n else\n format.html do\n @capture_device_models = CaptureDeviceMaker.all.order('title').collect{|maker| maker.capture_device_models}.flatten\n @media_publisher = MediaPublisher.all\n @photographers = AuthenticatedSystem::Person.all.order('fullname')\n @quality_types = QualityType.all.order('id')\n @recording_orientations = RecordingOrientation.all.order('title')\n @resource_types = Topic.find(2636).children\n @root_topics = Topic.roots \n render :action => 'edit'\n end\n format.xml { render :xml => @medium.errors.to_xml }\n end\n end\n end",
"def update\n\n generated_thumbnail = author_widget_params[:thumbnail].match(/^\\/assets/)\n\n params[:author_widget].delete(:thumbnail) if generated_thumbnail\n params[:author_widget][:widget_category_id] = @category.id\n\n respond_to do |format|\n\n if @author_widget.update(author_widget_params)\n if request.xhr?\n widget = WidgetLib::Generate.new\n widget.init_params(@author_widget.resource)\n widget.generate_css(@author_widget.thumbnail) unless generated_thumbnail\n on_success_xhr(format, @author_widget)\n else\n on_success(format, @author_widget, t('widget_update_success'))\n end\n else\n format.html {render :edit}\n format.json {render json: @author_widget.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update_description\n @course = Course.find(params[:id])\n respond_to do |format|\n if @course.update_attributes(params[:course])\n flash[:notice] = \"Course updated Successfully\"\n else\n flash[:error] = \"An error occured!\"\n end\n format.html\n format.js\n end\n end",
"def set_admin_description\n @admin_description = Admin::Description.find(params[:id])\n end",
"def description\n if element.blank?\n log_warning \"Content with id #{self.id} is missing its Element.\"\n return {}\n end\n desc = self.element.content_description_for(self.name)\n if desc.blank?\n self.element.available_content_description_for(self.name)\n end\n desc || {}\n end",
"def update\n respond_to do |format|\n if @video.update(video_params)\n @publication = Publication.find_by_published_id_and_published_type(@video.id, 'Video')\n @publication.update(:content => @video.content + @video.name + @video.description + @video.tag_list.join(' '))\n format.html { redirect_to videos_path, notice: 'El video fue actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'list' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @object = referenced_object\n @attribute = params[:attribute]\n @form_element = params[:form_element]\n @sub_id = params[:sub_id]\n @update_span = params[:update]\n send(\"#{@form_element.to_s}_update\", @object, @attribute)\n @object.save\n respond_to do |format|\n format.html { } unless @Klass.not_accessible_through_html?\n format.js { }\n end\n end",
"def set_elements\n super\n element(:message) {b.li(:class => 'uif-infoMessageItem')}\n element(:messages) {b.lis(:class => 'uif-infoMessageItem')}\n element(:message_header) {b.h3(:class => 'uif-pageValidationHeader')}\n element(:submit_button) {b.button(:id => \"submitEditor\")}\n element(:cancel_button) {b.button(:id => \"cancelEditor\")}\n element(:close_button) {b.button(:id => \"closeEditor\")}\n element(:return_to_search_button) {b.button(:id => \"returnToSearch_button\")}\n # Navigation Area Elements\n element(:delete_bib_button) {b.button(:title => 'Delete Bib')}\n element(:add_instance_button) {b.button(:title => 'Add Instance')}\n element(:add_einstance_button) {b.button(:title => 'Add EInstance')}\n # @note Vakata Context Menu items are only present on the screen after the containing menu header has been right-clicked.\n element(:delete_instance_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => \"Delete\")}\n element(:add_item_button) {b.button(:title => 'Add Item')}\n element(:delete_item_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => 'Delete')}\n end",
"def update_flickr_description\n if caption_changed? && flickr_image\n description = caption.to_s unless user.flickr_title\n description += \"\\n\\nTwitter: #{tweet_url}\" if tweet_url\n flickr_image.set_meta(:description => description)\n flickr_image.add_tags(tags.join(',')) unless tags.empty?\n end\n end",
"def set_internal\n @description = Description.find(params[:id])\n @internal = @description.internal\n end",
"def set_internal\n @description = Description.find(params[:id])\n @internal = @description.internal\n end"
]
| [
"0.5705707",
"0.5652698",
"0.5647921",
"0.5594134",
"0.55600524",
"0.5498407",
"0.54231143",
"0.53772646",
"0.53547984",
"0.5341152",
"0.53327996",
"0.5322458",
"0.5298105",
"0.5264204",
"0.5262664",
"0.5225102",
"0.5189534",
"0.5179718",
"0.51662725",
"0.51457626",
"0.51078725",
"0.50974554",
"0.5079378",
"0.5055707",
"0.50372154",
"0.5016488",
"0.5016094",
"0.50080824",
"0.50052214",
"0.50052214"
]
| 0.6263109 | 0 |
Gets media elements using Userown_media_elements | def get_own_media_elements
current_user_own_media_elements = current_user.own_media_elements(@page, @for_page, @filter)
@media_elements = current_user_own_media_elements[:records]
@pages_amount = current_user_own_media_elements[:pages_amount]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_media_elements(page)\n MediaElement.joins(:taggings).where(:taggings => {:tag_id => self.id}).order('media_elements.updated_at DESC').page(page)\n end",
"def media_elements_at\n case self.kind\n when AUDIO, VIDEO1, VIDEO2\n resp = self.media_elements_slides.first\n resp.nil? ? nil : resp.media_element\n when COVER, IMAGE1, IMAGE3\n self.media_elements_slides.first\n when IMAGE2\n resp = [nil, nil]\n mes = self.media_elements_slides\n resp[mes[0].position - 1] = mes[0] if !mes[0].nil?\n resp[mes[1].position - 1] = mes[1] if !mes[1].nil?\n resp\n when IMAGE4\n resp = [nil, nil, nil, nil]\n mes = self.media_elements_slides\n resp[mes[0].position - 1] = mes[0] if !mes[0].nil?\n resp[mes[1].position - 1] = mes[1] if !mes[1].nil?\n resp[mes[2].position - 1] = mes[2] if !mes[2].nil?\n resp[mes[3].position - 1] = mes[3] if !mes[3].nil?\n resp\n else\n nil\n end\n end",
"def get_medias(data)\n result = @client.api_request(\n :method => \"usermedia.get\",\n :params => {\n :userids => data[:userid],\n :output => \"extend\"\n }\n )\n result ? result : nil\n end",
"def mediafiles\n source_node.xpath('.//MediaFile').to_a.collect do |node|\n Mediafile.new(node)\n end\n end",
"def media\n parse(delete('media'))\n end",
"def get_user_recent_media\n response = @client.get(\"#{@base_url}/v1/users/self/media/recent\", access_token: get_user_access_token)\n medias = JSON.parse(response.body) \n if(medias[\"meta\"][\"code\"] == 200)\n media_url = []\n medias[\"data\"].each do |media|\n url = media[\"images\"][\"standard_resolution\"][\"url\"]\n media_url.push(url)\n end\n media_url \n end\n end",
"def find_media(media_u_id)\n\t\t\tif [email protected]? \n\t\t\t\treturn @media.find { |m| m.u_id == media_u_id }\n\t\t\tend\n\t\t\treturn nil\n\t\tend",
"def media\n return @media\n end",
"def media\n self\n end",
"def items\n media.map(&:proper_items_by_time).flatten\n end",
"def retrieve_media_url(tweet)\n retrieve_media_element(tweet, 'media_url')\n end",
"def media_list\n DATABASE.execute(\"SELECT media.cover_name FROM media_members JOIN media ON media_members.media_id = media.id WHERE media_members.member_id = #{id};\")\n end",
"def index\n @custom_media = ((GeneralMedium.joins(:personal_media_parameters).where('personal_media_parameters.users_id =?', current_user.id)).joins(:custom_medium))\n end",
"def get_media_per_user_single\n playlist_array = []\n current_user.workout_sets.find(params[:id]).media.each do |v|\n sources_array = []\n videos_hash = {}\n sources_array << {\n src: rails_blob_path(v.video),\n type: 'video/mp4'\n }\n videos_hash[:name] = v.title\n videos_hash[:sources] = sources_array\n playlist_array << videos_hash\n end\n gon.mediaSets = playlist_array\n end",
"def find_media_by_id(message_id)\n UploadedMedium.find(message_id)\n end",
"def visible_media_for_user(user)\n media.select { |m| m.visible_for_user?(user) }\n end",
"def case_media_list\n\t\t@case_media_attachments = @surgery_case.case_media.case_media_attachments\n\tend",
"def media_list\n @redis.hkeys(\"contact_media:#{self.id}\") - ['pagerduty']\n end",
"def medium_names\n primary_media | secondary_media | component_media\n end",
"def selfMedia\n myMedia = Medium.all.filter{|media| media.user_id == decoded_token}\n # ItinActiv = Activity.all.filter{ |activity| activity.itinerary_id == myItin.id }\n render json: myMedia\n end",
"def get_mediaitem_fields()\n @restv9.get_mediaItems_fields()\n end",
"def search_media\n session.delete(:media)\n if !params[:q].blank? && !advanced_search?\n session[:media] = simple_search_api.map { |m| m.id }.compact\n elsif advanced_search?\n session[:media] = advanced_search_api.map { |m| m.id }.compact\n else\n session[:media] = Medium.all.first(500).map { |m| m.id }\n end\n end",
"def get_media_per_user\n playlist_array = []\n current_user.workout_sets.each do |set|\n set.media.each do |v|\n sources_array = []\n videos_hash = {}\n sources_array << {\n src: rails_blob_path(v.video),\n type: 'video/mp4'\n }\n videos_hash[:name] = v.title\n videos_hash[:sources] = sources_array\n playlist_array << videos_hash\n end\n end\n gon.mediaSets = playlist_array\n end",
"def get_all_media_from_all_messages\n begin\n media_sql = \"SELECT * FROM mediacontent WHERE mediacontentid IN\";\n media_sql += \" (SELECT messagemediacontent.mediaid FROM messagemediacontent)\";\n media_sql += \" AND (HighQFilePath IS NOT NULL AND HighQFilePath != '' ) \";\n message_media_data = Immutable.dbh.execute(media_sql);\n return message_media_data;\n rescue DBI::DatabaseError => e\n Immutable.log.error \"Error code: #{e.err}\"\n Immutable.log.error \"Error message: #{e.errstr}\"\n Immutable.log.error \"Error SQLSTATE: #{e.state}\"\n end\n end",
"def index\n @custom_media_entries = CustomMediaEntry.all\n end",
"def get_all_media_items_for_model_type(model_name)\n attachments_table_name = model_name.tableize.singularize+\"_attachments\"\n query_main = \"DISTINCT(media_item_id), media_item_desc, filename, updated_at \"\n query_join = \" inner join #{attachments_table_name} using (media_item_id)\"\n @images = MediaItem.find(:all, :select => query_main, \n :joins => query_join,\n :order => 'updated_at desc')\n @images\n \n end",
"def index\n @other_media = OtherMedium.all\n end",
"def get_medias(page=1, page_size=10, sort_by=\"created_time\", order=\"desc\")\n from = (page.to_i-1)*page_size.to_i\n opt = {}\n opt[:order] = order\n opt[:by] = \"media:*:score\"\n #opt[:by] = \"media:*:#{sort_by}\"\n opt[:limit] = [from, page_size]\n\n # key for caching search result \n store_key = \"user#{id}_page#{page}_by_#{sort_by}_#{order}\"\n opt[:store] = store_key\n\n medias.sort(opt)\n # cache result for 5 minutes\n self.redis.expire(store_key, 300)\n stored_result = self.redis.lrange(store_key, 0, -1)\n # return media instances\n p stored_result\n stored_result.map do |media_id|\n Media.find(media_id)\n end\n end",
"def index\n @media = case params[\"mode\"]\n when \"all\" then Medium.fetch_ordered\n when \"paginated\" then Medium.fetch_ordered_by_page(params[\"page\"])\n else Medium.fetch_ordered_by_page(params[\"page\"])\n end\n end",
"def media(source)\n if source.media? && source.media.count == 1\n source.media[0].media_url.to_s\n else\n nil\n end\n end"
]
| [
"0.71667904",
"0.69947106",
"0.6593392",
"0.65456766",
"0.6522452",
"0.6473865",
"0.646598",
"0.64359754",
"0.63486004",
"0.61855525",
"0.61852956",
"0.61313766",
"0.6085632",
"0.6076357",
"0.6076312",
"0.60489213",
"0.6029287",
"0.60000145",
"0.5949952",
"0.5942411",
"0.5934963",
"0.5918686",
"0.58894545",
"0.5879462",
"0.5844019",
"0.57971215",
"0.57623154",
"0.57587713",
"0.57333535",
"0.5722212"
]
| 0.79123586 | 0 |
GET /action_states GET /action_states.json | def index
@action_states = ActionState.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_states\n perform(:get, 'enum/states', nil, nonauth_headers).body\n end",
"def get_state\n @states = State.find_state(params[:id])\n respond_to do |format|\n format.json { render :json => @states }\n end\n end",
"def index\n @api_states = Api::State.all\n end",
"def index\n @states = State.all\n \n render json: @states\n end",
"def index\n @states = State.all\n respond_with(@states)\n end",
"def index\n @states = State.all\n end",
"def index\n @states = State.all\n end",
"def index\n @states = State.all\n end",
"def index\n @states = State.all\n end",
"def index\n @states = State.all\n end",
"def index\n @event_states = EventState.all\n end",
"def index\n @page_title = 'States'\n @states = State.all\n end",
"def index\n @states = State.order(\"name\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @states }\n end\n end",
"def index\n @project_states = ProjectState.all\n json_response(@project_states)\n end",
"def _region_states(region_id)\n get('region/states', region_id)\n end",
"def states\n (['show'] + actions).uniq\n end",
"def show\n render json: @state\n end",
"def device_states_list\n get \"deviceStates\"\n end",
"def index\n @user_states = UserState.all\n end",
"def index\n @user_states = UserState.all\n end",
"def states\n @attributes[\"data\"][\"states\"]\n end",
"def states\r\n @states.collect {|id| $data_states[id] }\r\n end",
"def index\n @asset_states = AssetState.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asset_states }\n end\n end",
"def index\n @states = @country.states.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @states }\n end\n end",
"def states\n []\n end",
"def states\n []\n end",
"def index\n @sprint_states = SprintState.all\n end",
"def states\n @states ||= {}\n end",
"def show\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state }\n end\n end",
"def show\n @state = State.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state }\n end\n end"
]
| [
"0.7573909",
"0.7290489",
"0.7100373",
"0.6914498",
"0.68387026",
"0.68236977",
"0.68236977",
"0.68236977",
"0.68236977",
"0.68236977",
"0.6608056",
"0.6543935",
"0.65251696",
"0.6519283",
"0.64381415",
"0.6428163",
"0.6417171",
"0.6399927",
"0.63791746",
"0.63791746",
"0.63665384",
"0.63656485",
"0.6361189",
"0.6343378",
"0.62408763",
"0.62408763",
"0.62313724",
"0.61758506",
"0.6174284",
"0.6174284"
]
| 0.7819178 | 0 |
POST /action_states POST /action_states.json | def create
@action_state = ActionState.new(action_state_params)
respond_to do |format|
if @action_state.save
format.html { redirect_to [project, @action_state], notice: 'Action state was successfully created.' }
format.json { render :show, status: :created, location: @action_state }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @action_states = ActionState.all\n end",
"def create\n @state = State.new(state_params)\n\n if @state.save\n render json: @state, status: :created, location: @state\n # 'state was successfully created.'\n else\n render json: @state.errors, status: :unprocessable_entity\n end\n end",
"def states_params\n\t \t params.require(:state).permit(:country_id, :name, :status)\n\t end",
"def create\n @project_states = ProjectState.create!(project_state_params)\n json_response(@project_states, :created)\n end",
"def create\n @map_state = MapState.new(params[:map_state])\n\n respond_to do |format|\n if @map_state.save\n format.html { redirect_to @map_state, :notice => 'Map state was successfully created.' }\n format.json { render :json => @map_state, :status => :created, :location => @map_state }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @map_state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @state = State.new(params[:state])\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render json: @state, status: :created, location: @state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @state = State.new(params[:state])\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render json: @state, status: :created, location: @state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @state = State.new(state_params)\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render :show, status: :created, location: @state }\n else\n format.html { render :new }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_state = Api::State.new(api_state_params)\n\n if @api_state.save\n render json: @api_state, status: :created, location: @api_state\n else\n render json: @api_state.errors, status: :unprocessable_entity\n end\n end",
"def create\n @state = State.new(state_params)\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render action: 'show', status: :created, location: @state }\n else\n format.html { render action: 'new' }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @state = State.new(state_params)\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render :show, status: :created, location: @state }\n else\n format.html { render :new }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @states_assign = StatesAssign.new(states_assign_params)\n\n respond_to do |format|\n if @states_assign.save\n format.html { redirect_to @states_assign, notice: 'State was successfully created.' }\n format.json { render :show, status: :created, location: @states_assign }\n \"#{@states_assign.assigned_to}StateMachine\".constantize.state @states_assign.state.name.to_sym\n\n puts '##############################'\n puts LeadStateMachine.states\n puts '##############################'\n\n else\n format.html { render :new }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @state = State.new(params[:state])\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to(states_path, :notice => 'State was Created Successfully.') }\n format.xml { render :xml => @state, :status => :created, :location => @state }\n else\n\t@country = Country.all\n format.html { render :action => \"new\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @state = State.new(state_params)\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to @state, notice: 'State was successfully created.' }\n format.json { render json:{message:'State was successfully created.'}, status: :created, location: @state }\n else\n format.html { render action: 'new' }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @state = @country.states.build(params[:state])\n\n respond_to do |format|\n if @state.save\n format.html { redirect_to([@country, @state], :notice => 'State was successfully created.') }\n format.xml { render :xml => @state, :status => :created, :location => [@country, @state] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event_state = EventState.new(event_state_params)\n\n respond_to do |format|\n if @event_state.save\n format.html { redirect_to @event_state, notice: 'Event state was successfully created.' }\n format.json { render :show, status: :created, location: @event_state }\n else\n format.html { render :new }\n format.json { render json: @event_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@state = State.create(states_params)\n\t\tif @state.save\n\t\t\tflash[:success] = \"Record updated successfully\"\n\t\t\tredirect_to states_path\n\t\t else\n\t\t \tflash[:error] = \"Record not updated\"\n\t\t redirect_to states_path\n\t\tend\n\tend",
"def add_states(new_states); end",
"def index\n @states = State.all\n \n render json: @states\n end",
"def state_params\n params.require(:state).permit(:name, :abbreviation)\n end",
"def create\n @user_state = UserState.new(user_state_params)\n\n respond_to do |format|\n if @user_state.save\n format.html { redirect_to @user_state, notice: 'User state was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_state }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @states = State.all\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_state = UserState.new(user_state_params)\n\n respond_to do |format|\n if @user_state.save\n format.html { redirect_to @user_state, notice: 'User state was successfully created.' }\n format.json { render :show, status: :created, location: @user_state }\n else\n format.html { render :new }\n format.json { render json: @user_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def action_state=(value)\n @action_state = value\n end",
"def state_params\n params.require(:state).permit(:name, :code, :description, :country_id, :active)\n end",
"def create\n #we're going to be tailoring a message in the case of a wrong or duplicate answer:\n\n@message = \"\"\n\n \n\n#your standard new instance of the Resource line:\n\n@state = State.new(state_params)\n\n \n\n#we'll need this to check if the answer is a duplicate:\n\n@states = State.all\n\n \n\n#let's make sure the answer is correct, and that it's not a duplicate.\n\n#see the Application Helper for these methods:\n\ncorrect = check_answer_state(@state.name)\n\nis_dup = check_for_dup_state(@state.name,@states)\n\n \n\n#we're going to have a couple messages for when the user enters something that is not a city, or is a duplicate answer\n\nif correct == false\n\n@message = \"That is not a state TTS is in.\"\n\nelsif is_dup == true\n\n@message = \"You already guessed that one!\"\n\nend\n\n \n\nrespond_to do |format|\n\n#if we have > 1 city left to name, and the user's answer is true and not a duplicate answer, we'll save it in the database and redirect back to the same page\n\nif @states.count <= 48 && correct == true && is_dup == false && @state.save\n\nformat.html { redirect_to new_state_path, notice: 'State was successfully created.' }\n\nformat.json { render action: 'show', status: :created, location: @state }\n\n#if this is our last city to name, and the user's answer is true and not a duplicate answer, we'll save it in the database and redirect to the 'you won!' page\n\nelsif @states.count == 49 && correct == true && is_dup == false && @state.save\n\nformat.html { redirect_to youwonstate_path, notice: 'State was successfully created.' }\n\nformat.json { render action: 'show', status: :created, location: @state }\n\nelse\n\nformat.html { render action: 'new' }\n\nformat.json { render json: @state.errors, status: :unprocessable_entity }\n\nend\n\nend\n\nend",
"def state_params\n params.require(:state).permit(:name, :abbrev, :favorite, :favorites )\n end",
"def action_state_params\n params.require(:action_state).permit(:project_id, :chara, :field, :freq, :precis)\n end",
"def create\n @expense_state = ExpenseState.new(params[:expense_state])\n\n respond_to do |format|\n if @expense_state.save\n format.html { redirect_to @expense_state, notice: 'Expense state was successfully created.' }\n format.json { render json: @expense_state, status: :created, location: @expense_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @action_state.update(action_state_params)\n format.html { redirect_to [project, @action_state], notice: 'Action state was successfully updated.' }\n format.json { render :show, status: :ok, location: @action_state }\n end\n end\n end"
]
| [
"0.6681765",
"0.6533226",
"0.6487266",
"0.64165443",
"0.64110124",
"0.63889223",
"0.63889223",
"0.6381537",
"0.63767755",
"0.6347029",
"0.6346201",
"0.6326781",
"0.6256764",
"0.6248286",
"0.6225454",
"0.62234485",
"0.62085706",
"0.6071389",
"0.60122657",
"0.60032153",
"0.60027814",
"0.5998451",
"0.59648556",
"0.5910847",
"0.59079546",
"0.5892906",
"0.5877481",
"0.5876509",
"0.58655274",
"0.58565265"
]
| 0.68875045 | 0 |
PATCH/PUT /action_states/1 PATCH/PUT /action_states/1.json | def update
respond_to do |format|
if @action_state.update(action_state_params)
format.html { redirect_to [project, @action_state], notice: 'Action state was successfully updated.' }
format.json { render :show, status: :ok, location: @action_state }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_state = Api::State.find(params[:id])\n\n if @api_state.update(api_state_params)\n head :no_content\n else\n render json: @api_state.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @state.update(state_params)\n render json: @state\n # 'State was successfully updated.'\n else\n render json: @state.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @state.update_attributes(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { render json:{message:'State was successfully updated.'} }\n else\n format.html { render action: 'edit' }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @state }\n else\n format.html { render :edit }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @state }\n else\n format.html { render :edit }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to(states_path, :notice => 'State was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @state = @country.states.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to([@country, @state], :notice => 'State was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @modelstate.update(params[:modelstates])\n format.html { redirect_to @modelstate, notice: 'Modelstate was successfully updated.' }\n format.json { render :show, status: :ok, location: @modelstate }\n else\n format.html { render :edit }\n format.json { render json: @modelstate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @map_state = MapState.find(params[:id])\n\n respond_to do |format|\n if @map_state.update_attributes(params[:map_state])\n format.html { redirect_to @map_state, :notice => 'Map state was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @map_state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sprint_state.update(sprint_state_params)\n format.html { redirect_to @sprint_state, notice: 'Sprint state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sprint_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_state.update(event_state_params)\n format.html { redirect_to @event_state, notice: 'Event state was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_state }\n else\n format.html { render :edit }\n format.json { render json: @event_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @current_state.update(current_state_params)\n format.html { redirect_to \"/\", notice: 'CurrentState was successfully updated.' }\n format.json { render :root, status: :ok, location: @current_state }\n else\n format.html { render :edit }\n format.json { render json: @current_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @federal_state.update(federal_state_params)\n format.html { redirect_to @federal_state, notice: 'Federal state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @federal_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expense_state = ExpenseState.find(params[:id])\n\n respond_to do |format|\n if @expense_state.update_attributes(params[:expense_state])\n format.html { redirect_to @expense_state, notice: 'Expense state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @state_type.update(state_type_params)\n format.html { redirect_to @state_type, notice: 'State type was successfully updated.' }\n format.json { render :show, status: :ok, location: @state_type }\n else\n format.html { render :edit }\n format.json { render json: @state_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \"#{@states_assign.assigned_to}StateMachine\".constantize.states.delete(@states_assign.state.name)\n if @states_assign.update(states_assign_params)\n format.html { redirect_to @states_assign, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @states_assign }\n \"#{@states_assign.assigned_to}StateMachine\".constantize.state @states_assign.state.name.to_sym\n\n puts '##############################'\n puts LeadStateMachine.states\n puts '##############################'\n\n puts '##############################'\n puts PaymentStateMachine.states\n puts '##############################'\n\n\n else\n format.html { render :edit }\n format.json { render json: @states_assign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goal_state = GoalState.find(params[:id])\n\n respond_to do |format|\n if @goal_state.update_attributes(params[:goal_state])\n format.html { redirect_to @goal_state, notice: 'Goal state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_state.update(user_state_params)\n format.html { redirect_to @user_state, notice: 'User state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @state = State.find(params[:id])\n @state.updated_by = @updated_by\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to([:admin,@state], :notice => 'State was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n @event = Event.find(params[:id])\n @states = ['AL','AK','AZ','AR','CA','CO','CT','DE','FL','GA','HI','ID','IL','IN',\n 'IA','KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV',\n 'NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD','TN',\n 'TX','UT','VT','VA','WA','WV','WI','WY']\n end",
"def update\n @datum = Datum.find(params[:id])\n verify_user(@datum.user.id)\n\n action_list = @datum.action_list\n switch_action_list(action_list.id)\n\n respond_to do |format|\n if @datum.update_attributes(params[:datum])\n @datum.user.user_state.reset(action_list.id)\n if not @datum.user.user_state.save\n format.html { render action: \"edit\" }\n format.json { render json: @datum.user.user_state.errors, status: :unprocessable_entity }\n else \n format.html { redirect_to @datum, notice: 'Datum was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tender_state = TenderState.find(params[:id])\n\n respond_to do |format|\n if @tender_state.update_attributes(params[:tender_state])\n format.html { redirect_to @tender_state, notice: 'Tender state was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tender_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asset_state = AssetState.find(params[:id])\n respond_to do |format|\n if @asset_state.update_attributes(params[:asset_state])\n format.html { redirect_to system_asset_states_path, notice: 'Asset type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_state.update(task_state_params)\n format.html { redirect_to @task_state, success: 'Task state was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_state }\n else\n format.html { render :edit }\n format.json { render json: @task_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n puts params\n @state = State.find(params[:targetId])\n \n data = Hash.new\n #pagination - see doc\n data[\"code\"] = params[:code] \n data[\"name\"] = params[:name] \n data[\"countryId\"] = params[:countryId] \n\t\n respond_to do |format|\n if @state.update_attributes(data)\n format.html { redirect_to(:action => \"index\") }\n else \n\t puts @state.errors\n format.html { redirect_to(:action => \"edit\", :id => (params[:targetId])) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @united_state.update(united_state_params)\n format.html { redirect_to @united_state, notice: 'United state was successfully updated.' }\n format.json { render :show, status: :ok, location: @united_state }\n else\n format.html { render :edit }\n format.json { render json: @united_state.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.68128395",
"0.67845887",
"0.67845887",
"0.67845887",
"0.67651767",
"0.67571896",
"0.67542475",
"0.66479415",
"0.66479415",
"0.6631263",
"0.6543808",
"0.6541712",
"0.64760345",
"0.63940316",
"0.6382878",
"0.6354047",
"0.62879497",
"0.62710017",
"0.6259483",
"0.62157136",
"0.61968744",
"0.6076953",
"0.6074817",
"0.6066577",
"0.6046632",
"0.60441303",
"0.6036468",
"0.60325843",
"0.60038066",
"0.6003071"
]
| 0.71217287 | 0 |
current_organisation returns organisation obj for current organisation return nil if no current organisation defined | def current_organisation()
begin
organisation = (
Thread.current[:organisation_id].blank? ?
nil :
Organisation.find( Thread.current[:organisation_id] )
)
return organisation
rescue ActiveRecord::RecordNotFound
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_org\n current_user&.org\n end",
"def set_current_organisation( organisation )\n # able to handle organisation obj or organisation_id\n #case organisation\n # when Organisation then organisation_id = organisation.id\n # when Integer then organisation_id = organisation\n # when Array then organisation_id = organisation\n # else\n # raise ArgumentError, \"invalid organisation object or id\"\n #end\n #old_id = ( Thread.current[:organisation_id].nil? ? '%' : Thread.current[:organisation_id] )\n if organisation.is_a? Integer\n organisation = Organisation.where(id: organisation).first\n end\n \n Thread.current[:organisation_id] = organisation.present? ? organisation.root.subtree.map(&:id) : nil\n Thread.current[:current_organisation_id] = organisation.present? ? organisation.subtree.map(&:id) : nil\n Thread.current[:root_organisation_id] = organisation.present? ? organisation.root.id : nil\n #organisation = Organisation.find(organisation_id) rescue nil\n #Time.zone = organisation.time_zone || 'Singapore' rescue 'Singapore'\n end",
"def current_organisation_id()\n return Thread.current[:organisation_id]\n end",
"def current_id\n current_org&.id\n end",
"def current_organization\n Organization.find(params[:organization_id])\n end",
"def current_organization\n fog_model_interface.current_organization\n end",
"def organisation_name\n return if partnership?\n\n organisation.name\n end",
"def organization\n return @organization if @organization\n @organization = Organization.find(organization_id)\n end",
"def org\n user_id.present? ? User.includes(:org).find_by(id: user_id).org : nil\n end",
"def current_company\n current_user ? current_user.company : nil\n end",
"def organisation?\n session[:organisation] and session[:organisation].size > 0\n end",
"def organisation_name_fetch\n @organisation.try(:organisation_name)\n end",
"def org\n client.org(org_id)\n end",
"def org\n client.org(org_id)\n end",
"def organisation_details\n return blank_value unless organisation\n\n organisation.partnership? ? partner_names : organisation.name\n end",
"def org_id\n @org_id ||= query_org_id # lazy query org_id when not set by login response\n end",
"def show\n @organization = current_user.organization\n end",
"def set_organisation\n @organisation = Organisation.find(params[:organisation_id]) if params[:organisation_id]\n end",
"def organization\n capital_project.organization\n end",
"def organization\n id = if params[:organization_id]\n params[:organization_id]\n elsif params.dig(:q, :parent_id_eq)\n params[:q][:parent_id_eq]\n elsif params.dig(model.name.underscore.to_sym, :organization_id)\n params[model.name.underscore.to_sym][:organization_id]\n end\n Organization.where(id: id).first || @record&.organization || OpenStruct.new(id: nil)\n end",
"def organization\n self[:O]\n end",
"def org_name\n (org = self.organization) && org.name\n end",
"def current_company\n Company.find(1)\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def base_org\n if self.customization_of.present?\n return Template.where(family_id: self.customization_of).first.org\n else\n return self.org\n end\n end",
"def current_company\n @current_company = current_user.company\n end",
"def organisation=(new_org)\n org_id = new_org.id unless new_org.nil?\n end",
"def current_login\n current_company ? current_company : current_user.company\n end"
]
| [
"0.7711881",
"0.76772815",
"0.7624038",
"0.7284386",
"0.72407955",
"0.72248566",
"0.6995413",
"0.6935735",
"0.6915876",
"0.6709824",
"0.66519535",
"0.66405255",
"0.6632705",
"0.6632705",
"0.6558245",
"0.6423801",
"0.6405801",
"0.63878894",
"0.63841444",
"0.6370104",
"0.63510114",
"0.6331135",
"0.63295937",
"0.63252413",
"0.63252413",
"0.63252413",
"0.6306744",
"0.630659",
"0.6305112",
"0.6300225"
]
| 0.8878894 | 0 |
current_organisation_id returns organisation_id for current organisation | def current_organisation_id()
return Thread.current[:organisation_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_organisation()\n begin\n organisation = (\n Thread.current[:organisation_id].blank? ?\n nil :\n Organisation.find( Thread.current[:organisation_id] )\n )\n\n return organisation\n\n rescue ActiveRecord::RecordNotFound\n return nil\n end \n end",
"def current_id\n current_org&.id\n end",
"def current_organization\n Organization.find(params[:organization_id])\n end",
"def set_current_organisation( organisation )\n # able to handle organisation obj or organisation_id\n #case organisation\n # when Organisation then organisation_id = organisation.id\n # when Integer then organisation_id = organisation\n # when Array then organisation_id = organisation\n # else\n # raise ArgumentError, \"invalid organisation object or id\"\n #end\n #old_id = ( Thread.current[:organisation_id].nil? ? '%' : Thread.current[:organisation_id] )\n if organisation.is_a? Integer\n organisation = Organisation.where(id: organisation).first\n end\n \n Thread.current[:organisation_id] = organisation.present? ? organisation.root.subtree.map(&:id) : nil\n Thread.current[:current_organisation_id] = organisation.present? ? organisation.subtree.map(&:id) : nil\n Thread.current[:root_organisation_id] = organisation.present? ? organisation.root.id : nil\n #organisation = Organisation.find(organisation_id) rescue nil\n #Time.zone = organisation.time_zone || 'Singapore' rescue 'Singapore'\n end",
"def org_id\n @org_id ||= query_org_id # lazy query org_id when not set by login response\n end",
"def organization_id\n self.organization.id if self.organization && self.organization.is_a?(Organization)\n end",
"def org_id\n query('select id from Organization').first['Id']\n end",
"def institution_id\n\t\tif organisation.nil?\n\t\t\treturn nil\n\t\telse\n\t\t\treturn organisation.root.id\n\t\tend\n\tend",
"def current_org\n current_user&.org\n end",
"def org\n user_id.present? ? User.includes(:org).find_by(id: user_id).org : nil\n end",
"def set_organization\n @organization = current_user.organizations.where(id: params[:id]).first\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def set_organisation\n @organisation = Organisation.find(params[:organisation_id]) if params[:organisation_id]\n end",
"def organisation=(new_org)\n org_id = new_org.id unless new_org.nil?\n end",
"def authenticate_user!(options={})\n super(options)\n @organisation ||= current_user.organisation\n Organisation.current_id = @organisation.present? ? @organisation.subtree.map(&:id) : nil\n end",
"def current_organization\n fog_model_interface.current_organization\n end",
"def org\n client.org(org_id)\n end",
"def org\n client.org(org_id)\n end",
"def organisation_name\n return if partnership?\n\n organisation.name\n end",
"def full_org_id; (term_id && org_id) ? \"#{term_id}_#{org_id}\" : nil; end",
"def organization\n id = if params[:organization_id]\n params[:organization_id]\n elsif params.dig(:q, :parent_id_eq)\n params[:q][:parent_id_eq]\n elsif params.dig(model.name.underscore.to_sym, :organization_id)\n params[model.name.underscore.to_sym][:organization_id]\n end\n Organization.where(id: id).first || @record&.organization || OpenStruct.new(id: nil)\n end",
"def unit_id\n\t\tif organisation.nil? || organisation.parent_id.nil?\n\t\t\treturn nil\n\t\telse\n\t\t\treturn organisation_id\n\t\tend\n\tend",
"def set_organization\n if current_user.is_admin?\n @organization = Organization.where(id: params[:id]).first\n else\n @organization = current_user.organizations.where(id: params[:id]).first\n end\n \n end",
"def organization\n return @organization if @organization\n @organization = Organization.find(organization_id)\n end",
"def org_id\n\t\t\tOrganization.count + 1\n\t\tend",
"def organization\n id = Location.where(id: self.id).joins(:visits).select([:organization_id])\n Organization.where(id: id).select([:name]).first\n end",
"def group_org_id\n\t\t\tGroupOrganization.count + 1\n\t\tend"
]
| [
"0.81824243",
"0.80198395",
"0.75833",
"0.75296277",
"0.7467459",
"0.729725",
"0.72417474",
"0.6995078",
"0.6897121",
"0.68032783",
"0.6752774",
"0.67313534",
"0.6719804",
"0.6719804",
"0.6719804",
"0.67147934",
"0.6714425",
"0.65651304",
"0.6557183",
"0.6556622",
"0.6556622",
"0.65336615",
"0.65015745",
"0.6494059",
"0.6466294",
"0.6452924",
"0.6447647",
"0.644753",
"0.6346456",
"0.63002986"
]
| 0.83400047 | 0 |
set_current_organisation modellevel ability to set the current organisation NOTE: USE WITH CAUTION normally this should NEVER be done from the models ... it's only useful and safe WHEN performed at the start of a background job (DelayedJobperform) | def set_current_organisation( organisation )
# able to handle organisation obj or organisation_id
#case organisation
# when Organisation then organisation_id = organisation.id
# when Integer then organisation_id = organisation
# when Array then organisation_id = organisation
# else
# raise ArgumentError, "invalid organisation object or id"
#end
#old_id = ( Thread.current[:organisation_id].nil? ? '%' : Thread.current[:organisation_id] )
if organisation.is_a? Integer
organisation = Organisation.where(id: organisation).first
end
Thread.current[:organisation_id] = organisation.present? ? organisation.root.subtree.map(&:id) : nil
Thread.current[:current_organisation_id] = organisation.present? ? organisation.subtree.map(&:id) : nil
Thread.current[:root_organisation_id] = organisation.present? ? organisation.root.id : nil
#organisation = Organisation.find(organisation_id) rescue nil
#Time.zone = organisation.time_zone || 'Singapore' rescue 'Singapore'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_organisation\n @organisation = Organisation.find(params[:organisation_id]) if params[:organisation_id]\n end",
"def set_organisation\n raise \"You must set the organisation\" if session[:organisation].blank?\n OrganisationSession.set session[:organisation]\n end",
"def set_organization\n if current_user\n current_organization = Organization.find(current_user.organization_id)\n set_current_tenant(current_organization)\n end\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def set_organisation\n @organisation = Organisation.find(params[:id])\n end",
"def update\n if !current_user.admin?\n head :forbidden\n else\n if @organisation.update(organisation_params)\n render json: @organisation.to_json, status: :ok\n else\n render json: @organisation.errors, status: :unprocessable_entity\n end\n end\n end",
"def organisation=(new_org)\n org_id = new_org.id unless new_org.nil?\n end",
"def set_organization\n if current_user.is_admin?\n @organization = Organization.where(id: params[:id]).first\n else\n @organization = current_user.organizations.where(id: params[:id]).first\n end\n \n end",
"def update\n setup_super_admin_email if params[:organisation]\n path = organisation_path(params[:id])\n check_privileges(:can_edit?, path, @organisation); return if performed?\n @organisation.update_attributes_with_superadmin(organisation_params)\n @organisation.check_geocode\n rendering('Organisation was successfully updated.', 'edit')\n end",
"def set_organization\n @organization = Organization.find(params[:id])\n if !current_user.soadmin && current_user.organization != @organization\n redirect_to current_user.organization\n end\n end",
"def set_current_company\n if current_user.present? && !UserCompany.where(:user_id=>current_user.id).blank?\n userCompany = UserCompany.find_by_user_id(current_user.id)\n @company = Company.find(userCompany.company_id)\n end\n end",
"def autonomous_system_organization; end",
"def autonomous_system_organization; end",
"def autonomous_system_organization; end",
"def set_organization\n # @org = Organization.find(params[:id])\n end",
"def set_project_level\n @project_level = ProjectLevel.find(params[:id])\n end",
"def set_project_control\n @project_control = ProjectControl.find(params[:id]) if current_user.has_role?(:vendor, ProjectControl.find(params[:id])) || current_user.has_role?(:sponsor, ProjectControl.find(params[:id])) ||\n current_user.has_role?(:admin, ProjectControl.find(params[:id]))\n end",
"def set_organization\n @signed_in = admin_signed_in?\n @organization = Organization.find(params[:id])\n end",
"def current_organisation()\n begin\n organisation = (\n Thread.current[:organisation_id].blank? ?\n nil :\n Organisation.find( Thread.current[:organisation_id] )\n )\n\n return organisation\n\n rescue ActiveRecord::RecordNotFound\n return nil\n end \n end",
"def set_organization\n @organization = current_user.organizations.where(id: params[:id]).first\n end",
"def assign_default_project \n if current_user \n current_project = self\n current_user.save\n end\n end",
"def move_to(org)\n self.organisation = org\n self.save\n end",
"def set_org\n @org = Organization.find(params[:id])\n end",
"def current_company=(company_obj)\n self.current_company_id = company_obj.id\n self.save\n end",
"def set_role\n @role = Role.find_by_actor_id_and_project_id(current_actor.id, @project.id)\n if @role\n @role_level = (RoleLevel.find(@role.role_level_id)).name\n else\n @role_level = ''\n end\n end",
"def set_org_role\n @org_role = OrgRole.find(params[:id])\n end",
"def after_update_org\n\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller || self.changed.blank?\n\n current_user = PublicActivity.get_controller.current_user\n\n activity = self.create_activity :update, owner: current_user,trackable: self, params: {:detail => I18n.t('logs.update_org', org_name: self.name)}\n activity.organization_id = current_user.organization_id\n activity.save\n end",
"def set_current_user\n @current_user = current_student || current_admin\n end"
]
| [
"0.6453708",
"0.64062",
"0.62416416",
"0.6211622",
"0.6211622",
"0.6211622",
"0.6205148",
"0.60366184",
"0.58874464",
"0.57556295",
"0.57506716",
"0.5725723",
"0.5718173",
"0.56490356",
"0.56490356",
"0.56490356",
"0.5634117",
"0.56214094",
"0.5598364",
"0.5596463",
"0.5570601",
"0.555981",
"0.55546784",
"0.555164",
"0.55192035",
"0.5510688",
"0.5507012",
"0.54735184",
"0.543112",
"0.5423565"
]
| 0.72130495 | 0 |
where_restrict_organisation gens organisation restrictive where clause for each klass NOTE: subordinate join tables will not get the default scope by Rails theoretically, the default scope on the master table alone should be sufficient in restricting answers to the current_organisation alone .. HOWEVER, it doesn't feel right. adding an additional .where( where_restrict_organisations(klass1, klass2,...)) for each of the subordinate models in the join seems like a nice safety issue. | def where_restrict_organisation(*args)
args.map{|klass| "#{klass.table_name}.organisation_id = #{Thread.current[:organisation_id]}"}.join(" AND ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_filter_by_associations_window_function_limit_strategy(ds)\n ds.where(filter_by_associations_limit_key=>apply_window_function_eager_limit_strategy(associated_eager_dataset.select(*filter_by_associations_limit_alias_key)).select(*filter_by_associations_limit_aliases))\n end",
"def apply_filter_by_associations_distinct_on_limit_strategy(ds)\n k = filter_by_associations_limit_key \n ds.where(k=>apply_distinct_on_eager_limit_strategy(associated_eager_dataset.select(*k)))\n end",
"def apply_filter_by_associations_limit_strategy(ds)\n case filter_by_associations_limit_strategy\n when :distinct_on\n apply_filter_by_associations_distinct_on_limit_strategy(ds)\n when :window_function\n apply_filter_by_associations_window_function_limit_strategy(ds)\n else\n ds\n end\n end",
"def filter_by_associations_conditions_dataset\n cached_fetch(:filter_by_associations_conditions_dataset) do\n ds = associated_eager_dataset.unordered\n ds = filter_by_associations_add_conditions_dataset_filter(ds)\n ds = apply_filter_by_associations_limit_strategy(ds)\n ds\n end\n end",
"def apply_filter_by_associations_limit_strategy(ds)\n case filter_by_associations_limit_strategy\n when :correlated_subquery\n apply_correlated_subquery_limit_strategy(ds)\n else\n super\n end\n end",
"def conditions\n return nil unless tree.columns.scope?\n\n assoc_scope = method(:association_scope)\n join_scope = method(:join_association_scope)\n\n Proc.new do |join_association|\n conditions = if join_association.is_a?(ActiveRecord::Associations::JoinDependency::JoinAssociation)\n join_scope[join_association]\n elsif self.is_a?(ActiveRecord::Base)\n assoc_scope[self]\n else\n where(nil)\n end.where_values.reduce(:and)\n\n conditions.try(:to_sql)\n end\n end",
"def add_conditions(scope)\n unless @reflection.through_reflection.klass.descends_from_active_record?\n scope = scope.where(@reflection.through_reflection.klass.send(:type_condition))\n end\n\n scope = scope.where(@reflection.source_reflection.options[:conditions])\n scope.where(through_conditions)\n end",
"def filter_by_associations_add_conditions_dataset_filter(ds)\n k = filter_by_associations_conditions_associated_keys\n ds.select(*k).where(Sequel.negate(k.zip([])))\n end",
"def joins_on\n # join(relations).on(conditions)\n condition = deals.join(clients)\n .on(deals[:advertiser_id].eq(clients[:id]))\n workflow_criterions.each do |wc|\n case wc.field\n when 'currencies'\n condition = condition\n .join(currencies)\n .on(deals[:curr_cd].eq(currencies[:curr_cd]))\n when 'deal_type'\n condition = condition\n .join(values)\n .on(deals[:id].eq(values[:subject_id]))\n .join(options)\n .on(values[:option_id].eq(options[:id]))\n when 'deal_initiative'\n condition = condition\n .join(initiatives)\n .on(deals[:initiative_id].eq(initiatives[:id]))\n when 'teams'\n condition = condition\n .join(deal_members)\n .on(deal_members[:deal_id].eq(deals[:id]))\n .join(users)\n .on(users[:id].eq(deal_members[:user_id]))\n .join(teams)\n .on(teams[:id].eq(users[:team_id]).or(teams[:leader_id].eq(users[:id])))\n when 'client_segments'\n condition = condition\n .join(client_segments)\n .on(clients[:client_segment_id].eq(client_segments[:id]))\n when 'client_regions'\n condition = condition\n .join(client_regions)\n .on(clients[:client_region_id].eq(client_regions[:id]))\n when 'client_categories'\n condition = condition\n .join(client_categories)\n .on(clients[:client_category_id].eq(client_categories[:id]))\n when 'client_subcategories'\n condition = condition\n .join(client_subcategories)\n .on(clients[:client_subcategory_id].eq(client_subcategories[:id]))\n when 'share'\n condition = condition\n .join(deal_members)\n .on(deal_members[:deal_id].eq(deals[:id]))\n end\n case wc.base_object\n when 'Account Custom Fields'\n unless condition.to_sql.include?(\"INNER JOIN \\\"account_cfs\\\"\")\n condition = condition\n .join(account_cfs)\n .on(clients[:id].eq(account_cfs[:client_id]))\n end\n when 'Deal Custom Fields'\n unless condition.to_sql.include?(\"INNER JOIN \\\"deal_custom_fields\\\"\")\n condition = condition\n .join(deal_custom_fields)\n .on(deals[:id].eq(deal_custom_fields[:deal_id]))\n end\n when 'Deal Members'\n condition = condition\n .join(deal_members)\n .on(deal_members[:deal_id].eq(deals[:id]))\n .join(values)\n .on(values[:subject_id].eq(deal_members[:id]))\n .join(fields)\n .on(values[:field_id].eq(fields[:id]))\n .join(member_roles)\n .on(fields[:id].eq(member_roles[:field_id])) if wc.field.eql?('role')\n end\n end\n condition\n end",
"def where_permits( priv, keyword_args = {} )\n priv, association = disassemble_priv( priv )\n if association.nil?\n return <<-END_SQL\n (#{table_name}.id in\n #{self.ids_permitting_internal( priv, keyword_args )})\n END_SQL\n else\n klass = self.class_for_associate(association)\n fk = self.reflect_on_association(association).foreign_key.to_s\n return <<-END_SQL\n (#{table_name}.#{fk} in\n #{klass.ids_permitting_internal( priv, keyword_args )})\n END_SQL\n end\n end",
"def condition_parts(with_orgs=true)\n ### Subclass MUST respond with at least 1 non-nil AR::Relation object ###\n\n if with_orgs\n conditions = private_methods.grep(/_conditions$/)\n else\n conditions = (private_methods.grep(/_conditions$/) - [:organization_conditions])\n end\n conditions.map { |m| send(m) }.compact\n end",
"def optimize\n left_restriction.send(relation_method, right_restriction).restrict(partition.remainder)\n end",
"def default_where(klass)\n sql = ''\n arel_nodes = klass.scoped.with_default_scope.where_values.grep(Arel::Nodes::Equality)\n string_nodes = klass.scoped.with_default_scope.where_values.grep(String)\n\n unless arel_nodes.empty?\n sql += arel_nodes.inject(arel_nodes[0]) do |arel, equality|\n arel = arel.and(equality); arel\n end.to_sql\n end\n\n unless string_nodes.empty?\n sql += ' AND ' + string_nodes.map { |node| \"(#{node})\"}.join(' AND ')\n end\n\n sql\n end",
"def apply_agency_filter(organization_id,dayhome_query)\n \n \n dayhome_query = dayhome_query.joins(:organization)\n dayhome_query = dayhome_query.where(\"organizations.id = #{organization_id}\")\n dayhome_query\n end",
"def viewable_by(user, organization)\n group_ids = user.organization_group_ids(organization)\n joined = all.left_joins(roles: %i[users_roles groups_roles])\n joined.where(UsersRole.arel_table[:user_id].eq(user.id)).or(\n joined.where(GroupsRole.arel_table[:group_id].in(group_ids)),\n ).distinct # because of left joins\n end",
"def gemd_in_common_with(klass, user)\n Recommendable.query(klass, gemd_ids_in_common_with(klass, user))\n end",
"def query_scope\n record_class.public_send(include_strategy, included_associations)\n end",
"def options_for_association_conditions(association)\n case association.name\n when :frms\n # join with public if session is missing the usr_id\n ['frms.usr_id = ?', (session[:usr_id] || Usr.find_by_login('public').id)]\n when :prsna\n # join with public if session is missing the usr_id\n ['prsnas.usr_id = ?', (session[:usr_id] || Usr.find_by_login('public').id)]\n else\n super\n end\n end",
"def resolve_options(klass, options)\n # Factor in scope.\n if scope = klass.get_scope\n scope = scope.dup\n scond = scope.delete(:condition)\n scope.update(options)\n options = scope\n end\n\n if sql = options[:sql]\n sql = \"SELECT * FROM #{klass.table} \" + sql unless sql =~ /SELECT/i\n return sql\n end\n\n tables = [klass::table]\n\n if included = options[:include]\n join_conditions = []\n\n for name in [included].flatten\n if rel = klass.relation(name.to_s)\n target_table = rel[:target_class]::table\n tables << target_table\n\n if rel.is_a?(JoinsMany)\n tables << rel[:join_table]\n owner_key, target_key = nil\n klass.ogmanager.with_store do |s|\n owner_key, target_key = s.join_table_keys(klass, rel[:target_class])\n end\n join_conditions << \"#{rel.join_table}.#{owner_key}=#{klass.table}.#{rel.owner_class.primary_key} AND #{rel.join_table}.#{target_key}=#{rel.target_class.table}.#{rel.target_class.primary_key}\"\n else\n join_conditions << \"#{klass::table}.#{rel.foreign_key}=#{target_table}.#{rel.target_class.primary_key}\"\n end\n else\n raise \"Unknown relation name\"\n end\n end\n\n fields = options[:select] || tables.collect { |t| \"#{t}.*\" }.join(',')\n\n update_condition options, join_conditions.join(\" AND \")\n elsif fields = options[:select]\n fields = fields.map {|f| f.to_s}.join(\", \")\n else\n fields = \"*\"\n end\n\n if join_table = options[:join_table]\n tables << join_table\n update_condition options, options[:join_condition]\n end\n\n # Factor in scope in the conditions.\n update_condition(options, scond) if scond\n\n # where is just an alias, put to :condition\n update_condition(options, options.delete(:where))\n\n # add extra conditions\n update_condition(options, options.delete(:extra_condition))\n\n # rp: type is not set in all instances such as Class.first\n # so this fix goes here for now.\n if ogtype = options[:type] || (klass.schema_inheritance_child? ? \"#{klass}\" : nil)\n update_condition options, \"ogtype='#{ogtype}'\"\n end\n\n sql = \"SELECT #{fields} FROM #{tables.join(',')}\"\n\n if condition = options[:condition]\n # If an array is passed as a condition, use prepared\n # statement style escaping.\n if condition.is_a?(Array)\n condition = prepare_statement(condition)\n end\n\n sql << \" WHERE #{condition}\"\n end\n\n if group = options[:group] || options[:group_by]\n sql << \" GROUP BY #{group}\"\n end\n\n if order = options[:order] || options[:order_by]\n sql << \" ORDER BY #{order}\"\n end\n\n resolve_limit_options(options, sql)\n\n if extra = options[:extra] || options[:extra_sql]\n sql << \" #{extra}\"\n end\n\n return sql\n end",
"def find_right_models(klass, original_klass, join_model, join_alias)\n #debugger if 'titular' == klass\n #unless instance_variable_get(\"@#{klass}\".to_sym).blank?\n # instance_variable_get(\"@#{klass}\".to_sym)\n #else\n right_ids = find_right_ids(klass, join_model, join_alias)\n original_klass_model = original_klass.classify.constantize\n unless right_ids.empty?\n instance_variable_set \"@#{klass}\".to_sym, original_klass_model.find(right_ids)\n else\n []\n end\n #end\n end",
"def add_auth_config_conditions(query)\n arel_conditions = auth_configs.reduce(nil) do |conditions, ac|\n if conditions\n conditions.or(\n ac.assignment_to .arel_table.primary_key.not_eq(nil)\n )\n else\n ac.assignment_to.arel_table.primary_key.not_eq(nil)\n end\n end\n\n query\n .where(arel_conditions)\n .where(Permission.arel_table[:applies_to].in(applies_to))\n end",
"def claims_for_organisation(organisation_id)\n # NOTE: A transaction may not have a provider !!!\n query = Query.find_by_sql(\n \"select c.id claim_id, c.invoice_date, c.invoice_no,\n c.host_provider_id, hp.name host_provider_name,\n c.amount, c.comment, p.family_name, p.given_names, p.nhi_no,g.id programme_id, g.description programme_description, f.description fee_description\\n\"+ \n \"from claims c\\n\"+\n \" left join providers hp on hp.id = c.host_provider_id\\n\"+\n \" join patients p on p.id = c.patient_id\\n\"+\n \" join programmes g on g.id = c.programme_id\\n\"+\n \" join fee_schedules f on f.id = c.fee_schedule_id\\n\"+\n \"where c.organisation_id = #{organisation_id} and c.payment_run_id = #{self.id}\\n\"+\n \"order by c.invoice_date, c.id\" );\n query\n end",
"def filter_by_associations_conditions_expression(obj)\n ds = filter_by_associations_conditions_dataset.where(filter_by_associations_conditions_subquery_conditions(obj))\n {filter_by_associations_conditions_key=>ds}\n end",
"def scoped_records_arel(s)\n not_null_nodes = required_column_names.map do |c|\n s[c].not_eq(nil)\n end\n not_null_conds = not_null_nodes.shift\n not_null_nodes.each { |n| not_null_conds = not_null_conds.and(n) }\n result = s.project('*').where(not_null_conds)\n scope_nodes = sanitized_sandbox_scope.map do |scope_column, scope_def|\n tmp = []\n if scope_def['inclusion']\n inclusion_nodes = scope_def['inclusion'].map { |value| s[scope_column].eq(value) }\n tmp << inclusion_nodes.inject(&:or)\n end\n if scope_def['exclusion']\n exclusion_nodes = scope_def['exclusion'].map { |value| s[scope_column].not_eq(value) }\n tmp << exclusion_nodes.inject(&:or)\n end\n if scope_def['blank']\n tmp << s[scope_column].eq(nil)\n end\n tmp\n end.flatten\n scope_conds = scope_nodes.inject(&:and)\n result = result.where(scope_conds) if scope_conds\n result\n end",
"def by_organisation\n query = Query.find_by_sql(\n \"select o.id organisation_id, o.name organisation_name,o.residential_suburb organisation_suburb, o.not_gst_registered, sum(c.amount) sumamount\\n\"+\n \"from claims c\\n\"+\n \" join organisations o on o.id = c.organisation_id\\n\"+\n \"where c.payment_run_id = #{self.id}\\n\"+\n \"group by o.id, o.name,o.residential_suburb,o.not_gst_registered\\n\"+\n \"order by 2\")\n query\n end",
"def claims_paid_to_others_for_organisation_programme(cost_organisation_id,programme_id)\n query = Query.find_by_sql(\n \"select c.id claim_id, c.invoice_date, c.invoice_no, \\n\"+\n \" c.amount, c.comment, \\n\"+\n \" p.family_name, p.given_names, p.nhi_no,\\n\"+\n \" f.description fee_description,\\n\"+\n \" o.name organisation_name\\n\"+\n \"from claims c\\n\"+\n \" join patients p on p.id = c.patient_id\\n\"+\n \" join fee_schedules f on f.id = c.fee_schedule_id\\n\"+\n \" join organisations o on o.id = c.organisation_id\\n\"+\n \"where c.cost_organisation_id = #{cost_organisation_id} and c.payment_run_id = #{self.id} and c.programme_id = #{programme_id}\\n\"+\n \" and c.cost_organisation_id <> c.organisation_id and c.amount <> 0\\n\"+\n \"order by c.invoice_date, c.id\");\n query\n end",
"def associated_projects\n Project.includes(:assignments, :comments).where('id in (?) or id in (?) or id in (?)', project_ids, assigned_project_ids, commented_project_ids)\n end",
"def filter_by_associations_limit_strategy\n v = fetch(:filter_limit_strategy, self[:eager_limit_strategy])\n if v || self[:limit] || !returns_array?\n case v ||= self[:model].default_eager_limit_strategy\n when true, :union, :ruby\n # Can't use a union or ruby-based strategy for filtering by associations, switch to default eager graph limit\n # strategy.\n true_eager_graph_limit_strategy\n when Symbol\n v\n end\n end\n end",
"def where_clause\n parent_constraints = parent&.constraints || []\n (constraints - parent_constraints).to_where_clause\n end",
"def disgemd_in_common_with(klass, user)\n Recommendable.query(klass, disgemd_ids_in_common_with(klass, user))\n end"
]
| [
"0.5719611",
"0.5646677",
"0.55646676",
"0.55289453",
"0.5404927",
"0.5376554",
"0.5335817",
"0.53332233",
"0.5321977",
"0.52638996",
"0.524178",
"0.5206978",
"0.52049476",
"0.52001715",
"0.51796716",
"0.5166633",
"0.5142932",
"0.5134657",
"0.5118139",
"0.5098712",
"0.50682074",
"0.5046214",
"0.50456405",
"0.5044127",
"0.5040788",
"0.50377554",
"0.49942467",
"0.49938324",
"0.49637187",
"0.49627075"
]
| 0.8168442 | 0 |
Pass target to the scope handler of the specified type and name. If `name` is not specified then `:default` name is used. If `type` is not specified then we try to infer the type from the target class. | def apply_scope(target, type:, name: :default, scope_options: nil)
raise ActionPolicy::UnknownScopeType.new(self.class, type) unless
self.class.scoping_handlers.key?(type)
raise ActionPolicy::UnknownNamedScope.new(self.class, type, name) unless
self.class.scoping_handlers[type].key?(name)
mid = :"__scoping__#{type}__#{name}"
scope_options ? send(mid, target, **scope_options) : send(mid, target)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_name(name, type)\n @names[name.to_sym] = type unless name.nil?\n end",
"def authorization_scope_type_for(policy, target)\n policy.resolve_scope_type(target)\n end",
"def target\n @target ||= case scope\n when '#'\n klass\n when '.'\n klass && klass.class_eval{class << self; self; end}\n end\n end",
"def call_scope_by_type(type, scope, target, value, options) #:nodoc:\n if type == :boolean\n target.send(scope)\n elsif value && options.key?(:using)\n value = value.values_at(*options[:using])\n target.send(scope, *value)\n else\n target.send(scope, value)\n end\n end",
"def method_missing(name, *args, &block)\n if scopes.include?(name)\n scopes[name].call(self, *args)\n elsif klass\n target.send(name, *args, &block)\n else\n @parent.fuse(@conditions); @parent.send(name, *args, &block)\n end\n end",
"def for(type_name)\n raise NameError, \"No handler for type #{type_name}\" unless types[type_name]\n types[type_name]\n end",
"def target(*args)\n if args.blank?\n const_defined?(:Target) ? const_get(:Target) : (@target || name[0..-5].classify.constantize)\n else\n self.target = args.first\n end\n end",
"def bind(arg_name, klass)\n @bindings[arg_name] = klass\n end",
"def target_type(target_type)\n return if target_type.nil?\n return unless [String, Symbol].include?(target_type.class)\n target_type = target_type.to_sym if target_type.instance_of? String\n return unless TARGET_TYPES.include? target_type\n @_target_type = target_type\n end",
"def target_type(_target_type)\n return if _target_type.nil?\n return unless _target_type.instance_of?(String) || _target_type.instance_of?(Symbol)\n _target_type = _target_type.to_sym if _target_type.instance_of? String\n return unless TARGET_TYPES.include? _target_type\n @_target_type = _target_type\n end",
"def scoped_by(name, options = {})\n options[:scope] ||= :reference\n if scope_class = self.class.scope_types[options[:scope]]\n @scopes[name] = scope_class.new(@model, name, options)\n end\n end",
"def target_class_name\n options[:class_name] || name.to_s.classify\n end",
"def target(name, options = {})\n parent = @target_definition\n @target_definitions[name] = @target_definition = TargetDefinition.new(name, parent, self, options)\n yield\n ensure\n @target_definition = parent\n end",
"def type_name *args\n (@type_names ||= { })[args] ||=\n _type_name(args)\n end",
"def for_target(target)\n @target_name = target[:target_name].to_s\n return self\n end",
"def target_name(*args)\n if args.blank?\n (const_defined?(:TargetName) ? const_get(:TargetName) : (@target_name || target_model.name.underscore.titleize)).to_s\n else\n self.target_name = args.first\n end\n end",
"def to(target, rel_type = @method_id)\n @dir = :outgoing\n\n if Class === target || String === target\n # handle e.g. has_n(:friends).to(class)\n @target_name = target\n @rel_type = \"#{@source_class}##{rel_type}\".to_sym\n elsif Symbol === target\n # handle e.g. has_n(:friends).to(:knows) or to(\"Person#friends\")\n @target_name = target.to_s.split(\"#\")[0] if target.to_s.include?(\"#\")\n @rel_type = target.to_sym\n else\n raise \"Expected a class or a symbol for, got #{target}/#{target.class}\"\n end\n self\n end",
"def quoted_scope(name = nil, type: nil)\n schema, name = extract_schema_qualified_name(name)\n type =\n case type # rubocop:disable Style/HashLikeCase\n when \"BASE TABLE\"\n \"'r','p'\"\n when \"VIEW\"\n \"'v','m'\"\n when \"FOREIGN TABLE\"\n \"'f'\"\n end\n scope = {}\n scope[:schema] = quote(schema || shard.name)\n scope[:name] = quote(name) if name\n scope[:type] = type if type\n scope\n end",
"def bound_name?(name)\n type = @names[name.to_sym]\n if type.nil?\n @parent&.bound_name?(name)\n else\n type\n end\n end",
"def target_klass\n target_klass_name.constantize\n end",
"def target_name(target_name = nil)\n @target_name = target_name unless target_name.nil?\n \n return 'default' if @target_name.nil?\n @target_name\n end",
"def target_symbol(*args)\n if args.blank?\n (const_defined?(:TargetSymbol) ? const_get(:TargetSymbol) : (@target_symbol || target_model.name.underscore)).to_sym\n else\n self.target_symbol = args.first\n end\n end",
"def target(name, options = {})\n parent = @target_definition\n @target_definitions[name] = @target_definition = TargetDefinition.new(name, options[:exclusive] ? nil : parent, options[:include_headers_for] ? @target_definitions[options[:include_headers_for]] : nil)\n yield\n ensure\n @target_definition = parent\n end",
"def target(name, &block)\n t = TargetDef.new(name)\n @targets.push(t)\n\n block.call(t)\n end",
"def target_type=(value)\n @target_type = value\n end",
"def target_def; target.name; end",
"def []=(name, type)\n @names[name.to_sym] = type\n end",
"def scope\n klass\n end",
"def scope_type(node); end",
"def from(target, rel_type=@method_id)\n @dir = :incoming\n\n case target\n when /#/\n @target_name, _ = target.to_s.split(\"#\")\n @rel_type = target\n when Class, String\n @target_name = target.to_s\n @rel_type = \"#{@target_name}##{rel_type}\".to_sym\n when Symbol\n @target_name = nil\n @rel_type = target.to_sym\n else\n raise \"Expected a class or a symbol for, got #{target}/#{target.class}\"\n end\n self\n end"
]
| [
"0.5854092",
"0.54851234",
"0.54614395",
"0.5429654",
"0.5369638",
"0.53256947",
"0.52948576",
"0.5201738",
"0.5185947",
"0.5157362",
"0.51186293",
"0.50766975",
"0.5053053",
"0.5030344",
"0.500551",
"0.4995355",
"0.49022508",
"0.48995999",
"0.48943287",
"0.48399782",
"0.48347542",
"0.48181865",
"0.48013762",
"0.47965032",
"0.4788069",
"0.4781321",
"0.4778214",
"0.4777023",
"0.4762054",
"0.47612897"
]
| 0.7343106 | 0 |
Define scope type matcher. Scope matcher is an object that implements `===` (_case equality_) or a Proc. When no type is provided when applying a scope we try to infer a type from the target object by calling matchers one by one until we find a matching type (i.e. there is a matcher which returns `true` when applying it to the target). | def scope_matcher(type, class_or_proc)
scope_matchers << [type, class_or_proc]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applies_type?(scope, type); end",
"def type_matcher(mod)\n TypeMatcher.new(mod)\n end",
"def scope_type(node); end",
"def call_scope_by_type(type, scope, target, value, options) #:nodoc:\n if type == :boolean\n target.send(scope)\n elsif value && options.key?(:using)\n value = value.values_at(*options[:using])\n target.send(scope, *value)\n else\n target.send(scope, value)\n end\n end",
"def scope_match(&block)\n return @scope_match if block.nil?\n @scope_match = block\n end",
"def authorization_scope_type_for(policy, target)\n policy.resolve_scope_type(target)\n end",
"def apply_scope(target, type:, name: :default, scope_options: nil)\n raise ActionPolicy::UnknownScopeType.new(self.class, type) unless\n self.class.scoping_handlers.key?(type)\n\n raise ActionPolicy::UnknownNamedScope.new(self.class, type, name) unless\n self.class.scoping_handlers[type].key?(name)\n\n mid = :\"__scoping__#{type}__#{name}\"\n scope_options ? send(mid, target, **scope_options) : send(mid, target)\n end",
"def has_scope(scope_group, *scopes)\n options = scopes.extract_options!\n options.symbolize_keys!\n options.assert_valid_keys(:type, :if, :unless, :default, :as, :using, :allow_blank)\n\n if options.key?(:using)\n if options.key?(:type) && options[:type] != :hash\n raise \"You cannot use :using with another :type different than :hash\"\n else\n options[:type] = :hash\n end\n\n options[:using] = [*options[:using]]\n end\n\n self.scopes_configuration ||= {}\n self.scopes_configuration[scope_group] ||= {}\n\n scopes.each do |scope|\n self.scopes_configuration[scope_group][scope] ||= {\n :as => scope,\n :type => :default\n }\n self.scopes_configuration[scope_group][scope].merge!(options)\n end\n end",
"def applies?(scope, path, type); end",
"def scope(name, scope=nil, &block)\n raise ArgumentError, \"Dangerous scope name: a :#{name} method is already defined. Please, use another one.\" \\\n if respond_to?(name)\n proc = case\n when block_given?\n block\n when scope.is_a?(Flex::Scope)\n lambda {scope}\n when scope.is_a?(Proc)\n scope\n else\n raise ArgumentError, \"Scope object or Proc expected (got #{scope.inspect})\"\n end\n metaclass = class << self; self end\n metaclass.send(:define_method, name) do |*args|\n scope = proc.call(*args)\n raise Scope::Error, \"The scope :#{name} does not return a Flex::Scope object (got #{scope.inspect})\" \\\n unless scope.is_a?(Flex::Scope)\n scope\n end\n scope_methods << name\n end",
"def set_scope_class\n klass = self.class::Scope\n klass.send(:include, ScopeMethods)\n @scope_class = klass.new(@scope, @search_attributes)\n end",
"def class_scope?\n @type == :class || @type == :module\n end",
"def class_scope?\n @type == :class or @type == :module\n end",
"def has_scope?( scope )\n scope_names.include?( scope )\n end",
"def requested_type\n return @requested_type if defined?(@requested_type)\n\n opts = @scope.opts[:type_routing]\n @requested_type = accept_response_type if opts[:use_header]\n @requested_type ||= opts[:default_type]\n end",
"def scope\n finder_or_run(:scope)\n end",
"def verify_scope(scope)\n self.user_scope.each do |sym|\n raise RuntimeError, \"Expected to be passed a scope containing the key '#{sym.to_s}'\" unless scope.has_key? sym\n end\n scope\n end",
"def apply_to_scope(scope)\n scope\n end",
"def valid_scope?\n scope.to_s == self.class.scope.to_s\n end",
"def scope!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 2)\n\n type = SCOPE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 8:9: 'scope'\n match(\"scope\")\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__, 2)\n\n end",
"def valid_scope(valid_scopes, scope)\n\t\tend",
"def match(env, target)\n target_type = target.kind_of?(Type) ? target : target.pione_type(env)\n while target_type do\n return true if self == target_type\n target_type = target_type.parent_type\n end\n return false\n end",
"def scope(scope, &block)\n @scopes[scope] ||= []\n @scopes[scope] << block\n end",
"def resolved_scope(scope)\n scoper_object(scope).resolve\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end",
"def scope=(value)\n @scope = value\n end"
]
| [
"0.6947657",
"0.6124443",
"0.5949851",
"0.58142024",
"0.56766033",
"0.5673048",
"0.5441659",
"0.53827775",
"0.5366719",
"0.5353178",
"0.5302973",
"0.5300918",
"0.5299004",
"0.5231972",
"0.52060634",
"0.5149539",
"0.5135744",
"0.5116606",
"0.51091224",
"0.5091886",
"0.5006744",
"0.49135333",
"0.48937026",
"0.48188126",
"0.48121616",
"0.48121616",
"0.48121616",
"0.48121616",
"0.48121616",
"0.48121616"
]
| 0.7371604 | 0 |
Main method for getting all Available TimeBlock(s) for a given date. +:base_time: DateTime used for determining the base scan date range. | def available_on(base_time)
# Stash this for future use, as we will be using it to set a
# baseline date in order to derive a bunch of different appointments
# from.
set_base_time(base_time)
# Fetch all TimeEntris related for this date query.
time_entries = time_entries_for(base)
# Transform TimeEntry(s) -> TimeSlot(s).
available_slots = generate_time_slots(time_entries)
# Combine all sequential linear slots to into a single window.
# This produces multiple windows
windows = combine_linear_slots(available_slots)
# Generate TimeBlocks from the Available Slot ranges
open_time_blocks = generate_time_blocks(windows)
# Optimize & Filter our wide collection of TimeBlocks.
optimized_blocks = optimize_time_blocks(open_time_blocks)
# Finally, present the TimeBlock(s) as Appointment records
# to the Customer.
final = transform_blocks_to_appointments(optimized_blocks)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_blocks(base_time)\n set_base_time(base_time)\n time_entries = time_entries_for(base)\n end",
"def available_delivery_blocks(time)\n\n unless opens_today\n return []\n end\n\n # Reset date to compare with Postgres Time\n time = time.change(:month => 1, :day => 1, :year => 2000)\n\n lead_time_for_block_time_slots = 1.hour\n\n all_slots = block_slots.select { |slot| slot[:from] >= (time + lead_time_for_block_time_slots) } +\n live_slots.select { |slot| slot[:from] >= (time) }\n\n all_slots.map do |slot|\n {\n :from => slot[:from].strftime('%H:%M'),\n :to => slot[:to].strftime('%H:%M'),\n :type => slot[:type]\n }\n end\n end",
"def get_data_for_time_span()\n set_schedule_query_params\n\n @t1 = Time.at(@t1.to_i)\n @t2 = Time.at(@t2.to_i)\n\n @rsrcs = @config.resource_list # ScheduledResource.resource_list\n\n @blockss = ScheduledResource.get_all_blocks(@config, @t1, @t2, @inc)\n\n json_adjustments\n end",
"def get_busy_slots(start_min, start_max, time_zone)\n result = Array.new\n @googleCalendars.each do |x|\n result.push(x[:connection].query([x[:id]],start_min, start_max, time_zone))\n end\n return result\n end",
"def index\n @time_blocks = TimeBlock.all\n end",
"def get_availabilities\n #retrieve all availability\n self.therapist_availability.collect{ |availability| availability_start_end_datetime(availability.get_occurrences, availability) }.flatten\n end",
"def bra_all_ranges_per_date(date)\n bra_all_ranges = []\n ranges(date).each do |range|\n bra_all_ranges << bra_per_range(bra_key(range,date))\n end\n bra_all_ranges\nend",
"def get_availability\n unbooked_days = []\n availability_blocks = self.availabilities.includes(:bookings)\n availability_blocks.each do |availability_block|\n booked_days = []\n availability_block.bookings.each do |booking|\n booked_days += (booking.start_date..booking.end_date).to_a\n end\n (availability_block.start_date..availability_block.end_date).each do |day|\n unbooked_days.push(day) unless booked_days.include?(day)\n end\n end\n unbooked_days\n end",
"def bra_all_ranges_per_date(date)\n bra_all_ranges = []\n ranges(date).each do |range|\n bra_all_ranges << bra_per_range(bra_key(range,date))\n end\n bra_all_ranges\n end",
"def block_slots\n slots = []\n\n unless block_delivery_end_time.blank? || block_delivery_start_time.blank?\n\n available_hours = block_delivery_end_time - block_delivery_start_time\n\n number_of_slots = available_hours / 60.minutes\n\n number_of_slots.to_i.times do |i|\n slots << {\n from: block_delivery_start_time + i.hours,\n to: block_delivery_start_time + (i + 1).hours,\n type: :daytime\n }\n end\n end\n\n slots\n end",
"def get_busy_times(calendar_ids, min_date, max_date, access_token)\n form_data = {\n \"items\" => [{:id => calendar_ids}],\n \"timeMin\" => \"#{min_date.year}-#{min_date.month}-#{min_date.day}T00:00:00+00:00\",\n \"timeMax\" => \"#{max_date.year}-#{max_date.month}-#{max_date.day}T23:59:00+00:00\" \n }\n uri = URI.parse(\"https://www.googleapis.com/calendar/v3/freeBusy?access_token=#{access_token}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true \n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = form_data.to_json\n request['Content-Type'] = 'application/json'\n response = http.request(request)\n response_json = JSON.parse(response.body) \n busy_times = []\n response_json[\"calendars\"].keys.each do |calendar|\n unless response_json[\"calendars\"][calendar][\"busy\"].blank?\n response_json[\"calendars\"][calendar][\"busy\"].each do |busy|\n busy_times.push([busy[\"start\"], busy[\"end\"]])\n end\n end\n end\n busy_times\n end",
"def generate_time_blocks(windows)\n results = windows.map do |window|\n\n # Create a date based n todays date, but with the time changed to\n # that of the entry start/end.\n entry_start = base.change(\n hour: window.start_time.hour,\n min: window.start_time.minute)\n\n # By rounding off with #floor, we go the easy route (no partial time blocks)\n # Note: iterator is zero based.\n blocks = (window.duration / block_size).floor.times.map { |i|\n\n start_time = Skej::Warp.zone(\n entry_start + (i * block_size).minutes,\n session.chosen_office.time_zone)\n\n end_time = Skej::Warp.zone(\n start_time + block_size.minutes,\n session.chosen_office.time_zone)\n\n target_day = Skej::NLP.parse(session, window.day)\n .strftime('%A')\n .downcase\n .to_sym\n\n TimeBlock.new(\n session: session,\n time_entry_id: window.time_entry.id,\n business_id: session.business_id,\n time_sheet_id: window.time_sheet_id,\n office_id: window.office_id,\n day: target_day,\n start_time: start_time,\n end_time: end_time)\n\n }\n end.flatten # results\n end",
"def list_blocked_rooms(start_date, end_date)\n date_valid?(start_date, end_date)\n\n blocked_rooms = []\n\n @blocks.each do |block|\n blocked_rooms += block.rooms\n end\n\n return blocked_rooms\n end",
"def get_block_time_list(filename)\n to_return = []\n lines = File.open(filename, \"rb\") {|f| f.read.split(/\\n+/)}\n lines.each do |line|\n next if line !~ /^Block times/\n values = []\n # Block times are given as a space-separated list of start,end pairs. They\n # are in units of seconds * 1e5, so convert them to seconds here for\n # consistency.\n if line =~ /^[^:]+: (.*?)\\s*$/\n values = $1.split(\" \").map{|r| r.split(\",\").map{|v| v.to_f / 1e5}}\n end\n to_return << values\n end\n to_return\nend",
"def time_slots\n\n # you can book by the hour, and you can stay for an hour\n reservation_interval = 1.hour\n\n # Determine the earliest time we will allow reservation\n # It can't be in the past, we'll start 10 minutes from now\n start_time = Time.zone.now + 10.minutes\n # Then we have to round to the next hour block\n start_time = Time.zone.at( (start_time.to_f / reservation_interval).ceil * reservation_interval )\n # Then, if we are still earlier than opening hour, just use the opening hour\n # We can use the 'max' Array method\n start_time = [start_time, start_time.change(hour: opening_hour)].max\n\n # Determine the furthest in the future we will allow reservations\n end_time = (start_time + 3.days).change(hour: closing_hour)\n\n # Now, we want to make a list of every hour between our start_time and our end_time\n # For this we can use a begin... end while condition loop.\n # We'll start with an empty array that will hold all the hours,\n # and a variable to hold each hour, which we will keep increasing by 1 hour, and then add to our array\n # Our loop condition will have us stop looping once we've reached the end time\n\n all_times = []\n a_time = start_time\n\n begin\n\n # add this time to our list of times\n all_times << a_time\n\n # increment the time\n a_time += reservation_interval\n\n # Once we get to closing time, we have to skip ahead to the next day's opening\n # That way you can't make a reservation at 2am\n if (a_time + reservation_interval) > a_time.change(hour: closing_hour)\n a_time = (a_time + 1.day).change(hour:opening_hour)\n end\n\n end while a_time < end_time\n\n all_times\n end",
"def find_available_rooms_in_block(blocks, group_name, start_date: Date.today, end_date: Date.today + 2)\n return Block.all_available_rooms_in_block(blocks, group_name, start_date: start_date, end_date: end_date)\n end",
"def makeBlocks(days, startTimeString, endTimeString, info)\n\tblocks = []\n\tdays.split(\"\").each do |d|\n\t\tb = SCHBlock.new(d, startTimeString, endTimeString, info)\n\t\tblocks << b\n\tend\n\t(blocks)\nend",
"def get_readings_from_remote_server_for_dates(type, start_date, end_date)\n readings = []\n start_date.upto(end_date) do |date|\n readings += get_readings_from_remote(type, date)\n end\n return readings\nend",
"def getblock(hash)\n block = @api.request 'getblock', hash\n block[\"time\"] = Time.at(block[\"time\"]).utc if block.is_a? Hash\n block\n end",
"def time_slots\n collection=[]\n start_time=Time.now.beginning_of_hour\n end_time=Time.now.tomorrow.midnight-1.hour\n time=start_time\n\n while time < end_time\n collection<<[time.beginning_of_hour.hour, time.beginning_of_hour]\n time=time+1.hour\n end\n\n collection\n end",
"def get_all_thermal_blocks()\n zones = find_all_commands(\"ZONE\")\n end",
"def mmc_blockinfo\n\n # number of latest block\n @blckhigh = `#{@mmc_path} getblockcount`\n\n # hash of latest block\n blckhash = `#{@mmc_path} getblockhash #{@blckhigh}`\n\n # complete json of latest block\n blckinfo = `#{@mmc_path} getblock #{blckhash}`\n\n # difficulty of latest block\n @blckdiff = `#{@mmc_path} getdifficulty`\n\n # number of 30th latest block\n rcnthigh = @blckhigh.to_i - 30\n\n # hash of 30th latest block\n rcnthash = `#{@mmc_path} getblockhash #{rcnthigh}`\n\n # complete json of 30th latest block\n rcntinfo = `#{@mmc_path} getblock #{rcnthash}`\n\n # timestamp of latest block\n blcktime = JSON.parse(blckinfo)['time'].to_i\n\n # timestamp of 30th latest block\n rcnttime = JSON.parse(rcntinfo)['time'].to_i\n\n # average blocktime of 30 last blocks in seconds\n @blocktime = (blcktime.to_f - rcnttime.to_f) / 30.0\n\n # current hashrate in hashs per minute\n @hashrate = ((2 ** 32) * @blckdiff.to_f) / (@blocktime.to_f / 60.0)\n\n # calculates current block reward and total minted coins\n i = 0\n currweek = ((@blckhigh.to_f / 1680.0) - 0.5).round\n @reward = 280.0 ### @TODO: initial reward was limited, PTS shares\n @minted = 715842.49 ### @TODO: initial reward was limited, PTS shares\n while i < currweek do\n @minted += @reward * 1680.0\n @reward *= 0.95\n i += 1\n end\n @minted += (@blckhigh.to_f - (currweek * 1680.0)) * @reward\n\nend",
"def create_block_by_date(rooms_per_block, check_in, check_out, block_id, discount_percent: 0.0)\n while self.list_vacancies(check_in, check_out).empty?\n raise StandardError(\"No more vacancies!\")\n end\n\n room_num_array = self.list_vacancies(check_in, check_out).take(rooms_per_block).to_a\n\n # take one of the rooms from the room_num_array to make a reservation\n room_num = room_num_array.first\n\n new_block = Hotel::Block.new(room_num_array, check_in, check_out, block_id, discount_percent: 0.0)\n\n new_block.make_reservation(room_num, check_in, check_out, discount_percent: 0)\n\n @blocks << new_block\n end",
"def get_all_blocks\n\n @all_blocks = Block.where(is_published: 't')\n\n end",
"def index\r\n\r\n # 基準日指定ない場合、当日を基準とする\r\n param = params[:baseDate]\r\n @baseDate = param ? Date.parse(param) : Date.today\r\n\r\n # 基準日から7日分を作成\r\n @headers = Array.new(7) do |index|\r\n I18n.l(@baseDate + index.days, format: :short_date)\r\n end\r\n\r\n @dates = Array.new(7) do |index|\r\n (@baseDate + index.days).strftime(\"%Y-%m-%d\")\r\n end\r\n\r\n # 予約データ\r\n @reservations = Reservation.where(\"start_date <= ? and ? <= end_date\", @baseDate+6, @baseDate).order(\"start_date\")\r\n @reservations.each do |res|\r\n # 上段・下段(ライセンス番号)\r\n # virtualAttributesを取得するため、whereではなくselectを使用する\r\n subSet = @reservations.select{|sub|sub.start_date <= res.start_date && res.start_date <= sub.end_date}\r\n res.top = ([0,1] - subSet.map(&:top)).min\r\n\r\n # スケジュールバー左端・幅\r\n leftDate = [res.start_date, @baseDate].max\r\n rightDate = [res.end_date, @baseDate+6].min\r\n res.left = (leftDate - @baseDate).to_i\r\n res.width = (rightDate - leftDate).to_i + 1\r\n end\r\n end",
"def get_cost\n time_range = {}\n if reserv_range.end.day - reserv_range.begin.day == 1\n time_range[reserv_range.begin.wday] = (\n ((reserv_range.begin.hour * 60 + reserv_range.begin.min) / 60.0)...24.0\n )\n\n time_range[reserv_range.end.wday] = (0.0...(reserv_range.end.hour * 60 + reserv_range.end.min) / 60.0)\n else\n time_range[reserv_range.end.wday] = (((reserv_range.begin.hour * 60 + reserv_range.begin.min) / 60.0)...(reserv_range.end.hour * 60 + reserv_range.end.min) / 60.0)\n end\n\n cost_sum = 0\n\n time_range.each do |wday, tr|\n billings = Billing\n .select(\n \"numrange(start_time, end_time) * numrange(#{tr.begin},#{tr.end}) as period, cost_cents, cost_currency\"\n )\n .where(\n 'numrange(start_time, end_time) && numrange(:start, :end) AND day_type = :day_type AND sauna_id = :sauna_id',\n start: tr.begin,\n end: tr.end,\n day_type: wday,\n sauna_id: sauna_id\n )\n\n # puts billings.to_sql\n\n billings.each do |bill|\n cost_sum += (bill.period.end - bill.period.begin) * bill.cost_cents\n end\n end\n\n cost_sum\n end",
"def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n ranges\nend",
"def bus_available(from_city,to_city)\n @variable = @line_id\n @buses = []\n # p \"--------Current User(#{current_user.id})---------------\"\n #freq = 7\n \n @line_id.each do |line|\n available_buses = Bus.where(route_id: line, status: true)\n # p \"--------Line Id: #{line}--Bus #{available_buses.present?}---------\"\n\n if available_buses\n\n available_buses.each do |bus|\n # p \"---------Bus#{bus.bus_timings.find_by(city: from_city.name).day_of_deperture}-City#{from_city.name}----------\"\n \n\n freq = bus.frequency\n bus_time = bus.bus_timings\n \n\n start_date = bus.start_date + (day_offset = (bus_time.find_by(city: from_city.name).day_of_deperture - 1)).day\n end_date = bus.end_date + (bus_time.find_by(city: from_city.name).day_of_deperture - 1).day\n\n # p \"-------Start #{start_date}--End #{end_date}-------\" \n\n var = start_date - freq.day\n # p \"----------var#{var}------------\"\n\n (start_date..end_date).step(freq) do |date|\n\n if (Date.today <= date) && seat_availability(bus,(date - day_offset.day))\n @buses << {\"user_id\" => current_user,\"bus_id\" => bus.id, \"date\" => date, \"start_date\" => (date - day_offset.day), \"start_time\" => bus_time.first.deperture ,\"route\" => LineColorRoute.find(line).name ,\"source\" => from_city.name.titleize, \"departure\" => bus_time.where(city: from_city.name).first.deperture,\"destination\" => to_city.name.titleize, \"arrival\" => bus_time.where(city: from_city.name).last.arrival }\n end\n \n end\n end\n end\n end\n @buses = @buses.sort_by{ |hash| hash[\"date\"]}\n end",
"def get_readings_from_remote_for_dates(type, start_date, end_date)\n\treadings = []\n\tstart_date.upto(end_date) do |date|\n\t\treadings += get_readings_from_remote(type, date)\n\tend\n\treturn readings\nend",
"def index\n if params[:date_range].blank?\n @time_slots = TimeSlot.all\n else\n input_start_time =\n input_end_time = \n @time_slots = TimeSlot.where(\"start_time > ? AND end_time < ?\", input_start_time, input_end_time)\n end\n end"
]
| [
"0.70361656",
"0.67197216",
"0.6327685",
"0.5927963",
"0.5920603",
"0.58066165",
"0.57762384",
"0.5687271",
"0.5667841",
"0.56143665",
"0.5585009",
"0.5533882",
"0.55060583",
"0.55009145",
"0.5492323",
"0.5470167",
"0.54546696",
"0.5426355",
"0.5423387",
"0.53829724",
"0.53286076",
"0.5327365",
"0.53218263",
"0.529688",
"0.52158326",
"0.5212603",
"0.5203236",
"0.51959413",
"0.5181069",
"0.51787245"
]
| 0.718394 | 0 |
Public api for returning all collisions for a given Range. The Range is transformed into a TimeBlock, and then pushed through the pipeline for natural detection of any collisions. | def collisions_for(range)
collider.detect TimeBlock.new(
start_time: range.begin,
end_time: range.end,
session: @session)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collide_hash_all(hash_rects)\n hash_rects.select { |key,value|\n value.collide_rect?+(self)\n }\n end",
"def collisions(rect)\n remain = visible_sprites(rect).to_a\n coll = remain.select { |item| item.intersect_rect? rect }\n [coll, coll - remain]\n end",
"def collisions\n [collided_bombs, collided_rubies]\n end",
"def check_collisions!\n 1000.times do\n @particles.values.map(&:tick)\n position_groups = @particles.values.group_by(&:position)\n collisions = position_groups.select { |pos, particles| particles.size > 1 }\n collisions.values.flatten.collect(&:num).map { |num| @particles.delete(num) }\n end\n @particles\n end",
"def collide_hash(hash_rects)\n hash_rects.each { |key,value|\n if value.collide_rect?+(self); return [key,value]; end\n }\n return nil\n end",
"def each_collision(game_object)\r\n start_x = (game_object.bb.left / @grid[0]).to_i\r\n stop_x = (game_object.bb.right / @grid[0]).to_i\r\n \r\n (start_x ... stop_x).each do |x|\r\n start_y = (game_object.bb.top / @grid[1]).to_i\r\n stop_y = (game_object.bb.bottom / @grid[1]).to_i\r\n \r\n (start_y ... stop_y).each do |y|\r\n yield @map[x][y] if @map[x] && @map[x][y] && @map[x][y] != game_object # Don't yield collisions with itself\r\n end\r\n end\r\n end",
"def calc_box_collision\n return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key\n collision_floor!\n collision_left!\n collision_right!\n collision_ceiling!\n end",
"def calc_box_collision\n return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key\n collision_floor\n collision_left\n collision_right\n collision_ceiling\n end",
"def collisions\n collider.detect(self)\n end",
"def dynamic_collisions(elems)\n rv = []\n elems.each do |elem|\n\n #TODO need to handle non circle types to get better bounds, at least linesegment\n cs = candidates(elem.collision_radius, elem.collision_center).flatten.select do|candidate|\n @collider.check_for_collision_by_type(elem, candidate)\n end\n rv += cs.collect {|cand| [elem, cand]}\n end\n rv\n end",
"def handle_collisions\n @collisions.map do |shape, collision_context|\n game_entity = @entity_manager.find_by_shape(shape)\n game_entity.on_collide(@entity_manager, collision_context) if game_entity\n end\n @collisions = []\n end",
"def getCollisionsToCheck\n @check_collision_list\n end",
"def get_range(range)\n r = []\n enum = range.to_enum\n begin\n while (x = enum.next) < @size\n r << get_single_key(x)\n end\n rescue StopIteration\n end\n r.empty? ? nil : r\n end",
"def each(&block)\r\n @range.each(&block)\r\n end",
"def collisions\n from = @rc\n mask = @game_board.dup\n if from\n queen = mask.element(*from)\n mask.set_at(*from,1)\n end\n rc = from\n collision_count = 0\n collision_count += mask.row(rc[0]).count {|e| e.class == Queen}\n collision_count += mask.column(rc[1]).count {|e| e.class == Queen}\n\n mask.rows.each_with_index do |row,index|\n p_row = @rc[0]+index\n m_row = @rc[0]-index\n p_col = @rc[1]+index\n m_col = @rc[1]-index\n a,b,c,d = [m_row,m_col],[m_row,p_col],[p_row,m_col],[p_row,p_col]\n valid_range = 0...mask.column_size\n collision_count+=1 if valid_range.include?(m_row) && valid_range.include?(m_col) && mask[*a].class == Queen\n collision_count+=1 if valid_range.include?(m_row) && valid_range.include?(p_col) && mask[*b].class == Queen\n collision_count+=1 if valid_range.include?(p_row) && valid_range.include?(m_col) && mask[*c].class == Queen\n collision_count+=1 if valid_range.include?(p_row) && valid_range.include?(p_col) && mask[*d].class == Queen\n end\n mask.set_at(*from,queen) if from\n collision_count\n end",
"def enemies_in_range(range)\n return case attacking_direction\n when :right\n @game_state.enemies.select do |e| \n (e.x > @x && e.x < (self.right + range)) && (e.bottom > @y || e.y < self.bottom)\n end\n when :left\n @game_state.enemies.select do |e| \n (e.right < @x && e.right > (@x - range)) && (e.bottom > @y || e.y < self.bottom)\n end\n when :up\n @game_state.enemies.select do |e| \n (e.bottom < @y && e.bottom > (@y - range)) && (e.right > @x && e.x < self.right)\n end\n when :down\n @game_state.enemies.select do |e| \n (e.y > self.bottom && e.y < (self.bottom + range)) && (e.right > @x && e.x < self.right)\n end\n end\n end",
"def collide_with_other_blocks\n @game.blocks.each do |block|\n if collide(block)\n return block\n end\n end\n nil\n end",
"def hit_objects\n game_state.game_object_map.collisions_with(self)\n #[game_state.game_object_map.from_game_object(self)]\n end",
"def collisions args\n num_balls = args.state.balls.length\n if num_balls > 1\n (0..num_balls - 1).each do |i|\n ball1 = args.state.balls[i]\n ((i + 1)..num_balls - 1).each do |j|\n ball2 = args.state.balls[j]\n dist = (((ball1[:x] - ball2[:x]) ** 2) + ((ball1[:y] - ball2[:y]) ** 2)) ** (1/2)\n if dist < args.state.ball_diameter\n args.state.collision_data = resolve_bump ball1, ball2, dist, args\n if i == 0 and args.state.first_collision_type == 3\n args.state.first_collision_type = ball2[:type]\n end\n args.state.balls_collided = true\n end\n end\n end\n end\nend",
"def range\n @cached_range ||= get_range\n end",
"def catch_collisions\n beam_collide_enemy = [:beam, :enemy]\n enemy_collide_spaceship = [:spaceship, :enemy]\n\n Constants::SPACE.add_collision_func(*beam_collide_enemy) do |beam_shape, enemy_shape|\n add_collided_shape(beam_shape, beam_collide_enemy)\n add_collided_shape(enemy_shape, beam_collide_enemy)\n end\n Constants::SPACE.add_collision_func(*enemy_collide_spaceship) do |spaceship_shape, enemy_shape|\n add_collided_shape(enemy_shape, enemy_collide_spaceship)\n add_collided_shape(spaceship_shape, enemy_collide_spaceship)\n end\n end",
"def collisions\n results = []\n\n carts.each do |cart_a|\n carts.each do |cart_b| \n if cart_a.position == cart_b.position && cart_a != cart_b\n results << [cart_a, cart_b]\n end\n end\n end\n\n results\n end",
"def check_block_availability(rooms, range)\n\t\t\tpossible_rooms = room_finder(range) # Returns available rooms in the given range.\n\t\t\tavail = []\n\n\t\t\trooms.each do |room|\n\t\t\t\tif possible_rooms.include?(room)\n\t\t\t\t\tavail << room\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn avail\n\t\tend",
"def valid_tickets\n @nearby_tickets.filter_map do |ticket|\n in_ranges = ticket.map do |val|\n merged_rules.map {|val_range| val_range.include?(val)}.include?(true)\n end\n ticket unless in_ranges.include?(false)\n end\n end",
"def front_rear_and_internal_collisions\n colliding_with.where(ended: false).where('reservations.starts_at' => range) + colliding_with.where('reservations.ends_at' => range)\n end",
"def available_rooms(range_query)\n all_rooms = @rooms.map {|room| room.number}\n\n conflicting_reservations = @reservations.find_all { |res| res.range.overlap?(range_query) == true }\n occupied_rooms = conflicting_reservations.map {|res| res.room_num}\n occupied_rooms = occupied_rooms.uniq\n\n available_rooms = all_rooms - occupied_rooms \n\n return available_rooms\n end",
"def maps_for_range(range)\n last = (range.exclude_end?) ? range.last : range.last + 1\n maps.select { |m| m.start_addr >= range.first and m.max < last }\n end",
"def time_range min, max\n spawn :@trange, [min, max].map { |e| time_to_long e }\n end",
"def check_node_overlap!\n node_to_positions = {}\n each_node do |node|\n node.proper_range.each do |position|\n if node_to_positions[position]\n already = node_to_positions[position]\n puts \"There is a proper_range overlap between #{node} and #{already}\"\n puts \"Overlapping: #{already.proper_range & node.proper_range}\"\n binding.pry\n end\n node_to_positions[position] = node\n end\n end\n end",
"def collisions(obj)\n return projectile_collisions(obj) if obj.is_a?(Projectile) && obj.keep?\n return powerup_collision(obj) if obj.is_a?(Powerup)\n return unless obj.is_a?(Ball) && obj.keep?\n player_collision(obj)\n #balls_collisions(obj)\n end"
]
| [
"0.6032244",
"0.5861564",
"0.5708567",
"0.56075084",
"0.5579013",
"0.5519869",
"0.54588366",
"0.5458093",
"0.5350583",
"0.52792895",
"0.5246726",
"0.5141044",
"0.50969744",
"0.5044568",
"0.5018214",
"0.49943906",
"0.49637446",
"0.49148008",
"0.49016166",
"0.48722035",
"0.4865291",
"0.4829549",
"0.4798508",
"0.47725752",
"0.47642615",
"0.47552037",
"0.47483826",
"0.47363093",
"0.47064456",
"0.46928605"
]
| 0.78286237 | 0 |
Return all valid TimeBlock(s) for a given base time. | def valid_blocks(base_time)
set_base_time(base_time)
time_entries = time_entries_for(base)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_time_blocks(time_blocks)\n b = time_blocks.select(&:collision_free?)\n\n # Test environment has unreliable data entry for start times.\n b = b.select(&:in_future?) unless Rails.env.test?\n\n b\n end",
"def available_delivery_blocks(time)\n\n unless opens_today\n return []\n end\n\n # Reset date to compare with Postgres Time\n time = time.change(:month => 1, :day => 1, :year => 2000)\n\n lead_time_for_block_time_slots = 1.hour\n\n all_slots = block_slots.select { |slot| slot[:from] >= (time + lead_time_for_block_time_slots) } +\n live_slots.select { |slot| slot[:from] >= (time) }\n\n all_slots.map do |slot|\n {\n :from => slot[:from].strftime('%H:%M'),\n :to => slot[:to].strftime('%H:%M'),\n :type => slot[:type]\n }\n end\n end",
"def get_block_time_list(filename)\n to_return = []\n lines = File.open(filename, \"rb\") {|f| f.read.split(/\\n+/)}\n lines.each do |line|\n next if line !~ /^Block times/\n values = []\n # Block times are given as a space-separated list of start,end pairs. They\n # are in units of seconds * 1e5, so convert them to seconds here for\n # consistency.\n if line =~ /^[^:]+: (.*?)\\s*$/\n values = $1.split(\" \").map{|r| r.split(\",\").map{|v| v.to_f / 1e5}}\n end\n to_return << values\n end\n to_return\nend",
"def generate_time_blocks(windows)\n results = windows.map do |window|\n\n # Create a date based n todays date, but with the time changed to\n # that of the entry start/end.\n entry_start = base.change(\n hour: window.start_time.hour,\n min: window.start_time.minute)\n\n # By rounding off with #floor, we go the easy route (no partial time blocks)\n # Note: iterator is zero based.\n blocks = (window.duration / block_size).floor.times.map { |i|\n\n start_time = Skej::Warp.zone(\n entry_start + (i * block_size).minutes,\n session.chosen_office.time_zone)\n\n end_time = Skej::Warp.zone(\n start_time + block_size.minutes,\n session.chosen_office.time_zone)\n\n target_day = Skej::NLP.parse(session, window.day)\n .strftime('%A')\n .downcase\n .to_sym\n\n TimeBlock.new(\n session: session,\n time_entry_id: window.time_entry.id,\n business_id: session.business_id,\n time_sheet_id: window.time_sheet_id,\n office_id: window.office_id,\n day: target_day,\n start_time: start_time,\n end_time: end_time)\n\n }\n end.flatten # results\n end",
"def validate_time_slots times\n time_models = []\n times.each do |time|\n t = TimeSlot.new(from: time[:from], to: time[:to], opinion_poll: @opinion_poll)\n\n bad_request t.errors.messages and return unless t.valid?\n time_models.append t\n end\n time_models\n end",
"def time_slots_for(time_entry)\n count = (duration_for(time_entry.range) / block_size).floor.to_i\n time = time_entry.start_time\n\n slots = count.times.map do |i|\n # Instantiate a new TimeSlot out of thin air (no backing store)\n slot = TimeSlot.new time, time + block_size.minutes, time_entry\n\n # Stash the current session onto the slot as well, so it may handle\n # some of it's own session based logic.\n slot.session = session\n\n # finally increment the time for the next iteration\n time = time + block_size.minutes\n\n slot\n end\n\n # Detect deadspace at the TimeSlot layer.\n # If found, we add a final TimeSlot to make up the difference.\n if time < time_entry.end_time\n slots << TimeSlot.new(time, time_entry.end_time, time_entry)\n end\n\n # Return the aggregated slot collection\n slots\n end",
"def time_slots\n collection=[]\n start_time=Time.now.beginning_of_hour\n end_time=Time.now.tomorrow.midnight-1.hour\n time=start_time\n\n while time < end_time\n collection<<[time.beginning_of_hour.hour, time.beginning_of_hour]\n time=time+1.hour\n end\n\n collection\n end",
"def default_time_slots\n start_time = Time.parse(\"9:00\")\n end_time = Time.parse(\"20:30\")\n slots = []\n t = start_time\n while t <= end_time\n slots << t.strftime(\"%H:%M\")\n t += 30.minutes;\n end\n\n slots\n end",
"def valid_appointments(base_time)\n transform_blocks_to_appointments(valid_blocks(base_time))\n end",
"def generate_time_slots(time_entries)\n time_entries.map { |entry| extract_available_slots(entry) }.flatten\n end",
"def block_slots\n slots = []\n\n unless block_delivery_end_time.blank? || block_delivery_start_time.blank?\n\n available_hours = block_delivery_end_time - block_delivery_start_time\n\n number_of_slots = available_hours / 60.minutes\n\n number_of_slots.to_i.times do |i|\n slots << {\n from: block_delivery_start_time + i.hours,\n to: block_delivery_start_time + (i + 1).hours,\n type: :daytime\n }\n end\n end\n\n slots\n end",
"def index\n @time_blocks = TimeBlock.all\n end",
"def time_to_block(time)\n Rational(time / time_divisor).floor * time_divisor\n end",
"def makeBlocks(days, startTimeString, endTimeString, info)\n\tblocks = []\n\tdays.split(\"\").each do |d|\n\t\tb = SCHBlock.new(d, startTimeString, endTimeString, info)\n\t\tblocks << b\n\tend\n\t(blocks)\nend",
"def time_fragments\n []\n end",
"def available_on(base_time)\n # Stash this for future use, as we will be using it to set a\n # baseline date in order to derive a bunch of different appointments\n # from.\n set_base_time(base_time)\n\n # Fetch all TimeEntris related for this date query.\n time_entries = time_entries_for(base)\n\n # Transform TimeEntry(s) -> TimeSlot(s).\n available_slots = generate_time_slots(time_entries)\n\n # Combine all sequential linear slots to into a single window.\n # This produces multiple windows\n windows = combine_linear_slots(available_slots)\n\n # Generate TimeBlocks from the Available Slot ranges\n open_time_blocks = generate_time_blocks(windows)\n\n # Optimize & Filter our wide collection of TimeBlocks.\n optimized_blocks = optimize_time_blocks(open_time_blocks)\n\n # Finally, present the TimeBlock(s) as Appointment records\n # to the Customer.\n final = transform_blocks_to_appointments(optimized_blocks)\n end",
"def timeslots\n unless @timeslots.present?\n timeslots = Timeslot\n .timeslots_for(@schedule_range, @form)\n .select { |ts| ts.blocks >= @blocks_needed }\n timeslots = @schedule_range.all_timeslots if timeslots.empty?\n @timeslots = timeslots.sort_by { |ts| [ts.day_id, ts.start_minute] }\n end\n\n @timeslots\n end",
"def get_busy_slots(start_min, start_max, time_zone)\n result = Array.new\n @googleCalendars.each do |x|\n result.push(x[:connection].query([x[:id]],start_min, start_max, time_zone))\n end\n return result\n end",
"def time_block_params\n params[:time_block]\n end",
"def get_all_thermal_blocks()\n zones = find_all_commands(\"ZONE\")\n end",
"def time_slots\n\n # you can book by the hour, and you can stay for an hour\n reservation_interval = 1.hour\n\n # Determine the earliest time we will allow reservation\n # It can't be in the past, we'll start 10 minutes from now\n start_time = Time.zone.now + 10.minutes\n # Then we have to round to the next hour block\n start_time = Time.zone.at( (start_time.to_f / reservation_interval).ceil * reservation_interval )\n # Then, if we are still earlier than opening hour, just use the opening hour\n # We can use the 'max' Array method\n start_time = [start_time, start_time.change(hour: opening_hour)].max\n\n # Determine the furthest in the future we will allow reservations\n end_time = (start_time + 3.days).change(hour: closing_hour)\n\n # Now, we want to make a list of every hour between our start_time and our end_time\n # For this we can use a begin... end while condition loop.\n # We'll start with an empty array that will hold all the hours,\n # and a variable to hold each hour, which we will keep increasing by 1 hour, and then add to our array\n # Our loop condition will have us stop looping once we've reached the end time\n\n all_times = []\n a_time = start_time\n\n begin\n\n # add this time to our list of times\n all_times << a_time\n\n # increment the time\n a_time += reservation_interval\n\n # Once we get to closing time, we have to skip ahead to the next day's opening\n # That way you can't make a reservation at 2am\n if (a_time + reservation_interval) > a_time.change(hour: closing_hour)\n a_time = (a_time + 1.day).change(hour:opening_hour)\n end\n\n end while a_time < end_time\n\n all_times\n end",
"def slots\n slot_start = start_time\n slot_end = slot_start + slot_length\n while slot_end <= end_time\n slot = ::V2::TimeSlot.new(start_time: slot_start, end_time: slot_end, event_id: @event_id)\n @slots << slot if slot.valid? && slot.save\n slot_start = slot_end + buffer\n slot_end = slot_start + slot_length\n end\n\n @slots\n end",
"def get_acceptable_call_times\n AvailableTime.all.map{|m|\n if m.pharmacy_id == self.id #should be interger already but casting just in case\n {\"start\" => m.start_time.strftime(\"%H:%M:%S\"), \"stop\" => m.end_time.strftime(\"%H:%M:%S\")}\n else\n nil\n end\n }.compact\n end",
"def get_all_blocks\n\n @all_blocks = Block.where(is_published: 't')\n\n end",
"def valid_schedule?(time_blocks)\n time_blocks = quicksort_timeblocks(time_blocks)\n return !exists_overlap?(time_blocks)\n end",
"def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt) ? break : ''\n @times.push(tmp)\n end\n end",
"def get_time_slot_array\n time_slot_array = [\"07:00\", \"07:30\", \"08:00\", \"08:30\", \"09:00\", \"09:30\", \"10:00\", \"10:30\",\n \"11:00\", \"11:30\", \"12:00\", \"12:30\", \"13:00\", \"13:30\", \"14:00\", \"14:30\",\n \"15:00\", \"15:30\", \"16:00\", \"16:30\", \"17:00\", \"17:30\", \"18:00\", \"18:30\",\n \"19:00\", \"19:30\", \"20:00\", \"20:30\", \"21:00\"]\n end",
"def timeslots\n\t\tif (self != nil)\n\t\t\tcompany = self.company\n\t\t\tstart_time = company.start_time\n\t\t\tend_time = company.end_time\n\t\t\tcompany_duration = (( end_time - start_time )/60).round(2)\n\t\t\tno_of_slots = ( company_duration / (self.time_slot.hour*60 + self.time_slot.min) ).to_i\n\t\t\ttime_slot_array =Array.new\n\t\t\tremember_hour = start_time.hour.round\n\t\t\tremember_min = start_time.min\n\t\t\tno_of_slots.times do | index |\n\t\t\t\ta = remember_hour == 0 ? \"00\" : remember_hour\n\t\t\t\tb = remember_min == 0 ? \"00\" : remember_min\n\t\t\t\tc = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour == 0 ? \"00\" :((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\td = (remember_min + self.time_slot.min) % 60 == 0 ? \"00\" : (remember_min + self.time_slot.min) % 60\n\t\t\t\ttime_slot_array << [\"#{a}:#{b}-#{c}:#{d}\", index]\n\t\t\t\tremember_hour = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\tremember_min = (remember_min + self.time_slot.min) % 60\n\t\t\tend\n\t\t\ttime_slot_array\n\t\tend\n\tend",
"def all_timeslots\n unless @all_timeslots.present?\n @all_timeslots = (1..5).map do |day_id|\n Timeslot.new(self, day_id, @day_start_minute, @day_end_minute)\n end\n end\n\n @all_timeslots\n end",
"def unfinished_dispatch_time_ranges\n dispatches.where(safe_return: false).map(&:active_time_window)\n end"
]
| [
"0.6995972",
"0.666866",
"0.61515516",
"0.60989684",
"0.6043392",
"0.6019025",
"0.57999414",
"0.5793993",
"0.5751547",
"0.56786937",
"0.5677315",
"0.5637624",
"0.5597517",
"0.55707026",
"0.55529094",
"0.5491499",
"0.5484656",
"0.5475232",
"0.54654413",
"0.5422617",
"0.5392022",
"0.5366929",
"0.5350359",
"0.52865314",
"0.5268814",
"0.52152836",
"0.5203646",
"0.5186633",
"0.51743",
"0.5164157"
]
| 0.8538772 | 0 |
Returns all valid Appointments for a given base time. | def valid_appointments(base_time)
transform_blocks_to_appointments(valid_blocks(base_time))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_appointments\n # Appointment\n return unless current_user\n @appointments = current_user.appointments\n\n clean_open_appointments = sanatize_open_appointments(current_user.open_appointments)\n @pending_requests = clean_open_appointments.group_by do |d|\n start_date = set_in_timezone(d.start_date, current_user.id)\n start_date.strftime('%A %B %d')\n end\n\n @in_progress_appointments = current_user\n .in_progress_appointments.group_by do |d|\n start_date = set_in_timezone(d.start_date, current_user.id)\n start_date.strftime('%A %B %d')\n end\n @scheduled_appointments = current_user.scheduled_appointments\n .group_by do |d|\n start_date = set_in_timezone(d.start_date, current_user.id)\n start_date.strftime('%A %B %d')\n end\n\n @past_appointments = past_appointments.group_by do |d|\n start_date = set_in_timezone(d.start_date, current_user.id)\n start_date.strftime('%A %B %d')\n end\n\n @appointments = current_user.appointments\n\n # Appointment Packs\n @appointment_packs = active_appointment_packs\n @past_appointment_packs = past_appointment_packs\n end",
"def available_on(base_time)\n # Stash this for future use, as we will be using it to set a\n # baseline date in order to derive a bunch of different appointments\n # from.\n set_base_time(base_time)\n\n # Fetch all TimeEntris related for this date query.\n time_entries = time_entries_for(base)\n\n # Transform TimeEntry(s) -> TimeSlot(s).\n available_slots = generate_time_slots(time_entries)\n\n # Combine all sequential linear slots to into a single window.\n # This produces multiple windows\n windows = combine_linear_slots(available_slots)\n\n # Generate TimeBlocks from the Available Slot ranges\n open_time_blocks = generate_time_blocks(windows)\n\n # Optimize & Filter our wide collection of TimeBlocks.\n optimized_blocks = optimize_time_blocks(open_time_blocks)\n\n # Finally, present the TimeBlock(s) as Appointment records\n # to the Customer.\n final = transform_blocks_to_appointments(optimized_blocks)\n end",
"def appointments(params = {})\n scope 'user_schedule'\n get('schedule/appointments/', params)\n end",
"def index\n if !time_slot_params[:start].present? && !time_slot_params[:end].present?\n @appointments = Appointment.all\n else\n #time_slot_params[:start], time_slot_params[:end]\n @appointments = Appointment.in_time_slot_only(time_slot_params).all\n end\n render :json => @appointments, :status => :ok\n end",
"def appointments\n Appointment.all(contact: to_s)\n end",
"def missed_appointments\n appointments = Observation.joins(:encounter)\n .merge(appointment_encounters)\n .where.not(person_id: referral_patients.select(:person_id))\n .where(concept: ConceptName.where(name: 'Appointment date').select(:concept_id))\n .where('value_datetime BETWEEN ? AND ? AND encounter.program_id = ?',\n @start_date.strftime('%Y-%m-%d 00:00:00'),\n @end_date.strftime('%Y-%m-%d 23:59:59'), 1)\n .group(:person_id)\n\n appointments.each_with_object([]) do |appointment, patients|\n patient = missed_appointment?(appointment)\n\n patients << patient unless patient.blank?\n end\n end",
"def appointments(officer_id)\n client.get(\"officers/#{officer_id}/appointments/\")\n end",
"def index\n appointment_can_cancel_and_reschedule\n\n # If patient already had a dose, keep it in the same UBS.\n # This is an optimized query, hence a little odd using +pick+s.\n ubs_id = Appointment.where(id: current_patient.doses.pick(:appointment_id)).pick(:ubs_id)\n\n # Otherwise limit to where they can schedule\n ubs_id = allowed_ubs_ids if ubs_id.blank?\n\n @days = parse_days\n @appointments = scheduler.open_times_per_ubs(from: @days.days.from_now.beginning_of_day,\n to: @days.days.from_now.end_of_day,\n filter_ubs_id: ubs_id)\n rescue AppointmentScheduler::NoFreeSlotsAhead\n redirect_to home_community_appointments_path, flash: { alert: 'Não há vagas disponíveis para reagendamento.' }\n end",
"def appointments\n Appointment.all.filter { |appointment| appointment.provider_id == self.id || appointment.user_id == self.id}\n end",
"def get_appts\n @user = current_user\n @appointments = @user.appointments.actual.includes(:status, :address, :assignments, {:subscription => :subscriptionable}, :employees, :team)\n # filter by the datetime object via params from fullcalendar\n filter_show = ActiveSupport::JSON.decode(params[:filter_show])\n appointments_in_range = @appointments.where(\"appointments.start_time >= :start_time AND appointments.start_time <= :end_time\", {:start_time => Time.at(params['start'].to_i), :end_time => Time.at(params['end'].to_i)} )\n events = []\n appointments_in_range.each do |appointment|\n if appointment_is_allowed?(appointment, filter_show)\n customer = appointment.subscription.subscriptionable\n eventHash = {:id => appointment.id, :title => calendar_title(appointment, customer), :start => \"#{appointment.start_time.iso8601}\", :end => \"#{appointment.end_time.iso8601}\", :allDay => false, :recurring => appointment.subscription.repeat }\n\n eventHash[:backgroundColor] = event_background_color(appointment, params[:event_color])\n eventHash[:borderColor] = eventHash[:backgroundColor]\n\n events << eventHash\n # optional day view\n #events << {:id => event.id, :title => @customer_name, :url => \"/appointments/\"+event.id.to_s+\"/edit\", :description => \"Description here\", :start => \"#{event.start_time.iso8601}\", :end => \"#{event.end_time.iso8601}\", :allDay => true}\n end\n end\n render :json => events\n end",
"def set_appointments\n @appointments = []\n latest_message = Message.order('created_at').last\n lines = latest_message.message_lines.where(order: params[:Body].split(' ').map(&:to_i))\n lines.each do |line|\n @appointments << line.appointment\n end\n end",
"def fetch_appointments(obj, t_d)\n (z = obj.state.appointments_for_dates[t_d]) ? z : {}\n # x = (z = obj.state.appointment_availabilities[t_d]) ? z : {}\n # begining = Moment.new(t_d).set(hour: 9).format()\n # ending = Moment.new(t_d).set(hour: 19).format()\n # x.each do |k, v|\n # v.each do |av|\n # break if av.map.is_a? Array\n # p_av = JSON.parse(av.map).each_slice(2).to_a.sort {|x, y| x[1] <=> y[1]} unless av.map.length == 1\n # p_av.unshift([begining, begining])\n # p_av.push([ending, ending])\n # _map = []\n # i = 0\n # while i < (p_av.length - 1)\n # first = Moment.new p_av[i][1]\n # second = Moment.new p_av[i + 1][0]\n # d = second.diff(first, \"minutes\")\n # if d > 20\n # _map << [first, second]\n # end\n # i += 1\n # end\n # av.map = _map\n # end\n # end \n # x\n end",
"def validate_time(start_time, end_time)\n\t\t\t\ttime_now = Time.now.strftime(\"%m/%d/%Y %H:%M\")\n\t\t\t\tappointments = Appointment.all\n\t\t\t\ttoday = start_time.split[0]\n\t\t\t\ttoday_appts = appointments.where(start_time: today)\n\t\t\t\tresult = false\n\n\t\t\t\tif start_time > time_now\n\t\t\t\t\tif today_appts.length == 0\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\t\ttoday_appts.each do |appt|\n\t\t\t\t\t\tif start_time <= appt.end_time && appt.start_time <= end_time\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tresult = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend#end of each loop\n\t\t\t\tend#end of if start_time\n\t\t\t\tresult\n\t\t\tend",
"def index\n @appointment = current_patient.appointments.not_checked_in.current\n if @appointment && [email protected]_cancel_and_reschedule?\n return redirect_to(\n home_community_appointments_path,\n flash: { alert: t('alerts.cannot_cancel_or_reschedule', days: Rails.configuration.x.schedule_up_to_days) }\n )\n end\n\n @days = parse_days\n @appointments = scheduler.open_times_per_ubs(from: @days.days.from_now.beginning_of_day,\n to: @days.days.from_now.end_of_day)\n rescue AppointmentScheduler::NoFreeSlotsAhead\n redirect_to home_community_appointments_path, flash: { alert: 'Não há vagas disponíveis para reagendamento.' }\n end",
"def appointments\n # 1. access the Appt's @@all variable\n # 2. from there, select only the appoints whose doctor is self\n Appointment.all.select{|appointment| appointment.doctor == self}\n end",
"def appointments\n Appointment.all.select { |x| x.patient == self }\n end",
"def appointments\r\n Appointment.all.collect do\r\n\t\t\t|appt| appt if appt.doctor == self\r\n\t\tend\r\n\tend",
"def appointments\n Appointment.all.collect do\n\t\t\t|appt| appt if appt.doctor == self\n\t\tend\n\tend",
"def my_appointments(user)\n Appointment.where(user_id: user.id)\n end",
"def appointments_on(date)\n appointments.starts_on(date).to_a\n end",
"def check_overlap\n appointments = Appointment.all\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time\n\n appointments.each do |appt|\n appt_start = DateTime.strptime(appt.start_time,\"%m/%d/%y %H:%M\").to_time\n appt_end = DateTime.strptime(appt.end_time,\"%m/%d/%y %H:%M\").to_time\n\n ## if the appointment being checked is a new appointment ##\n if @new_appt\n if current_start >= appt_start && current_start <= appt_end\n @valid = false\n elsif current_end >= appt_start && current_end <= appt_end\n @valid = false\n end\n\n ## if the appointment being checked is an old appointment being updated ##\n else\n if current_start > appt_start && current_start < appt_end\n @valid = false\n elsif current_end > appt_start && current_end < appt_end\n @valid = false\n end\n end\n\n end\n @valid\n p @valid\n end",
"def appointment_unique_with_doctor_in_clinic\n times_taken = []\n begin\n self.doctor.appointments.confirmed.each do |appt|\n unless appt.id == self.id\n times_taken << appt.appointment_time\n end\n end\n rescue NoMethodError\n errors.add(:doctor_id, 'No doctor specified')\n end\n errors.add(:appointment_time, \"Time not available\") if times_taken.include?(appointment_time)\n end",
"def appointments\n Appointment.all.select {|appt| appt.patient == self}\n end",
"def remaining_appointments_today\n Appointment.today.with_doctor(doctor_id).\n where(appointment_time: appointment_time+1.minute...DateTime.tomorrow)\n end",
"def approval\n @appointments = Appointment.in_clinic(@admin).requests.\n order_by_time.includes(:doctor, :patient).not_past\n end",
"def populate_with_appointments(\n appointments_start_dates\n )\n appointments_start_dates.each do |start_date|\n expert = Expert.find(expert_id)\n if expert.available_for_datetime(start_date)\n appointment = appointments.new(\n user_id: user_id,\n service_id: service_id,\n expert_id: expert_id,\n description: description,\n start_date: start_date,\n duration_in_min: service.duration_in_min,\n type: 'OpenAppointment'\n )\n\n if appointment.save\n appointments << appointment\n true\n else\n puts \"---- 🔸 FAILURE | while saving appointment \\\n error:#{appointment.errors.messages}🔸\\\n in populate_with_appointments\"\n false\n end\n else\n puts \"---- 🔸 FAILURE | Expert(#{expert.id}) not available for \\\n start_date #{start_date}🔸in populate_with_appointments\"\n return false\n end\n end\n end",
"def validate_time_slots times\n time_models = []\n times.each do |time|\n t = TimeSlot.new(from: time[:from], to: time[:to], opinion_poll: @opinion_poll)\n\n bad_request t.errors.messages and return unless t.valid?\n time_models.append t\n end\n time_models\n end",
"def time_collision_validation\n\t\tappointments = Appointment.all\n\n\t\t#if duration is equals to 0, it means it is fixed pay. \n\t\t#Here, duration is set to 0 so it will not be validated \n\t\t#This will execute if is_pay_per hour is set to 0\n\t\tif @start_date.present? && @start_time.present? && duration == 0.to_s\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\n\t\t\tappointments.each do |a|\n\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t# compare fixed-pay input to pay per hour appointment\n\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && start_at >= a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"An appointment is already \n\t\t\t\t\t\t\tset at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\n\n\t\t\t\t\t\t#compare fixed-pay input to fixed pay appointment\n\t\t\t\t\telsif !a.task.is_pay_per_hour && start_at == a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend \t\n\t\t\t\tend \t\n\t\t\tend\n\n\n\t\t\t\t#Here, duration should be present and will be always validated\n\t\t\t\t#This will execute if is_pay_per hour is set to 1\n\t\t\telsif @start_date.present? && @start_time.present? && duration.present?\n\t\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\tend_at = Time.parse(\"#{@start_date} #{@start_time}\") + (@duration.to_f.hours+ (1.hours))\n\n\t\t\t\tappointments.each do |a|\n\t\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t\t# compare pay per hour input to pay per hour appointment\n\t\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && a.start_at < end_at \n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"An appointment already \n\t\t\t\t\t\t\t\texists at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\n\n\t\t\t\t\t\t\t#compare pay per hour input to fixed pay appointment\n\t\t\t\t\t\telsif !a.task.is_pay_per_hour && a.start_at <= end_at && a.start_at >= start_at\n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\t\t\t\t\n\t\t\t\t\t\tend\t\t\t\n\t\t\t\t\tend \n\t\t\t\tend\n\t\t\tend \n\t\tend",
"def index\n @request = current_user.requests.last\n @appointments = current_user.appointments\n @appointments_uncomplete = current_user.appointments.completed_false\n @appointment = Appointment.new\n end",
"def appointment(params = {})\n @appointment_id = params.delete :appointment_id\n scope 'user_schedule'\n\n get_one('schedule/appointmenttypes/', @appointment_id, params)\n end"
]
| [
"0.7045828",
"0.6885598",
"0.6717285",
"0.6605498",
"0.6413851",
"0.63946986",
"0.63369745",
"0.6309198",
"0.6276353",
"0.6226337",
"0.61962336",
"0.61922294",
"0.6171634",
"0.6166286",
"0.6164967",
"0.616016",
"0.60806805",
"0.60776097",
"0.6060947",
"0.60355353",
"0.60132176",
"0.59426355",
"0.59293175",
"0.5899311",
"0.58493906",
"0.58325523",
"0.5817051",
"0.58087194",
"0.58079076",
"0.57700557"
]
| 0.8377896 | 0 |
Get all TimeEntry(s) that match the current session properties. +:target_date+ A DateTime to base the TimeEntry collection query from. | def time_entries_for(target_date)
target_day = Skej::NLP.parse(session, target_date.to_s)
.strftime('%A')
.downcase
.to_sym
TimeEntry.where(build_query_params).with_day(target_day).map do |entry|
entry.session = session and entry
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_entries\n get_ticket_property_list(\"time_entries\" , Unfuddled::TimeEntry)\n end",
"def get_time_entries(start_date=nil, end_date=nil)\n options = Hash.new\n options[\"start_date\"] = iso8601_date(start_date) if start_date\n options[\"end_date\"] = iso8601_date(end_date) if end_date\n get \"/time_entries\", options\n end",
"def entries\n settings.time_entries.present? ? settings.time_entries : []\n end",
"def time_entries(options = {})\n entries = []\n time_invested(options).groups.each { |g| entries << g[\"time_entries\"] }\n\n process_list_response( entries.flatten , Unfuddled::TimeEntry )\n end",
"def time_entries(start_date, end_date)\n opts = {\n params: {\n start_date: start_date.to_datetime.iso8601,\n end_date: end_date.to_datetime.iso8601\n }\n }\n\n begin\n response = toggl_resource['time_entries'].get(opts)\n rescue => e\n raise 'Error getting Toggl data: ' + e.response\n end\n data = JSON.parse response\n\n data.map do |entry|\n duration = entry['duration'].to_f\n\n # Negative duration means the task is currently running.\n # In this case, we'll set duration to how long it's been running\n if duration < 0\n duration = Time.now - Time.at(duration.abs)\n end\n\n {\n description: entry['description'],\n start: Date.parse(entry['start']),\n duration: duration\n }\n end\n end",
"def time_log_entries(user_id, started_at, stopped_at, project_id)\n result = TimeLogEntry::Flex.by_user(user_id)\n if started_at.present? && stopped_at.present?\n result = result.after_stopped_at(started_at.sub(' ', 'T'))\n result = result.before_started_at(stopped_at.sub(' ', 'T'))\n end\n result = result.by_project(project_id) if project_id.present?\n result.map{ |found_element| found_element['_source'] }\n end",
"def all_matchday_times\n all_matches = fetch_matches\n matchtimes = Hash[(1..38).collect { |md| [md, []] }]\n all_matches.each do |m|\n matchtimes[m['matchday']].push(m['utcDate'])\n end\n matchtimes\n end",
"def index\n @session_times = SessionTime.all\n end",
"def index\n @records = current_user.records.order(target_date: :desc)\n end",
"def extract_target_entries\n extract_host_entries\n extract_event_entries\n extract_service_entries\n extract_note_entries\n extract_vuln_entries\n extract_web_entries\n end",
"def time_entry_scope(options={})\n @query.results_scope(options)\n end",
"def time_entry_scope(options={})\n @query.results_scope(options)\n end",
"def entries\n if @group_by\n most_recent_matching_entry_in_group\n elsif @most_recent_only\n Array(most_recent_matching_entry)\n elsif @created_within\n get_created_within\n else\n matching_entries\n end\n end",
"def find\n return nil unless entry_paths.any?\n past_entries = entry_paths.map do |path|\n match = path.match(DATE_PATH_MATCHER)\n Date.parse(match.to_s)\n end.select { |date| date < today }\n\n past_entries.last\n end",
"def get_entries(date = nil)\r\n if date.nil?\r\n list = []\r\n for i in @log\r\n list.push(i)\r\n end\r\n elsif @log[date].nil?\r\n list = nil\r\n else\r\n list = @log[date]\r\n end\r\n list\r\n end",
"def filtered_by_target(target)\n filtered_by_association(\"target\", target)\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def hits_for_day(timestamp)\n properties = Advert.where(user_id: self.id).pluck(:property_id)\n beg_time = Time.zone.at(timestamp).beginning_of_day\n end_time = Time.zone.at(timestamp).end_of_day\n Hit.where(\"property_id IN (?)\", properties).where(created_at: beg_time..end_time).all\n end",
"def list_targets\n # Date is the current date per RFC 2616, section 3.3.1,\n # rfc1123-date format, e.g.: Sun, 22 Apr #2012 08:49:37 GMT.\n date_timestamp = Time.now.httpdate # ruby provides this date format with httpdate method\n signature = build_signature(\"/targets\", nil, \"GET\", date_timestamp)\n raise ArgumentError.new(\"Signature returned nil. Aborting...\") if signature.nil?\n\n authorization_header = \"VWS \" + @accesskey + \":\" + signature\n begin\n RestClient.get(TARGETS_URL, Date: date_timestamp, Authorization: authorization_header)\n rescue => e\n e.response\n end\n end",
"def matchdays_times_for(matchdays)\n all_matches = fetch_matches_scheduled\n matchtimes = Hash[matchdays.collect { |md| [md, []] }]\n all_matches.each do |m|\n next unless matchdays.include?(m['matchday'])\n\n matchtimes[m['matchday']].push(m['utcDate'])\n end\n matchtimes\n end",
"def list(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil)\n self.stream(\n to: to,\n from: from,\n parent_call_sid: parent_call_sid,\n status: status,\n start_time: start_time,\n start_time_before: start_time_before,\n start_time_after: start_time_after,\n end_time: end_time,\n end_time_before: end_time_before,\n end_time_after: end_time_after,\n limit: limit,\n page_size: page_size\n ).entries\n end",
"def show\n @event = Event.find(params[:id])\n @times_allowed = @event.times_allowed.map(&:to_datetime)\n @participants = @event.participants\n end",
"def time_entry(id:)\n ::TimeEntry.find_by(id: id)\n end",
"def all_people_scheduled\n Entry.users_for_client(self.id)\n end",
"def fetch_events_time(range_begin_in_secs, range_end_in_secs)\n #\n # collect from_time beginning of day (in seconds)\n #\n frt = self.from_time.beginning_of_day.to_i\n\n case self.recurrence_type\n when \"NO_RECURRENCE\"\n self.no_recurrence_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_DAYS\"\n self.recur_every_n_days_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_WEEKS\"\n self.recur_every_n_weeks_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_MONTHS\"\n self.recur_every_n_months_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_N_YEARS\"\n self.recur_every_n_years_dates(range_begin_in_secs, range_end_in_secs, frt)\n when \"EVERY_DAYS_OF_WEEK\"\n self.recur_every_days_of_week_dates(range_begin_in_secs, range_end_in_secs, frt)\n else\n []\n end\n end",
"def history_timestamps\n self.class.history.timestamps do |query|\n query.where(:id => self)\n end\n end",
"def show\n\t\tif current_user.caregiver\n\t\t\t@target\t= current_user.caregiver\n\t\t\tif params[:related_id]\n\t\t\t\t@related_user = Requester.find(params[:related_id])\n\t\t\telse\t\n\t\t\t\t@related_user = Requester.find(params[:id])\n\t\t\tend\n\t\t\t@schedules = @target.schedules.where(:requester => @related_user).where([\"scheduled_date >=?\",@@target_date - 2.days]).where([\"scheduled_date <?\",@@target_date + 2.days]).order(\"scheduled_date Asc\")\n\t\telse\n\t\t\t@target\t= current_user.requester\n\t\t\tif params[:related_id]\n\t\t\t\t@related_user = Caregiver.find(params[:related_id])\n\t\t\telse\n\t\t\t\t@related_user = Caregiver.find(params[:id])\n\t\t\tend\t\n\t\t\t@schedules = @target.schedules.where(:caregiver => @related_user).where([\"scheduled_date >=?\", @@target_date - 2.days]).where([\"scheduled_date <?\",@@target_date + 2.days]).order(\"scheduled_date Asc\")\n\t\tend\n\t\t@schedule_dates = @schedules.pluck(:scheduled_date).uniq\n\t\t@schedule_ids = @schedules.pluck(:id).uniq\n\t\t@timezones = TimeZone.find(@schedules.includes(:events).pluck(:time_zone_id).uniq)\n\t\t# no use:\n\t\t# @schedules = @requester.caregivers.where(:user => current_user).uniq.first.schedules\n\t\t# @schedules = Schedule.includes(:events).where(:requester_id => @requester_id)\n\t\t# @schedules = Schedule.where([\"scheduled_date>?\", Time.now]).where([\"scheduled_date<?\",Time.now + 7.days]).find_by_id(@requester.events.includes(:schedule).pluck(:schedule_id))\n\tend",
"def index\n @logs ||= Log.where(device_id: selected_device).order(created_at: :desc)\n unless params[:start_time].blank?\n start_date = DateTime.parse(\"#{params[:start_time]} 00:00:00\")\n @logs = @logs.where(\"created_at >= :start_time\", {start_time: start_date})\n end\n\n unless params[:end_time].blank?\n end_date = DateTime.parse(\"#{params[:end_time]} 23:59:59\")\n @logs = @logs.where(\"created_at <= :end_time\", {end_time: end_date})\n end\n end"
]
| [
"0.5922868",
"0.5683903",
"0.5566405",
"0.53385276",
"0.5298395",
"0.52521545",
"0.5115447",
"0.50400954",
"0.48718688",
"0.48286006",
"0.48045316",
"0.48045316",
"0.4798784",
"0.47657496",
"0.47596595",
"0.4755274",
"0.4742012",
"0.4742012",
"0.4742012",
"0.47243476",
"0.47109145",
"0.47024012",
"0.46744612",
"0.4661811",
"0.4648173",
"0.46476164",
"0.46442735",
"0.46428186",
"0.46378818",
"0.4636532"
]
| 0.8224443 | 0 |
Produces TimeSlot(s) from a collection of TimeEntries | def generate_time_slots(time_entries)
time_entries.map { |entry| extract_available_slots(entry) }.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_slots_for(time_entry)\n count = (duration_for(time_entry.range) / block_size).floor.to_i\n time = time_entry.start_time\n\n slots = count.times.map do |i|\n # Instantiate a new TimeSlot out of thin air (no backing store)\n slot = TimeSlot.new time, time + block_size.minutes, time_entry\n\n # Stash the current session onto the slot as well, so it may handle\n # some of it's own session based logic.\n slot.session = session\n\n # finally increment the time for the next iteration\n time = time + block_size.minutes\n\n slot\n end\n\n # Detect deadspace at the TimeSlot layer.\n # If found, we add a final TimeSlot to make up the difference.\n if time < time_entry.end_time\n slots << TimeSlot.new(time, time_entry.end_time, time_entry)\n end\n\n # Return the aggregated slot collection\n slots\n end",
"def time_slots\n collection=[]\n start_time=Time.now.beginning_of_hour\n end_time=Time.now.tomorrow.midnight-1.hour\n time=start_time\n\n while time < end_time\n collection<<[time.beginning_of_hour.hour, time.beginning_of_hour]\n time=time+1.hour\n end\n\n collection\n end",
"def timeslots\n data['timeslots'].map { |ts|\n Timeslot.new(\n Time.at(ts['start_date']),\n Time.at(ts['end_date'] || ts['start_date']),\n data['timezone']\n )\n }.reject(&:finished?).sort_by(&:start_date)\n end",
"def get_time_slot_array\n time_slot_array = [\"07:00\", \"07:30\", \"08:00\", \"08:30\", \"09:00\", \"09:30\", \"10:00\", \"10:30\",\n \"11:00\", \"11:30\", \"12:00\", \"12:30\", \"13:00\", \"13:30\", \"14:00\", \"14:30\",\n \"15:00\", \"15:30\", \"16:00\", \"16:30\", \"17:00\", \"17:30\", \"18:00\", \"18:30\",\n \"19:00\", \"19:30\", \"20:00\", \"20:30\", \"21:00\"]\n end",
"def time_entries(options = {})\n entries = []\n time_invested(options).groups.each { |g| entries << g[\"time_entries\"] }\n\n process_list_response( entries.flatten , Unfuddled::TimeEntry )\n end",
"def slots\n slot_start = start_time\n slot_end = slot_start + slot_length\n while slot_end <= end_time\n slot = ::V2::TimeSlot.new(start_time: slot_start, end_time: slot_end, event_id: @event_id)\n @slots << slot if slot.valid? && slot.save\n slot_start = slot_end + buffer\n slot_end = slot_start + slot_length\n end\n\n @slots\n end",
"def all_timeslots\n unless @all_timeslots.present?\n @all_timeslots = (1..5).map do |day_id|\n Timeslot.new(self, day_id, @day_start_minute, @day_end_minute)\n end\n end\n\n @all_timeslots\n end",
"def time_slots\n\n # you can book by the hour, and you can stay for an hour\n reservation_interval = 1.hour\n\n # Determine the earliest time we will allow reservation\n # It can't be in the past, we'll start 10 minutes from now\n start_time = Time.zone.now + 10.minutes\n # Then we have to round to the next hour block\n start_time = Time.zone.at( (start_time.to_f / reservation_interval).ceil * reservation_interval )\n # Then, if we are still earlier than opening hour, just use the opening hour\n # We can use the 'max' Array method\n start_time = [start_time, start_time.change(hour: opening_hour)].max\n\n # Determine the furthest in the future we will allow reservations\n end_time = (start_time + 3.days).change(hour: closing_hour)\n\n # Now, we want to make a list of every hour between our start_time and our end_time\n # For this we can use a begin... end while condition loop.\n # We'll start with an empty array that will hold all the hours,\n # and a variable to hold each hour, which we will keep increasing by 1 hour, and then add to our array\n # Our loop condition will have us stop looping once we've reached the end time\n\n all_times = []\n a_time = start_time\n\n begin\n\n # add this time to our list of times\n all_times << a_time\n\n # increment the time\n a_time += reservation_interval\n\n # Once we get to closing time, we have to skip ahead to the next day's opening\n # That way you can't make a reservation at 2am\n if (a_time + reservation_interval) > a_time.change(hour: closing_hour)\n a_time = (a_time + 1.day).change(hour:opening_hour)\n end\n\n end while a_time < end_time\n\n all_times\n end",
"def time_entries\n get_ticket_property_list(\"time_entries\" , Unfuddled::TimeEntry)\n end",
"def timeslots\n\t\tif (self != nil)\n\t\t\tcompany = self.company\n\t\t\tstart_time = company.start_time\n\t\t\tend_time = company.end_time\n\t\t\tcompany_duration = (( end_time - start_time )/60).round(2)\n\t\t\tno_of_slots = ( company_duration / (self.time_slot.hour*60 + self.time_slot.min) ).to_i\n\t\t\ttime_slot_array =Array.new\n\t\t\tremember_hour = start_time.hour.round\n\t\t\tremember_min = start_time.min\n\t\t\tno_of_slots.times do | index |\n\t\t\t\ta = remember_hour == 0 ? \"00\" : remember_hour\n\t\t\t\tb = remember_min == 0 ? \"00\" : remember_min\n\t\t\t\tc = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour == 0 ? \"00\" :((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\td = (remember_min + self.time_slot.min) % 60 == 0 ? \"00\" : (remember_min + self.time_slot.min) % 60\n\t\t\t\ttime_slot_array << [\"#{a}:#{b}-#{c}:#{d}\", index]\n\t\t\t\tremember_hour = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\tremember_min = (remember_min + self.time_slot.min) % 60\n\t\t\tend\n\t\t\ttime_slot_array\n\t\tend\n\tend",
"def time_entries(start_date, end_date)\n opts = {\n params: {\n start_date: start_date.to_datetime.iso8601,\n end_date: end_date.to_datetime.iso8601\n }\n }\n\n begin\n response = toggl_resource['time_entries'].get(opts)\n rescue => e\n raise 'Error getting Toggl data: ' + e.response\n end\n data = JSON.parse response\n\n data.map do |entry|\n duration = entry['duration'].to_f\n\n # Negative duration means the task is currently running.\n # In this case, we'll set duration to how long it's been running\n if duration < 0\n duration = Time.now - Time.at(duration.abs)\n end\n\n {\n description: entry['description'],\n start: Date.parse(entry['start']),\n duration: duration\n }\n end\n end",
"def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt) ? break : ''\n @times.push(tmp)\n end\n end",
"def next_time_slots\n\t\ttime_slot_array = self.timeslots\n\t\ttime_slot_array.drop_while do |x|\n\t\t\tx[0].split(\"-\")[0].to_time < Time.now\n\t\tend\n\tend",
"def from_meeting_rooms!(meeting_rooms)\n @time_slots = []\n meeting_rooms.each do |meeting_room|\n meeting_room.time_slots.each do |time_slot|\n if time_slot.is_a? TimeSlot\n @time_slots << time_slot.duration_in_minutes\n end\n end\n end\n self\n end",
"def validate_time_slots times\n time_models = []\n times.each do |time|\n t = TimeSlot.new(from: time[:from], to: time[:to], opinion_poll: @opinion_poll)\n\n bad_request t.errors.messages and return unless t.valid?\n time_models.append t\n end\n time_models\n end",
"def timetable_from_items(items)\n h = {}\n items.select { |i| i.identifier =~ %r{^/schedule/day/.+} }.sort_by { |d| d[:conference_day] }.map do |day|\n h[day[:slug]] = timetable_from_items_for_day(items, day)\n end\n h\n end",
"def to_a(resolution: :hour)\n return [] if @start.nil? && @finish.nil?\n\n if finish < start\n to_time_array(start, TimeOfDay.new(23), resolution) +\n to_time_array(TimeOfDay.new(0), finish, resolution)\n else\n to_time_array(start, finish, resolution)\n end\n end",
"def block_slots\n slots = []\n\n unless block_delivery_end_time.blank? || block_delivery_start_time.blank?\n\n available_hours = block_delivery_end_time - block_delivery_start_time\n\n number_of_slots = available_hours / 60.minutes\n\n number_of_slots.to_i.times do |i|\n slots << {\n from: block_delivery_start_time + i.hours,\n to: block_delivery_start_time + (i + 1).hours,\n type: :daytime\n }\n end\n end\n\n slots\n end",
"def time_fragments\n []\n end",
"def get_timeslots_12hrs\n #create the new array\n timeslots_12hrs = Array.new\n\n for i in [email protected]\n temp_holder = @timeslots[i].split(':')\n temp_holder[0] = temp_holder[0].to_i\n\n if temp_holder[0] > 12\n temp_holder[0] = temp_holder[0] - 12\n timeslots_12hrs.push(temp_holder[0].to_s + \":\" + temp_holder[1] + \"pm\")\n elsif temp_holder[0] == 12\n timeslots_12hrs.push(temp_holder[0].to_s + \":\" + temp_holder[1] + \"pm\")\n else\n timeslots_12hrs.push(@timeslots[i] + \"am\")\n end\n end\n\n return timeslots_12hrs\n end",
"def get_timeslots_12hrs\n \t#create the new array\n \t@timeslots_12hrs = Array.new\n\n for i in [email protected]\n @temp_holder = @timeslots[i].split(':')\n @temp_holder[0] = @temp_holder[0].to_i\n if @temp_holder[0] > 12\n @temp_holder[0] = @temp_holder[0] - 12\n @timeslots_12hrs.push(@temp_holder[0].to_s + \":\" + @temp_holder[1] + \"pm\")\n elsif @temp_holder[0] == 12\n @timeslots_12hrs.push(@temp_holder[0].to_s + \":\" + @temp_holder[1] + \"pm\")\n else\n @timeslots_12hrs.push(@timeslots[i] + \"am\")\n end\n end\n\n return @timeslots_12hrs\n end",
"def default_time_slots\n start_time = Time.parse(\"9:00\")\n end_time = Time.parse(\"20:30\")\n slots = []\n t = start_time\n while t <= end_time\n slots << t.strftime(\"%H:%M\")\n t += 30.minutes;\n end\n\n slots\n end",
"def get_start_times\n times = []\n self.start_time.split('%').each do |t|\n times.push(DateTime.strptime(t, '%m-%d-%Y %H:%M'))\n end\n times\n end",
"def generate_time_blocks(windows)\n results = windows.map do |window|\n\n # Create a date based n todays date, but with the time changed to\n # that of the entry start/end.\n entry_start = base.change(\n hour: window.start_time.hour,\n min: window.start_time.minute)\n\n # By rounding off with #floor, we go the easy route (no partial time blocks)\n # Note: iterator is zero based.\n blocks = (window.duration / block_size).floor.times.map { |i|\n\n start_time = Skej::Warp.zone(\n entry_start + (i * block_size).minutes,\n session.chosen_office.time_zone)\n\n end_time = Skej::Warp.zone(\n start_time + block_size.minutes,\n session.chosen_office.time_zone)\n\n target_day = Skej::NLP.parse(session, window.day)\n .strftime('%A')\n .downcase\n .to_sym\n\n TimeBlock.new(\n session: session,\n time_entry_id: window.time_entry.id,\n business_id: session.business_id,\n time_sheet_id: window.time_sheet_id,\n office_id: window.office_id,\n day: target_day,\n start_time: start_time,\n end_time: end_time)\n\n }\n end.flatten # results\n end",
"def day_times\n @day_times ||= available_times.map(&:day_time)\n @day_times\n end",
"def get_times(hash)\n\ttimes = hash.map { |name, time| time }\nend",
"def restaurant_time_select\n\t\ttimes = (0..23).map { |hour| [formatted_time(hour), hour] }\n\tend",
"def build_slots(current_time, finish_time, start_hour, finish_hour)\n while current_time < finish_time\n slots_quantity = get_slots_quantity(start_hour, finish_hour)\n\n (1..slots_quantity).each do\n verterx = @elements_factory.create_vertex(current_time, current_time.class,\n {gained_weight: 0, duration: @slots_size})\n @slots << verterx\n\n current_time += @slots_size\n break if current_time >= finish_time\n end\n\n current_time = current_time.beginning_of_day + start_hour.seconds_since_midnight.seconds + 1.day if start_hour.seconds_since_midnight > finish_hour.seconds_since_midnight\n end\n end",
"def manage_time_slots\n @time_slot = TimeSlot.new\n\n end",
"def create_time_slots\n return unless params[:start_time]\n\n start_time = Time.from_picker(params.delete(:start_time))\n end_time = Time.from_picker(params.delete(:end_time))\n\n return if end_time < start_time # Prevent infinite loop\n\n shift_length = params.delete(:shift_length).to_i\n shift_overlap = params.delete(:shift_overlap).to_i\n people_per_shift = params.delete(:people_per_shift)\n\n num_shifts = ((end_time - start_time) / shift_length).ceil\n return if num_shifts > 100 # Arbitrary threshold to prevent flooding database\n\n cur_time = start_time\n TimeSlot.transaction do\n while cur_time < end_time\n end_shift_time = cur_time + shift_length + shift_overlap\n TimeSlot.create! job: @job,\n start_time: cur_time,\n end_time: [end_shift_time, end_time].min,\n slots: people_per_shift\n cur_time += shift_length\n end\n end\n end"
]
| [
"0.73997855",
"0.7293364",
"0.6935869",
"0.6710855",
"0.65502787",
"0.6529408",
"0.62408537",
"0.6206863",
"0.60246116",
"0.60169065",
"0.6007946",
"0.6006138",
"0.59570074",
"0.59515446",
"0.5933802",
"0.5849529",
"0.5832255",
"0.57931644",
"0.57828283",
"0.57533526",
"0.5735045",
"0.57214767",
"0.5697638",
"0.56853676",
"0.5670124",
"0.5657035",
"0.5643781",
"0.5603836",
"0.5598085",
"0.55702645"
]
| 0.7823904 | 0 |
Responsible combining a collection of slots into common groups, defined by touching boundaries. +:slots: Array / Collection of TimeSlot(s) | def combine_linear_slots(slots)
last_slot = false
end_time = false
start_time = false
flushed = false # Tracks the current continuity chain
count = 0
aggregate = []
debug = []
slots.sort_by(&:start_time).each_with_index do |slot, i|
# Very close to each other, mark it as a continuation
# to the end_time.
start_time = slot.start_time unless last_slot
end_time = slot.end_time unless last_slot
if slot.start_time < (end_time + 30.seconds)
debug << "slot:#{slot.start_time} - neighbor detected"
end_time = slot.end_time
elsif last_slot
debug << "slot:#{slot.start_time} - gap detected"
aggregate << TimeSlot.new(start_time, end_time, slot.time_entry)
start_time = slot.start_time
end_time = slot.end_time
end
last_slot = slot
end
aggregate << TimeSlot.new(start_time, end_time, last_slot.time_entry) if last_slot
aggregate.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_ranges(schedule)\n merged_schedule = []\n\n schedule.each do |meeting|\n overlapping_time_slots = check_times(meeting, merged_schedule)\n merged_schedule -= overlapping_time_slots if merged_schedule.include?(overlapping_time_slots)\n merged_schedule << slot_merger(overlapping_time_slots)\n end\n\n merged_schedule\nend",
"def groupped_slots\n @groupped_slots ||= publication_history.group_by do |published_at|\n time_of_day = date_to_local_duration(published_at)\n duration_to_slot(time_of_day)\n end\n end",
"def slots\n slot_start = start_time\n slot_end = slot_start + slot_length\n while slot_end <= end_time\n slot = ::V2::TimeSlot.new(start_time: slot_start, end_time: slot_end, event_id: @event_id)\n @slots << slot if slot.valid? && slot.save\n slot_start = slot_end + buffer\n slot_end = slot_start + slot_length\n end\n\n @slots\n end",
"def time_slots\n collection=[]\n start_time=Time.now.beginning_of_hour\n end_time=Time.now.tomorrow.midnight-1.hour\n time=start_time\n\n while time < end_time\n collection<<[time.beginning_of_hour.hour, time.beginning_of_hour]\n time=time+1.hour\n end\n\n collection\n end",
"def time_slots_for(time_entry)\n count = (duration_for(time_entry.range) / block_size).floor.to_i\n time = time_entry.start_time\n\n slots = count.times.map do |i|\n # Instantiate a new TimeSlot out of thin air (no backing store)\n slot = TimeSlot.new time, time + block_size.minutes, time_entry\n\n # Stash the current session onto the slot as well, so it may handle\n # some of it's own session based logic.\n slot.session = session\n\n # finally increment the time for the next iteration\n time = time + block_size.minutes\n\n slot\n end\n\n # Detect deadspace at the TimeSlot layer.\n # If found, we add a final TimeSlot to make up the difference.\n if time < time_entry.end_time\n slots << TimeSlot.new(time, time_entry.end_time, time_entry)\n end\n\n # Return the aggregated slot collection\n slots\n end",
"def timeslots\n\t\tif (self != nil)\n\t\t\tcompany = self.company\n\t\t\tstart_time = company.start_time\n\t\t\tend_time = company.end_time\n\t\t\tcompany_duration = (( end_time - start_time )/60).round(2)\n\t\t\tno_of_slots = ( company_duration / (self.time_slot.hour*60 + self.time_slot.min) ).to_i\n\t\t\ttime_slot_array =Array.new\n\t\t\tremember_hour = start_time.hour.round\n\t\t\tremember_min = start_time.min\n\t\t\tno_of_slots.times do | index |\n\t\t\t\ta = remember_hour == 0 ? \"00\" : remember_hour\n\t\t\t\tb = remember_min == 0 ? \"00\" : remember_min\n\t\t\t\tc = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour == 0 ? \"00\" :((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\td = (remember_min + self.time_slot.min) % 60 == 0 ? \"00\" : (remember_min + self.time_slot.min) % 60\n\t\t\t\ttime_slot_array << [\"#{a}:#{b}-#{c}:#{d}\", index]\n\t\t\t\tremember_hour = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\tremember_min = (remember_min + self.time_slot.min) % 60\n\t\t\tend\n\t\t\ttime_slot_array\n\t\tend\n\tend",
"def mask_for_time_slots\n offset = (ends_at.next_day.beginning_of_day - ends_at) / APPOINTMENT_INTERVAL\n slots_number = (ends_at - starts_at) / APPOINTMENT_INTERVAL\n ('1' * slots_number).to_i(2) << offset\n end",
"def timeslots\n data['timeslots'].map { |ts|\n Timeslot.new(\n Time.at(ts['start_date']),\n Time.at(ts['end_date'] || ts['start_date']),\n data['timezone']\n )\n }.reject(&:finished?).sort_by(&:start_date)\n end",
"def time_slots\n\n # you can book by the hour, and you can stay for an hour\n reservation_interval = 1.hour\n\n # Determine the earliest time we will allow reservation\n # It can't be in the past, we'll start 10 minutes from now\n start_time = Time.zone.now + 10.minutes\n # Then we have to round to the next hour block\n start_time = Time.zone.at( (start_time.to_f / reservation_interval).ceil * reservation_interval )\n # Then, if we are still earlier than opening hour, just use the opening hour\n # We can use the 'max' Array method\n start_time = [start_time, start_time.change(hour: opening_hour)].max\n\n # Determine the furthest in the future we will allow reservations\n end_time = (start_time + 3.days).change(hour: closing_hour)\n\n # Now, we want to make a list of every hour between our start_time and our end_time\n # For this we can use a begin... end while condition loop.\n # We'll start with an empty array that will hold all the hours,\n # and a variable to hold each hour, which we will keep increasing by 1 hour, and then add to our array\n # Our loop condition will have us stop looping once we've reached the end time\n\n all_times = []\n a_time = start_time\n\n begin\n\n # add this time to our list of times\n all_times << a_time\n\n # increment the time\n a_time += reservation_interval\n\n # Once we get to closing time, we have to skip ahead to the next day's opening\n # That way you can't make a reservation at 2am\n if (a_time + reservation_interval) > a_time.change(hour: closing_hour)\n a_time = (a_time + 1.day).change(hour:opening_hour)\n end\n\n end while a_time < end_time\n\n all_times\n end",
"def block_slots\n slots = []\n\n unless block_delivery_end_time.blank? || block_delivery_start_time.blank?\n\n available_hours = block_delivery_end_time - block_delivery_start_time\n\n number_of_slots = available_hours / 60.minutes\n\n number_of_slots.to_i.times do |i|\n slots << {\n from: block_delivery_start_time + i.hours,\n to: block_delivery_start_time + (i + 1).hours,\n type: :daytime\n }\n end\n end\n\n slots\n end",
"def build_slots(current_time, finish_time, start_hour, finish_hour)\n while current_time < finish_time\n slots_quantity = get_slots_quantity(start_hour, finish_hour)\n\n (1..slots_quantity).each do\n verterx = @elements_factory.create_vertex(current_time, current_time.class,\n {gained_weight: 0, duration: @slots_size})\n @slots << verterx\n\n current_time += @slots_size\n break if current_time >= finish_time\n end\n\n current_time = current_time.beginning_of_day + start_hour.seconds_since_midnight.seconds + 1.day if start_hour.seconds_since_midnight > finish_hour.seconds_since_midnight\n end\n end",
"def get_time_slot_array\n time_slot_array = [\"07:00\", \"07:30\", \"08:00\", \"08:30\", \"09:00\", \"09:30\", \"10:00\", \"10:30\",\n \"11:00\", \"11:30\", \"12:00\", \"12:30\", \"13:00\", \"13:30\", \"14:00\", \"14:30\",\n \"15:00\", \"15:30\", \"16:00\", \"16:30\", \"17:00\", \"17:30\", \"18:00\", \"18:30\",\n \"19:00\", \"19:30\", \"20:00\", \"20:30\", \"21:00\"]\n end",
"def create_time_slots\n return unless params[:start_time]\n\n start_time = Time.from_picker(params.delete(:start_time))\n end_time = Time.from_picker(params.delete(:end_time))\n\n return if end_time < start_time # Prevent infinite loop\n\n shift_length = params.delete(:shift_length).to_i\n shift_overlap = params.delete(:shift_overlap).to_i\n people_per_shift = params.delete(:people_per_shift)\n\n num_shifts = ((end_time - start_time) / shift_length).ceil\n return if num_shifts > 100 # Arbitrary threshold to prevent flooding database\n\n cur_time = start_time\n TimeSlot.transaction do\n while cur_time < end_time\n end_shift_time = cur_time + shift_length + shift_overlap\n TimeSlot.create! job: @job,\n start_time: cur_time,\n end_time: [end_shift_time, end_time].min,\n slots: people_per_shift\n cur_time += shift_length\n end\n end\n end",
"def merged_meetings(meeting_time_ranges)\n # assuming meetings can fall at most 12 30-minute blocks past 9am\n start_times = Array.new(13, nil) # array of start times at their index\n end_times = Array.new(13, nil) # array of end times - their index is their start time\n meeting_time_ranges.each do |meeting_time_range|\n start_time = meeting_time_range[0]\n end_time = meeting_time_range[1]\n\n # add start_time to start_times\n start_times[start_time] = start_time\n\n # add end_time to end_times at its start_time index, unless there is already a later end_time at that index\n end_times[start_time] = end_time unless !end_time[start_time].nil? && end_time[start_time] > end_time\n end\n\n merged_meeting_times = []\n\n # start_times look something like [0, nil, nil, 3, 4, nil, nil, nil, nil, 9, 10, nil]\n # end_times look something like [1, nil, nil, 5, 8, nil, nil, nil, nil, 10, 12, nil]\n last_start_time = nil\n last_end_time = nil\n start_times.each do |start_time|\n next if start_time.nil?\n\n if last_start_time.nil? # no values have been stored yet\n last_start_time = start_time\n last_end_time = end_times[start_time]\n next\n end\n\n if start_time <= last_end_time # current start_time is before the last end_time\n if start_time < last_start_time\n # current start_time earlier than last_start_time - assign as last_start_time\n last_start_time = start_time\n end\n\n if end_times[start_time] > last_end_time\n # current end_time later than last_end_time - assign it end_time as last_end_time\n last_end_time = end_times[start_time]\n end\n next\n end\n\n if start_time > last_end_time\n # we have reached the start of a new range - store the last range\n merged_meeting_times << [last_start_time, last_end_time]\n\n # reset the last_end_time and last_start_time to the current values\n last_start_time = start_time\n last_end_time = end_times[start_time]\n next\n end\n end\n\n # be sure to append the remaining last meeting time range\n merged_meeting_times << [last_start_time, last_end_time]\n\n merged_meeting_times\nend",
"def all_timeslots\n unless @all_timeslots.present?\n @all_timeslots = (1..5).map do |day_id|\n Timeslot.new(self, day_id, @day_start_minute, @day_end_minute)\n end\n end\n\n @all_timeslots\n end",
"def merged_meetings_2(meeting_time_ranges)\n # merged_meetings where we cannot assume how many time blocks\n meeting_time_ranges = meeting_time_ranges.sort\n\n merged_meeting_times = []\n\n last_start_time = nil\n last_end_time = nil\n meeting_time_ranges.each do |meeting_time_range|\n start_time = meeting_time_range[0]\n end_time = meeting_time_range[1]\n\n if last_start_time.nil? # no values have been stored yet\n last_start_time = start_time\n last_end_time = end_time\n next\n end\n\n if start_time <= last_end_time # current start_time is before the last end_time\n if start_time < last_start_time\n # current start_time earlier than last_start_time - assign as last_start_time\n last_start_time = start_time\n end\n\n if end_time > last_end_time\n # current end_time later than last_end_time - assign it end_time as last_end_time\n last_end_time = end_time\n end\n next\n end\n\n if start_time > last_end_time\n # we have reached the start of a new range - store the last range\n merged_meeting_times << [last_start_time, last_end_time]\n\n # reset the last_end_time and last_start_time to the current values\n last_start_time = start_time\n last_end_time = end_time\n next\n end\n end\n\n # be sure to append the remaining last meeting time range\n merged_meeting_times << [last_start_time, last_end_time]\n\n merged_meeting_times\nend",
"def generate_time_slots(time_entries)\n time_entries.map { |entry| extract_available_slots(entry) }.flatten\n end",
"def vacant_slots(from, to)\n\n end",
"def timeslots\n unless @timeslots.present?\n timeslots = Timeslot\n .timeslots_for(@schedule_range, @form)\n .select { |ts| ts.blocks >= @blocks_needed }\n timeslots = @schedule_range.all_timeslots if timeslots.empty?\n @timeslots = timeslots.sort_by { |ts| [ts.day_id, ts.start_minute] }\n end\n\n @timeslots\n end",
"def next_time_slots\n\t\ttime_slot_array = self.timeslots\n\t\ttime_slot_array.drop_while do |x|\n\t\t\tx[0].split(\"-\")[0].to_time < Time.now\n\t\tend\n\tend",
"def consolidate(schedules)\n schedules\n .group_by(&:first)\n .transform_values { _1.map(&:last).consolidate_ranges(:time) }\n end",
"def from_meeting_rooms!(meeting_rooms)\n @time_slots = []\n meeting_rooms.each do |meeting_room|\n meeting_room.time_slots.each do |time_slot|\n if time_slot.is_a? TimeSlot\n @time_slots << time_slot.duration_in_minutes\n end\n end\n end\n self\n end",
"def set_time_slots_list\n last_slot = TimeSlotsList.last\n while last_slot\n TimeSlotsList.last.destroy\n last_slot = TimeSlotsList.last\n end\n @time_slots_list = TimeSlotsList.new\n @time_slots_list.group = params[:group]\n @group = params[:group]\n @time_slots_list.save!\n end",
"def car_slots_ordered(start_time, num_slots)\n self.car_slots.where(\"start_time >= ? AND end_time <= ?\", start_time, start_time.advance(:days => +num_slots)).order(:start_time)\n # TODO: handle case where num slots returned != num slots requested (probably means we forgot to create enough car slots)\n end",
"def generate_schedule\r\n match_list = make_match_list\r\n schedule = make_empty_schedule\r\n # pp match_list\r\n # pp match_list.size\r\n\r\n scheduled_matches = []\r\n referee_count = 0\r\n move_to_next_slot = false\r\n\r\n schedule.each do |day|\r\n # puts \"#{day[:day]}\"\r\n day[:slots].each do |slots|\r\n # puts \" #{slots[:time]}\"\r\n\r\n match_count = -1\r\n move_to_next_slot = false\r\n match_to_validate = {}\r\n\r\n slots[:matches].each do |match|\r\n # puts \" scheduled (#{scheduled_matches.size})\"; pp scheduled_matches\r\n # puts \"match list (#{match_list.size})\"; pp match_list\r\n # puts \" to_val: \"; pp scheduled_matches\r\n while(!validate_rest_time(match_to_validate, scheduled_matches))\r\n match_count += 1 #next match on match_list\r\n # puts \" CLASH: mc=#{match_count} \"\r\n match_to_validate = {:teams=>match_list[match_count],:day => day[:day], :time => slots[:time]}\r\n\r\n if(match_list.size == match_count)\r\n # puts \"----> Move to next slot\"\r\n move_to_next_slot=true\r\n break\r\n end\r\n end\r\n\r\n # puts \"move_to_next_slot: #{move_to_next_slot}\"\r\n \r\n unless(move_to_next_slot)\r\n scheduled_matches << match_to_validate\r\n match[:referees] = REFEREES[referee_count%REFEREES.size]\r\n match[:score] = [0,0]\r\n match[:teams] = match_list.delete_at(match_count)\r\n # print \"Adding match: \"; pp match\r\n # puts \"-\"*34\r\n referee_count += 1\r\n match_count = 0\r\n match_to_validate = {:teams=>match_list[match_count], :day => match[:day], :time => match[:time]}\r\n else\r\n break\r\n end\r\n\r\n end\r\n\r\n end\r\n end\r\n\r\n schedule\r\n end",
"def live_slots\n slots = []\n\n unless live_delivery_block_end_time.blank? || live_delivery_block_start_time.blank?\n available_hours = live_delivery_block_end_time - live_delivery_block_start_time\n\n number_of_slots = available_hours / 60.minutes\n\n number_of_slots.to_i.times do |i|\n slots << {\n from: live_delivery_block_start_time + i.hours,\n to: live_delivery_block_start_time + (i + 1).hours,\n type: :live\n }\n end\n end\n\n slots\n end",
"def validate_time_slots times\n time_models = []\n times.each do |time|\n t = TimeSlot.new(from: time[:from], to: time[:to], opinion_poll: @opinion_poll)\n\n bad_request t.errors.messages and return unless t.valid?\n time_models.append t\n end\n time_models\n end",
"def default_time_slots\n start_time = Time.parse(\"9:00\")\n end_time = Time.parse(\"20:30\")\n slots = []\n t = start_time\n while t <= end_time\n slots << t.strftime(\"%H:%M\")\n t += 30.minutes;\n end\n\n slots\n end",
"def manage_time_slots\n @time_slot = TimeSlot.new\n\n end",
"def time_slot_range_label(time_slot)\n start_time = time_slot.start_time.to_s(:time_slot_short)\n end_time = time_slot.end_time.to_s(:time_slot_long)\n \"#{start_time} - #{end_time}\"\n end"
]
| [
"0.6928598",
"0.6598432",
"0.6556763",
"0.62836176",
"0.61598545",
"0.61425924",
"0.61248326",
"0.59110165",
"0.5904596",
"0.5904228",
"0.5902116",
"0.58843243",
"0.58529955",
"0.5809075",
"0.5797486",
"0.57824683",
"0.57600373",
"0.57475156",
"0.56936073",
"0.56116503",
"0.553205",
"0.5521786",
"0.5521366",
"0.54984605",
"0.5451708",
"0.5448667",
"0.54288715",
"0.5412445",
"0.53852063",
"0.53506255"
]
| 0.7387607 | 0 |
Given a collection of TimeBlock(s), return only the ones that have no detectable collisions (and thus are valid). +:time_blocks+ All extracted TimeBlock(s) you wish to have validated. | def validate_time_blocks(time_blocks)
b = time_blocks.select(&:collision_free?)
# Test environment has unreliable data entry for start times.
b = b.select(&:in_future?) unless Rails.env.test?
b
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_blocks(base_time)\n set_base_time(base_time)\n time_entries = time_entries_for(base)\n end",
"def valid_schedule?(time_blocks)\n time_blocks = quicksort_timeblocks(time_blocks)\n return !exists_overlap?(time_blocks)\n end",
"def validate_time_slots times\n time_models = []\n times.each do |time|\n t = TimeSlot.new(from: time[:from], to: time[:to], opinion_poll: @opinion_poll)\n\n bad_request t.errors.messages and return unless t.valid?\n time_models.append t\n end\n time_models\n end",
"def available_delivery_blocks(time)\n\n unless opens_today\n return []\n end\n\n # Reset date to compare with Postgres Time\n time = time.change(:month => 1, :day => 1, :year => 2000)\n\n lead_time_for_block_time_slots = 1.hour\n\n all_slots = block_slots.select { |slot| slot[:from] >= (time + lead_time_for_block_time_slots) } +\n live_slots.select { |slot| slot[:from] >= (time) }\n\n all_slots.map do |slot|\n {\n :from => slot[:from].strftime('%H:%M'),\n :to => slot[:to].strftime('%H:%M'),\n :type => slot[:type]\n }\n end\n end",
"def no_overlap\n self.class.where(user_id: user.id, time_type: time_type).each do |other_time|\n errors.add(:start_time, \"i'm a sad error\") if overlaps?(other_time)\n end\n end",
"def find_not_all(conditions={}, &block)\n all.reject { |item| match_all(item, conditions, &block) }\n end",
"def valid_tickets\n @nearby_tickets.filter_map do |ticket|\n in_ranges = ticket.map do |val|\n merged_rules.map {|val_range| val_range.include?(val)}.include?(true)\n end\n ticket unless in_ranges.include?(false)\n end\n end",
"def first_not_all(conditions={}, &block)\n all.detect { |item| !match_all(item, conditions, &block) }\n end",
"def exists_overlap?(time_blocks)\n (0..time_blocks.size - 2).each do |i|\n if (time_blocks[i].term == time_blocks[i+1].term &&\n time_blocks[i].day == time_blocks[i+1].day &&\n time_blocks[i].end_time > time_blocks[i+1].start_time)\n return true\n end\n end\n return false\n end",
"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 optimize_time_blocks(time_blocks)\n Optimizer.new.optimize(time_blocks)\n end",
"def generate_time_blocks(windows)\n results = windows.map do |window|\n\n # Create a date based n todays date, but with the time changed to\n # that of the entry start/end.\n entry_start = base.change(\n hour: window.start_time.hour,\n min: window.start_time.minute)\n\n # By rounding off with #floor, we go the easy route (no partial time blocks)\n # Note: iterator is zero based.\n blocks = (window.duration / block_size).floor.times.map { |i|\n\n start_time = Skej::Warp.zone(\n entry_start + (i * block_size).minutes,\n session.chosen_office.time_zone)\n\n end_time = Skej::Warp.zone(\n start_time + block_size.minutes,\n session.chosen_office.time_zone)\n\n target_day = Skej::NLP.parse(session, window.day)\n .strftime('%A')\n .downcase\n .to_sym\n\n TimeBlock.new(\n session: session,\n time_entry_id: window.time_entry.id,\n business_id: session.business_id,\n time_sheet_id: window.time_sheet_id,\n office_id: window.office_id,\n day: target_day,\n start_time: start_time,\n end_time: end_time)\n\n }\n end.flatten # results\n end",
"def validate_block(block)\n # check block ready conditions\n # 1. parent block must already be accepted.\n parent_block = get_block(block.parent_hash)\n raise BlockNotReadyError.new(\"can't find parent block by hash #{block.parent_hash.to_hex}\") unless parent_block\n # TODO 2. pow_chain_ref block must already be accepted.\n # 3. local time must greater or equal than minimum timestamp.\n unless (local_timestamp = Time.now.to_i) >= (minimum_timestamp = genesis_time + block.slot_number * SLOT_DURATION)\n raise BlockNotReadyError.new(\"local_timestamp(#{local_timestamp}) must greater than or equal with minimum_timestamp(#{minimum_timestamp})\")\n end\n end",
"def contains_block?(block_of_time)\n if(self.start_time <= block_of_time.start_time &&\n self.end_time >= block_of_time.end_time)\n true\n else\n false\n end\n end",
"def test_blocks_not_consecutive\n block_num_checker = BlockNumChecker::new\n arr = [0,1,2,8,4,5,6]\n assert_equal 1, block_num_checker.check_block(arr)\n end",
"def missing_ranges()\n return [] if @time_map.nil?\n @time_map.missing_ranges()\n end",
"def locked_candidates_1_from_block block, number\n\t\tblock_cells = get_block_cells block\n\t\tblock_cells_with_number = block_cells.select { |i| @candidates[i].include?(number) }\n\t\t\n\t\treturn_bool = false\n\n\t\tif block_cells_with_number.empty?\n\t\t\treturn return_bool\n\t\tend\n\n\t\tblock_cell_rows = block_cells_with_number.map { |i| i / 9 }\n\t\t\n\t\tonly_in_row = block_cell_rows.count(block_cell_rows[0]) == block_cell_rows.length ? true : false\n\n\t\tif only_in_row\n\t\t\tnumber_of_deleted_items = 0\n\t\t\tget_other_row_cells(block_cells_with_number[0]).select { |i| !block_cells_with_number.include?(i) }.each do |i|\n\t\t\t\tdeleted_item = @candidates[i].delete number\n\t\t\t\tnumber_of_deleted_items += 1 if !deleted_item.nil?\n\t\t\tend\n\t\t\treturn_bool = true if number_of_deleted_items > 0\n\t\tend\n\n\t\tblock_cell_cols = block_cells_with_number.map { |i| i % 9 }\n\n\t\tonly_in_col = block_cell_cols.count(block_cell_cols[0]) == block_cell_cols.length ? true : false\n\t\t\n\t\tif only_in_col\n\t\t\tnumber_of_deleted_items = 0\n\t\t\tget_other_col_cells(block_cells_with_number[0]).select { |i| !block_cells_with_number.include?(i) }.each do |i|\n\t\t\t\tdeleted_item = @candidates[i].delete number\n\t\t\t\tnumber_of_deleted_items += 1 if !deleted_item.nil?\n\t\t\tend\n\t\t\treturn_bool = true if number_of_deleted_items > 0\n\t\tend\n\t\t\n\t\treturn return_bool\n\tend",
"def meets_temporal_constraints?(time, &block)\n !find_failed_temporal_constraint(time, &block) &&\n !find_failed_occurence_constraint(true, &block)\n end",
"def check_times\n if start_end_times.count > 0 && !start_end_times.nil?\n start_end_times.each do |t|\n return true if t.check_time_ranges\n end\n\n false\n else\n true\n end\n end",
"def missed_deadlines(current_time)\n result = []\n while !deadlines.empty? && deadlines.first[0] < current_time\n result << deadlines.shift\n end\n result\n end",
"def validate_time_slot_ids times\n\n empty_times if times.size == 0\n\n times.each do |id|\n time_slot = TimeSlot.find(id)\n end\n true\n\n rescue ActiveRecord::RecordNotFound\n r = {times: 'Record Not Found'}\n return not_found r\n end",
"def get_block_time_list(filename)\n to_return = []\n lines = File.open(filename, \"rb\") {|f| f.read.split(/\\n+/)}\n lines.each do |line|\n next if line !~ /^Block times/\n values = []\n # Block times are given as a space-separated list of start,end pairs. They\n # are in units of seconds * 1e5, so convert them to seconds here for\n # consistency.\n if line =~ /^[^:]+: (.*?)\\s*$/\n values = $1.split(\" \").map{|r| r.split(\",\").map{|v| v.to_f / 1e5}}\n end\n to_return << values\n end\n to_return\nend",
"def collide_with_other_blocks\n @game.blocks.each do |block|\n if collide(block)\n return block\n end\n end\n nil\n end",
"def complete_schedule?(time_blocks, courses)\n # check to see that all course requirements have been satisfied\n # this part is more likely to return false than the next part\n courses.each do |course|\n if (!requirement_satisfied?(time_blocks, course))\n return false\n end\n end\n\n # check to see that we haven't added any unnecessary courses\n # this is more of an error check, rather than something that we\n # expect to ever be false\n time_blocks.each do |tb|\n course = tb.section.course\n if (!courses.include? course)\n # we added an unnecessary section\n return false\n end\n end\n end",
"def get_blocks\n @blocks ||= Block.find :all, :conditions => { :show_in_all => '' }\n end",
"def without_set_blocks(options)\n piece = options[:piece]\n game = options[:game]\n\n collection = clone\n collection.sets.map! { |set| set.without_blocks(piece: piece, game: game) }\n collection\n end",
"def conflict?(times)\n\t\treturn false if @tba == true\n\n\t\ttimes.each do |time|\n\t\t\treturn false if time.tba == true\n\t\t\treturn true if \\\n\t\t\t\t\t((time.startTimeInMinutes <= @endTimeInMinutes && time.startTimeInMinutes >= @startTimeInMinutes) \\\n\t\t\t\t\tor (time.endTimeInMinutes >= @startTimeInMinutes && time.endTimeInMinutes <= @endTimeInMinutes) \\\n\t\t\t\t\tor (time.startTimeInMinutes > @startTimeInMinutes && time.endTimeInMinutes < @endTimeInMinutes) \\\n\t\t\t\t\tor (time.startTimeInMinutes < @startTimeInMinutes && time.endTimeInMinutes > @endTimeInMinutes)) \\\n\t\t\t\t\tand (@days & time.days).length > 0\n\t\tend\n\n\t\treturn false\n\tend",
"def find_none(conditions={}, &block)\n all.select { |item| match_none(item, conditions, &block) }\n end",
"def does_not_contain(&block)\n [:does_not_contain, block]\n end",
"def does_not_contain(&block)\n [:does_not_contain, block]\n end"
]
| [
"0.6731134",
"0.60678077",
"0.5977046",
"0.58140635",
"0.5484393",
"0.5484328",
"0.54600245",
"0.534294",
"0.5336923",
"0.5301098",
"0.5291553",
"0.52813506",
"0.52577484",
"0.52175826",
"0.52076405",
"0.5142211",
"0.5131774",
"0.50770044",
"0.507346",
"0.5050142",
"0.5046692",
"0.5045441",
"0.50404817",
"0.5027059",
"0.5020657",
"0.4987285",
"0.49798852",
"0.49677834",
"0.49541187",
"0.49541187"
]
| 0.7842012 | 0 |
Given a collection of TimeBlock(s), return a more optimized subset of the given collection. +:time_blocks: Collection of TimeBlock(s) to be filtered and optimized. | def optimize_time_blocks(time_blocks)
Optimizer.new.optimize(time_blocks)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quicksort_timeblocks(time_blocks)\n if (time_blocks.size <= 1)\n return time_blocks\n end\n\n pivot = time_blocks[0]\n left = []\n right = []\n\n time_blocks[1..time_blocks.size-1].each do |tb|\n if (tb.term.to_i < pivot.term.to_i)\n left.push(tb)\n elsif (pivot.term.to_i < tb.term.to_i)\n right.push(tb)\n elsif (before_in_week(tb.day, pivot.day))\n left.push(tb)\n elsif (before_in_week(pivot.day, tb.day))\n right.push(tb)\n elsif (tb.start_time < pivot.start_time)\n left.push(tb)\n else\n right.push(tb)\n end\n end\n\n sorted_left = quicksort_timeblocks(left)\n sorted_right = quicksort_timeblocks(right)\n time_blocks = sorted_left.push(pivot) + sorted_right\n return time_blocks\n end",
"def filter(array, block)\n return array.select(&block)\nend",
"def filter(array, block)\n return array.select &block\nend",
"def filter(array, block)\n return array.select(&block)\nend",
"def filter(array, block)\n return array.select(&block) # Your code here\nend",
"def available_delivery_blocks(time)\n\n unless opens_today\n return []\n end\n\n # Reset date to compare with Postgres Time\n time = time.change(:month => 1, :day => 1, :year => 2000)\n\n lead_time_for_block_time_slots = 1.hour\n\n all_slots = block_slots.select { |slot| slot[:from] >= (time + lead_time_for_block_time_slots) } +\n live_slots.select { |slot| slot[:from] >= (time) }\n\n all_slots.map do |slot|\n {\n :from => slot[:from].strftime('%H:%M'),\n :to => slot[:to].strftime('%H:%M'),\n :type => slot[:type]\n }\n end\n end",
"def validate_time_blocks(time_blocks)\n b = time_blocks.select(&:collision_free?)\n\n # Test environment has unreliable data entry for start times.\n b = b.select(&:in_future?) unless Rails.env.test?\n\n b\n end",
"def additional_blocks_with_time_report_query\n return @@additional_blocks if defined?(@@additional_blocks)\n\n @@additional_blocks = Dir.glob(\"#{Redmine::Plugin.directory}/*/app/views/my/blocks/_*.{rhtml,erb}\").inject({}) do |h,file|\n name = File.basename(file).split('.').first.gsub(/^_/, '')\n\n ################\n # Smile specific : partials overriden in plugin ignored\n unless (\n # Query selection partials ignored : plugins overrides partial\n name.end_with?('_query_selection') ||\n # Core blocks partials ignored : plugins overrides partial\n (name == 'issues') ||\n CORE_BLOCKS.keys.include?(name)\n )\n h[name] = {:label => name.to_sym, :partial => \"my/blocks/#{name}\"}\n else\n Rails.logger.debug \"==>prof additional_blocks_with_time_report_query, overriden by plugin : #{name} partial\"\n end\n\n h\n end\n\n Rails.logger.debug \"==>prof additional_blocks_with_time_report_query #{@@additional_blocks}\"\n @@additional_blocks\n end",
"def reduce_blocks(blks, filter = writable_mifare_blocks)\n if identify_2d_array(blks)\n hsh = blks.to_h\n filter.map { |x| hsh[x] }.compact.flatten\n else\n filter.map { |x| blks[x] }.compact.flatten\n end\n end",
"def generate_time_blocks(windows)\n results = windows.map do |window|\n\n # Create a date based n todays date, but with the time changed to\n # that of the entry start/end.\n entry_start = base.change(\n hour: window.start_time.hour,\n min: window.start_time.minute)\n\n # By rounding off with #floor, we go the easy route (no partial time blocks)\n # Note: iterator is zero based.\n blocks = (window.duration / block_size).floor.times.map { |i|\n\n start_time = Skej::Warp.zone(\n entry_start + (i * block_size).minutes,\n session.chosen_office.time_zone)\n\n end_time = Skej::Warp.zone(\n start_time + block_size.minutes,\n session.chosen_office.time_zone)\n\n target_day = Skej::NLP.parse(session, window.day)\n .strftime('%A')\n .downcase\n .to_sym\n\n TimeBlock.new(\n session: session,\n time_entry_id: window.time_entry.id,\n business_id: session.business_id,\n time_sheet_id: window.time_sheet_id,\n office_id: window.office_id,\n day: target_day,\n start_time: start_time,\n end_time: end_time)\n\n }\n end.flatten # results\n end",
"def filter!(&block)\n @rows.select!(&block)\n end",
"def get_blocks\n @blocks ||= Block.find :all, :conditions => { :show_in_all => '' }\n end",
"def blocks_for_block_size\n # We're already done with the last block behavior, if we wanted a small\n # last block, or if we only generated a single block\n return block_list if block_list.size <= 1 || last_block == :small_last\n\n case last_block\n when :truncate_all\n # Implemented in add_for_block_size\n nil\n when :small_last\n # Implemented just above\n nil\n when :truncate_last\n block_list.pop\n else # default to :big_last behavior\n last = block_list.pop\n block_list.last.words.concat(last.words)\n end\n\n block_list\n end",
"def sublist(&block)\n @tasks.select(&block)\n end",
"def get_all_blocks\n\n @all_blocks = Block.where(is_published: 't')\n\n end",
"def batch(items)\n items.select { |i| filter(i) }\n end",
"def first_not_all(conditions={}, &block)\n all.detect { |item| !match_all(item, conditions, &block) }\n end",
"def get_broadcasts_for_minute broadcasts, time\n broadcasts.collect { |b| TimeDifference.between( b.start, time).in_minutes < 1 }\n end",
"def filter\n collection = @collection\n collection = collection.sort_by(&@sort_method) if @sort_method\n collection.reverse! if (@list_order.to_sym == ORDER[:lowest]) ^ @reverse\n collection = collection[((@list_position) - 1)..-1] || []\n\n collection.first(requested_size).tap do |filtered_collection|\n @filtered_size = filtered_collection.size\n end\n end",
"def my_select (collection)\n if block_given?\n i = 0 \n new_collection = []\n \n while i < collection.length \n if yield(collection[i]) \n new_collection << collection[i]\n end\n i += 1\n end\n \n else\n puts \"Hey! No block was given!\"\n end\n new_collection \nend",
"def without_set_blocks(options)\n piece = options[:piece]\n game = options[:game]\n\n collection = clone\n collection.sets.map! { |set| set.without_blocks(piece: piece, game: game) }\n collection\n end",
"def get\n # TODO think about processing entries in batches\n remove_times = @remove_set.to_h\n @add_set.to_a.select do |element, add_time|\n remove_time = remove_times[element]\n !remove_time || remove_time < add_time\n end.map(&:first)\n end",
"def find_every(opts, &block)\n collection = []\n\n all_ids(opts) do |partial_ids, data, partial_opts|\n partial_items = partial_ids.map do |id|\n find_single(id, opts, false)\n end\n\n if block_given?\n yield(instantiate_collection( partial_items ), data, opts)\n end\n\n collection.concat partial_items\n end\n\n instantiate_collection( collection )\n end",
"def get_blocks(options = {block_range: (0..0)}, &block)\n get_block_objects(options.merge(object: :block), block)\n end",
"def contains_block?(block_of_time)\n if(self.start_time <= block_of_time.start_time &&\n self.end_time >= block_of_time.end_time)\n true\n else\n false\n end\n end",
"def records_modified_since(time)\n condition = []\n %w(updated_at created_at).each do |col|\n condition << \"#{col} >= ?\" if column_names.include? col\n end\n if condition.empty?\n logger.warn \"#{self.name}: Override records_modified_since(time) to keep the index up to date with records changed during rebuild.\"\n []\n else\n find :all, :conditions => [ condition.join(' AND '), *([time]*condition.size) ]\n end\n end",
"def find_all(&block)\r\n copy_and_return(@records.select(&block))\r\n end",
"def get_blocks(project_id = nil, span = nil, context_size = nil, sort = false)\n\t\t_blocks = blocks.in_project(project_id).in_span(span)\n\n\t\tif span.present?\n\t\t\tb = span[:begin]\n\t\t\tunless context_size.nil?\n\t\t\t\tb -= context_size\n\t\t\t\tb = 0 if b < 0\n\t\t\tend\n\t\t\t_blocks.each{|a| a.begin -= b; a.end -= b}\n\t\tend\n\n\t\tif sort\n\t\t\t_blocks.sort{|b1, b2| (b1.begin <=> b2.begin).nonzero? || (b2.end <=> b1.end)}\n\t\telse\n\t\t\t_blocks\n\t\tend\n\tend",
"def normalize_regions(regions)\n regions = regions.sort_by { |r| r.start_time }\n filtered_regions = Array.new\n last_region = regions.shift\n regions.each do |r|\n if r.start_time < last_region.end_time\n last_region.end_time = [last_region.end_time, r.end_time].max\n else\n filtered_regions << last_region\n last_region = r\n end\n end\n if last_region\n filtered_regions << last_region\n end\n filtered_regions\n end",
"def select(&block)\n append(Filter.new(&block))\n end"
]
| [
"0.5368214",
"0.5326802",
"0.53122807",
"0.52685475",
"0.5181944",
"0.5129373",
"0.5116508",
"0.5077676",
"0.5031447",
"0.49094605",
"0.48733032",
"0.4859573",
"0.48289484",
"0.4816768",
"0.4806716",
"0.47583252",
"0.47385758",
"0.46988118",
"0.46612123",
"0.46600792",
"0.46407554",
"0.4629884",
"0.46262267",
"0.46067443",
"0.45756897",
"0.45454302",
"0.45436493",
"0.4533539",
"0.45294103",
"0.452764"
]
| 0.67573684 | 0 |
The size of a TimeBlock. Based on the minute duration of the chosen Service. | def block_size
session.chosen_service.duration rescue session.business.services.first.duration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size_time(base = self.date_from)\n\t\t\t\t\t@sizes = {} if @sizes.nil?\n\t\t\t\t\tif @sizes[base.to_s].nil?\n\t\t\t\t\t\tsize = DateTime.parse(\"2000-01-01 00:00:00 +0000\")\n\t\t\t\t\t\tself.reservations(base).each do |reservation|\n\t\t\t\t\t\t\tif reservation.above_line?\n\t\t\t\t\t\t\t\tsize += reservation.size.seconds_since_midnight.seconds\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t@sizes[base.to_s] = size\n\t\t\t\t\tend\n\t\t\t\t\treturn @sizes[base.to_s]\n\t\t\t\tend",
"def block_size\n self[:block_size]\n end",
"def block_size\n check_valid\n md.block_size\n end",
"def size(base = self.date_from)\n\t\t\t\t\treturn self.send(\"size_#{self.capacity_type.to_s}\", base)\n\t\t\t\tend",
"def block_size()\n # KB MB\n 4 * 1024 * 1024\n end",
"def block_size\n @disk.block_size\n end",
"def d_size\n @capacity / @blockSize\n end",
"def size\n @size ||= begin\n block_count * block_size unless block_count.nil? || block_size.nil?\n end\n end",
"def block_sizes\n unless defined?(@block_sizes) then\n @block_sizes = split_comma(@data[18]).collect { |x| x.to_i }\n end\n @block_sizes\n end",
"def size\n\t\t\treturn @m.capacity\n\t\tend",
"def size\n\t\treturn @m.capacity\n\tend",
"def size\n\t\t7500\n\tend",
"def size_used\n info[\"size-used\"]\n end",
"def size\n @size \n end",
"def size\n @size \n end",
"def size\n info[\"size\"]\n end",
"def get_size\n\t\treturn @size\n\tend",
"def size\n @info[:size]\n end",
"def sizes\n Vultr::Resource::Plan.new(@faraday)\n end",
"def part_size_in_bytes\n data.part_size_in_bytes\n end",
"def size\n\t\tstat[:size]\n\tend",
"def size\n\t\tstat[:size]\n\tend",
"def size\n @size.size\n end",
"def size_in_bytes\n to_i description['SizeInBytes']\n end",
"def size_mb \n return size / 1048576 # (1024 * 1024) \n end",
"def get_size\n\t\tend",
"def bytes_total\n blocks * block_size\n end",
"def byte_rate\n Rational(size,duration)\n end",
"def calculate_size\n @size = unit_count + holidays_count\n end",
"def size\n vm.hardware_profile.vm_size\n end"
]
| [
"0.6852872",
"0.6738088",
"0.66986936",
"0.6645414",
"0.6619052",
"0.64590394",
"0.64569837",
"0.644224",
"0.6386727",
"0.6282654",
"0.6222423",
"0.6215486",
"0.6212822",
"0.616994",
"0.616994",
"0.6114185",
"0.61123925",
"0.61122954",
"0.6108511",
"0.6100553",
"0.6090947",
"0.6090947",
"0.6085288",
"0.6074602",
"0.6067066",
"0.6041949",
"0.6041905",
"0.60163766",
"0.600858",
"0.6007148"
]
| 0.7701602 | 0 |
Fetch the timezone for the chosen office. While also memoizing the time_zone result as | def time_zone
return @time_zone_cache if @time_zone_cache
# Get the office id from the session json store
id = @session.store[:chosen_office_id]
office = Office
.where(business_id: @session.business_id, id: id)
.first
if office.present?
@time_zone_cache = office.time_zone
end
@time_zone_cache
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_zone\n @session.chosen_office.time_zone if @session.chosen_office.present?\n end",
"def timezone!\n if @timezone.nil?\n\n tz = get_country! \n # if country have only one zone then return that zone\n if tz.zones.count == 1\n @timezone = TZInfo::Timezone.get(tz.zones[0].name)\n else\n location_fetch! if @latitude.nil? or @longitude.nil?\n # some services returns timezone when fetch location \n tz_name! if @timezone.nil?\n end\n end\n return @timezone\n end",
"def time_zone_offset\n @session.chosen_office.time_zone_offset\n end",
"def timezone\n TimeZoneHelper.info_hash(tzinfo_tz, rails_tz)\n end",
"def tz_timezone ; timezone? ? TZInfo::Timezone.get(@timezone) : nil ; end",
"def tz\n # logger.debug(\"CHC: customer tz called from #{caller.join(\"\\n\")}\")\n if tzb = time_zone_binary\n tzb.to_r / MINS_PER_DAY\n else\n nil\n end\n end",
"def get_time_zone\n return nil if new_record?\n time_zone || lambda{\n _zone = nil\n _zone = GeoIP.new(Rails.root.join('lib', 'geoip_files', 'GeoLiteCity.dat')).city(last_sign_in_ip).try(:timezone) if last_sign_in_ip\n update_column(:time_zone, _zone) if _zone\n _zone\n }.call\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 time_zone\n addresses.primary.blank? || addresses.primary.time_zone.blank? ? nil : addresses.primary.time_zone\n end",
"def timezone\n @history.objects.find { |o| o.name == \"tz\" }.val\n end",
"def timezone\n Timezone.get_proxy(@identifier)\n end",
"def current_user_timezone\n app_get_geo_data_by_ip.try(:timezone) || \"America/La_Paz\"\n end",
"def request_time_zone\n facility_id = @request.dig(:facility, :parent_site_code)\n facility = Mobile::VA_FACILITIES_BY_ID[\"dfn-#{facility_id}\"]\n facility ? facility[:time_zone] : nil\n end",
"def find_timezone(city)\n @cities = City.all\n cityObject = @cities.where(name: city.downcase)\n\n timezone=nil\n cityObject.each do |c|\n timezone = c.timezone\n end\n\n return timezone\n end",
"def time_zone; end",
"def time_zone; end",
"def time_zone; end",
"def time_zone; end",
"def time_zone; end",
"def tz\n ActiveSupport::TimeZone.new timezone\n end",
"def time_in_zone\n # Time.zone should be UTC\n Time.zone.at((time+utc_offset)/1000)\n end",
"def get\n @timezone\n end",
"def get\n @timezone\n end",
"def timezone\n data[:timezone]\n end",
"def timezone\n return call('Bugzilla.tomezone')\n end",
"def time_zone\n return @time_zone\n end",
"def time_zone\n @time_zone\n end",
"def calculate(timezone); end",
"def time_zone\n ActiveSupport::TimeZone[\"Wellington\"]\n end"
]
| [
"0.750561",
"0.7415016",
"0.73211753",
"0.68303543",
"0.67889184",
"0.67746866",
"0.6667891",
"0.6656611",
"0.6656611",
"0.65952057",
"0.6561896",
"0.6533011",
"0.64766604",
"0.64741546",
"0.646192",
"0.6433686",
"0.6433686",
"0.6433686",
"0.6433686",
"0.6433686",
"0.64171845",
"0.6412741",
"0.6402361",
"0.6402361",
"0.6379385",
"0.6374292",
"0.63727266",
"0.633077",
"0.6325484",
"0.627452"
]
| 0.8218083 | 0 |
Add a random amount of blocks (30min per block) to the end of an existing start. | def random_range_end(start)
start + (rand(1..5) * 30).minutes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_range_start\n base.to_datetime + (rand(1..30) * 30).minutes\n end",
"def add_block block\n block.at self.length\n @blocks << block\n end",
"def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n @single_block += words\n end",
"def add_for_block_size(words)\n # If we're running :truncate_all, then just append the block for this\n # document and return\n if last_block == :truncate_all\n if block_list.empty?\n name = I18n.t('lib.frequency.block_size_dataset',\n num: block_list.size + 1, size: block_size)\n block_list.push(Block.new(words: words[0...block_size],\n name: name))\n end\n return\n end\n\n # Make the first block, if needed\n unless block_list.last\n block_list.push(\n Block.new(\n words: [],\n name: I18n.t('lib.frequency.block_size_dataset',\n num: 1, size: block_size)\n )\n )\n end\n\n # Fill up the last block\n current_left = block_size - block_list.last.words.size\n if current_left.positive?\n block_list.last.words.concat(words.shift(current_left))\n end\n\n # Bail if there weren't enough words in the document to finish that block\n return if block_list.last.words.size < block_size\n\n # Turn the remaining words into blocks and append\n words.in_groups_of(block_size, false).each do |b|\n name = I18n.t('lib.frequency.block_size_dataset',\n num: block_list.size + 1, size: block_size)\n block_list.push(Block.new(words: b, name: name))\n end\n end",
"def add_for_block_size(words)\n # If we're running :truncate_all, then just append the block for this\n # document and return\n if @last_block == :truncate_all\n if @blocks.empty?\n name = I18n.t('lib.frequency.block_size_dataset',\n num: @blocks.size + 1, size: @block_size)\n @blocks << Block.new(words[0...@block_size], name)\n end\n return\n end\n\n # Make the first block, if needed\n unless @blocks.last\n @blocks << Block.new([], I18n.t('lib.frequency.block_size_dataset',\n num: 1, size: @block_size))\n end\n\n # Fill up the last block\n current_left = @block_size - @blocks.last.words.size\n @blocks.last.words += words.shift(current_left) if current_left > 0\n\n # Bail if there weren't enough words in the document to finish that block\n return if @blocks.last.words.size < @block_size\n\n # Turn the remaining words into blocks and append\n words.in_groups_of(@block_size, false).each do |b|\n name = I18n.t('lib.frequency.block_size_dataset',\n num: @blocks.size + 1, size: @block_size)\n @blocks << Block.new(b, name)\n end\n end",
"def add_for_num_blocks(words)\n # We just add to the single block, and we split this when we call\n # #blocks\n single_block.concat(words)\n end",
"def create_blocks prev_hash, n, opts = {}\n interval = opts[:interval] || 600\n time = opts[:time] || Time.now.to_i\n bits = opts[:bits] || 553713663\n block = @store.get_block(prev_hash)\n n.times do |i|\n block = create_block block.hash, true, [], @key, 50e8, {\n time: time += interval, bits: bits }\n # block = @store.get_block(block.hash)\n # puts \"#{i} #{block.hash[0..8]} #{block.prev_block.reverse_hth[0..8]} #{Time.at(block.time).strftime('%Y-%m-%d %H:%M:%S')} c: #{block.chain} b: #{block.bits} n: #{block.nonce} w: #{block.work}\"\n end\n block\nend",
"def insert_mines\n @random_spots = []\n @num_of_mine.times do\n\n while @random_spots.length < @num_of_mine\n rand_num = Random.rand(@num_of_tiles**2)\n\n if !@random_spots.include?(rand_num)\n @random_spots << rand_num\n end\n\n end\n end\nend",
"def burst!(times)\n @burst_length += times\n end",
"def generate_random_block_id\n return ((0..9).to_a.sample(5)).join\n end",
"def random_spawn_countdown minimum\n 10.randomize(:ratio, :sign).to_i + 60\n end",
"def generate_blocks(blocks_array)\r\n size=rand(1..3)\r\n index=0\r\n while blocks_array.length<size\r\n case rand(4)\r\n when 0\r\n blocks_array[index]=Obstacle.new(\"media/man.png\", :man)\r\n when 1\r\n blocks_array[index]=Obstacle.new(\"media/tree.png\", :tree)\r\n when 2\r\n blocks_array[index]=Obstacle.new(\"media/bird.png\", :bird)\r\n when 3\r\n blocks_array[index]=Obstacle.new(\"media/bird2.png\", :bird2)\r\n end\r\n\r\n index+=1\r\n end\r\n end",
"def makeDurationBlockRel(relname, var_to_copy, binding, block_dur, skip_blocks)\n block_var = createNewVariable(relname + \"_blocks\", \"block_num\")\n rel_var = make_rel(relname, var_to_copy, 0)\n\n var_to_copy = getVariable(var_to_copy)\n binding = getVariable(binding)\n\n\n block_dur = block_dur * 1000 # Convert to milliseconds\n block_num = 1\n for bindcell in binding.cells\n cell_dur = bindcell.offset - bindcell.onset\n if cell_dur <= block_dur\n cell = block_var.make_new_cell()\n cell.change_arg(\"block_num\", block_num.to_s)\n cell.change_arg(\"onset\", bindcell.onset)\n cell.change_arg(\"offset\", bindcell.offset)\n block_num += 1\n else\n num_possible_blocks = cell_dur / block_dur #Integer division\n if num_possible_blocks > 0\n for i in 0..num_possible_blocks\n if i % skip_blocks == 0\n cell = block_var.make_new_cell()\n cell.change_arg(\"block_num\", block_num.to_s)\n cell.change_arg(\"onset\", bindcell.onset + i * block_dur)\n if bindcell.onset + (i + 1) * block_dur <= bindcell.offset\n cell.change_arg(\"offset\", bindcell.onset + (i + 1) * block_dur)\n else\n cell.change_arg(\"offset\", bindcell.offset)\n end\n block_num += 1\n end\n end\n end\n end\n end\n setVariable(relname + \"_blocks\", block_var)\nend",
"def create_block_of_rooms(start_date, end_date, discounted_rate)\n dates = date_range(start_date, end_date)\n new_block = RoomBlock.new(start_date, end_date, room_cost: discounted_rate)\n new_block.id = assign_block_id\n\n num_of_rooms = 0\n @rooms.each do |room|\n if is_available?(room, dates) && is_not_blocked?(room, dates)\n new_block.add_room(room)\n num_of_rooms += 1\n end\n if num_of_rooms == 5\n break\n end\n end\n\n @room_blocks << new_block\n\n return new_block\n end",
"def create_random_list(limit)\n limit.times do\n add(rand(10))\n end\n end",
"def create_a_block(group_name, num_of_rooms: 5, start_date: Date.today, end_date: Date.today + 2, room_rate: 175)\n if num_of_rooms > 5\n raise ArgumentError.new(\"Only 5 rooms per block.\")\n end\n\n list = Room.all_available_rooms(rooms, start_date: start_date, end_date: end_date)\n\n if list.length < num_of_rooms\n raise ArgumentError.new(\"Not enough rooms available. Only #{list.length} room(s) available.\")\n else\n final_list = list[0...num_of_rooms]\n end\n\n new_block = Block.new(group_name, final_list, start_date: start_date, end_date: end_date, room_rate: room_rate)\n\n blocks << new_block\n\n final_list.each do |room_number|\n room = Room.find_room(rooms, room_number)\n room.change_status_of_room(rooms, room_number, start_date: start_date, end_date: end_date)\n end\n\n return new_block\n end",
"def create_blocks(count)\n begin\n create_blocks! count\n rescue\n nil\n end\n end",
"def no_of_blocks\n @highlighted_blocks = \"\"\n blocks = Random.rand(5) + 1\n blocks.times {|count|\n row = Random.rand(5)\n column = Random.rand(5)\n @highlighted_blocks << \"#button_#{row}_#{column} \"\n }\n end",
"def add_blocks_to_schedule(time_blocks, schedule, recurring)\n time_blocks.each do |block|\n day_of_week = block.split(\"_\")[0]\n time = block.split(\"_\")[1]\n start_time = Time.utc(\"2011\", nil, nil, time.split(\" - \")[0])\n end_time = Time.utc(\"2011\", nil, nil, time.split(\" - \")[1])\n \n if Day.exists?(day_of_week, schedule.id)\n day = Day.where(:name => day_of_week, :schedule_id => schedule.id).first\n else\n day = Day.new(:name => day_of_week, :schedule_id => schedule.id)\n day.save\n end\n \n if !TimeBlock.exists?(start_time, end_time, day.id, recurring)\n time_block = TimeBlock.new(:start_time => start_time, :end_time => end_time, :day_id => day.id, :recurring => recurring)\n time_block.save\n end\n end\n end",
"def create_blocks!(count)\n begin\n result = []\n 1.upto count do |i|\n result << create_block\n end\n rescue\n result.each(&:destroy)\n raise\n end\n end",
"def start_new_block\n if (@block_buffer)\n add_block(@block_buffer)\n @block_buffer = nil\n end\n end",
"def next_duration\n @durations.empty? ? rand(20) : @durations.shift\n end",
"def random_blocks(length, height, odds, kind)\n return unless rand(0..odds) == rand(0..odds)\n block = [[0, 0], [1, 0], [0, 1], [1, 1]]\n length = rand(length - 1)\n block.each do |xy|\n @elements << Element.new(kind, [length + xy[0], height + xy[1]], [0, 0], 1)\n end\n end",
"def next_blocks(*blocks)\n @next_blocks = blocks.dup\n end",
"def random_time_offset(max_minutes_offset=5)\n rand(max_minutes_offset) * (-1).power!(rand(2)) * 60\n end",
"def next\n Time.now + @min + Random.rand(@max - @min)\n end",
"def add_random_mines(num_mines)\n add_mines(get_random_mines(num_mines)) \n end",
"def new_block(check_in, check_out, number_of_rooms, rate)\n block_rooms_ids = []\n\n rooms_available = available_rooms(check_in, check_out)\n\n if number_of_rooms <= 5 && rooms_available.count >= number_of_rooms\n number_of_rooms.times do\n block_rooms_ids << rooms_available[0]\n end\n\n block = BlockRoom.new(check_in, check_out, rate, block_rooms_ids)\n\n @blocks << block\n else\n raise ArgumentError.new(\"Can only block 5 rooms at a time. Can only block available rooms. There are #{available_rooms.count} rooms.\")\n end\n end",
"def insert_new_generation\n (0...@new_generation.size).each do |i|\n evaluate_chromosome @new_generation[i]\n j = rand [email protected]\n @chromosomes.delete_at j\n @chromosomes << @new_generation[i]\n end\n @mating_pool.clear\n @new_generation.clear\n end",
"def generate_next_block(block_data, blockchain)\n previous_block = latest_block(blockchain)\n p previous_block\n block_index = previous_block.block_index + 1\n timestamp = Time.now.to_i.to_s\n block_hash = Digest::SHA256.hexdigest(block_index.to_s + previous_block.block_hash + timestamp + block_data)\n Block.new(block_index, previous_block.block_hash, timestamp, block_data, block_hash)\n end"
]
| [
"0.6101411",
"0.58748794",
"0.578914",
"0.5707435",
"0.57006514",
"0.5687463",
"0.5662635",
"0.56504726",
"0.5633058",
"0.56010556",
"0.55987895",
"0.5523075",
"0.5510154",
"0.5418222",
"0.5354336",
"0.531994",
"0.5262501",
"0.52583444",
"0.52465177",
"0.5210932",
"0.5204403",
"0.5177305",
"0.51727265",
"0.5131196",
"0.5115198",
"0.5062654",
"0.50547314",
"0.50496477",
"0.50422734",
"0.50092775"
]
| 0.66548526 | 0 |
add hvac Add the daylighting controls for lobby, cafe, dinning and banquet | def add_daylighting_controls(building_vintage)
space_names = ['Banquet_Flr_6','Dining_Flr_6','Cafe_Flr_1','Lobby_Flr_1']
space_names.each do |space_name|
space = self.getSpaceByName(space_name).get
space.addDaylightingControls(building_vintage, false, false)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addDaylightingControls()\n \n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Started adding daylighting controls.')\n \n # Add daylighting controls to each space\n self.getSpaces.sort.each do |space|\n added = space.addDaylightingControls(self.template, false, false)\n end\n \n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Finished adding daylighting controls.')\n \n end",
"def add_hl_hl\n end",
"def add_a_hl\n end",
"def set_clocks\n now = DateTime.now\n $current_time.value = now.strftime(DateTimeFormat)\n $universal_time.value = now.new_offset.strftime(DateTimeFormat)\n $lunar_date.value = '%4d\\'%02d\\'%02d' % LunarYear.lunar_date(now.to_date)\n now\nend",
"def daylight_params\n params.require(:daylight).permit(:start, :stop)\n end",
"def set_vacation_hours_event\n @vacation_hours_event = VacationHoursEvent.find(params[:id])\n end",
"def create\n @daylight = Daylight.new(daylight_params)\n\n respond_to do |format|\n if @daylight.save\n format.html { redirect_to @daylight, notice: 'Daylight was successfully created.' }\n format.json { render json: @daylight, status: :created, location: @daylight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daylight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_hl_de\n end",
"def hours\n\n today = Date.today\n hours = {}\n #if @traveler.is_visitor? or @traveler.is_api_guest? #Return a wide range of hours\n if not @traveler or not @traveler.registered?\n (0..30).each do |n|\n hours[(today + n).to_s] = {open: \"07:00\", close: \"22:00\"}\n end\n\n else # This is not a guest, check to see if the traveler is registered with a service\n\n # NOTE(wilsonj806) For now this implementation does not let registered users\n #...book trips on weekends. Eventually we want to change that so they can do so\n\n if @traveler.booking_profiles.count > 0 #This user is registered with a service\n booking_profile = @traveler.booking_profiles.first\n service = booking_profile.service\n\n min_notice_days = (service.booking_details[:min_days] || 2).to_i\n max_notice_days = (service.booking_details[:max_days] || 14).to_i\n\n \n if service.booking_details[:trusted_users] and booking_profile.external_user_id.in? service.booking_details.try(:[], :trusted_users).split(',').map{ |x| x.strip }\n (1..21).each do |n|\n hours[(today + n).to_s] = {open: \"00:00\", close: \"23:59\"}\n end\n elsif service.schedules.count > 0 #This user's service has listed hours. This is the most common case.\n \n #Find out if we are past the cutoff for today. If so, start counting from tomorrow\n if service.booking_details[:cutoff_time] and (Time.now.in_time_zone.seconds_since_midnight > service.booking_details[:cutoff_time].to_i)\n day = Time.now + 1.days \n else\n day = Time.now\n end\n \n biz_days_count = 0\n (0..max_notice_days).each do |n|\n if service.open_on_day? day\n if biz_days_count >= min_notice_days\n schedule = service.schedules.where(day: day.wday).first\n if schedule\n hours[day.strftime('%Y-%m-%d')] = {open: schedule.schedule_time_to_military_string(schedule.start_time), \n close: schedule.schedule_time_to_military_string(schedule.end_time)}\n end\n end\n biz_days_count += 1\n end\n day = day + 1.days \n end\n\n else #This user is registered with a service, but that service has not entered any hours\n\n (min_notice_days..max_notice_days).each do |n|\n unless (today + n).saturday? or (today + n).sunday?\n hours[(today + n).to_s] = {open: \"08:00\", close: \"17:00\"}\n end\n end\n\n end\n\n else #This user is logged in but isn't registered with a service\n\n (1..14).each do |n|\n unless (today + n).saturday? or (today + n).sunday?\n hours[(today + n).to_s] = {open: \"08:00\", close: \"17:00\"}\n end\n end\n\n end # if #traveler.user_profile.user_services.count > 0\n end # if @travler.is_visitor\n\n render status: 200, json: hours\n\n end",
"def add_veth veth\n cmd = \"#{@vzctl} set #{@ctid} --netif_add #{veth[:ifname]},#{veth[:mac]},#{veth[:host_ifname]},\" \\\n \"#{veth[:host_mac]}, #{veth[:bridge]}\"\n execute(cmd)\n end",
"def add_exterior_lights(building_type, building_vintage, climate_zone, prototype_input)\n # TODO Standards - translate w/linear foot of facade, door, parking, etc\n # into lookup table and implement that way instead of hard-coding as\n # inputs in the spreadsheet.\n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Started adding exterior lights')\n\n # Occupancy Sensing Exterior Lights\n # which reduce to 70% power when no one is around.\n unless prototype_input['occ_sensing_exterior_lighting_power'].nil?\n occ_sens_ext_lts_power = prototype_input['occ_sensing_exterior_lighting_power']\n occ_sens_ext_lts_sch_name = prototype_input['occ_sensing_exterior_lighting_schedule']\n occ_sens_ext_lts_name = 'Occ Sensing Exterior Lights'\n occ_sens_ext_lts_def = OpenStudio::Model::ExteriorLightsDefinition.new(self)\n occ_sens_ext_lts_def.setName(\"#{occ_sens_ext_lts_name} Def\")\n occ_sens_ext_lts_def.setDesignLevel(occ_sens_ext_lts_power)\n occ_sens_ext_lts_sch = self.add_schedule(occ_sens_ext_lts_sch_name)\n occ_sens_ext_lts = OpenStudio::Model::ExteriorLights.new(occ_sens_ext_lts_def, occ_sens_ext_lts_sch)\n occ_sens_ext_lts.setName(\"#{occ_sens_ext_lts_name} Def\")\n occ_sens_ext_lts.setControlOption('AstronomicalClock')\n end\n\n # Building Facade and Landscape Lights\n # that don't dim at all at night.\n unless prototype_input['nondimming_exterior_lighting_power'].nil?\n nondimming_ext_lts_power = prototype_input['nondimming_exterior_lighting_power']\n nondimming_ext_lts_sch_name = prototype_input['nondimming_exterior_lighting_schedule']\n nondimming_ext_lts_name = 'NonDimming Exterior Lights'\n nondimming_ext_lts_def = OpenStudio::Model::ExteriorLightsDefinition.new(self)\n nondimming_ext_lts_def.setName(\"#{nondimming_ext_lts_name} Def\")\n nondimming_ext_lts_def.setDesignLevel(nondimming_ext_lts_power)\n nondimming_ext_lts_sch = self.add_schedule(nondimming_ext_lts_sch_name)\n nondimming_ext_lts = OpenStudio::Model::ExteriorLights.new(nondimming_ext_lts_def, nondimming_ext_lts_sch)\n nondimming_ext_lts.setName(\"#{nondimming_ext_lts_name} Def\")\n nondimming_ext_lts.setControlOption('AstronomicalClock')\n end\n\n # Fuel Equipment, As Exterior:FuelEquipment is not supported by OpenStudio yet,\n # temporarily use Exterior:Lights and set the control option to ScheduleNameOnly\n # todo: change it to Exterior:FuelEquipment when OpenStudio supported it.\n unless prototype_input['exterior_fuel_equipment1_power'].nil?\n fuel_ext_power = prototype_input['exterior_fuel_equipment1_power']\n fuel_ext_sch_name = prototype_input['exterior_fuel_equipment1_schedule']\n fuel_ext_name = 'Fuel equipment 1'\n fuel_ext_def = OpenStudio::Model::ExteriorLightsDefinition.new(self)\n fuel_ext_def.setName(\"#{fuel_ext_name} Def\")\n fuel_ext_def.setDesignLevel(fuel_ext_power)\n fuel_ext_sch = self.add_schedule(fuel_ext_sch_name)\n fuel_ext_lts = OpenStudio::Model::ExteriorLights.new(fuel_ext_def, fuel_ext_sch)\n fuel_ext_lts.setName(\"#{fuel_ext_name}\")\n fuel_ext_lts.setControlOption('ScheduleNameOnly')\n end\n\n unless prototype_input['exterior_fuel_equipment2_power'].nil?\n fuel_ext_power = prototype_input['exterior_fuel_equipment2_power']\n fuel_ext_sch_name = prototype_input['exterior_fuel_equipment2_schedule']\n fuel_ext_name = 'Fuel equipment 2'\n fuel_ext_def = OpenStudio::Model::ExteriorLightsDefinition.new(self)\n fuel_ext_def.setName(\"#{fuel_ext_name} Def\")\n fuel_ext_def.setDesignLevel(fuel_ext_power)\n fuel_ext_sch = self.add_schedule(fuel_ext_sch_name)\n fuel_ext_lts = OpenStudio::Model::ExteriorLights.new(fuel_ext_def, fuel_ext_sch)\n fuel_ext_lts.setName(\"#{fuel_ext_name}\")\n fuel_ext_lts.setControlOption('ScheduleNameOnly')\n end\n\n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Finished adding exterior lights')\n \n return true\n end",
"def set_vhp_ctas\n #ctas =\n\n end",
"def add_cont name,telephone,\n\t\t\t\t\t\t@agenda << {name: name, telephone: telephone}\n\t\t\t\t\tend",
"def add_vic_com\n if @vic_com != nil and @common_events[@vic_com] != nil\n @common_event_q += @common_events[@vic_com].list\n end\n if @common_events[GTBS::VIC_COM] != nil\n @common_event_q += @common_events[GTBS::VIC_COM].list\n end\n end_battle(0)\n end",
"def defineSaturdaySundayAndWendnesdayAsHoliday\n Setting['plugin_redmine_workload']['general_workday_monday'] = 'checked';\n Setting['plugin_redmine_workload']['general_workday_tuesday'] = 'checked';\n Setting['plugin_redmine_workload']['general_workday_wednesday'] = '';\n Setting['plugin_redmine_workload']['general_workday_thursday'] = 'checked';\n Setting['plugin_redmine_workload']['general_workday_friday'] = 'checked';\n Setting['plugin_redmine_workload']['general_workday_saturday'] = '';\n Setting['plugin_redmine_workload']['general_workday_sunday'] = '';\n end",
"def zone() end",
"def vac(hours = 1)\n vac = bac(hours) - eac(hours)\n vac.round(1)\n end",
"def set_default_times\n if !self.start\n return\n end\n\n if self.start.hour == 0 # hour set to 0 if not otherwise defined...\n self.start = self.start + 9.hours\n end\n\n if !self.end\n if self.online?\n self.end = self.start + 1.hour\n else\n diff = 17 - self.start.hour\n self.end = self.start + diff.hours\n end\n end\n # TODO: Set timezone for online events. Where to get it from, though?\n # TODO: Check events form to add timezone autocomplete.\n # Get timezones from: https://timezonedb.com/download\n\n end",
"def update\n @vacation = Vacation.find(params[:id])\n set_tz_offset(:vacation)\n\n respond_to do |format|\n if @vacation.update_attributes(params[:vacation])\n format.html { redirect_to @vacation, :notice => 'Vacation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @vacation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test\n WorkCalendar.configure do |c|\n c.weekdays = %i(mon tue wed thu fri)\n c.holidays = [Date.new(2015, 1, 1), Date.new(2015, 7, 3), Date.new(2015, 12, 25)]\n end\n end",
"def day\n @client = Client.new\n @title = @current_user.name\n @view = 'day'\n # TODO is Date.parse in current time zone? If not add.\n @date = params[:date].nil? ? Date.current : Date.parse(params[:date])\n # TODO: brakeman is warning of security problem with this line\n @nav_title = @date.strftime(NAV_TITLE[@view.to_sym])\n # TODO: should employees stay or go?\n @employees = [1]\n\n @appointments_by_hour = Hash.new\n r = Appointment.where(time: @[email protected]_time_zone.end_of_day).order(:time).includes(:client)\n r.each do |appointment| #.order(:time).group_by(&:time)\n k = appointment.time.hour\n if @appointments_by_hour.has_key?(k)\n @appointments_by_hour[k].push(appointment)\n else\n @appointments_by_hour[k] = [appointment]\n end\n end\n\n render 'index'\n end",
"def add_to_region\r\n western_states = [\"Arizona\", \"Colorado\", \"Idaho\", \"Montana\", \"Nevada\", \"New Mexico\", \"Utah\", \"Wyoming\", \"Alaska\", \"California\", \"Hawaii\", \"Oregon\", \"Washington\"]\r\n southern_states = [\"Alabama\", \"Arkansas\", \"Delaware\", \"Florida\", \"Georgia\", \"Kentucky\", \"Louisiana\", \"Maryland\", \"Mississippi\", \"North Carolina\", \"Oklahoma\", \"South Carolina\", \"Tennessee\", \"Texas\", \"Virgina\", \"West Virginia\"]\r\n eastern_states = [\"Maine\", \"New Hampshire\", \"Vermont\", \"Massachusetts\", \"Rhode Island\", \"Connecticut\", \"New York\", \"Pennsylvania\", \"New Jersey\"]\r\n midwest_states = [\"Wisconsin\", \"Michigan\", \"Illinois\", \"Indiana\", \"Ohio\", \"North Dakota\", \"South Dakota\", \"Nebraska\", \"Kansas\", \"Minnesota\", \"Iowa\", \"Missouri\"]\r\n\r\n if western_states.include?(name)\r\n @@wregion[:confirmed_cases] += self.confirmed_cases\r\n @@wregion[:overall_deaths] += self.overall_deaths\r\n elsif southern_states.include?(name)\r\n @@sregion[:confirmed_cases] += self.confirmed_cases\r\n @@sregion[:overall_deaths] += self.overall_deaths\r\n elsif eastern_states.include?(name)\r\n @@eregion[:confirmed_cases] += self.confirmed_cases\r\n @@eregion[:overall_deaths] += self.overall_deaths\r\n elsif midwest_states.include?(name)\r\n @@mregion[:confirmed_cases] += self.confirmed_cases\r\n @@mregion[:overall_deaths] += self.overall_deaths\r\n end\r\n\r\n end",
"def add_all_lights\n all_lights = []\n overview[\"lights\"].each do |id, light|\n all_lights << add_light(id.to_i, light[\"name\"])\n end\n all_lights\n end",
"def add_all_lights\n all_lights = []\n overview[\"lights\"].each do |id, light|\n all_lights << add_light(id.to_i, light[\"name\"])\n end\n all_lights\n end",
"def add_hl_bc\n end",
"def ajust_weather_switches\n weather = current_weather\n $game_switches[::Yuki::Sw::WT_Rain] = (weather == 1)\n $game_switches[::Yuki::Sw::WT_Sunset] = (weather == 2)\n $game_switches[::Yuki::Sw::WT_Sandstorm] = (weather == 3)\n $game_switches[::Yuki::Sw::WT_Snow] = (weather == 4)\n $game_switches[::Yuki::Sw::WT_Fog] = (weather == 5)\n end",
"def index\n @vacation_hours_events = VacationHoursEvent.all\n end",
"def load_calendar agency_id=nil\n expanded_calendar = {}\n\n #=========GET SERVICE_IDs, ASSOCIATE THEM WITH INTs=====\n sid_numbers = load_service_ids\n\n #=========FIGURE OUT THE SERVICE DAY BOUNDS=============\n\n day_bounds = conn.exec <<-SQL\n select min(departure_time), max(arrival_time) from gtf_stop_times\n SQL\n\n #convert day_bounds to seconds since beginning of local midnight\n sid_start = GoogleTransitFeed::parse_time( day_bounds[0][0] )\n sid_end = GoogleTransitFeed::parse_time( day_bounds[0][1] )\n\n #pop an error if service days overlap\n #if sid_end-sid_start > SECONDS_IN_DAY then raise \"Service day spans #{day_bounds[0][0]} to #{day_bounds[0][1]}; Service days may not overlap\" end\n\n #=========GET TIMEZONE INFORMATION======================\n if agency_id then\n timezone = conn.exec \"SELECT agency_timezone FROM gtf_agency WHERE agency_id='#{agency_id}'\"\n else\n timezone = conn.exec \"SELECT agency_timezone FROM gtf_agency\"\n end\n timezone = TZInfo::Timezone.get( timezone[0][0] ) #convert timezone string (eg \"America/New York\") to timezone\n tz_offset = timezone.current_period.utc_offset #number of seconds offset from UTC (eg -18000)\n dst_offset = timezone.current_period.std_offset #number of seconds changed during daylight savings eg 3600\n\n #=========EXPAND calendar TABLE INTO HASH===============\n dates = conn.exec <<-SQL\n SELECT service_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, start_date, end_date from gtf_calendar\n SQL\n\n #for each service_id in the calendar table\n dates.each do |service_id, mon, tue, wed, thu, fri, sat, sun, start_date, end_date|\n #convert to boolean daymask\n daymask = [mon.to_i, tue.to_i, wed.to_i, thu.to_i, fri.to_i, sat.to_i, sun.to_i].collect do |day| day == 1 end\n\n #Find the UTC date, as if we're in London\n i = GoogleTransitFeed::parse_date( start_date.to_s ) #date as parsed to UTC\n n = GoogleTransitFeed::parse_date( end_date.to_s ) #end date is inclusive\n\n #the expanded calendar is a hash with the dates where services run as keys and\n #the service_ids of particular services running each day as values, grouped in arrays\n #for each day in the service_id date range\n while i <= n do\n if daymask[ i.wday ] then\n expanded_calendar[i] ||= []\n expanded_calendar[i] << sid_numbers[service_id]\n end\n\n i += SECONDS_IN_DAY\n end\n end\n\n #=========APPLY EXCEPTIONS FROM calendar_dates TO expanded_calendar HASH=============\n single_dates = conn.exec <<-SQL\n SELECT service_id, date, exception_type from gtf_calendar_dates\n SQL\n\n single_dates.each do |service_id, date, exception_type|\n #returns UTC date, as if we're in London\n i = GoogleTransitFeed::parse_date( date.to_s )\n expanded_calendar[i] ||= []\n\n if exception_type.to_i == 1 then\n expanded_calendar[i] << sid_numbers[service_id]\n elsif exception_type.to_i == 2 then\n expanded_calendar[i].delete sid_numbers[service_id]\n end\n end\n\n #========CONVERT EXPANDED CALENDAR TO SORTED ARRAY===================================\n expanded_calendar = expanded_calendar.to_a\n expanded_calendar.sort! do |a,b|\n a.first <=> b.first\n end\n\n #========CONVERT SORTED ARRAY INTO CALENDAR OBJECT===================================\n ret = Calendar.new\n expanded_calendar.each do |day, service_ids|\n local_daystart = day.to_i-tz_offset\n #if daylight savings is in effect\n if timezone.period_for_utc( day.to_i ).dst? then\n local_daystart -= dst_offset\n daylight_savings = dst_offset\n else\n daylight_savings = 0\n end\n\n ret.append_day( local_daystart+sid_start, local_daystart+sid_end, service_ids, daylight_savings )\n end\n\n return ret.rewind!\n end",
"def control_init(controls = {})\r\n @init_end << add_control(GSmallMapControl.new) if controls[:small_map]\r\n @init_end << add_control(GLargeMapControl.new) if controls[:large_map]\r\n @init_end << add_control(GSmallZoomControl.new) if controls[:small_zoom]\r\n @init_end << add_control(GScaleControl.new) if controls[:scale]\r\n @init_end << add_control(GMapTypeControl.new) if controls[:map_type]\r\n @init_end << add_control(GOverviewMapControl.new) if controls[:overview_map]\r\n end",
"def create\n @gotodate = params[:vacation][:starts_at].to_time.to_i * 1000\n set_tz_offset(:vacation)\n @user = User.find(params[:user_id])\n @vacation = @user.vacations.build(params[:vacation])\n\n\n respond_to do |format|\n if @vacation.save\n format.js { render 'update_listing', :layout => false }\n else\n format.js { render :partial => 'shared/error', :locals => {:target => @vacation} }\n end\n end\n end"
]
| [
"0.71322644",
"0.5209009",
"0.5202599",
"0.5136928",
"0.5112874",
"0.5109905",
"0.4953279",
"0.49216655",
"0.49124262",
"0.48623702",
"0.4854162",
"0.48344964",
"0.47726038",
"0.4744203",
"0.47417986",
"0.47315714",
"0.47222507",
"0.46913967",
"0.4673408",
"0.46558735",
"0.46505213",
"0.46459463",
"0.4637779",
"0.4637779",
"0.46262956",
"0.46082819",
"0.45961088",
"0.45913056",
"0.45757276",
"0.45744005"
]
| 0.70055264 | 1 |
Generate a planet based on user's inputs | def generate_planet
puts "\nLet's create a planet from scratch."
print "Please enter its name first: "
name = gets.chomp
print "What's its diameter of this planet in km? "
diameter = gets.chomp.to_f
print "What's its mass in kg? (example of input format: 3.30 x 10^23 ) "
mass = gets.chomp
print "What's the year length of this planet in days? "
yr_length = gets.chomp.to_f
print "What's the distance from the sun to this planet in km? "
dis_from_sun = gets.chomp.to_f
print "How many moons does this planet have? Enter 0 if there is none. "
moons = gets.chomp.to_i
planet = Planet.new({"name" => name, "diameter" => diameter, "mass" => mass, "yr_length" => yr_length, "dis_from_sun" => dis_from_sun, "moons" => moons})
return planet
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_planet()\n puts \"\\nAdding planet. Please tell me more about this planet.\"\n \n print \"Enter the planet name: \"\n name = gets.chomp.capitalize\n \n print \"\\nEnter the planet color: \"\n color = gets.chomp.downcase\n \n print \"\\nEnter planet mass in kg: \"\n mass_kg = gets.chomp.to_f\n \n print \"\\nEnter planet's distance from the sun in km: \"\n distance_from_sun_km = gets.chomp.to_f\n \n print \"\\nEnter a fun fact about the planet: \"\n fun_fact = gets.chomp\n \n return Planet.new(name, color, mass_kg, distance_from_sun_km, fun_fact)\n end",
"def create_planet(name, mass, year_length, diameter, number_of_moons, distance_from_sun)\n return Planet.new(name, mass, year_length, diameter, number_of_moons, distance_from_sun)\nend",
"def define_new_planet\n print \"\\nWhat is the name of the planet? \"\n planet_name = gets.chomp.capitalize\n print \"What is the diameter of #{planet_name} (in miles)? \"\n planet_diameter = gets.chomp.to_i\n print \"What is #{planet_name}'s distance from the sun (in millions of miles): \"\n planet_distance_from_sun = gets.chomp.to_f\n print \"What is the #{planet_name}'s year length (in Earth years)? \"\n planet_year_length = gets.chomp.to_f\n print \"How many moon's does #{planet_name} have? \"\n planet_moons = gets.chomp.to_i\n return new_planet = Planet.new(planet_name, planet_diameter, planet_distance_from_sun, planet_year_length, planet_moons)\nend",
"def create_planet\n puts \"\\nPlease input the following information about your new planet:\"\n\n puts \"Name of Planet:\"\n new_planet_name = gets.chomp.capitalize\n\n puts \"Distance from sun (in million km):\"\n new_planet_distance_from_sun = gets.chomp.to_i\n\n puts \"Year length (in days):\"\n new_planet_year_length = gets.chomp.to_i\n\n puts \"Diameter (in km):\"\n new_planet_diameter = gets.chomp.to_i\n\n puts \"Affiliated Zodiac Sign\"\n new_planet_zodiac = gets.chomp.capitalize\n\n puts \"Number of moons:\"\n new_planet_num_moons = gets.chomp.to_i\n\n return Planet.new(new_planet_name, new_planet_distance_from_sun, new_planet_year_length, new_planet_diameter, new_planet_zodiac, new_planet_num_moons)\nend",
"def gen_planet(class_map)\n class_map[\"colour\"] = PLANET_COLOURS[class_map[\"type\"].downcase]\n text = \"//#{class_map[\"package\"]} class: #{class_map[\"name\"]}\n#{class_map[\"indexed_name\"]}.setValues({\n name: \\\"#{class_map[\"indexed_name\"]}\\\",\n geometry: new THREE.SphereGeometry(#{class_map[\"radius\"]+0.01}, 10, 10),\n material: new THREE.MeshLambertMaterial({emissive: 0x888888, color: #{class_map[\"colour\"]}, map: planet_texture}),\n origin: #{class_map[\"package\"]}, \n orbitradx: #{(Random.rand(2) == 0)? \"\" : \"-\"}#{class_map[\"orbit\"]}, \n orbitrady: #{(Random.rand(2) == 0)? \"\" : \"-\"}#{class_map[\"orbit\"]}, \n #{(Random.rand(2) == 0)? \"ysin: false\" : \"xsin:false\"},\n rotx: 0.01, \n roty: 0.01, \n rotz: 0.01,\n tfactor: #{1 + Random.rand}});\ncelestials[celestials.length] = #{class_map[\"indexed_name\"]};\\n\\n\"\n return text\nend",
"def user_planet(solar_system)\n puts \"Your new planet will need a name: \"\n name = gets.chomp\n puts \"Tell me more about planet #{name}! Just hit return (enter) on your keyboard if don't know the value.\"\n puts \"Position from its star (star is position 0): \"\n position = gets.chomp\n puts \"Mass: \"\n mass = gets.chomp\n puts \"Radius: \"\n radius = gets.chomp\n puts \"Orbital Period (days to get around the star once): \"\n orbital_period = gets.chomp\n star = solar_system\n\n user_planet = Planet.new(name, position, mass, radius, orbital_period, star)\n end",
"def create_planet\n new_planet ={}\n\n print \"\\nWhat is the name of the planet? \"\n new_planet[:name] = gets.chomp.downcase\n\n print \"How old is #{new_planet[:name].each_first_letters} in Earth years? \"\n new_planet[:age] = gets.chomp.to_i\n\n print \"What is the size of #{new_planet[:name].each_first_letters}? \"\n new_planet[:size] = gets.chomp\n\n print \"How many visitors does #{new_planet[:name].each_first_letters} get? \"\n new_planet[:visitor_count] = gets.chomp\n\n print \"Who or what are #{new_planet[:name].each_first_letters} inhabitants? \"\n new_planet[:inhabitants] = gets.chomp\n\n new_planet = Planet.new(new_planet)\n\n return new_planet\nend",
"def planet; end",
"def planet; end",
"def planet; end",
"def planet; end",
"def planet; end",
"def planet; end",
"def create_planet(array_of_planets)\n puts \"Tell us some information about your planet.\"\n print \"Name: \"\n name = gets.chomp\n print \"Length of Year: \"\n year_length = gets.chomp\n print \"Distance from the Sun: \"\n distance_from_sun = gets.chomp\n puts \"We have found that most planets known to humankind share certain characteristics. If the given information is true of your planet, type YES. If its not, give us the correct information for your planet.\"\n puts \"Language: Meowish\"\n language = gets.chomp\n if language == \"YES\"\n language = \"Meowish\"\n else\n language = language\n end\n puts \"Inhabitants: Cats\"\n inhabitants = gets.chomp\n if inhabitants == \"YES\"\n inhabitants = \"Cats\"\n else\n inhabitants = inhabitants\n end\n puts \"Primary Export: Catnip\"\n primary_export = gets.chomp\n if primary_export == \"YES\"\n primary_export = \"Catnip\"\n else\n primary_export = primary_export\n end\n array_of_planets << Planet.new(name, year_length, distance_from_sun, language: language, inhabitants: inhabitants, primary_export: primary_export)\nend",
"def create_user_planet\n puts \"What do you call your planet?:\"\n user_planet_name = gets.chomp\n\n puts \"What is the radius of your planet?:\"\n user_planet_radius = gets.chomp\n\n puts \"What is the length of day for #{user_planet_name}?:\"\n user_planet_lod = gets.chomp\n\n puts \"How far away is #{user_planet_name} from the sun?:\"\n user_planet_distance_sun = gets.chomp\n\n puts \"What is the year length?:\"\n user_planet_year_length = gets.chomp\n\n\n puts \"What is the mass for #{user_planet_name}?:\"\n user_planet_mass = gets.chomp\n\n user_planet = Planets.new(user_planet_name, user_planet_radius, user_planet_lod, user_planet_distance_sun, user_planet_year_length, user_planet_mass)\nreturn user_planet\nend",
"def add_planet_from_user\n print \"What is the name of the planet you would like to add? \"\n name = gets.chomp.capitalize\n\n print \"What color is the planet? \"\n color = gets.chomp.downcase\n\n print \"What is the mass of the planet in kilograms? \"\n mass = gets.chomp.to_i\n\n print \"How far away is the planet from the sun in kilometers? \"\n distance = gets.chomp.to_i\n\n print \"Let's add a fun fact about the planet! Complete the sentence. #{name}..\"\n fact = gets.chomp.downcase\n\n new_planet = Planet.new(name, color, mass, distance, fact)\n return new_planet\n end",
"def user_create_planet(solar_system)\n\tputs \"What is the name of the planet?\"\n\tuser_planet_name = gets.chomp.capitalize\n\n\tputs \"What color is #{user_planet_name}?\"\n\tuser_planet_color = gets.chomp.downcase\n\n\tputs \"What is its mass in kilograms?\"\n\tuser_planet_mass = verify_number(gets.chomp)\n\n\tputs \"What distance is the planet from the sun (in kilometers)?\"\n\tuser_planet_distance = verify_number(gets.chomp)\n\n\tputs \"Can you share a fun fact about #{user_planet_name}?\"\n\tuser_planet_fun_fact = gets.chomp.capitalize\n\n\tuser_planet = Planet.new(user_planet_name,user_planet_color, user_planet_mass,user_planet_distance,user_planet_fun_fact)\n\tsolar_system.add_planet(user_planet)\nend",
"def add_planet\n planet = Planet.new(get_planet_name, get_planet_distance, get_planet_rotation, get_planet_moons)\n return planet\nend",
"def add_new_planet our_solar_system\n puts \"Please enter the planet name\"\n planet_name = gets.chomp.capitalize\n print \"Please enter the length of time the planet takes to go around its star in earth days. ➤ \"\n year_length = gets.chomp.to_f.round(2)\n print \"Please enter how far is the planet from the sun in kilometers. ➤ \"\n distance_from_the_sun = gets.chomp.to_f.round(2)\n print \"Please enter the mass of a planet in kilograms. ➤ \"\n mass = gets.chomp\n print \"Please enter a diameter of the planet in kilometers. ➤ \"\n diameter = gets.chomp.to_f.round(2)\n print \"Please enter what is the composition of the atmosphere. ➤ \"\n atmospheric_components = gets.chomp\n\n new_planet = Planet.new(planet_name, year_length, distance_from_the_sun, mass, diameter, atmospheric_components)\n our_solar_system.add_planet(new_planet)\n puts \"New planet #{planet_name} is added.\".red\nend",
"def set_planet\n end",
"def manual_add_planet(sol)\n puts \"What is the name of the planet? \"\n name = valid_name(gets.chomp)\n puts \"What is the mass(unit: 1e+24 kg) of the planet #{name}?\"\n mass = valid_float(gets.chomp)\n puts \"What is the diameter(unit: km) of the planet #{name}?\"\n diameter = valid_float(gets.chomp).abs\n puts \"How many moons does the planet #{name} have?\"\n number_of_moons = valid_integer(gets.chomp)\n puts \"What is the distance(unit: 1e+6 km) between the sun and the planet #{name}?\"\n distance_from_the_sun = valid_float(gets.chomp).abs\n puts \"What is the rate of the solar rotation for the planet #{name} in Earth hours?\"\n rate_of_solar_rotation = valid_float(gets.chomp)\n puts \"What is the orbital period for the planet #{name} in Earth days?\"\n orbital_period = valid_float(gets.chomp)\n\n sol.add_planet(\n Planet.new(\n {\n name: name,\n mass: mass,\n diameter: diameter,\n number_of_moons: number_of_moons,\n distance_from_the_sun: distance_from_the_sun,\n rate_of_solar_rotation: rate_of_solar_rotation,\n orbital_period: orbital_period\n }\n )\n )\n return sol\nend",
"def planet\n fetch('stargate.planets')\n end",
"def build_system(name, planet)\n @planets[name] = planet\n end",
"def add_planet (solar_system)\n print\"Enter a planet name: \"\n planet_name = gets.chomp # ask them for the name of the planet they wish to learn about\n planet = solar_system.find_planet_by_name(planet_name)\n if planet.nil?\n # Ask the user for details about the planet (W3.3)\n puts\"What is the planet color? \"\n planet_color = gets.chomp #\n\n puts\"What is the planet mass kg?: \"\n planet_mass = gets.chomp.to_i #\n\n puts\"What is the planet distance from sun? \"\n planet_distance = gets.chomp.to_i #\n\n puts\" What is a fun fact about the planet?\"\n planet_fun_fact = gets.chomp #\n # Create a new instance of Planet with that info, and add to solar_system(W3.3)\n new_planet = Planet.new(planet_name, planet_color, planet_mass, planet_distance, planet_fun_fact)\n solar_system.add_planet(new_planet)\n puts \"Planet added with success!\"\n puts new_planet.summary\n else\n puts \"That planet already exists!\"\n puts planet.summary\n end\nend",
"def show_planet(number)\n selected = @solar_system[number-1]\n\n # Calculate planet related ages\n age = 4.5e9/(selected.rotation_time/12.0)\n age = age.to_i.to_s\n age = age.reverse.scan(/\\d{3}|.+/).join(\",\").reverse\n\n # Calculate the closest neighboring planets\n # Collect names and distances of planets\n distance_and_name = []\n @solar_system.length.times do |i|\n planet_info = {}\n planet_info[:name] = @solar_system[i].name\n planet_info[:distance] = @solar_system[i].distance_from_the_sun\n distance_and_name << planet_info\n end\n # Get only the distances and sort them\n planet_distances = []\n @solar_system.each do |planet|\n planet_distances << planet.distance_from_the_sun\n end\n ordered_planets = planet_distances.sort\n number_index = ordered_planets.index(selected.distance_from_the_sun).to_i\n\n # Find the select planet's distance neighbors (2)\n if (number_index+1) == @solar_system.length\n neighbor1_distance = 0\n neighbor1_difference = 0\n else\n neighbor1_distance = ordered_planets[(number_index+1)]\n neighbor1_difference = (selected.distance_from_the_sun - neighbor1_distance).abs.round(2)\n end\n if (number_index-1) < 0\n neighbor2_distance = 0\n neighbor2_difference = 0\n else\n neighbor2_distance = ordered_planets[(number_index-1)]\n neighbor2_difference = (selected.distance_from_the_sun - neighbor2_distance).abs.round(2)\n end\n neighbor1_name = \"\"\n neighbor2_name = \"\"\n distance_and_name.each do |planet|\n if neighbor1_distance == planet[:distance]\n neighbor1_name << planet[:name]\n end\n if neighbor2_distance == planet[:distance]\n neighbor2_name << planet[:name]\n end\n end\n if neighbor1_distance == 0 && neighbor2_distance == 0\n true_neighbor = \"not to be found\"\n true_distance = \"both infinity and negative infinity\"\n elsif neighbor1_distance == 0 && neighbor2_distance > 0\n true_neighbor = neighbor2_name\n true_distance = neighbor2_difference\n elsif neighbor2_distance == 0 && neighbor1_distance > 0\n true_neighbor = neighbor1_name\n true_distance = neighbor1_difference\n else\n true_neighbor = \"#{neighbor2_name} and #{neighbor1_name}\"\n true_distance = \"#{neighbor2_difference} and #{neighbor1_difference}\"\n end\n\n # Text summary shown to user\n text = \"\\nThe planet \\[#{selected.name}\\] is #{selected.distance_from_the_sun} Astronomical Units from the sun.\n \\rThe closest neighboring planet(s) is/are #{true_neighbor}, which is/are #{true_distance} AU away.\n \\rIt orbits the sun once every #{selected.rotation_time} Earth months, or #{(selected.rotation_time/12.0).round(2)} Earth years.\n \\rSince our sun is 4.5 billion Earth years old, this planet's age is #{age}!\n \\r#{selected.name} also enjoys #{selected.moon_count} moon(s) orbitin' around it.\\n\"\n return text\n end",
"def planet_info #(there's no parameter here)\n puts \"#{@name} has #{@orbital} days in one of its years, weighs #{@mass} earth, has #{@moons}, and is #{@distance_from_sun} million miles from the sun.\"\n end",
"def add_planet\n\t\tputs \"Would you like to add a planet? Enter Y/N\".colorize(:blue)\n\t\tanswer = gets.chomp.downcase\n\t\tif answer == \"y\"\n\t\t\tputs \"Great! Please enter the name of planet.\"\n\t\t\tname = gets.chomp\n\t\t\tputs \"Now enter the diameter of your planet.\"\n\t\t\tdiameter = gets.chomp\n\t\t\tputs \"What is the mass of your new planet?\"\n\t\t\tmass = gets.chomp\n\t\t\tputs \"How many moons?\"\n\t\t\tmoons = gets.chomp\n\t\t\tputs \"Is there life on your planet? Please enter \\\"Y\\\" or \\\"N\\\".\"\n\t\t\tlife = gets.chomp.downcase\n\t\t\t\tif life == \"y\"\n\t\t\t\t\tlife = true\n\t\t\t\telse \n\t\t\t\t\tlife = false\n\t\t\t\tend\n\t\t\tputs \"Finally, what is the solar rotation of your planet?\"\n\t\t\trotation = gets.chomp\n\t\t\t@new_planet = Planet.new(name: name, diameter: diameter, mass: mass, moons: moons, life: life, rotation: rotation)\n\t\t\[email protected](new_planet)\n\t\t\tputs \"Great! #{name} is born!\".colorize(:blue)\n\t\telse\n\t\t\tputs \"Fine. I didn't want your planets anyway.\".colorize(:blue)\n\t\tend\n\tend",
"def show_planets our_solar_system\n all_planets = our_solar_system.planets\n puts \"Choose which planet:\"\n all_planets.length.times do |index|\n puts \"#{index+1}: #{all_planets[index].name}\"\n end\n puts \"Which planet info you want\"\n planet_choice = gets.chomp.to_i\n if planet_choice >=1 && planet_choice <= all_planets.length\n # Display all the planet objects in array.\n puts all_planets[planet_choice - 1].print_planet_info\n # Local variable which is assigned the planet that is selected\n choosen_planet = all_planets[planet_choice -1]\n all_planets.length.times do |index|\n # Skips the selected planet\n if planet_choice - 1 != index\n # Output the distance from other planet.\n puts \"✹ The distance from #{all_planets[index].name} is #{choosen_planet.distance_from_the_planet(all_planets[index])} km.\".bold\n puts \"\"\n end\n end\n end\nend",
"def user_add_planet(solar_system)\n print \"What planet do you want to add?\"\n name = gets.chomp\n print \"what is the color of the planet?\"\n color = gets.chomp\n print \"what is the mass in kg of the planet? \"\n mass_kg = gets.chomp.to_i\n print \"what is the distance from the sun for the planet?\"\n distance_sun = gets.chomp.to_i\n print \"what is a fun fact about the planet?\"\n fun_fact= gets.chomp\n\n user_planet = Planet.new(name,color,mass_kg,distance_sun,fun_fact)\n solar_system.add_planets(user_planet)\n\nend",
"def add_planet(solar_system)\n print \"\\nPlease enter the following details about your planet.\\nPlanet name: \"\n name = gets.chomp\n print \"Planet color: \"\n color = gets.chomp\n print \"Planet mass (kg): \"\n mass = gets.chomp.to_i\n while mass <= 0\n print \"Please enter an integer greater than 0. Planet mass (kg): \"\n mass = gets.chomp.to_i\n end\n print \"Distance from star (km): \"\n distance = gets.chomp.to_i\n while distance <= 0\n print \"Please enter an integer greater than 0. Planet distance from star (kg): \"\n distance = gets.chomp.to_i\n end\n print \"Fun fact: \"\n fact = gets.chomp\n \n new_planet = Planet.new(name, color, mass, distance, fact)\n solar_system.add_planet(new_planet)\nend"
]
| [
"0.78234327",
"0.7657574",
"0.7433642",
"0.7393319",
"0.7371366",
"0.71264064",
"0.70756966",
"0.7057372",
"0.70562917",
"0.70562917",
"0.70562917",
"0.70562917",
"0.70562917",
"0.7000872",
"0.69893163",
"0.6938458",
"0.6905905",
"0.68091875",
"0.67716867",
"0.67657614",
"0.6743436",
"0.6706929",
"0.66683453",
"0.66149354",
"0.66075563",
"0.6592037",
"0.65726584",
"0.65716654",
"0.6551298",
"0.6549869"
]
| 0.79343444 | 0 |
def decimal_base(n) ten_to_position = 1 loop do n = 1 break if n == 0 ten_to_position = 10 end ten_to_position end | def decimal_base(n)
10**(n-1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toBase(n, base)\n return n.to_s(base) if base > 0\n return '0' if n.zero?\n\n digits = []\n while n != 0\n n, remainder = n.divmod(base)\n if remainder < 0\n n += 1\n remainder -= base\n end\n digits << remainder\n end\n digits.join.reverse\nend",
"def super_digit(n)\n while n >= 10\n n = n % 10 + super_digit(n / 10)\n end\n return n\nend",
"def super_digit(n)\n while n > 9\n n = n % 10 + super_digit(n / 10)\n end\n return n\nend",
"def super_digit(n)\n # base case\n return n if n/10 == 0\n \n # recursive case\n return super_digit(n/10 + n%10)\nend",
"def super_digit(n)\n n < 10 ? n : super_digit(n / 10 + n % 10)\nend",
"def convert_base(number, base)\n \n exponents = []\n n = 0 # Exponent / number position\n\n # Find the appropriate exponent size larger than the number \n while number != 0\n # puts \"Current top number: #{number}\"\n # puts \"Current exponent value: #{n}\"\n running_total = 0\n if number < base ** n\n # puts \"Base ** n: #{base ** n}\" \n # puts \"If loop current number: #{number}\"\n running_total += base ** (n-1)\n # puts \"If loop running_total: #{running_total}\"\n number = number - running_total\n # puts \"If loop number after subtraction: #{number}\"\n if exponents[n-1].nil? then exponents[n-1] = 1 else exponents[n-1] += 1 end\n n = 0\n else\n n += 1\n end\n end\n\n exponents.inspect\n\nend",
"def super_digit(n)\n return n if n/10 == 0\n \n sum = n % 10\n while n/10 != 0\n n = n/10\n sum += n % 10\n end\n return super_digit(sum)\nend",
"def super_digit(n)\n return n if n < 10\n\n sum_digits = 0\n until n == 0\n sum_digits += n % 10\n n /= 10\n end\n\n super_digit(sum_digits)\nend",
"def super_digit(n)\n return n if n <= 9\n \n until n < 10\n sum = 0\n sum += (n % 10)\n sum += (n / 10)\n n = sum\n end\n\n return sum\nend",
"def dec_to_base7(decimal)\r\n result = []\r\n until decimal == 0\r\n result.push(decimal % 7)\r\n decimal = decimal / 7\r\n end\r\n return result.reverse.join.to_i\r\nend",
"def base_converter(num, b)\n\n return num.to_s if [0, 1].include?(num)\n\n digits = %w(0123456789abcdef)\n base_converter(num/b, b) + digits[num % b]\n\nend",
"def decimal(digits, base)\n e = digits.size - 1\n v = 0\n digits.each do |n|\n v += n.to_i * base**e\n e -= 1\n end\n v\n end",
"def digital_root(n)\n n < 10 ? n : digital_root(n / 10 + n % 10)\nend",
"def s(n)\n ((9*n-1)*(10**n)+1)/9\nend",
"def super_digit(n)\n if 10 > n\n return n\n end\n\n last_digit = n % 10\n sum = n / 10 + last_digit \n \n return super_digit(sum)\nend",
"def base_converter(num, b)\n return num.to_s if [0,1].include?(num)\n\n digits = %w(0 1 2 3 4 5 6 7 8 9 a b c d e f)\n base_converter(num/b, b) + digits[num % b]\nend",
"def persistence(n)\n n < 10 ? 0 : 1 + persistence(n.digits.reduce(&:*))\nend",
"def super_digit(n)\n sum = 0\n while n >= 10 do\n sum += n % 10\n n /= 10\n end\n sum += n\n return sum < 10 ? sum : super_digit(sum)\nend",
"def get_first_digit n \n n / 10**length(n) \nend",
"def super_digit(n)\n return n if n < 10\n\n sum = 0 \n\n while n > 0\n digit = n % 10\n n /= 10\n sum += digit\n end\n\n super_digit(sum)\n\nend",
"def base_converter(num, b)\n return \"\" if num == 0\n digits = %w(0 1 2 3 4 5 6 7 8 9 a b c d e f)\n\n base_converter(num/b, b) + digits[num%b]\n end",
"def last_n_digits(num, n)\r\n # your code goes here\r\n num % 10**n\r\nend",
"def super_digit(n)\n sum = 0\n\n if n < 10\n return sum + n\n else\n until n < 10\n sum += (n % 10)\n n /= 10\n end\n\n sum += n\n end\n\n return super_digit(n = sum)\nend",
"def super_digit(n)\n return n if n / 10 == 0\n return super_digit(digit_helper(n))\nend",
"def super_digit(n)\n sum = 0;\n\n while n > 0 || sum > 9\n if n == 0\n n = sum\n sum = 0\n end\n sum += n % 10\n n /= 10\n end\n return sum\nend",
"def champernowne(n)\n # Find which base-10 'power' n belongs to.\n # (if it is ones, tens, hundreds, thousands, etc)\n power = 0\n 0.step do |d|\n if 9*(d+1) * 10**(d) >= n\n power = d\n break\n end\n end\n return n if power == 0\n digits = power + 1\n # Get all the numbers that we've passed through before reaching n.\n bounds = (0..(power-1)).map { |d| 9*(d+1) * 10**(d) }\n passed_indices = bounds.reduce(0, :+) # In the case where n is in [1, 9], bounds defaults to 0.\n normalized_position = n - passed_indices\n number = (10**power + (normalized_position - 1) / (digits)).to_s\n # This variable holds the index of the digit to be returned.\n normalized_index = normalized_position % digits\n return (normalized_index == 0 ? number[-1] : number[normalized_index-1]).to_i\nend",
"def round_1_sig_fig n \n get_first_digit(n) * 10**length(n)\nend",
"def super_digit(n)\n return n if n < 10 \n return super_digit(n.to_s.chars.map(&:to_i).sum)\nend",
"def super_digit(n)\n return n if n < 10 \n \n sum = 0\n until n == 0\n sum += n % 10\n n /= 10\n end\n \n return super_digit(sum) # I had n.digits.sum here earlier, but since #digits creates a new array, I thought this solution would be less expensive\nend",
"def place_to_num(place, base = 10)\n place > 1 ? base**(place - 1) : 1\n end"
]
| [
"0.74928284",
"0.7391296",
"0.73467326",
"0.7299868",
"0.72959495",
"0.7256317",
"0.72488725",
"0.7213806",
"0.71847534",
"0.7150823",
"0.7109661",
"0.7091952",
"0.7083971",
"0.705517",
"0.7028662",
"0.7022338",
"0.70145804",
"0.700829",
"0.6998789",
"0.6951361",
"0.6947307",
"0.692563",
"0.69053507",
"0.68976283",
"0.68693036",
"0.68691546",
"0.68684816",
"0.68494624",
"0.6838654",
"0.68334717"
]
| 0.8483405 | 0 |
Sets the acceleration of a stepper, in (micro)steps per second squared, or raises an error. | def acceleration=(new_acceleration)
Klass.setAcceleration(@handle, @index, new_acceleration.to_f)
new_acceleration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accelerate (rateOfAcceleration)\n @speed = @speed + rateOfAcceleration\n end",
"def accel\n @speed += 7\n end",
"def accelerate\n @speed = @speed + @accelerator\n end",
"def acceleration(state_object, t)\n k = 10\n b = 1\n (- k * state_object.position) - (b * state_object.velocity)\nend",
"def accelerate(speed_wanted)\n @speed = speed_wanted\n puts \"The #{@color} #{@model} accelerated to #{@speed} mph.\"\n end",
"def accel=(value)\n MSPhysics::Newton::Hinge.set_accel(@address, value)\n end",
"def accelerate(time) \n @velocity += time * @acceleration;\n @velocity = @max_speed if @velocity > @max_speed\n end",
"def increase_speed(delta=10)\n @speed += delta\n end",
"def acceleration(state_object, t)\n k = 10\n b = 1\n (- k * state_object.x) - (b * state_object.v)\nend",
"def accelerate(mph)\n @speed += mph\n puts \"You accelerate the car by #{mph} miles per hour\"\n end",
"def accelerate strength = 1.0\n self.speed += self.rotation_vector * strength/SUBSTEPS\n end",
"def accelerate\n self.current_speed += 1 \n end",
"def set_speed(input_speed)\n @speed = input_speed * MULTIPLIER\n end",
"def set_speed(new_speed:)\n if new_speed > 30\n new_speed = 30\n elsif new_speed < 0\n new_speed = 0\n end\n @curr_speed = new_speed \n end",
"def pedal_faster accel\n #Increment speed by the value of the argument\n @speedometer += accel\n #Display updated speed\n speed\n end",
"def speedIncrease(value)\n self.speedSet = self.speedGet + value\n end",
"def step_acceleration(time, state)\n\t\t\n#\t\tpp state\n\n\t\tt1, t1p = state[0]\n\t\tt2, t2p = state[1]\n\t\tf = state[2][0]\n\n\t\t# modulo the positions\n#\t\tt1 = begin m = t1 % (2.0 * PI); m > PI ? -(PI - m) : m end\n#\t\tt2 = begin m = t2 % (2.0 * PI); m > PI ? -(PI - m) : m end\n\n\t\t# bind velocities\n\t\tt1p = (t1p < T1P_MIN) ? T1P_MIN : ((t1p > T1P_MAX) ? T1P_MAX : t1p)\n\t\tt2p = (t2p < T2P_MIN) ? T2P_MIN : ((t2p > T2P_MAX) ? T2P_MAX : t2p)\n\n\t\t# f\n#\t\tassert{ inputs.include?('F') }\n#\t\tf = inputs['F']\n#\t\tassert{ [0.0, -1.0, 1.0].include?(f) }\n\t\t\n\t\t# tau\n\t\ttau = f * TORQUE \n\n\t\t# phi 2\n\t\tphi2 = M2 * LC2 * G * cos(t1 + t2 - PI / 2.0)\n\n\t\t# phi 1\n\t\tphi1 = -M2 * L1 * LC2 * (t2p ** 2.0) * sin(t2) - 2.0 * M2 * L1 * LC2 * t2p * t1p * sin(t2) + (M1 * LC1 + M2 * L1) * G * cos(t1 - PI / 2.0) + phi2\n\n\t\t# d2\n\t\td2 = M2 * (LC2 ** 2.0 + L1 * LC2 * cos(t2)) + I2\n\n\t\t# d1\n\t\td1 = M1 * (LC1 ** 2.0) + M2 * ((L1 ** 2.0) + (LC2 ** 2.0) + 2.0 * L1 * LC2 * cos(t2)) + I1 + I2\n\n\t\t# t2pp\n\t\tt2pp = (tau + (d2 / d1) * phi1 - phi2) / (M2 * (LC2 ** 2.0) + I2 - (d2 ** 2.0) / d1)\n\n\t\t# t1pp\n\t\tt1pp = (d2 * t2pp + phi1) / -d1\n\n#\t\t$stderr << \"debug acceleration t1pp #{t1pp}, t2pp #{t2pp}\\n\"\n\t\tmask = 1_000_000_000_000_000\n\t\tt1pp = (t1pp * mask).to_i / mask.to_f\n\t\tt2pp = (t2pp * mask).to_i / mask.to_f\n#\t\tt1pp = (t1pp * 10_000).to_i / 10_000.0\n#\t\tt2pp = (t2pp * 10_000).to_i / 10_000.0\n\n\t\n\t\t[t1pp, t2pp, 0.0]\n\tend",
"def accelerate\n @speed += 1\n end",
"def set_Speed(value)\n set_input(\"Speed\", value)\n end",
"def set_Speed(value)\n set_input(\"Speed\", value)\n end",
"def setSpeed(value)\r\n @speed = value\r\n end",
"def set_velocity action = :increment\n if action == :increment and @velocity <= 3\n @velocity += 1\n\n elsif action == :decrement and @velocity > 1\n @velocity -= 1\n end\n end",
"def gravity=(acceleration)\n acceleration = acceleration.to_f\n Sketchup.active_model.set_attribute('MSPhysics', 'Gravity', acceleration)\n sim = MSPhysics::Simulation.instance\n sim.world.set_gravity(0, 0, acceleration) if sim\n end",
"def speed_set _value\n send_cmd(\"speed_set #{_value}\")\n end",
"def apply_force(force:)\n f = force / @mass\n @acceleration += f\n end",
"def apply_force(force:)\n f = force / @mass\n @acceleration += f\n end",
"def apply_force(force:)\n f = force / @mass\n @acceleration += f\n end",
"def accelerate_to(speed) \r\n\t\tputs \"You #{speed > @speed ? \"sped up\" : \"slowed down\"} to #{speed}mph.\"\r\n\t\t@speed = speed;\r\n\tend",
"def update_timestep=(timestep)\n timestep = AMS.clamp(timestep.to_f, 1/1200.0, 1/30.0)\n Sketchup.active_model.set_attribute('MSPhysics', 'Update Timestep', timestep)\n sim = MSPhysics::Simulation.instance\n sim.update_timestep = timestep if sim\n end",
"def update\n # Update velocity\n @velocity.add(@acceleration)\n # Limit speed\n @velocity.limit(@maxspeed)\n @location.add(@velocity)\n # Reset accelerationelertion to 0 each cycle\n @acceleration.mult(0)\n end"
]
| [
"0.6187451",
"0.61048514",
"0.60582536",
"0.60556734",
"0.6005321",
"0.5939681",
"0.59366953",
"0.58714765",
"0.5864271",
"0.5863374",
"0.5802886",
"0.58006376",
"0.57577443",
"0.5673338",
"0.5644646",
"0.5620917",
"0.5570925",
"0.555828",
"0.55382943",
"0.55382943",
"0.55065477",
"0.5279983",
"0.52414954",
"0.52284205",
"0.5214222",
"0.5214222",
"0.5214222",
"0.5213994",
"0.521059",
"0.5206829"
]
| 0.6707642 | 1 |
Sets the current position of a stepper, in (micro)steps, or raises an error. | def current_position=(new_current_position)
Klass.setCurrentPosition(@handle, @index, new_current_position.to_i)
new_current_position
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current=(new_value)\n value = (new_value)%steps\n @dirty = @current != value\n @current = value\n end",
"def progressSetPosition _obj, _args\n \"_obj progressSetPosition _args;\" \n end",
"def set_invalid_steps(steps)\n self.invalid_steps = steps\n end",
"def pt_step _value, _force=0\n send_cmd(\"pt_step #{_value} #{_force}\")\n end",
"def setpoint\n @setpoint\n end",
"def steps=(new_value)\n @steps = new_value\n end",
"def move_prev\n self.step -= 1\n 'prev'\n end",
"def before_step(step)\n @current_step = step\n end",
"def position=(new_position)\n Klass.setPosition(@handle, @index, new_position.to_f)\n new_position\n end",
"def update_position!(next_move)\n table.x = next_move[:x]\n table.y = next_move[:y]\n end",
"def pt_up_step _value, _force=0\n send_cmd(\"pt_up_step #{_value} #{_force}\")\n end",
"def step\n halt if should_halt?\n stop_elevator or move_elevator\n end",
"def setCurrentWaypoint _obj, _args\n \"_obj setCurrentWaypoint _args;\" \n end",
"def position=(point); end",
"def change_position(position)\n @old_position = @position = position\n end",
"def target_position=(new_target_position)\n Klass.setTargetPosition(@handle, @index, new_target_position.to_i)\n\t new_target_position\n end",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def seek(position)\n current.position = position if position\n\n self\n end",
"def position=(new_position)\n Klass.setPosition(@handle, @index, new_position.to_i)\n new_position\n end",
"def set_position\n if params[:new_position].present? and params[:old_position].present?\n Top.update_position(params[:new_position], params[:old_position])\n head :ok\n else\n head :bad_request\n end\n end",
"def pos=(pos)\n if self.pos > pos\n @previous_line_number = @start_line_number\n @previous_pos = 0\n end\n super\n end",
"def next_position\n\n # change the direction when the number of a half spin\n # has been walked. Also increase the number of steps\n # in the next turn accordingly.\n if @steps_of_half_spin == 0\n @max_steps_in_dir += 1\n @steps_of_half_spin = 2 * @max_steps_in_dir\n @move_right_or_up = !@move_right_or_up\n @steps = 0\n end\n @steps_of_half_spin -= 1\n\n if @move_right_or_up\n if @steps < @max_steps_in_dir\n @x += 1\n @steps += 1\n else\n # up\n @y += 1\n end\n Pos2.new(@x, @y)\n else\n if @steps < @max_steps_in_dir\n # left\n @x -= 1\n @steps += 1\n else\n # down\n @y -= 1\n end\n Pos2.new(@x, @y)\n end\n end",
"def step\n move_if_needed; return self\n end",
"def advance_step\n @step += 1\n @scheduling.step\n end",
"def set_step\n @step = Step.find(params[:id])\n end",
"def move(number)\n @position += number\n if @position < 32\n puts \"You moved #{number} steps forward\"\n end\n sleep(1)\n landed_on_which_panel(@position)\n end",
"def pos=(pos)\n @pos = pos\n end",
"def set_current_position!\n matrix[\n position[:y]\n ][\n position[:x]\n ] = DIRECTION_ARROWS[direction]\n end",
"def update_step(step, linear)\n if linear\n self.step_flow = step_flows.find_by(current_step: step)\n self.step_status.mirror_step_flow(self.step_flow)\n self.save\n else\n self.step_status.current_step = step\n end\n self.step_status.save\n self.save\n end",
"def set_point_position(index, position)\n MSPhysics::Newton::CurvySlider.set_point_position(@address, index, position)\n end"
]
| [
"0.5806139",
"0.56053126",
"0.55437475",
"0.5539134",
"0.55381596",
"0.5532316",
"0.55119836",
"0.54062337",
"0.5401332",
"0.5385979",
"0.53545046",
"0.5323149",
"0.5322548",
"0.5318022",
"0.5297276",
"0.52906615",
"0.52874625",
"0.52843904",
"0.5279208",
"0.5277352",
"0.5270568",
"0.5259079",
"0.52370584",
"0.52270144",
"0.5223654",
"0.52134424",
"0.5203621",
"0.51936066",
"0.5176957",
"0.5176797"
]
| 0.5665552 | 1 |
Sets the engaged state of the Phidget. | def engaged=(new_state)
tmp = new_state ? 1 : 0
Klass.setEngaged(@handle, @index, tmp)
new_state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_state(state)\n self.state = state\n self.save\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def set_State(value)\n set_input(\"State\", value)\n end",
"def state=(new_state)\n @state = new_state\n refresh\n end",
"def set_state(is_on)\n @client.set_state(is_on)\n end",
"def set_state(state)\n @state = state\n self[:action] = state\n @health = @health.clamp(0, 100)\n trigger 'change'\n send_status_notification unless dead?\n save\n end",
"def state=(value)\n @state = value\n end",
"def state=(value)\n @state = value\n end",
"def state=(value)\n @state = value\n end",
"def state=(value)\n @state = value\n end",
"def state=(value)\n @state = value\n end",
"def state=(value)\n @state = value\n end",
"def state=(value)\n @state = value\n end",
"def state=(value)\n @state = value\n end",
"def state=(value)\n @state = value\n end",
"def state=(value)\n @state = value\n end"
]
| [
"0.61920553",
"0.61920553",
"0.6154074",
"0.6154074",
"0.6154074",
"0.6154074",
"0.6154074",
"0.6154074",
"0.6154074",
"0.60919803",
"0.60879356",
"0.60879356",
"0.60879356",
"0.60879356",
"0.60879356",
"0.60879356",
"0.60879356",
"0.6069289",
"0.5995986",
"0.5988838",
"0.58908737",
"0.5863558",
"0.5863558",
"0.5863558",
"0.5863558",
"0.5863558",
"0.5863558",
"0.5863558",
"0.5863558",
"0.5863558"
]
| 0.7006594 | 1 |
Sets the target position of a stepper, in (micro)steps, or raises an error. | def target_position=(new_target_position)
Klass.setTargetPosition(@handle, @index, new_target_position.to_i)
new_target_position
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_move_to_target\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n xpos = target.x + (flip ? -@acts[1] : @acts[1])\n ypos = target.y + @acts[2]\n goto(xpos, ypos, @acts[3], @acts[4], @acts[5] || 0)\n end",
"def setpoint_to_target\n @setpoint = @freq_target\n end",
"def setup_target_move\n return unless PONY::ERRNO::check_sequence(current_act)\n args = [@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0]\n current_action_targets.each do |target|\n target.goto(*args)\n end\n end",
"def setup_target_move\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n args = [@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0]\n if area_flag\n target_array.each do |target|\n target.goto(*args)\n end\n return\n end\n target.goto(*args)\n end",
"def target=(new_value)\n @target = new_value unless const_defined?(:Target)\n end",
"def set_invalid_steps(steps)\n self.invalid_steps = steps\n end",
"def set_move_target cf=current_file\n ff = expand_path(cf)\n return unless File.directory? ff\n\n @move_target = ff\n message \"Move target set to #{cf}.\"\nend",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def seek(target)\n #A vector pointing from the location to the target\n desired = PVector.sub(target, @location)\n # Scale to maximum speed\n desired.setMag(@maxspeed)\n\n # Steering = Desired minus velocity\n steer = PVector.sub(desired, @velocity)\n steer.limit(@maxforce) # Limit to maximum steering force\n apply_force(steer)\n end",
"def steps=(new_value)\n @steps = new_value\n end",
"def setup_move_to_target\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n if area_flag\n size = target_array.size\n xpos = target_array.inject(0) {|r,battler| r + battler.x}/size\n ypos = target_array.inject(0) {|r,battler| r + battler.y}/size\n xpos += @acts[1]\n xpos *= -1 if flip && !@ignore_flip_point\n # Get the center coordinate of enemies\n goto(xpos, ypos + @acts[2], @acts[3], @acts[4])\n return\n end\n xpos = target.x + (flip ? -@acts[1] : @acts[1])\n ypos = target.y + @acts[2]\n goto(xpos, ypos, @acts[3], @acts[4], @acts[5] || 0)\n end",
"def setup_move\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n goto(@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0)\n end",
"def pt_step _value, _force=0\n send_cmd(\"pt_step #{_value} #{_force}\")\n end",
"def setup_move_to_target\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n if area_flag\n size = target_array.size\n xpos = target_array.inject(0) {|r,battler| r + battler.x}/size\n ypos = target_array.inject(0) {|r,battler| r + battler.y}/size\n xpos += @acts[1] * (flip && !@ignore_flip_point ? -1 : 1)\n # Get the center coordinate of enemies\n goto(xpos, ypos + @acts[2], @acts[3], @acts[4])\n return\n end\n xpos = target.x + (flip ? -@acts[1] : @acts[1])\n ypos = target.y + @acts[2]\n goto(xpos, ypos, @acts[3], @acts[4], @acts[5] || 0)\n end",
"def progressSetPosition _obj, _args\n \"_obj progressSetPosition _args;\" \n end",
"def setup_target_slide\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n args = [@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0]\n if area_flag\n target_array.each do |target|\n target.slide(*args)\n end\n return\n end\n target.slide(*args)\n end",
"def set_Target(value)\n set_input(\"Target\", value)\n end",
"def set_Target(value)\n set_input(\"Target\", value)\n end",
"def set_Target(value)\n set_input(\"Target\", value)\n end",
"def set_Target(value)\n set_input(\"Target\", value)\n end",
"def set_Target(value)\n set_input(\"Target\", value)\n end",
"def set_Target(value)\n set_input(\"Target\", value)\n end",
"def set_Target(value)\n set_input(\"Target\", value)\n end",
"def set_Target(value)\n set_input(\"Target\", value)\n end",
"def set_Target(value)\n set_input(\"Target\", value)\n end",
"def setup_move\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n mx = @map_char.real_x + @acts[1]\n my = @map_char.real_y + @acts[2]\n goto(mx, my, @acts[3], @acts[4], @acts[5] || 0)\n end",
"def target=(value)\n @target = value\n end",
"def setpoint\n @setpoint\n end",
"def seek(target)\n # A vector pointing from the location to the target\n desired = target - location\n # Normalize desired and scale to the maximum speed\n desired.normalize!\n desired *= MAX_SPEED\n # Steering = Desired minus velocity\n steer = desired - @velocity\n # Limit to a maximum steering force\n steer.set_mag(MAX_FORCE) { steer.mag > MAX_FORCE }\n steer\n end",
"def move_prev\n self.step -= 1\n 'prev'\n end"
]
| [
"0.62203336",
"0.5957737",
"0.587027",
"0.5716573",
"0.55401325",
"0.5535329",
"0.5513744",
"0.5488356",
"0.54202664",
"0.53962225",
"0.5392546",
"0.5384767",
"0.5373468",
"0.53674364",
"0.53669",
"0.53264296",
"0.53110605",
"0.53110605",
"0.53110605",
"0.53110605",
"0.53110605",
"0.53110605",
"0.53110605",
"0.53110605",
"0.53110605",
"0.5290357",
"0.5282491",
"0.52573675",
"0.52561355",
"0.5221632"
]
| 0.6607499 | 0 |
Sets the velocity limit of a stepper, in (micro)steps per second, or raises an error. | def velocity_limit=(new_velocity_limit)
Klass.setVelocityLimit(@handle, @index, new_velocity_limit.to_f)
new_velocity_limit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def velocity_limit=(new_velocity_limit)\n Klass.setVelocityLimit(@handle, @index, new_velocity_limit.to_f)\n new_velocity_limit\n end",
"def set_velocity action = :increment\n if action == :increment and @velocity <= 3\n @velocity += 1\n\n elsif action == :decrement and @velocity > 1\n @velocity -= 1\n end\n end",
"def set_speed(new_speed:)\n if new_speed > 30\n new_speed = 30\n elsif new_speed < 0\n new_speed = 0\n end\n @curr_speed = new_speed \n end",
"def setSpeed(value)\r\n @speed = value\r\n end",
"def set_Speed(value)\n set_input(\"Speed\", value)\n end",
"def set_Speed(value)\n set_input(\"Speed\", value)\n end",
"def velocity(val = nil)\n val.nil? ? @state.velocity : @state.velocity = val\n end",
"def sliderSetSpeed _obj, _args\n \"_obj sliderSetSpeed _args;\" \n end",
"def set_speed(input_speed)\n @speed = input_speed * MULTIPLIER\n end",
"def setVelocity _obj, _args\n \"_obj setVelocity _args;\" \n end",
"def speed_set _value\n send_cmd(\"speed_set #{_value}\")\n end",
"def speed=(value)\n\t\t\t@speed = value\n\t\tend",
"def vel=(v)\n self.mo = Vector[mo[0], *(mo[0]*v.normalize)]\n end",
"def velocity=(arg)\n @view__.velocity = arg.is_a?(Vector) ? arg.getInternal__ : arg\n arg\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end",
"def set_Limit(value)\n set_input(\"Limit\", value)\n end"
]
| [
"0.7112307",
"0.6255239",
"0.6249731",
"0.6048269",
"0.59822744",
"0.59822744",
"0.5972854",
"0.589134",
"0.57726794",
"0.5745471",
"0.5715279",
"0.57056004",
"0.5559399",
"0.5486125",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187",
"0.5467187"
]
| 0.72637236 | 0 |
Create a NxN grid of points on a face of the cube. Note that this will generate (N+1)(N+1) points. Each point is projected on the sphere and stored in an array. Note that all these are points on the unit sphere, and so their distance to the origin is 1, and so each point can be used as its own normal. | def grid(face, n)
dx = 2.0/n
dy = 2.0/n
a = Array.new
n += 1
n.times do |j|
y = -1.0 + j*dy
n.times do |i|
x = -1.0 + i*dx
lon, lat = QuadSphere::CSC.inverse(face, x, y)
sx = Math::cos(lat) * Math::cos(lon)
sy = Math::cos(lat) * Math::sin(lon)
sz = Math::sin(lat)
a << [sx,sy,sz]
end
end
a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_points(u_count, v_count)\n points = []\n v_count.times do |iv|\n row = []\n u_count.times do |iu|\n u = map1d(iu, (0..u_count), U_RANGE)\n v = map1d(iv, (0..v_count), V_RANGE)\n # default scale: 50, param: Array.new(12, 1) and mesh_distortion: 0\n row << superformula(u: u, v: v)\n end\n points << row\n end\n points\nend",
"def generate_grid\n grid = []\n @y.times do\n row = []\n @x.times do\n row << nil\n end\n grid << row\n end\n grid\n end",
"def grid(n, m)\n arr = Array.new(n) { Array.new(m, :N) }\n arr\nend",
"def vertices\n [\n pos,\n Vertex.new(pos.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z),\n Vertex.new(pos.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x, pos.y + dims.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z + dims.z)\n ]\n end",
"def 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 generate_coordinates\n coordinates = []\n (0..@column_count - 1).to_a.each do |i|\n (0..@row_count - 1).to_a.each do |j|\n coordinates << {x: i, y: j, z: 0}\n end\n end\n coordinates\n end",
"def generate_grid x = @x, y = @y\n new_grid = []\n\n y.times { new_grid << [] }\n new_grid.each do |array|\n x.times do\n array << []\n end\n end\n end",
"def new_cube(n)\r\n return n*n*n,70;\r\nend",
"def create_grid\n grid = Array.new(6, Array.new(7, BLANK))\n end",
"def three_row_grid\n grid = []\n grid << [\n Cell.new(:alive, 0, 0),\n Cell.new(:alive, 0, 1),\n Cell.new(:dead, 0, 2)\n ]\n grid << [\n Cell.new(:alive, 1, 0),\n Cell.new(:dead, 1, 1),\n Cell.new(:dead, 1, 2)\n ]\n grid << [\n Cell.new(:dead, 2, 0),\n Cell.new(:dead, 2, 1),\n Cell.new(:dead, 2, 2)\n ]\n grid\nend",
"def grid\n Matrix.build(@row_count, @column_count) { Cell.new }.to_a\n end",
"def make_grid\n @grid = Array.new(4){Array.new(4)}\n end",
"def grid\n \t\t\tfinal, y = Array.new, 0\n \t\t\t@@axis.fetch(:y).times do\n \t\t\t\tfinal[y], x = Array.new, 0\n \t\t\t\t@@axis.fetch(:x).times do\n \t\t\t\t\tfinal[y][x] = init_coord(x, y)\n \t\t\t\t\tx += 1\n \t\t\t\tend\n \t\t\t\ty += 1\n\t\t\tend\n\t\t\tfinal.reverse\n\t\tend",
"def create_grid\n spaces = create_spaces\n assign_spaces_to_rows.map do |row|\n row.each.with_index do |coordinates, index|\n row[index] = {coordinates => spaces[coordinates]}\n end\n end\n end",
"def make_grid(*points)\n self.convert_values()\n printed = \"\"\n if (@clear)\n system ('clear')\n end\n x_points = Array.new\n y_points = Array.new\n # Divide points\n (0..points.length - 1).each do |position|\n if (position % 2 == 0)\n x_points.push(points[position].to_i)\n else\n y_points.push(points[position].to_i)\n end\n end\n # Start loop\n (0..@y_size.to_i).each do |current_y|\n (0..@x_size.to_i).each do |current_x|\n # Setup\n print_fill = true\n relative_x = current_x - @x_offset\n relative_y = @y_offset - current_y\n point_amount = x_points.length - 1\n # Check point\n (0..point_amount.to_i).each do |position_point|\n if (x_points[position_point] == relative_x)\n if (y_points[position_point] == relative_y)\n printed << @point.to_s\n print_fill = false\n end\n end\n end\n # Fill\n if (print_fill)\n if (@x_offset == current_x)\n printed << \"|\"\n elsif (@y_offset == current_y)\n printed << \"-\"\n else\n printed << @blank_space.to_s\n end\n end\n if (y_offset == current_y && current_x != @x_size)\n printed << \"-\"\n else\n printed << \" \"\n end\n end\n printed << \"\\n\"\n end\n print printed\n return printed\n end",
"def row_cube(y, z)\n Cube.new(0 * cell_width, y * cell_height, z * cell_depth,\n cell_width * columns, cell_height, cell_depth)\n end",
"def initiate_grid\n new_grid = []\n @width.times do |x|\n new_grid[x] = []\n @height.times do |y|\n new_grid[x][y] = 0\n end\n end\n new_grid\n end",
"def col_cube(x, z)\n Cube.new(x * cell_width, 0 * cell_height, z * cell_depth,\n cell_width, cell_height * rows, cell_depth)\n end",
"def cell_cube(*args)\n MACL::Cube.new(*cell_a(*args))\n end",
"def gridit(xd, yd, zd, nx, ny)\n nd = equal_length(xd, yd, zd)\n inquiry [{ double: nx }, { double: ny }, { double: nx * ny }] do |px, py, pz|\n super(nd, xd, yd, zd, nx, ny, px, py, pz)\n end\n end",
"def vertices\n [\n @origin,\n { x: x_max, y: y_min, z: z_min },\n { x: x_min, y: y_max, z: z_min },\n { x: x_min, y: y_min, z: z_max },\n { x: x_max, y: y_max, z: z_min },\n { x: x_max, y: y_min, z: z_max },\n { x: x_min, y: y_max, z: z_max },\n { x: x_max, y: y_max, z: z_max }\n ]\n end",
"def three_by_three_boxes\n @boxes ||= [0,1,2].repeated_permutation(2).map do |box_coord|\n box_row, box_col = *box_coord\n col_offset = box_col * 3\n row(box_row * 3)[col_offset...(col_offset+3)] +\n row(box_row * 3 + 1)[col_offset...(col_offset+3)] +\n row(box_row * 3 + 2)[col_offset...(col_offset+3)]\n end\n end",
"def create_boxes(num)\n box_vertices = polygon_vertices(NUM_SIDES, EDGE_SIZE)\n box_image = polygon_image(box_vertices)\n boxes = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_poly(1.0, box_vertices, CP::Vec2.new(0, 0))) # mass, moment of inertia\n body.p = CP::Vec2.new(rand(WIDTH), rand(40) - 50)\n shape = CP::Shape::Poly.new(body, box_vertices, CP::Vec2.new(0, 0))\n shape.e = 0.0\n shape.u = 0.4\n boxes << Box.new(box_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return boxes\n end",
"def grid(cols, rows, col_size=1, row_size=1)\n (0..cols*rows).map do |i|\n x = col_size * (i % cols)\n y = row_size * i.div(cols)\n yield x, y\n end\n end",
"def initialize(size = 3)\n @size = size\n @grid = Array.new(size) { Array.new(size) }\n end",
"def grid(cols, rows, col_size=1, row_size=1)\n (0...cols*rows).map do |i|\n x = col_size * (i % cols)\n y = row_size * i.div(cols)\n yield x, y\n end\n end",
"def build_grid\n x = 0\n 10.times do\n row = []\n y = 0\n 10.times do\n row.push({display: \"~~\", ship: false, coord: [x, y]})\n y += 1\n end\n self.grid << row\n x += 1\n end\n p self.grid\n end",
"def create_boxes(num)\n box_vertices = polygon_vertices(NUM_SIDES, EDGE_SIZE)\n box_image = polygon_image(box_vertices)\n boxes = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_poly(1.0, box_vertices, CP::Vec2.new(0, 0))) # mass, moment of inertia\n body.p = CP::Vec2.new(rand(SCREEN_WIDTH), rand(40) - 50)\n shape = CP::Shape::Poly.new(body, box_vertices, CP::Vec2.new(0, 0))\n shape.e = 0.0\n shape.u = 0.4\n boxes << AObject.new(box_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return boxes\n end",
"def createcells(xstart,xend, ystart,yend, stepOverinuse, aface)\r\n countx = 0\r\n xmax = ymax = 0\r\n x = xstart\r\n while (x <= xend) do\r\n y = ystart\r\n county = 0\r\n while (y <= yend) do\r\n #note: using half stepover on the X axis, gets the ends of the zigs closer to the border\r\n xc = ((x-xstart) / (stepOverinuse/2) + 0.002).round # x cell index\r\n yc = ((y-ystart) / stepOverinuse + 0.002).round # y cell index\r\n pt = Geom::Point3d.new(x, y,0)\r\n res = aface.classify_point(pt)\r\n \r\n case res\r\n when Sketchup::Face::PointUnknown #(indicates an error),\r\n puts \"unknown\" if (@debug)\r\n when Sketchup::Face::PointInside #(point is on the face, not in a hole),\r\n @cells[[xc,yc]] = true\r\n when Sketchup::Face::PointOnVertex #(point touches a vertex),\r\n #cells[[xc,yc]] = true\r\n when Sketchup::Face::PointOnEdge #(point is on an edge),\r\n #cells[[xc,yc]] = true\r\n when Sketchup::Face::PointOutside #(point outside the face or in a hole),\r\n #puts \"outside\" if (@debug)\r\n when Sketchup::Face::PointNotOnPlane #(point off the face's plane).\r\n puts \"notonplane\" if (@debug)\r\n end\r\n \r\n xmax = (xmax < xc) ? xc : xmax\r\n ymax = (ymax < yc) ? yc : ymax\r\n y += stepOverinuse\r\n county += 1\r\n if (county > 5000) #really for debugging but prevents runaway loops\r\n puts \"county high break\"\r\n break\r\n end\r\n end # while y\r\n x += (stepOverinuse / 2.0)\r\n countx += 1\r\n if (countx > 5000)\r\n puts \"countx high break\"\r\n break\r\n end\r\n end # while x\r\n @cellxmax = xmax\r\n @cellymax = ymax\r\n end",
"def gen_cells args = {}\n\t\t\tx = args[:x] || 0\n\t\t\ty = args[:y] || 0\n\t\t\tw = args[:w] || 32\n\t\t\th = args[:h] || 32\n\n\t\t\tcell_count = {\n\t\t\t\tx: (current_room.w.to_f / w.to_f).floor,\n\t\t\t\ty: (current_room.h.to_f / h.to_f).floor\n\t\t\t}\n\n\t\t\treturn cell_count[:y].times.map do |row|\n\t\t\t\tnext cell_count[:x].times.map do |col|\n\t\t\t\t\tnext Cell.new(\n\t\t\t\t\t\tx: (w * col),\n\t\t\t\t\t\ty: (h * row),\n\t\t\t\t\t\tw: w, h: h,\n\t\t\t\t\t\tindex: { x: col, y: row },\n\t\t\t\t\t\tsolid: false\n\t\t\t\t\t)\n\t\t\t\tend\n\t\t\tend .flatten\n\t\tend"
]
| [
"0.5928719",
"0.570356",
"0.56557053",
"0.56169516",
"0.56094754",
"0.5591064",
"0.55714774",
"0.5485938",
"0.54362124",
"0.5412299",
"0.5383223",
"0.5371151",
"0.53186864",
"0.52793384",
"0.5258932",
"0.52141297",
"0.52060217",
"0.5205415",
"0.517512",
"0.51573133",
"0.51541215",
"0.5153713",
"0.51408494",
"0.5114458",
"0.51144063",
"0.51078653",
"0.51043904",
"0.50894344",
"0.5066011",
"0.50584126"
]
| 0.7749322 | 0 |
p grid(0, 3) Create triangle strips to represent a NxN mesh. The given array should then contain (N+1)2 points, arranged as N+1 rows of N+1 points. | def mesh2strips(n,a)
dx = 2.0/n
dy = 2.0/n
row = n+1
n.times do |j|
glBegin(GL_TRIANGLE_STRIP)
rowi = j*row
row.times do |x|
add_vertex(a[rowi+x])
add_vertex(a[rowi+row+x])
end
glEnd
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_grid(board_array)\n\t# split into triplets\n\ttriplets_array = []\n board_array.each { |array| triplets_array << array.each_slice(3).to_a }\n\n # shuffle the triplets\n shuffle_container = [[], [], []]\n 9.times do |row|\n 3.times do |column|\n current_array = triplets_array[row][column]\n shuffle_container[column] << current_array\n end\n end\n\n # flatten and re-split\n final_array = []\n shuffle_container.flatten.each_slice(9) { |array| final_array << array }\n\n return final_array\nend",
"def grid(face, n)\n dx = 2.0/n\n dy = 2.0/n\n a = Array.new\n n += 1\n\n n.times do |j|\n y = -1.0 + j*dy\n n.times do |i|\n x = -1.0 + i*dx\n lon, lat = QuadSphere::CSC.inverse(face, x, y)\n sx = Math::cos(lat) * Math::cos(lon)\n sy = Math::cos(lat) * Math::sin(lon)\n sz = Math::sin(lat)\n a << [sx,sy,sz]\n end\n end\n\n a\n end",
"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 grid(n, m)\n arr = Array.new(n) { Array.new(m, :N) }\n arr\nend",
"def pascals_triangle(n)\n triangle = [[1]]\n until triangle.length == n\n triangle << row(triangle[-1])\n end\n triangle\nend",
"def triangles(n)\n\ts = []\n\t1.upto n do |i|\n\t\tn, triangle_n = yield i\n\t\ts << [n, triangle_n]\n\tend\n\ts\nend",
"def pascals_triangle(n)\n triangles = [[1]]\n while triangles.length < n\n triangles << next_line(triangles[-1])\n end\n triangles\nend",
"def pascals_triangle(n)\n triangle = [[1]]\n\n (1...n).each do |lvl_idx| # levels of pyramid by array idx\n current_lvl = []\n prev_lvl = triangle[lvl_idx - 1] \n\n (0..lvl_idx).each do |pos| # elements of level\n left = (pos == 0) ? 0 : prev_lvl[pos - 1]\n right = (pos == lvl_idx) ? 0 : prev_lvl[pos]\n current_lvl[pos] = left + right\n end\n triangle << current_lvl\n end\n triangle\nend",
"def create_grid\n grid = Array.new(6, Array.new(7, BLANK))\n end",
"def create_grid\n grid = Array.new(8) { Array.new(8) { [] } }\n grid.map! do |row|\n if grid.index(row).even?\n row.each { |space| row.index(space).even? ? space << 'white' : space << 'black' }\n else\n row.each { |space| row.index(space).even? ? space << 'black' : space << 'white' }\n end\n row.map! do |space|\n space << [grid.index(row), row.index(space)]\n end\n end\n grid.reverse\n end",
"def pascals_triangle(num)\n ret_arr = [[1]]\n (num-1).times do #|idx|\n new_arr = [1]\n ((ret_arr[-1].length) -1).times do |j|\n new_arr << ret_arr[-1][j] + ret_arr[-1][j+1]\n end\n ret_arr.append(new_arr << 1)\n end\n ret_arr\nend",
"def pascals_triangle(n)\n triangle = []\n (1..n).each do |line|\n level = []\n num = 1\n (1..line).each do |idx|\n level << num\n num = (num * (line - idx) / idx)\n end\n triangle << level\n end\n triangle\nend",
"def p_triangle(n)\n (0..n).each{|i|\n list = [1]\n element = 1\n k = 1\n (0..i-1).step(1){|index|\n element = element * (i-k+1)/k\n list.push element \n k += 1\n }\n yield(list)\n }\nend",
"def make_grid\n @grid = Array.new(4){Array.new(4)}\n end",
"def three_row_grid\n grid = []\n grid << [\n Cell.new(:alive, 0, 0),\n Cell.new(:alive, 0, 1),\n Cell.new(:dead, 0, 2)\n ]\n grid << [\n Cell.new(:alive, 1, 0),\n Cell.new(:dead, 1, 1),\n Cell.new(:dead, 1, 2)\n ]\n grid << [\n Cell.new(:dead, 2, 0),\n Cell.new(:dead, 2, 1),\n Cell.new(:dead, 2, 2)\n ]\n grid\nend",
"def triangulate(vertices)\n\t\tedges = []\n tris = []\n # sort by X coord\n vertices = vertices.sort_by {|p|p.x}\n # center/radius cache used by circum_circle\n cc_cache = {}\n\n # Set up the supertriangle\n # This is a triangle which encompasses all the sample points.\n # The supertriangle coordinates are added to the end of the\n # vertex list. The supertriangle is the first triangle in\n # the triangle list.\n number_of_vertices = vertices.size\n\t\tbounding_p1, bounding_p2, bounding_p3 = get_bounding_vertices(vertices)\n\t\tvertices << bounding_p1 << bounding_p2 << bounding_p3\n\t\ttris << ITRIANGLE.new(number_of_vertices, number_of_vertices+1, number_of_vertices+2)\n\n # Include each point one at a time into the existing mesh\n vertices.each_with_index { |current_point, i|\n edges.clear\n # Set up the edge buffer.\n # If the point (xp,yp) lies inside the circumcircle then the\n # three edges of that triangle are added to the edge buffer\n # and that triangle is removed.\n j = 0\n\t\t\ttris_size = tris.size\n\t\t\twhile j < tris_size\n\t\t\t\tcurrent_triangle = tris[j]\n if !current_triangle.complete\n p1 = vertices[current_triangle.p1]\n p2 = vertices[current_triangle.p2]\n p3 = vertices[current_triangle.p3]\n inside,xc,yc,r = circum_circle(current_point, p1, p2, p3, cc_cache)\n if (xc + r) < current_point.x\n current_triangle.complete = true\n end\n if inside\n\t\t\t\t\t\tedges << IEDGE.new(current_triangle.p1, current_triangle.p2)\n edges << IEDGE.new(current_triangle.p2, current_triangle.p3)\n edges << IEDGE.new(current_triangle.p3, current_triangle.p1)\n tris.delete_at(j)\n\t\t\t\t\t\ttris_size -= 1\n j -= 1\n end\n end\n j += 1\n end #while j\n\t\t\t\n\t\t\twhile !edges.empty?\n\t\t\t\tedge = edges.shift\n\t\t\t\trejected = edges.reject! {|e| e == edge}\n\t\t\t\ttris << ITRIANGLE.new(edge.p1, edge.p2, i) if rejected.nil? \n\t\t \tend\n \n } #each i\n \n\t\t# Remove supertriangle vertices\n\t\t3.times do \n\t\t\tvertices.pop\n\t\tend\n\t\tnumber_of_vertices = vertices.size\n\n # Remove triangles with supertriangle vertices\n # These are triangles which have a vertex number greater than number_of_vertices\n\t\ttris.delete_if {|tri| tri.p1 >= number_of_vertices || tri.p2 >= number_of_vertices || tri.p3 >= number_of_vertices}\n\n [ vertices, tris ]\n end",
"def generate_triangle_numbers(n)\n is_triangle = Array.new(n+1, false)\n \n index = 1\n increment = 1\n while index < is_triangle.length\n is_triangle[index] = true\n increment += 1\n index += increment\n end\n \n return is_triangle\nend",
"def create_inner_arrays(array)\n size = array.size\n array = [array.first((size + 1) / 2), array.last(size / 2)]\nend",
"def generate_rows(array)\n rows = []\n array.each do |line|\n row = [line]\n array.each do |column|\n row << line * column\n end\n rows << row\n end\n\n rows\n end",
"def generate_grid\n grid = []\n @y.times do\n row = []\n @x.times do\n row << nil\n end\n grid << row\n end\n grid\n end",
"def triangles()\n @triangles = []\n loop_start_time = Time.now\n while @triangles.size != @count\n begin\n t = Triangle.new(*random_coordinate_triplet)\n if t.possible? && within_threshold(t) && within_threshold2(t)\n @triangles << t\n else\n if (Time.now - loop_start_time) > 10\n raise 'too much calculation'\n end\n end\n rescue Math::DomainError\n puts \"Out of domain... trying again.\"\n end\n end\n @triangles\n end",
"def generate_surrounding_spaces(x, y)\n surround_array = []\n# Loop over 3x3 grid\n for i in x-1..x+1\n for j in y-1..y+1\n # Exclude the center square and ones not on the grid\n if ((i==x) && (j==y)) || !is_on_grid(i,j)\n next\n end\n surround_array.push([j, i])\n end\n end\n\n return surround_array\nend",
"def triangle(nrows)\n return [[1]] if nrows <= 1\n previous = triangle(nrows-1)\n center = previous[-1].enum_for(:each_cons, 2).map {|a| a[0] + a[1] }\n return previous << ( [1] + center + [1] )\nend",
"def create_grid_from_size(size_arr)\n rows = size_arr[0]\n columns = size_arr[1]\n Array.new(rows) { Array.new(columns) }\n end",
"def identifier_triangle_points\n point_to_triangles = []\n (@maillage_points.length+1).times do\n point_to_triangles << []\n end\n @triangles.length.times do |i|\n t = @triangles[i]\n point_to_triangles[t.p1.num] << i\n point_to_triangles[t.p2.num] << i\n point_to_triangles[t.p3.num] << i\n end\n return point_to_triangles\n end",
"def generate_grid x = @x, y = @y\n new_grid = []\n\n y.times { new_grid << [] }\n new_grid.each do |array|\n x.times do\n array << []\n end\n end\n end",
"def pyramid(n)\n outer_array = []\n 0.upto(n) do |i|\n next if i == 0\n outer_array << Array.new(i, i)\n end\n outer_array\nend",
"def triangle_test(x)\n\t#split input into array\n array = x\n\t\n #delete first array so only dealing with triangle sides\n array.delete_at(0)\n \n #split array into smaller array of arrays of 3 sides each\n triangle_arrays = array.each_slice(3).to_a \n\n #iterate through each \"triangle\"\n triangle_arrays.each do |a, b, c|\n\n if (a == b) && (a == c)\n puts \"Equilateral\"\n elsif (a == b) || (a == c) || (b == c)\n puts \"Isoceles\"\n else\n puts \"None of these\"\n end\n\nend\n \nend",
"def grid\n rows = []\n (1..self.height).to_a.each do |h|\n rows << row(h)\n end\n rows.reverse\n end",
"def pascals_triangle(n)\n triangle = []\n triangle << [1]\n while triangle.length < n\n next_level = []\n current_level = Array.new(triangle.last) # create copy of last row\n current_level.push(0)\n current_level.unshift(0)\n\n iterator = 0\n\n while iterator < current_level.length-1\n\n next_level << current_level[iterator..iterator+1].sum\n iterator += 1\n end\n\n triangle << next_level\n end\n triangle\nend"
]
| [
"0.62033063",
"0.60679984",
"0.6010272",
"0.58452564",
"0.58127",
"0.5795336",
"0.5707064",
"0.57053405",
"0.56979764",
"0.5663744",
"0.55985594",
"0.5590872",
"0.55771965",
"0.55767393",
"0.5552159",
"0.55489373",
"0.553704",
"0.5499699",
"0.5486645",
"0.54455215",
"0.53211874",
"0.5319198",
"0.52683645",
"0.52547354",
"0.5211066",
"0.5208506",
"0.51854414",
"0.5156775",
"0.51316756",
"0.5103952"
]
| 0.7099372 | 0 |
Set client stats details Author: Puneet Date: 02/02/2018 Reviewed By: | def set_client_stats(client_stats_data)
@client_stats = CompanyApi::Response::Entity::ClientStats.new(client_stats_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_client_usage(client)\n client_id = client.id\n registration_count = User.using_client_shard(client: client).where(client_id: client_id).count\n kyc_submissions_count = UserKycDetail.using_client_shard(client: client).\n where(client_id: client_id).sum(:submission_count)\n\n client_usage_obj = ClientUsage.find_or_initialize_by(client_id: client_id)\n client_usage_obj.registration_count = registration_count\n client_usage_obj.kyc_submissions_count = kyc_submissions_count\n client_usage_obj.save! if client_usage_obj.changed?\n client_usage_obj\n end",
"def update_client_details\n user = @client.user\n self.username = user.screen_name\n self.save!\n end",
"def set_client_info\n @client_info = ClientInfo.find(params[:id])\n end",
"def set_client_info\n @client_info = ClientInfo.find(params[:id])\n end",
"def fetch_setup_details\n\n r = super\n return r unless r.success?\n\n r = SaasApi::Client::FetchStats.new.perform(client_id: @client_id)\n @api_response_data[:client_stats] = r.data if r.success?\n\n success\n\n end",
"def client_info\n #implement\n client_information = \"#{@name_str} #{@age_num} #{@pet_num}\"\n end",
"def update_updated_at_and_by\n #logger.info { \"FILTTERISSÄ: #{response.headers[\"Status\"]}\" }\n if response.headers[\"Status\"] =~ /^20/\n @collection.set_update_info(DateTime.now, (@user ? @user.guid : @client.id))\n # @collection.updated_at = DateTime.now\n # @collection.updated_by = @user ? @user.guid : @client.id\n # @collection.save\n\n end\n end",
"def set_stats\n {\n \"projectId\": '1234',\n \"invalid\": 2,\n \"error\": 1,\n \"info\": 0,\n \"warning\": 2\n }\nend",
"def edit\n today = ServerTime.now.strftime \"%Y-%m-%d\"\n ten_days_ago = (ServerTime.now - 10.days).strftime \"%Y-%m-%d\"\n @total_hits = current_user.total_hits.to_i\n @total_hits_today = current_user.total_hits_today.to_i\n day_keys = (10.days.ago.to_date..ServerTime.now.to_date)\n .map{|d| d.strftime(\"%Y-%m-%d\")}\n stats_for_ten_days = AnalyticData::UserHits.new(current_user.id)\n .stats_for_period ten_days_ago, today\n logger.debug \"hhhhhhhhhhhh========>#{stats_for_ten_days}\"\n @hits_with_date = Hash[day_keys.zip(stats_for_ten_days)]\n super\n end",
"def details\n\t\"#{assigned_to} - #{status} - #{start_date} - #{description} - #{location} - #{Client.find(client_id).name}\"\nend",
"def stats\n @client.stats\n end",
"def details\n\t\t\"#{name}---#{status}-----#{start_date}----#{description}---- #{Client.find(client_id).name}---#{Client.find(client_id).email}\"\n\tend",
"def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def setup_superuser_stats # rubocop:disable Metrics/AbcSize\n @stats =\n {\n user_count: User.all,\n dataset_count: Identifier.all,\n user_7days: User.where(['stash_engine_users.created_at > ?', Time.new - 7.days]),\n dataset_started_7days: Resource.joins(:current_resource_state)\n .where(stash_engine_resource_states: { resource_state: %i[in_progress] })\n .where(['stash_engine_resources.created_at > ?', Time.new - 7.days]),\n dataset_submitted_7days: Identifier.where(['stash_engine_identifiers.created_at > ?', Time.new - 7.days])\n }\n end",
"def stats\n @additions ||= 0\n @deletions ||= 0\n @stats_row_one = {\n active_user_count: @active_user_count,\n pull_count: @pull_count,\n comment_count: @comment_count,\n qa_signoff_count: @qa_signoff_count\n }\n @stats_row_two = {\n avg_additions: @additions.round.to_i,\n avg_deletions: @deletions.round.to_i,\n net_additions: @net_additions\n }\n end",
"def set_client_report\n @client_report = Client::Report.find(params[:id])\n end",
"def get_member_brief_stats(custid)\n res = $client.get(\"/membersite/member/CareerStats.do?custid=#{custid}\", $headers)\n start = res.body.index('buf = \\'{\"memberSince\"') + 7\n length = res.body.index(\"MemberProfile.driver = extractJSON\") - 3 - start\n data = res.body[start, length]\n JSON.parse data\nend",
"def client_id=(client_id); end",
"def client_id=(client_id); end",
"def info_hash(user, client)\n basic_info = basic_hash(user, client)\n basic_info.merge!({:totalResults => readable_items_count(user, client),\n :link => { :rel => \"self\", :href => \"/appdata/#{client.id}/@collections/#{id}\"}\n })\n return basic_info\n end",
"def update!(**args)\n @client = args[:client] if args.key?(:client)\n @threat_info = args[:threat_info] if args.key?(:threat_info)\n end",
"def meta\n {\n exp: 1.day.from_now.to_i,\n iss: 'issuser_name',\n aud: 'client'\n }\n end",
"def client\n OpenSourceStats.client\n end",
"def set_client\n @client = Client.find(current_user.client_id)\n end",
"def create_client_info\n store.hmset(@client.uid, \"gen_func\", \"increment by 1\", \"min_critical\", MIN_CRITICAL, \"max_critical\", MAX_CRITICAL )\n end",
"def set_client\n @client = Client.find(current_user.client_id)\n end",
"def set_stats\n @stats = AppStats.new(Post.all, Quote.all)\n end",
"def set_stats(hunt_stat, str_stat, sneak_stat, chr_stat)\n $stats[:hunt] = hunt_stat\n $stats[:strength] = str_stat\n $stats[:sneak] = sneak_stat\n $stats[:charisma] = chr_stat\n end",
"def set_client_status\n @client_status = ClientStatus.find(params[:id])\n end",
"def client=(client)\n @client = client\n end"
]
| [
"0.632931",
"0.609067",
"0.60432386",
"0.60432386",
"0.6000351",
"0.59391373",
"0.58106226",
"0.5807779",
"0.57885337",
"0.5697464",
"0.569321",
"0.5660587",
"0.5552315",
"0.5550092",
"0.5515177",
"0.5488684",
"0.5468579",
"0.546816",
"0.546816",
"0.54330796",
"0.53912634",
"0.5374654",
"0.53627676",
"0.5329724",
"0.5321153",
"0.5319884",
"0.5309798",
"0.52919436",
"0.52691704",
"0.52673507"
]
| 0.73293805 | 0 |
Set Client BT Addresss Data Author: Puneet Date: 02/02/2018 Reviewed By: | def set_client_bt_addresses_data(client_bt_addresses_data)
@client_bt_addresses = CompanyApi::Response::Entity::ClientBrandedTokenAddresses.new(client_bt_addresses_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_address\n end",
"def set_client_address\n @client_address = ClientAddress.find(params[:id])\n end",
"def set_addresses=(v)\n self.addresses = build_addresses(v)\n end",
"def update_contact_info txn\n AddressManager::set_user_address txn.user, txn\n end",
"def set_client\n @client = Client.find(params[:id])\n @[email protected]_encoding(\"UTF-8\")\n @[email protected]_encoding(\"UTF-8\")\n @[email protected]_encoding(\"UTF-8\")\n end",
"def set_address\n\t\t@address = Contact.find(params[:contact_id]).address\n\tend",
"def set_address_type\n\n end",
"def set_Addresses(value)\n set_input(\"Addresses\", value)\n end",
"def set_Addresses(value)\n set_input(\"Addresses\", value)\n end",
"def set_Addresses(value)\n set_input(\"Addresses\", value)\n end",
"def set_address_options\n @address_options = Address.all.map{ |a| [ a.label, a.id ]}\n end",
"def address=(value)\n\t\t\t@address = value\n\t\tend",
"def address=(value)\n\t\t\t@address = value\n\t\tend",
"def set_address type, key, params={}\n opts = {:single_quoted => false}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"AddressType\" => Type::String.safe_value(type, opts),\n \"VoterKey\" => Type::String.safe_value(key, opts),\n \"AddressLine1\" => Type::String.safe_value(params[:address_1], opts),\n \"AddressLine2\" => Type::String.safe_value(params[:address_2], opts),\n \"AddressCity\" => Type::String.safe_value(params[:city], opts),\n \"AddressState\" => Type::String.safe_value(params[:state], opts),\n \"AddressZip5\" => Type::String.safe_value(params[:zip5], opts),\n \"AddressZip4\" => Type::String.safe_value(params[:zip4], opts)\n }\n }\n\n put 'set_address.php', params\n end",
"def set_street_address_1_update\n @customer = Customer.find(customer_id)\n\n Order.find(id).update_column(:street_address_1, @customer.street_address_1)\n end",
"def set_address\n @customer_ship_address = CustomerShipAddress.find(params[:id])\n end",
"def address=(value)\n @address = value\n end",
"def address=(value)\n @address = value\n end",
"def save_address\n end",
"def set_address(address)\n @fields.merge!(address.to_hash)\n end",
"def client_address_params\n params.require(:client_address).permit(:client_id, :appaddress_id, :comments)\n end",
"def set_for_manual_address\n @show_manual_address = true\n @address_read_only = false\n # clear the identifier as this address is no longer from the search\n @address_detail.address_identifier = nil\n end",
"def set_street_address_1_save\n @customer = Customer.find(customer_id)\n\n Order.find(id).update_column(:street_address_1, @customer.street_address_1)\n end",
"def address1_set(address)\n self.address1.set address\n end",
"def update_fetch_address( atts = {} )\n self.fetch_address = (self.fetch_address || {}).merge( atts )\n end",
"def set_address\n @address = Addresslanlng.new\n end",
"def set_address\n @address = Address.find_by(id: params[:id], user_profile_id: current_user.user_profile_id)\n end",
"def bcc=(addresses)\n address_list_assign('Bcc', addresses)\n end",
"def set_street_address_2_update\n @customer = Customer.find(customer_id)\n\n Order.find(id).update_column(:street_address_2, @customer.street_address_2)\n end",
"def set_Address1(value)\n set_input(\"Address1\", value)\n end"
]
| [
"0.6881441",
"0.6312769",
"0.60506237",
"0.6017915",
"0.59968686",
"0.5966925",
"0.59465563",
"0.59386486",
"0.59386486",
"0.59386486",
"0.591972",
"0.5915055",
"0.5915055",
"0.59133244",
"0.59031093",
"0.58883625",
"0.58808154",
"0.58808154",
"0.58686054",
"0.5835885",
"0.5814571",
"0.5792625",
"0.57850313",
"0.5781941",
"0.5763241",
"0.57589567",
"0.57559043",
"0.57522774",
"0.57150275",
"0.5706754"
]
| 0.7541487 | 0 |
get(Symbol) method that returns a node by the id returns | def get id
@nodes[id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node(id)\n @nodes[id.to_i]\n end",
"def get_node(id)\n get_object('node', id)\n end",
"def node_by_id(id)\r\n @nodes.each do |n|\r\n return n if n.attributes['id'] == id \r\n end\r\n end",
"def get_node_by_id(id, options={})\n options[:exactget] ||= {}\n options[:exactget][:id] = id.to_s\n ret = get_nodes(options)\n if ret.empty?\n warn \"Cannot find node #{name}\"\n ret = nil\n elsif ret.values.size == 1\n ret = ret.values[0]\n else\n raise \"Multiple nodes returned for #{name}\"\n end\n ret\n end",
"def []( id )\n get_node_by_id( id ) ||\n get_edge_by_id( id )\n end",
"def get_node(key); end",
"def bnode(id)\n RDF::Node.intern(id)\n end",
"def get(key)\n node_for(key).get(key)\n end",
"def []( id )\n get_tree_by_id( id ) ||\n get_network_by_id( id )\n end",
"def find(id)\n node = @nodes[id]\n return node if node\n\n addr = Directory[id]\n return unless addr\n\n if id == DCell.id\n node = DCell.me\n else\n node = Node.new(id, addr)\n end\n\n @nodes[id] ||= node\n @nodes[id]\n end",
"def get_node(node)\n\t\t\t@nodes[node]\n\t\tend",
"def node_get(node)\n nodes.fetch prepare_key(node), nil\n end",
"def find id\n return nil if node.ids.empty?\n node.send(:orm_class).find id\n end",
"def fetch_node(key)\n node = fetch_node_nt(key)\n raise unless node\n node\n end",
"def node_from_id(input)\n\n site_id = @context['__site_id']\n \n # Attempt to locate the node.\n node = Rails.cache.fetch \"node_id:#{site_id}:#{input}\" do\n n = node_scope.where(:id => input.to_i).first\n n.blank? ? nil : n.to_liquid\n end\n\n node\n \n end",
"def dereference(id)\n crate.dereference(id)\n end",
"def node(node_name)\n nodes(node_name).first\nend",
"def id\n @node.id\n end",
"def get(\n id,\n deadline: nil\n )\n return @nodes.get(\n id,\n deadline: deadline,\n )\n end",
"def get(oid)\n roid=self.oid2roid(oid)\n return nil if roid.empty?\n validate_roid(roid)\n roid_first=roid.first\n node=@nodes[roid_first]\n return node.get(oid) if node\n return nil\n end",
"def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end",
"def get_element id\n @elements[id.to_s]\n end",
"def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end",
"def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end",
"def node(name)\n return node_manager.find(name)\n end",
"def gatherNode(id)\n @nodes.bsearch { |n| n.data == data}\n end",
"def getNode(name)#name is the int for the vertice\n\t\[email protected] {|nodes| nodes.node == name }[0] \n\tend",
"def [](leaf_id)\n node_hash leaf_node_id(leaf_id)\n end",
"def get_node(string_key)\n pos = self.get_node_pos(string_key)\n return nil if pos.nil?\n\n return @ring[@_sorted_keys[pos]]\n end",
"def node(id, params = {})\n get \"nodes/#{id}\", {query: params}\n end"
]
| [
"0.77852273",
"0.7746689",
"0.74849606",
"0.7415566",
"0.7203441",
"0.6996068",
"0.6890222",
"0.6885043",
"0.6787701",
"0.6758027",
"0.66858804",
"0.66643023",
"0.66091704",
"0.6607736",
"0.6528776",
"0.65238875",
"0.65092194",
"0.6489196",
"0.64593965",
"0.64387286",
"0.63982904",
"0.63943636",
"0.6388068",
"0.6388068",
"0.63747305",
"0.63708884",
"0.6334485",
"0.6316292",
"0.63036215",
"0.6293563"
]
| 0.79646957 | 0 |
connect(Edge) method that adds a connection to the list of nodes returns | def connect edge
self.add edge.src
self.add edge.dst
@nodes[edge.src] << edge
edge
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_nodes(node1, node2)\n # node1.connect(node2)\n end",
"def __connect__(node)\n raise \"Cannot connect to a node which is not on the same graph!\" if node.graph != @this.graph\n node.in.instance_exec(@this) { |n| @others << n }\n @graph.instance_eval { @changed = true }\n end",
"def connectWith(node, weight = 0)\n edge = Edge.new(self, node, weight)\n @edges << edge\n\n edge\n end",
"def connect(vertex1, vertex2, edge_attributes = {})\n self.vertices << vertex1 unless self.vertices.include? vertex1\n self.vertices << vertex2 unless self.vertices.include? vertex2\n edge = Edge.new(edge_attributes)\n self.edges << edge\n edge << vertex1 << vertex2\n end",
"def connect_for!(source, edge_args, target)\n edge = Edge(source, edge_args, target)\n\n self[:graph][source][edge] = target\n\n return target, edge\n end",
"def connect(node0, node1)\n @connections << [node0, node1] unless @connections.include? [node0, node1]\n @connections << [node1, node0] unless @connections.include? [node1, node0]\n end",
"def connect node1, node2\n if !Set.new([node1, node2]).subset? @nodes\n raise BadNodeInput, 'The graph does not have either ' + node1 + ' or ' + node2\n end\n @connections[node1] ||= Array.new\n @connections[node1].push node2\n unless node1.eql? node2\n @connections[node2] ||= Array.new\n @connections[node2].push node1\n end\n end",
"def connect(peer)\n return if @connections[peer]\n @connections[peer] = []\n peer.connections[self] = []\n\n Layout.parallel_links.times do\n local = add_link\n remote = peer.add_link\n @connections[peer].push([local, remote])\n peer.connections[self].push([remote, local])\n end\n end",
"def connect(params)\n order = params[:order]; from = params[:from]; to = params[:to]\n\n if to.kind_of?(Enumerable)\n to.each do |singularized_to|\n connect :from => from, :to => singularized_to, :order => order\n end\n else\n edges.add(from, to, order)\n end\n end",
"def connect_over(node)\n node.inputs.each do |producer_edge|\n node.outputs.each do |consumer_edge|\n connect(\n producer_edge.from,\n consumer_edge.to,\n producer_edge.type,\n producer_edge.label\n )\n end\n end\n end",
"def add_edge(from, to)\n from.adjacents << to\n end",
"def connect(src, tar, distance = 1)\n unless @nodes.include?(src)\n raise ArgumentError, \"No such node: #{src}\"\n end\n unless @nodes.include?(tar)\n raise ArgumentError, \"No such node: #{tar}\"\n end\n @edges.push Edge.new(src, tar, distance)\n end",
"def add_edge(nodeA, nodeB)\n nodeA.adjacents << nodeB\n nodeB.adjacents << nodeA\n\n @nodes << nodeA\n @nodes << nodeB\n end",
"def connect(lnode)\n @lnode = lnode\n end",
"def add_edge(element1, element2)\n index1 = self.dict[element1]\n index2 = self.dict[element2]\n raise Exception.new(\"Nodes not exist!\") unless index1 && index2\n\n head_node2 = self.adj_list_array[index2].head_node\n new_node1 = Node.new(element1, head_node2.next_node)\n head_node2.next_node = new_node1\n\n\n head_node1 = self.adj_list_array[index1].head_node\n new_node2 = Node.new(element2, head_node1.next_node)\n head_node1.next_node = new_node2\n\n self\n end",
"def add_edge(node_a, node_b)\n node_a.adjacents << node_b\n node_b.adjacents << node_a\n end",
"def connect_endpoint(collection, edge)\n if collection.any? { |o| ! edge.equal?(o) && edge.similar?(o) }\n raise DuplicateEdgeError.new(self, edge)\n end\n\n collection.add(edge)\n end",
"def add_edge(a,b)\n @adj_list[a][b] = 1\n end",
"def add_edge(node)\n @adj_nodes.push(node.position)\n end",
"def add_edge(source_vertex, destination_vertex)\n @adjacent_list[source_vertex].push(destination_vertex)\n @indegree[destination_vertex] += 1\n end",
"def connect(a, b, weight = 0.5)\n c = Connection.new a, b, weight\n a.join c\n # Also add the Connection here\n connections << c\n end",
"def add_edge(e)\n @edges[e.from] << e\n end",
"def connect(vert1, vert2)\n # Basically, if the two elements in the edge set are in the @vertices\n # set, then we add the edge to the set.\n edge = [ vert1, vert2 ]\n\n if (edge.to_set & @vertices) == edge.to_set\n @edges.add(edge)\n end\n end",
"def connect(from, to, type, label = nil)\n raise if from == to\n raise if !to.is_a?(PhiNode) && type == :data && label.nil?\n\n edge = Edge.new(from, to, type, label)\n from.outputs << edge\n to.inputs << edge\n end",
"def connect(src, dest, len = 1)\n\t\tif self.include?(src) and self.include?(dest) and !edge_exists?(src, dest) and len > 0\n\t\t\t\t@e << Edge.new(src, dest, len)\n\t\telse\n\t\t\treturn nil\n\t\tend\n\t\ttrue\n\tend",
"def <<(other)\n c = Connection.new\n c.end = other\n other.edges << self unless other.edges.include? self\n self.connections << c\n self\n end",
"def connect_mutually(vertex1, vertex2, distance = 1)\n self.connect vertex1, vertex2, distance\n self.connect vertex2, vertex1, distance\n end",
"def add_edge(from, to, weight = 1.0)\n\t\t\tadd_node(from)\n\t\t\tadd_node(to)\n\t\t\t@size += 1 if connect(from, to, weight)\n\t\t\tself\n\t\tend",
"def add_edge(object_1, object_2)\n node_1 = check_object(object_1)\n node_2 = check_object(object_2)\n node_1.adjacents << node_2\n node_2.adjacents << node_1\n end",
"def add_edge(src, dest)\n # add a edge to the head\n @adjList[src] << dest\n # since this graph is not directed we need to do the oposite also\n # @adjList[dest] << src\n @edges += 1\n end"
]
| [
"0.7149291",
"0.7143974",
"0.7126218",
"0.69445294",
"0.68873805",
"0.68495196",
"0.672731",
"0.67185426",
"0.6711184",
"0.6705357",
"0.6662451",
"0.65780455",
"0.65737826",
"0.65538955",
"0.6543518",
"0.65326816",
"0.6487913",
"0.6485545",
"0.6385783",
"0.635903",
"0.6352993",
"0.63439983",
"0.6284507",
"0.6256694",
"0.62309754",
"0.6206491",
"0.6183157",
"0.61363924",
"0.61256087",
"0.61122304"
]
| 0.8483913 | 0 |
path_number(List, Symbol, Hash, String) return the number of paths with in the limits returns | def path_number visit_path, dst, limits, condition=EG
paths = route(visit_path, dst, limits, condition)
select_condition = condition == EG ? EG : condition == UNTIL ? LESS : UNTIL
return (paths.select {|path| eval final_eval( select_condition, limits )}).length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_count(*args)\n path_rels(*args).size\n end",
"def get_num_paths(grid_width)\n n, r = grid_width * 2, grid_width\n ((n - r + 1)..n).inject(:*) / (1..r).inject(:*)\nend",
"def count_paths(grid_size)\n factorial(2*grid_size) / (factorial(grid_size) * factorial(grid_size))\nend",
"def path_count(steps, current=0)\n if current == steps\n 1\n elsif current > steps\n 0\n else\n path_count(steps, current + 1) +\n path_count(steps, current + 2) +\n path_count(steps, current + 3)\n end\nend",
"def path_captures\n return 0 unless conditions[:path]\n Behavior.count_parens_up_to(conditions[:path], conditions[:path].size)\n end",
"def number_of_paths(n)\n return 0 if n < 0\n return 1 if n == 1 || n == 0\n number_of_paths(n - 1) + number_of_paths(n - 2) + number_of_paths(n - 3)\nend",
"def num_paths\n @num_paths ||= begin\n self[width - 1, height - 1]\n end\n end",
"def actual_path_length\n folders.count\n end",
"def total_paths(initial_s)\n reachable_stops(initial_s).count\n end",
"def count()\n return @child_path_parts.count\n end",
"def path_as_number(request)\n number_or_zero(path_contents(request))\n end",
"def dir_count(route, dir)\n route.count(dir)\nend",
"def count_routes(n)\n\n\treturn 0\nend",
"def numPaths(start_from, vertices,edge_weights)\n graph = RGL::DirectedAdjacencyGraph.new\n graph.add_vertices vertices\n edge_weights.each { |(bag1, bag2), w| graph.add_edge(bag1, bag2) }\n\n num_paths = 0\n vertices.map do |vert|\n unless vert.eql?(start_from)\n num_paths+=1 if graph.path?(start_from,vert)\n end\n end\n num_paths\nend",
"def path_length(guess)\n Log.indent(\"path_length #{guess.inspect}\") do\n do_path_length(guess).tap{|x| Log.debug(\"returning #{x.inspect}\")}\n end\n end",
"def path_length(path)\n return 0 if path.size <= 1\n (0..path.size - 2).map {|i| dist(path[i], path[i + 1])}.inject(&:+)\n end",
"def step_number visit_path, dst, limits, condition=nil\n return route(visit_path, dst, limits, UNTIL).first.nodes.length - 1\n end",
"def paths(n)\n return nCr(2*(n-1),n)\nend",
"def howManyMineHits(path)\n path.select { |i| @structure[i] & MINE > 0 }\n end",
"def get_count(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n return 0 if !file.is_dir\n file.files_count\n end",
"def count\n @count ||= begin\n Grim.processor.count(@path)\n end\n end",
"def number_of_paths_to_end_from_point(start_point)\n \n tabs = \"\\t\" * ([start_point.x, start_point.y].max)\n puts \"#{tabs} (#{start_point.x}, #{start_point.y})\"\n \n # only 1 path to end from the edges\n return 1 if (start_point.y == 2 || start_point.x == 2)\n \n # last point\n return 0 if (start_point.x == 2 && start_point.y == 2)\n \n # otherwise, it's the sum of the paths that can be taken when adding the ones from right and the ones from below\n right_point = Point.new(start_point.x + 1, start_point.y)\n down_point = Point.new(start_point.x, start_point.y + 1)\n \n right = number_of_paths_to_end_from_point(right_point)\n down = number_of_paths_to_end_from_point(down_point)\n \n # puts \"From: (#{start_point.x}, #{start_point.y}) -> #{right + down} \"\n \n return right + down\nend",
"def n_paths(graph, from)\n counter = { from => 1 }\n graph.topsort.each do |v|\n next if v == from\n in_edges = graph.edges.select { |e| e.target == v && graph.adjacent(v, :direction => :in).include?(e.source) }\n counter[v] = in_edges.map { |e| counter[e.source] }.inject(:+)\n end\n counter\nend",
"def paths()\n assert( @maximum.exists?, \"you cannot obtain paths() for an infinite Repeater\" )\n assert( @maximum <= 10, \"if you really need to obtain paths() for a Repeater with greater than 10 elements, change this assertion\" )\n \n #\n # First, compile the element to its paths. We will end up with a BranchPoint.\n \n element_paths = nil\n if @element.is_an?(ExpressionForm) then\n element = @element.paths\n else\n element = BranchPoint.new( Sequence.new(@element) )\n end\n \n #\n # Next, produce a BranchPoint with a Sequence for each count we are doing.\n \n run = Sequence.new()\n minimum.times do\n run << element\n end\n \n result = BranchPoint.new( run )\n (maximum - minimum).times do\n run = Sequence.new( run, element )\n run.minimal = false\n result << run\n end\n \n \n #\n # Finally, get the paths of the produced Sequence.\n \n return result.paths\n end",
"def birth_path_number(birthdate)\n path_number = birthdate.reduce(:+)\n if path_number > 9\n second_number = path_number.to_s.split(//).map(&:to_i)\n third_number = second_number.reduce(:+)\n else\n explanation(birth_path_message)\n end\nend",
"def number_of_edges\n @pathway.relations.size\n end",
"def depth\n PathExpression.range(path)[1]\n end",
"def get_max_path(num_pyramid)\n num_pyramid.each_index do |i|\n next if i == 0\n num_pyramid[i].each_index do |j|\n num_pyramid[i][j] += [num_pyramid[i - 1][j], num_pyramid[i - 1][j + 1]].max\n end\n end\n\n num_pyramid[-1].first\nend",
"def countSubst(path)\n count = 0\n path.each do | atom |\n if @atoms[atom].size > 2 then\n count += (@atoms[atom].size - 2)\n end\n end\n count\n end",
"def path_number(birthdate)\n# Access birthdate numbers with array, so must be integers; add all together\n number = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\n \n# Convert number back to string to use array to again access each number \n number = number.to_s\n# Convert back to integers and use array to get each number\n number = number[0].to_i + number[1].to_i\n\n# If number is greater than 9, must be reduced again \n if number > 9\n number = number[0].to_i + number[1].to_i\n end\n \n return number\nend"
]
| [
"0.7148266",
"0.7054428",
"0.6922436",
"0.6717221",
"0.6602749",
"0.6582553",
"0.65792847",
"0.62654996",
"0.6254104",
"0.623642",
"0.62050784",
"0.61050344",
"0.610447",
"0.60559106",
"0.60262126",
"0.6015799",
"0.6009623",
"0.5996869",
"0.58924735",
"0.57638484",
"0.5754598",
"0.573807",
"0.5702635",
"0.5694975",
"0.5678772",
"0.56779146",
"0.5613398",
"0.56117314",
"0.5604654",
"0.5532958"
]
| 0.7635548 | 0 |
step_number(Hash, String) return the eval expression for the conditions returns | def final_eval condition, limits
return "#{condition[:steps]}#{limits[:steps]}" if limits.has_key? :steps
return "#{condition[:cost]}#{limits[:cost]}" if limits.has_key? :cost
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculation\n wizard_step(nil) { { next_step: :calculate_next_step, cache_index: LbttController } }\n end",
"def opinion_wizard_step_number(step)\n step.to_s.split(\"_\").last.to_i\n end",
"def next_step\n (history.keys.last.to_i + 1).to_s\n end",
"def step_result; end",
"def steps(n)\nend",
"def step_number(string)\n return string.split('-',5)[2].to_i\n end",
"def take_steps(n, steps = 1)\n\treturn 0 if n < 0\n\n\treturn 1 if n == 0\n\treturn @hash[n] unless @hash[n].nil?\n\t\n\t@hash[n] = take_steps(n - 1) + take_steps(n - 2) + take_steps(n - 3)\n\treturn @hash[n]\nend",
"def expr1\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n value = nil\n e = nil\n\n begin\n # at line 28:5: e= number ( '*' e= number | '/' e= number )*\n @state.following.push( TOKENS_FOLLOWING_number_IN_expr1_207 )\n e = number\n @state.following.pop\n # --> action\n value = e \n # <-- action\n # at line 29:5: ( '*' e= number | '/' e= number )*\n while true # decision 2\n alt_2 = 3\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == T__12 )\n alt_2 = 1\n elsif ( look_2_0 == T__13 )\n alt_2 = 2\n\n end\n case alt_2\n when 1\n # at line 29:7: '*' e= number\n match( T__12, TOKENS_FOLLOWING_T__12_IN_expr1_217 )\n @state.following.push( TOKENS_FOLLOWING_number_IN_expr1_221 )\n e = number\n @state.following.pop\n # --> action\n value *= e \n # <-- action\n\n when 2\n # at line 30:7: '/' e= number\n match( T__13, TOKENS_FOLLOWING_T__13_IN_expr1_231 )\n @state.following.push( TOKENS_FOLLOWING_number_IN_expr1_235 )\n e = number\n @state.following.pop\n # --> action\n value /= e \n # <-- action\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end\n \n return value\n end",
"def number_of_steps\n case current_instruction.opcode\n when 3, 4\n 2\n else\n 4\n end\n end",
"def number_of_steps\n case current_instruction.opcode\n when 3, 4\n 2\n else\n 4\n end\n end",
"def number_of_steps\n case current_instruction.opcode\n when 3, 4\n 2\n else\n 4\n end\n end",
"def kaprekar_step(n)\n\n # TODO: Solve it!\n\n end",
"def flow_expression\n\n @dict.fexp\n end",
"def num_steps(n)\n # if n = 1\n # 1\n # elsif n = 2\n # 2\n # elsif n = 3\n # num_steps(1) + num_steps(2)\n # elsif n = 4\n # num_steps(2) + num_steps(3)\n # end\n if n < 3\n n\n else\n num_steps(n-2) + num_steps(n-1)\n end\nend",
"def execute(step)\n end",
"def make_step\n @result\n end",
"def step\n instcode = @memory[@ip]\n raise \"nil opcode encountered\" if instcode.nil?\n\n opcode = instcode % 100\n arg0imm = (instcode / 100) % 10 == 1\n arg1imm = (instcode / 1000) % 10 == 1\n\n argcount = ARGCOUNT[opcode] || 0\n args = @memory[@ip + 1..@ip + argcount]\n arg0 = (arg0imm ? args[0] : @memory[args[0]]) if argcount >= 1\n arg1 = (arg1imm ? args[1] : @memory[args[1]]) if argcount >= 2\n\n jump_target = nil\n case opcode\n when 1 # add\n @memory[args[2]] = arg0 + arg1\n when 2 # mul\n @memory[args[2]] = arg0 * arg1\n when 3 # in\n raise \"input past end\" unless @inputs.any?\n @memory[args[0]] = @inputs.shift\n when 4 # out\n @outputs << arg0\n when 5 # jnz\n jump_target = arg1 if arg0 != 0\n when 6 # jz\n jump_target = arg1 if arg0 == 0\n when 7 # lt\n @memory[args[2]] = (arg0 < arg1) ? 1 : 0\n when 8 # eq\n @memory[args[2]] = (arg0 == arg1) ? 1 : 0\n when 99\n return nil\n else\n raise \"invalid opcode #{opcode} at position #{@ip}\"\n end\n\n if jump_target\n @ip = jump_target\n else\n @ip += argcount + 1\n end\n end",
"def k_num!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n\n\n type = K_NUM\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 441:4: ( 'round' | 'aleatorio' | 'between' )\n # at line 441:4: ( 'round' | 'aleatorio' | 'between' )\n alt_14 = 3\n case look_14 = @input.peek( 1 )\n when 0x72 then alt_14 = 1\n when 0x61 then alt_14 = 2\n when 0x62 then alt_14 = 3\n else\n raise NoViableAlternative( \"\", 14, 0 )\n\n end\n case alt_14\n when 1\n # at line 441:5: 'round'\n match( \"round\" )\n\n\n when 2\n # at line 441:13: 'aleatorio'\n match( \"aleatorio\" )\n\n\n when 3\n # at line 441:25: 'between'\n match( \"between\" )\n\n\n end\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__, 47 )\n\n\n end",
"def steps(value)\n factor = 10**(Math.log10(value).floor - 1)\n case \n when value < factor * 10\n factor\n when value < 5 * factor * 10\n 5 * factor\n else\n 10 * factor\n end\n end",
"def steps(value)\n factor = 10**(Math.log10(value).floor - 1)\n case \n when value < factor * 10\n factor\n when value < 5 * factor * 10\n 5 * factor\n else\n 10 * factor\n end\n end",
"def next_step\n self.step_flow.next_step if can_increment_step\n end",
"def eval_shop_condition(formula)\n @@interpreter.eval_shop_condition(formula)\n end",
"def parse_condition(exp); end",
"def create_steps(value, expected)\n temp = []\n st_count = 0\n\n value.each do |x|\n temp[st_count] = {}\n temp[st_count][:step_number] = \"#{st_count+1}\"\n temp[st_count][:actions] = \"<p>#{x.strip}</p>\"\n temp[st_count][:expected_results] = expected unless expected.nil?\n temp[st_count][:execution_type] = \"1\"\n temp[st_count][:active] = \"1\"\n st_count += 1\n end\n return temp\n end",
"def sheets_steps= value ; @sheets_steps = value end",
"def next_hash\n result = @stmt.step\n return nil if result.nil?\n unless result.kind_of?(Hash)\n result_ary = result\n result = {}\n result_ary.each_with_index do |el, i|\n result[@stmt.column_name(i)] = el\n end\n end\n result\n end",
"def compute(expr)\n\n\t\tj=0;\n\t\twhile j<=expr.size\n\t if !expr[j+1].nil?\n\t\t\t\tif expr[j+1].chr=='`' || expr[j+1].chr==\"'\"\n\t\t\t\t\t(expr[j].chr=='1') ? k=\"0\" : k=\"1\"\n\t\t\t\t\texpr=expr.slice(0,j).to_s+k+expr.slice(j+2..-1).to_s\n\t\t\t\t\t#j=j-1\n\t\t\t\tend\n\t end\n\t\t\tj+=1\n\t\tend\n\n\t\tj=0\n\t while(j<=expr.size)\n\t if !expr[j+1].nil?\n\t\t\t\tif (expr[j].chr=='0' || expr[j].chr=='1') && (expr[j+1].chr=='0' || expr[j+1].chr=='1')\n\t\t\t\t\t(expr[j].chr=='1' && expr[j+1].chr=='1') ? k=\"1\" : k=\"0\"\n\t\t\t\t\texpr=expr.slice(0,j).to_s+k+expr.slice(j+2..-1).to_s\n\t\t\t\t\t#j=j-1;\n\t\t\t\telsif (expr[j].chr=='0' || expr[j].chr=='1') && expr[j+1].chr=='^'\n\t\t\t\t\t(expr[j].chr==expr[j+2].chr) ? k=\"0\" : k=\"1\"\n\t\t\t\t\texpr=expr.slice(0,j).to_s+k+expr.slice(j+3..-1).to_s\n\t\t\t\t\t#j=j-1;\n\t\t\t\tend\n\t end\n\t\t\tj+=1\n\t\tend\n\t\tk=0\n\n\t\tj=0\n\t\twhile(j<expr.size)\n\t\t\tif expr[j].chr=='1'\n\t\t\t\tk=1\n\t\t\t\treturn k\n\t\t\tend\n\t\t\tj+=1\n\t\tend\n\t\treturn k\n\n\tend",
"def expression; end",
"def step count\n @algorithm.call count\n end",
"def hash_for(expression)\n\n end"
]
| [
"0.5798169",
"0.56881636",
"0.5677804",
"0.5475534",
"0.54139423",
"0.53727996",
"0.5353041",
"0.5338501",
"0.53065944",
"0.53065944",
"0.53065944",
"0.5299751",
"0.5289309",
"0.52679855",
"0.52373195",
"0.5217548",
"0.5089139",
"0.50588447",
"0.50575215",
"0.50575215",
"0.505702",
"0.50484395",
"0.50376534",
"0.5036761",
"0.50056845",
"0.498579",
"0.49814457",
"0.4977812",
"0.49721935",
"0.4949935"
]
| 0.5814103 | 0 |
Returns the account for this business linked to a "money" program with is_money == true | def cashbox
return @cashbox if @cashbox.present?
return nil unless has_money_program?
@cashbox = self.accounts.where(:program_id => money_program.id, :is_money => true).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_account\n accounts.currency_code_is(\"flc\").first\n end",
"def payment_entry\n business_account.entries.find { |e|\n e.code == number.to_s and not e.accounts.include? commodity_account\n }\n end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def entry\n business_account.entries.find { |e|\n e.code == number.to_s and e.accounts.include? commodity_account\n }\n end",
"def account\n AccountInfoParser.parse(post(\"money/info\"))\n end",
"def getaccount(coinaddress)\n coind.getaccount coinaddress\n end",
"def business_account\n customer_or_supplier \\\n proc { customer.receivable_account },\n proc { supplier.payable_account }\n end",
"def balance_for(account)\n @accounts[account]\n end",
"def get_account(acct)\n\t\t$DB.where(account_name: acct).each do |t|\n\t\t\tputs \"#{t[:account_name]}: #{t[:balance]}\"\n\t\tend\n\tend",
"def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end",
"def get_account(account_id)\n @accounts[account_id]\n end",
"def get_account(account_id)\n @accounts[account_id]\n end",
"def balance\n @accounts.values.first\n end",
"def get_marketplace_bank_account\n Balanced::BankAccount.find(\"/v1/bank_accounts/BAj6sNNBdMp5WmY6PJ7sAu3\")\n end",
"def account\n find('Account', account_id)\n end",
"def account_to; Account.get(self.account_to_id); end",
"def get_account_number\n @acct_num\n end",
"def bank_account\n @bank_account\n end",
"def credit_account\n if @invoice.amount\n result = @invoice.bank_account.credit_account(seller_amount) rescue false\n else\n false\n end\n end",
"def account_from; Account.get(self.account_from_id); end",
"def account_from; Account.get(self.account_from_id); end"
]
| [
"0.6982914",
"0.68794227",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.67552257",
"0.6677856",
"0.6670226",
"0.6612918",
"0.6459652",
"0.644602",
"0.64443004",
"0.6411041",
"0.6390428",
"0.6390428",
"0.6295162",
"0.62915784",
"0.6281422",
"0.6270203",
"0.62470394",
"0.6245151",
"0.6145224",
"0.6122824",
"0.6122824"
]
| 0.69634044 | 1 |
Tries to detect the current processor based if any of the processors exist. Mogrify have precedence over gm by default. === Returns [String] The detected procesor | def choose_processor
self.processor = if MiniMagick::Utilities.which('mogrify')
:mogrify
elsif MiniMagick::Utilities.which('gm')
:gm
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gm?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :gm unless processor.nil?\n false\n end",
"def mogrify?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :mogrify unless processor.nil?\n false\n end",
"def processor\n return @options[:processor]\n end",
"def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end",
"def processor_path\n @processor_path || DEFAULT_PROCESSOR_PATH\n end",
"def get_processor; end",
"def default_processor_type\n :image_magick\n end",
"def processors\n @@processors ||= @@processor_classes.collect {|processor| processor.instance}\n end",
"def p4_cpu(os)\n cpu = RbConfig::CONFIG['target_cpu']\n case os\n when :darwin, :linux\n if cpu =~ /i686/\n 'x86'\n elsif cpu =~ /universal/\n 'x86_64'\n else\n cpu\n end\n else\n case cpu\n when /ia/i\n 'ia64'\n else\n cpu\n end\n end\nend",
"def fetch(processor_name)\n idx = processors.index {|processor| processor.name.equal?(processor_name)}\n idx or raise(UnknownProcessor.new(processor_name))\n end",
"def processor_count\n @processor_count ||= begin\n os_name = RbConfig::CONFIG[\"target_os\"]\n if os_name =~ /mingw|mswin/\n require 'win32ole'\n result = WIN32OLE.connect(\"winmgmts://\").ExecQuery(\n \"select NumberOfLogicalProcessors from Win32_Processor\")\n result.to_enum.collect(&:NumberOfLogicalProcessors).reduce(:+)\n elsif File.readable?(\"/proc/cpuinfo\")\n IO.read(\"/proc/cpuinfo\").scan(/^processor/).size\n elsif File.executable?(\"/usr/bin/hwprefs\")\n IO.popen(\"/usr/bin/hwprefs thread_count\").read.to_i\n elsif File.executable?(\"/usr/sbin/psrinfo\")\n IO.popen(\"/usr/sbin/psrinfo\").read.scan(/^.*on-*line/).size\n elsif File.executable?(\"/usr/sbin/ioscan\")\n IO.popen(\"/usr/sbin/ioscan -kC processor\") do |out|\n out.read.scan(/^.*processor/).size\n end\n elsif File.executable?(\"/usr/sbin/pmcycles\")\n IO.popen(\"/usr/sbin/pmcycles -m\").read.count(\"\\n\")\n elsif File.executable?(\"/usr/sbin/lsdev\")\n IO.popen(\"/usr/sbin/lsdev -Cc processor -S 1\").read.count(\"\\n\")\n elsif File.executable?(\"/usr/sbin/sysconf\") and os_name =~ /irix/i\n IO.popen(\"/usr/sbin/sysconf NPROC_ONLN\").read.to_i\n elsif File.executable?(\"/usr/sbin/sysctl\")\n IO.popen(\"/usr/sbin/sysctl -n hw.ncpu\").read.to_i\n elsif File.executable?(\"/sbin/sysctl\")\n IO.popen(\"/sbin/sysctl -n hw.ncpu\").read.to_i\n else\n $stderr.puts \"Unknown platform: \" + RbConfig::CONFIG[\"target_os\"]\n $stderr.puts \"Assuming 1 processor.\"\n 1\n end\n end\n end",
"def detect_cpu_cores_nix\n # On Unix platforms trying to use etc module to determine accessible\n # number of cores\n require 'etc'\n Etc.nprocessors\n end",
"def processor_count\n case RbConfig::CONFIG['host_os']\n when /darwin9/\n `hwprefs cpu_count`.to_i\n when /darwin/\n (`which hwprefs` != '' ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i\n when /linux|cygwin/\n `grep -c ^processor /proc/cpuinfo`.to_i\n when /(net|open|free)bsd/\n `sysctl -n hw.ncpu`.to_i\n when /mswin|mingw/\n require 'win32ole'\n wmi = WIN32OLE.connect(\"winmgmts://\")\n cpu = wmi.ExecQuery(\"select NumberOfLogicalProcessors from Win32_Processor\")\n cpu.to_enum.first.NumberOfLogicalProcessors\n when /solaris2/\n `psrinfo -p`.to_i # this is physical cpus afaik\n else\n $stderr.puts \"Unknown architecture ( #{RbConfig::CONFIG[\"host_os\"]} ) assuming one processor.\"\n 1\n end\nend",
"def explicit_map_processor?\n settings[:mapper]\n end",
"def find_processor_by_dataset(dataset)\n processors.values.detect { |p| p.datasets&.include? dataset }\n end",
"def valid_processors\n [:kramdown] + third_party_processors\n end",
"def processor_count # rubocop:disable all\n @processor_count ||=\n begin\n if Overcommit::OS.windows?\n require 'win32ole'\n result = WIN32OLE.connect('winmgmts://').ExecQuery(\n 'select NumberOfLogicalProcessors from Win32_Processor'\n )\n result.to_enum.collect(&:NumberOfLogicalProcessors).reduce(:+)\n elsif File.readable?('/proc/cpuinfo')\n IO.read('/proc/cpuinfo').scan(/^processor/).size\n elsif File.executable?('/usr/bin/hwprefs')\n IO.popen('/usr/bin/hwprefs thread_count').read.to_i\n elsif File.executable?('/usr/sbin/psrinfo')\n IO.popen('/usr/sbin/psrinfo').read.scan(/^.*on-*line/).size\n elsif File.executable?('/usr/sbin/ioscan')\n IO.popen('/usr/sbin/ioscan -kC processor') do |out|\n out.read.scan(/^.*processor/).size\n end\n elsif File.executable?('/usr/sbin/pmcycles')\n IO.popen('/usr/sbin/pmcycles -m').read.count(\"\\n\")\n elsif File.executable?('/usr/sbin/lsdev')\n IO.popen('/usr/sbin/lsdev -Cc processor -S 1').read.count(\"\\n\")\n elsif File.executable?('/usr/sbin/sysctl')\n IO.popen('/usr/sbin/sysctl -n hw.ncpu').read.to_i\n elsif File.executable?('/sbin/sysctl')\n IO.popen('/sbin/sysctl -n hw.ncpu').read.to_i\n else\n # Unknown platform; assume 1 processor\n 1\n end\n end\n end",
"def processors\n {\n insert: InsertProcessor,\n replace: ReplaceProcessor,\n fragment: FragmentProcessor,\n each: EachProcessor,\n if: IfProcessor,\n unless: UnlessProcessor,\n switch: SwitchProcessor,\n case: CaseProcessor,\n object: ObjectProcessor,\n text: TextProcessor,\n utext: UTextProcessor,\n remove: RemoveProcessor,\n default: DefaultProcessor\n }\n end",
"def get_processor\n case @config[\"markdown\"].downcase\n when \"kramdown\" then KramdownParser.new(@config)\n else\n custom_processor\n end\n end",
"def is_processed_image? picture\n model.class.to_s.underscore == \"pimage\"\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 detect_platform\n @@platform_features ||= {\n :interpreter => detect_interpreter,\n :interpreter_language => detect_interpreter_language,\n :ipv4 => detect_reachable_ip,\n :ruby_version => RUBY_VERSION,\n }.merge(detect_os).merge(detect_hardware)\n end",
"def default_processor_type\n :base\n end",
"def get_prc(prc)\n prc = [prc] unless prc.is_a?(Array)\n prc.map { |pn| Mdoc.get_processor(pn) }\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 processes\n\t\tif ::File.directory? \"/proc\"\n\t\t\tresolve_unix_uids(linux_processes)\n\t\telsif ::File.directory? \"C:/WINDOWS\"\n\t\t\twindows_processes\n\t\telse\n\t\t\tos_x_processes\n\t\tend\n\tend",
"def pe_family\n if !ENV['PE_VERSION'] || ENV['PE_VERSION'] == 'latest'\n if ENV['PE_FAMILY']\n return ENV['PE_FAMILY']\n elsif !PRE_RELEASE\n return nil\n else\n puts \"You must set the PE_VERSION or PE_FAMILY environment variable to build a pre-release version\"\n exit 1\n end\n else\n ENV[\"PE_VERSION\"].split('.')[0 .. 1].join('.')\n end\nend",
"def choose_processors\n [:thumbnail]\n end",
"def _identify\n begin\n product = nil\n { \"sfcb\" => [ \"root/interop\", \"CIM_ObjectManager\" ],\n \"pegasus\" => [ \"root/PG_Internal\", \"PG_ConfigSetting\" ]\n }.each do |cimom, op|\n obj = objectpath *op\n @client.instances(obj).each do |inst|\n product = inst.Description || cimom\n break\n end\n break if product\n end\n rescue Sfcc::Cim::ErrorInvalidClass, Sfcc::Cim::ErrorInvalidNamespace\n raise \"Unknown CIMOM\"\n end\n product\n end",
"def current_engine\n unless defined?(@current_engine)\n processors = environment.attributes_for(self.pathname).processors\n processors.each do |processor|\n if engine = CAPTURE_ENGINES[processor.to_s]\n @current_engine = engine\n break\n end\n end\n end\n\n @current_engine\n end"
]
| [
"0.74321014",
"0.7190223",
"0.6387016",
"0.6373831",
"0.60417885",
"0.5790201",
"0.5749444",
"0.5714313",
"0.57106245",
"0.56824136",
"0.55886793",
"0.5558089",
"0.5539528",
"0.55147165",
"0.54887444",
"0.5444319",
"0.5433147",
"0.5340609",
"0.5298695",
"0.5288989",
"0.52737963",
"0.5262326",
"0.52443725",
"0.52334887",
"0.519703",
"0.5184022",
"0.5177697",
"0.5168251",
"0.5160831",
"0.516021"
]
| 0.74514323 | 0 |
Discovers the imagemagick version based on mogrify's output. === Returns The imagemagick version | def image_magick_version
@@version ||= Gem::Version.create(`mogrify --version`.split(' ')[2].split('-').first)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imagemagick7?; end",
"def valid_version_installed?\n image_magick_version >= minimum_image_magick_version\n end",
"def version\n Gem.loaded_specs['image_optim'].version.to_s\n rescue\n 'DEV'\n end",
"def minimum_image_magick_version\n @@minimum_version ||= Gem::Version.create('6.6.3')\n end",
"def imagemagick?; end",
"def im_identify(source_name)\n \n # configure in local_config.rb\n identify = \"#{IMAGE_MAGICK_PATH}identify\"\n\n #raise \"Failed to find 'identify' binary on your system. Check your ImageMagick installation.\" unless `#{identify} --version`[\"ImageMagick\"]\n \n # Finally figured out how to make identify fast (-ping)\n # assume identify is in PATH for compatibility\n cmd = \"#{identify} -ping -format '%m:%w:%h' #{source_name}\"\n # logger.info(\"$PATH is: \" + `echo $PATH`)\n logger.info(\"Executing '#{cmd}'\")\n \n res = `#{cmd}`.strip.gsub(\"'\",'').split(\":\") # the gsub fixes a bug on PCs where additional characters were added\n {:type => res[0], :width => res[1], :height => res[2]}\n end",
"def full_version\n \"image_optim v#{version}\"\n end",
"def magick_formats\n @magick_formats ||= `convert -version`\n .scan(/Delegates.*/)\n .first\n .delete_prefix('Delegates (built-in):')\n .split\n end",
"def choose_processor\n self.processor = if MiniMagick::Utilities.which('mogrify')\n :mogrify\n elsif MiniMagick::Utilities.which('gm')\n :gm\n else\n nil\n end\n end",
"def get_gcovr_version()\n version_number_major = 0\n version_number_minor = 0\n\n command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_GCOVR_POST_REPORT, [], \"--version\")\n shell_result = @ceedling[:tool_executor].exec(command[:line], command[:options])\n version_number_match_data = shell_result[:output].match(/gcovr ([0-9]+)\\.([0-9]+)/)\n\n if !(version_number_match_data.nil?) && !(version_number_match_data[1].nil?) && !(version_number_match_data[2].nil?)\n version_number_major = version_number_match_data[1].to_i\n version_number_minor = version_number_match_data[2].to_i\n end\n\n return version_number_major, version_number_minor\n end",
"def version\n output = @filer.invoke(\"system-get-version\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.child_get_string(\"version\")\n end\n end",
"def _identify\n begin\n product = nil\n { \"sfcb\" => [ \"root/interop\", \"CIM_ObjectManager\" ],\n \"pegasus\" => [ \"root/PG_Internal\", \"PG_ConfigSetting\" ]\n }.each do |cimom, op|\n obj = objectpath *op\n @client.instances(obj).each do |inst|\n product = inst.Description || cimom\n break\n end\n break if product\n end\n rescue Sfcc::Cim::ErrorInvalidClass, Sfcc::Cim::ErrorInvalidNamespace\n raise \"Unknown CIMOM\"\n end\n product\n end",
"def size\n res = %x( #{magick_bin_name(\"identify\")} -format \"%[fx:w]x%[fx:h]\" #{Shellwords.shellescape path} )\n if res.size > 0\n res.chomp.split(\"x\").map {|x| x.to_i}\n else\n nil\n end\n end",
"def actual_dimensions(version = nil)\n if :original == version || [:original] == version\n version = nil\n elsif :fullsize == version || [:fullsize] == version\n version = fullsize_version\n end\n current_version = version.present? ? get_version(*version) : self\n path = current_version.path\n image = {}\n image = MiniMagick::Image.open(path) if File.exists?(path)\n [image[:width], image[:height]]\n end",
"def default_processor_type\n :image_magick\n end",
"def image\n [:MANAGED_MAP, :UNMANAGED_MAP].each do |map|\n unless self.class.const_defined?(map)\n raise MapUndefined, \"Const #{map} is undefined; maps appear unbuilt\"\n end\n end\n\n map = @managed ? self.class::MANAGED_MAP : self.class::UNMANAGED_MAP\n distro = @distro.downcase.to_sym\n\n unless map[distro].nil?\n return map[distro][@version] unless map[distro][@version].nil?\n return map[distro][\"*\"] unless map[distro][\"*\"].nil?\n end\n\n nil\n end",
"def version\n h = call(CMD_VERSION)\n return h[:result]\n end",
"def docker_version() ; info[:docker_version] ; end",
"def detect\n @version ? id(@version) : nil\n end",
"def detect\n @version ? id(@version) : nil\n end",
"def detect\n @version ? id(@version) : nil\n end",
"def detect\n @version ? id(@version) : nil\n end",
"def detect\n @jonas_version ? id(@jonas_version) : nil\n end",
"def get_os_type(image_name)\n image_service = Azure::VirtualMachineImageManagementService.new\n image = image_service.list_virtual_machine_images.select{|x| x.name == image_name}.first\n Loggerx.error_with_exit \"The virtual machine image source is not valid.\" unless image\n image.os_type\n end",
"def show_image_version\n if @options[\"mode\"] == \"himage\"\n tpl = @himage_tpl\n elsif @options[\"mode\"] == \"vimage\"\n tpl = @vimage_tpl\n else \n raise \"invalid template name\" + @options[\"mode\"]\n end\n calc_weather_icon\n calc_wind_icon\n parse_radar unless @options[\"radar_location\"].empty?\n erb = ERB.new(File.read(tpl), 0, '>')\n @conky_output = erb.result(binding)\n puts @conky_output\n end",
"def rmagik_info(file)\n puts \"- - - - - :rmagik-S\"\n puts file\n puts \">> Checking for oversized file > 430px wide\"\n img = Magick::Image::read(file).first\n puts \"Geometry: #{img.columns}x#{img.rows} - #{img.columns.class}x#{img.rows.class}\"\n\n if img.columns > 430 # resize to 430 wide\n \n scale = (430.0 / img.columns.to_f).round(6) # calculate scaling factor for image\n \n puts \"RESIZING before copying x#{scale}\"\n \n file_large = file.sub(File.extname(file), '_LRG.jpg') # copy to image_name_LRG.jpg\n FileUtils.cp( file, \"scratch/#{file_large}\")\n \n img_430 = img.scale(scale)\n \n img_430.write(file)\n \n end\n \n #img = Magick::Image::read(file).first\n #puts \" Format: #{img.format}\"\n #puts \" Geometry: #{img.columns}x#{img.rows}\"\n #puts \" Class: \" + case img.class_type\n # when Magick::DirectClass\n # \"DirectClass\"\n # when Magick::PseudoClass\n # \"PseudoClass\"\n # end\n #puts \" Depth: #{img.depth} bits-per-pixel\"\n #puts \" Colors: #{img.number_colors}\"\n #puts \" Filesize: #{img.filesize}\"\n #puts \" Resolution: #{img.x_resolution.to_i}x#{img.y_resolution.to_i} \"+\n # \"pixels/#{img.units == Magick::PixelsPerInchResolution ?\n # \"inch\" : \"centimeter\"}\"\n #if img.properties.length > 0\n # puts \" Properties:\"\n # img.properties { |name,value|\n # puts %Q| #{name} = \"#{value}\"|\n # }\n #end\n puts \"- - - - - :rmagik-E\"\nend",
"def format\n image_format = FFI::MemoryPointer::new( ImageFormat )\n error = OpenCL.clGetImageInfo( self, FORMAT, image_format.size, image_format, nil)\n error_check(error)\n return ImageFormat::from_pointer( image_format )\n end",
"def get_build\n if defined?(@major) and defined?(@minor) and defined?(@build) then\n return @major, @minor, @build\n else\n @major, @minor, @build = nil\n end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n if ntdlls.length > 0\n dumpvers = %x{pev -p #{ntdlls.first}}\n if $?.success?\n major, minor, build = dumpvers.split('.')\n @major, @minor, @build = Integer(major), Integer(minor), Integer(build)\n end\n else\n search = File.join(@path, 'sources/{setup.exe,winsetup.dll}')\n setup = Dir.glob(search, File::FNM_CASEFOLD)\n setup.each do |file|\n dumpvers = %x{pev -p #{file}}\n if $?.success?\n major, minor, build = dumpvers.split('.')\n @major, @minor, @build = Integer(major), Integer(minor), Integer(build)\n break\n end\n end # end of setup block\n begin\n get_xmlinfo if not defined?(@xmlinfo)\n majors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MAJOR/text()')\n minors = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/MINOR/text()')\n builds = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/VERSION/BUILD/text()')\n major = majors.first # The install.wim image will have multiple sub-\n minor = minors.first # images. Check to make sure each one has the same\n build = builds.first # version number.\n if majors.count(major) == majors.size and\n minors.count(minor) == minors.size and\n builds.count(build) == builds.size then\n @major, @minor, @build = Integer(major.to_s), Integer(minor.to_s), Integer(build.to_s)\n end\n rescue Exception => e\n # puts \"error(get_build): #{e}\"\n # raise\n end\n end\n return @major, @minor, @build\n end",
"def Check_OS_Version()\n\tos_version = `ver`\n\treturn os_version\nend",
"def validate!\n identify\n rescue MiniMagick::Error => error\n raise MiniMagick::Invalid, error.message\n end"
]
| [
"0.6637482",
"0.65219146",
"0.6472974",
"0.64288706",
"0.63321644",
"0.62835586",
"0.61837244",
"0.590618",
"0.58283144",
"0.5734902",
"0.5685154",
"0.56706923",
"0.561554",
"0.5570928",
"0.55627096",
"0.5544048",
"0.55422163",
"0.550007",
"0.5496064",
"0.5496064",
"0.5496064",
"0.5496064",
"0.54329485",
"0.5424384",
"0.5408277",
"0.5389166",
"0.53837174",
"0.5347341",
"0.5312134",
"0.52954173"
]
| 0.8131971 | 0 |
The minimum allowed imagemagick version === Returns The minimum imagemagick version | def minimum_image_magick_version
@@minimum_version ||= Gem::Version.create('6.6.3')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_version_installed?\n image_magick_version >= minimum_image_magick_version\n end",
"def image_magick_version\n @@version ||= Gem::Version.create(`mogrify --version`.split(' ')[2].split('-').first)\n end",
"def os_minimum_version\n return @os_minimum_version\n end",
"def os_minimum_version\n return @os_minimum_version\n end",
"def version\n Gem.loaded_specs['image_optim'].version.to_s\n rescue\n 'DEV'\n end",
"def imagemagick7?; end",
"def min_version\n @min_version ||= nil\n end",
"def full_version\n \"image_optim v#{version}\"\n end",
"def minimum_required_patch_version\n return @minimum_required_patch_version\n end",
"def require_mini_magick!\n unless defined?(MiniMagick)\n begin \n require 'mini_magick'\n rescue LoadError => e\n raise 'Required options need the mini_magick gem installed.'\n end\n end\n end",
"def imagemagick?; end",
"def os_minimum_version=(value)\n @os_minimum_version = value\n end",
"def os_minimum_version=(value)\n @os_minimum_version = value\n end",
"def min_licensing_version\n nil\n end",
"def min_licensing_version\n nil\n end",
"def docker_major_version\n @@docker_major_version ||= begin\n Timeout.timeout(0.2) { read_docker_version[/(\\d+)\\.\\d+\\.\\d+/, 1].to_i }\n rescue Timeout::Error\n 0\n end\n end",
"def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end",
"def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end",
"def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end",
"def minimum_supported_operating_system\n return @minimum_supported_operating_system\n end",
"def minimum_warning_patch_version\n return @minimum_warning_patch_version\n end",
"def default_processor_type\n :image_magick\n end",
"def major(version)\n res = 0\n res = Regexp.last_match(1) if version =~ /^\\s*(\\d+)\\.\\d+\\.\\d+/\n res\n end",
"def version_gte_71?\n version >= v71\n end",
"def compatible?(version)\n bin_version = Gem::Version.new(version)\n supports_min = !minimum_cocoapods_version ||\n (bin_version >= Gem::Version.new(minimum_cocoapods_version))\n supports_max = !maximum_cocoapods_version ||\n (bin_version <= Gem::Version.new(maximum_cocoapods_version))\n supports_min && supports_max\n end",
"def major ; version.major ; end",
"def major_version\n version.match(/(\\d\\.\\d)/)[0] if name.is_a? String\n end",
"def minimum_required_minor_engine_version\n data.minimum_required_minor_engine_version\n end",
"def best_request_version\n klass = get_class_for(:max_server_version)\n klass.minimum_api_version.to_s\n end",
"def major_version\n '1.8'\n end"
]
| [
"0.7833048",
"0.766381",
"0.67313546",
"0.67313546",
"0.6671334",
"0.6591078",
"0.6586556",
"0.6427364",
"0.6194594",
"0.6013946",
"0.59711105",
"0.59376246",
"0.59376246",
"0.5827781",
"0.5827781",
"0.5811156",
"0.5773059",
"0.5773059",
"0.5773059",
"0.5725629",
"0.5670229",
"0.565443",
"0.5568958",
"0.5563894",
"0.5562944",
"0.5553038",
"0.5534381",
"0.5534098",
"0.5530679",
"0.55055445"
]
| 0.8851184 | 0 |
Checks whether the imagemagick's version is valid === Returns [Boolean] | def valid_version_installed?
image_magick_version >= minimum_image_magick_version
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n validate!\n true\n rescue MiniMagick::Invalid\n false\n end",
"def valid?\n image_resource? && supported_format?\n end",
"def invalid?\n %w(undefined 0).include?(version.to_s)\n end",
"def valid_version?\n !statement[\"ver\"].empty?\n end",
"def valid_version?(version)\n version =~ /\\d+\\.\\d+\\.\\d+(\\.(alpha|beta|rc)(\\.\\d+)?)?/\nend",
"def valid?\n return false if @image.nil?\n return false if @image_id.nil?\n return false if @name.nil?\n return false if @ready.nil?\n return false if @restart_count.nil?\n return true\n end",
"def valid?(ver)\n !!(ver =~ /\\A#{REGEX_FULL}\\Z/)\n end",
"def version_ok?\n @version_ok ||= ((GIT_VERSION <=> version) <= 0)\n end",
"def valid_version?(arg)\n return true if arg == false || arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9]+)?$/ ? true : false\n end",
"def valid?\n errors, _warnings = valid\n errors.empty? && unsupported.empty?\n end",
"def supports?\n [email protected]?\n end",
"def version?\n false\n end",
"def valid_version?(arg)\n return true if arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9]+)?$/ ? true : false\n end",
"def check_version(v)\n return true if (!version || version[0..4].gsub(\".\",\"\").to_i>=v)\n return false\n end",
"def valid?\n return false if @info.nil?\n return false if @schema_version.nil?\n true\n end",
"def valid?\n !(image_too_small? || image_too_big?)\n end",
"def valid?\n html_version_validator = EnumAttributeValidator.new('String', [\"Xhtml\", \"Html5\"])\n return false unless html_version_validator.valid?(@html_version)\n metafile_format_validator = EnumAttributeValidator.new('String', [\"Png\", \"Svg\", \"EmfOrWmf\"])\n return false unless metafile_format_validator.valid?(@metafile_format)\n office_math_output_mode_validator = EnumAttributeValidator.new('String', [\"Image\", \"MathML\", \"Text\"])\n return false unless office_math_output_mode_validator.valid?(@office_math_output_mode)\n return true\n end",
"def valid_schema_version?\n schema_version = PROIEL::PROIELXML::Schema.check_schema_version_of_xml_file(@filename)\n\n if schema_version.nil?\n @errors << 'invalid schema version'\n\n false\n else\n true\n end\n rescue PROIEL::PROIELXML::Schema::InvalidSchemaVersion => e\n @errors << e.message\n\n false\n end",
"def invalid?\n\t\treturn ( major.text.include?('Success') and minor.text.include?('IncorrectSignature') )\n\tend",
"def available?\n !!version\n end",
"def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPEG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end",
"def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPEG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end",
"def valid?\n formats.count > 0\n end",
"def valid?\n return false if !super\n pictures_compression_validator = EnumAttributeValidator.new('String', ['Dpi330', 'Dpi220', 'Dpi150', 'Dpi96', 'Dpi72', 'DocumentResolution'])\n return false unless pictures_compression_validator.valid?(@pictures_compression)\n external_fonts_handling_validator = EnumAttributeValidator.new('String', ['AddLinksToFontFiles', 'Embed', 'Vectorize'])\n return false unless external_fonts_handling_validator.valid?(@external_fonts_handling)\n true\n end",
"def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end",
"def valid_image_format?\n VALID_FILE_MIMETYPES.include? self.filetype\n end",
"def valid_file?\n if @image.size.zero?\n errors.add_to_base(\"Please enter an image filename\")\n return false\n end\n unless @image.content_type =~ /^image/\n errors.add(:image, \"is not a recognized format\")\n return false\n end\n if @image.size > 1.megabyte\n errors.add(:image, \"can't be bigger than 1 megabyte\")\n return false\n end\n return true\n end",
"def seems_valid?\n return true if nil_uuid?\n return seems_valid_microsoft? if variant_microsoft?\n return false if undefined_version? && variant_rfc_4122?\n if variant_rfc_4122?\n version == 1 ? reasonable_time? : !undefined_version?\n else\n nil\n end\n end",
"def available?\n !version.nil?\n end",
"def valid?\n if Gem.loaded_specs.has_key?(\"json-schema\")\n return validation_errors.empty?\n else\n return true\n end\n end"
]
| [
"0.7430224",
"0.70996916",
"0.7020582",
"0.6940662",
"0.69345105",
"0.6854174",
"0.6702889",
"0.6696321",
"0.6671831",
"0.6659723",
"0.6572059",
"0.6560966",
"0.65524983",
"0.65450585",
"0.64926857",
"0.6492017",
"0.6451872",
"0.64208996",
"0.6383397",
"0.63796216",
"0.6377261",
"0.6377261",
"0.63720435",
"0.6368909",
"0.63683003",
"0.6362243",
"0.6330423",
"0.63027585",
"0.6293185",
"0.6258893"
]
| 0.8595329 | 0 |
Picks the right processor if it isn't set and returns whether it's mogrify or not. === Returns [Boolean] | def mogrify?
choose_processor if processor.nil?
return processor.to_s.downcase.to_sym == :mogrify unless processor.nil?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gm?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :gm unless processor.nil?\n false\n end",
"def choose_processor\n self.processor = if MiniMagick::Utilities.which('mogrify')\n :mogrify\n elsif MiniMagick::Utilities.which('gm')\n :gm\n else\n nil\n end\n end",
"def processor\n return @options[:processor]\n end",
"def explicit_map_processor?\n settings[:mapper]\n end",
"def hault_processing\n if self.processing?\n true\n else\n false\n end\n end",
"def compute_on_promotion?\n @compute_on_promotion ||= calculable.respond_to?(:promotion)\n end",
"def register(processor)\n return false if @processors.include? processor\n @processors[processor] = true\n end",
"def is_processed_image? picture\n model.class.to_s.underscore == \"pimage\"\n end",
"def is_processable?\n if @is_processable.nil?\n if mposts.empty?\n @is_processable = true\n else\n first_user = mposts.first.user_id\n @is_processable =\n mposts.any? {|mpost| mpost.is_cirkle_hoster?} ||\n mposts.any? {|mpost| mpost.user_id != first_user} || # more than one member\n !master_mpost.device_devs.any? {|dev| first_user != Mpost.user_id_from_dev(dev)} # at most one member\n end\n end\n return @is_processable\n end",
"def using_cpu?\n return @status[ 'CPU' ][ 'Active' ]\n end",
"def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end",
"def machine?\n machine_flag != '0'\n end",
"def get_processor; end",
"def supports_cooler(cooler)\n return cooler.supports_cpu(self)\n end",
"def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end",
"def is_plex?(); @type == GRT_PLEX; end",
"def apply_post_processing?\n if self.has_default_image?\n return false\n else\n return true\n end\n end",
"def receive_plates_process?(params)\n @receive_plates_process ||=\n InstrumentProcess.find_by(id: params[:instrument_process]).key.eql?(\"slf_receive_plates\")\n end",
"def pre_processed?\n @pre_processed ||=\n (options[:pre_processed] || (default_val && !default_val.is_a?(::Proc)))\n end",
"def processings?\n @processings.any?\n end",
"def fetch(processor_name)\n idx = processors.index {|processor| processor.name.equal?(processor_name)}\n idx or raise(UnknownProcessor.new(processor_name))\n end",
"def _if_process(value)\n if check_type.to_s.downcase == 'process'\n value\n else\n nil\n end\n end",
"def explicit_mapper?\n explicit_map_processor? || explicit_map_command?\n end",
"def run?\n return false unless @process\n return true\n end",
"def apply_post_processing?\n if self.is_video?\n return true\n elsif self.is_image?\n if self.is_seed\n return true\n end \n else \n return false \n end\n end",
"def physical_device?\n arches.any? do |arch|\n arch[/arm/, 0]\n end\n end",
"def optimizable?(path)\n !!workers_for_image(path)\n end",
"def optimizable?(path)\n !!workers_for_image(path)\n end",
"def needs_promotion?\n !!@promotion_coords\n end",
"def processing_instruction?\n type == PI_NODE\n end"
]
| [
"0.7781849",
"0.74955004",
"0.63985616",
"0.62639934",
"0.61793256",
"0.59958065",
"0.5983024",
"0.58769286",
"0.58340687",
"0.5832451",
"0.5798496",
"0.57964385",
"0.5730911",
"0.56767637",
"0.56473035",
"0.56198865",
"0.5616269",
"0.5589491",
"0.5588428",
"0.55843437",
"0.55805427",
"0.55682117",
"0.55526984",
"0.5541162",
"0.5532534",
"0.55214924",
"0.5516186",
"0.5516186",
"0.5489174",
"0.54755497"
]
| 0.8571836 | 0 |
Picks the right processor if it isn't set and returns whether it's graphicsmagick or not. === Returns [Boolean] | def gm?
choose_processor if processor.nil?
return processor.to_s.downcase.to_sym == :gm unless processor.nil?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_processor\n self.processor = if MiniMagick::Utilities.which('mogrify')\n :mogrify\n elsif MiniMagick::Utilities.which('gm')\n :gm\n else\n nil\n end\n end",
"def mogrify?\n choose_processor if processor.nil?\n\n return processor.to_s.downcase.to_sym == :mogrify unless processor.nil?\n false\n end",
"def graphic_instance?\n has_gpu = `lspci | grep -i -o 'NVIDIA'`\n is_graphic_instance = !has_gpu.strip.empty?\n\n is_graphic_instance\nend",
"def graphicsmagick?; end",
"def is_processed_image? picture\n model.class.to_s.underscore == \"pimage\"\n end",
"def default_processor_type\n :image_magick\n end",
"def using_cpu?\n return @status[ 'CPU' ][ 'Active' ]\n end",
"def can_render_images_on?\n self.ppi && self.resolution_x && self.resolution_y\n end",
"def valid_version_installed?\n image_magick_version >= minimum_image_magick_version\n end",
"def image_work?\n true\n end",
"def apply_post_processing?\n if self.has_default_image?\n return false\n else\n return true\n end\n end",
"def processor\n return @options[:processor]\n end",
"def can_use_png?\n return browser_version.to_i >= 7 if browser_name== 'ie'\n true\n end",
"def imagemagick7?; end",
"def imagemagick?; end",
"def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end",
"def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end",
"def processing_instruction?\n type == PI_NODE\n end",
"def image_processing?\n !image_tmp.blank?\n end",
"def running_on_shitty_gpu?\n return @shitty_gpu\n end",
"def groff_available?\n require 'rbconfig'\n\n if RbConfig::CONFIG[\"host_os\"] =~ /(msdos|mswin|djgpp|mingw)/\n `which groff 2>NUL`\n else\n `which groff 2>/dev/null`\n end\n\n $? == 0\n end",
"def explicit_map_processor?\n settings[:mapper]\n end",
"def assembly_drawing?\n self.eco_types.detect { |et| et.name == \"Assembly Drawing\" } != nil\n end",
"def raster_work?\n false\n end",
"def is_plex?(); @type == GRT_PLEX; end",
"def browser_supported_by_metamask?\n browser.chrome? || browser.firefox?\n end",
"def groff?\n system(\"which groff > /dev/null\")\n end",
"def rbx?\n engine == :rbx\n end",
"def fabrication_drawing?\n self.eco_types.detect { |et| et.name == \"Fabrication Drawing\" } != nil\n end",
"def markup_processor_for?(editor)\n \"Refinery::Blog::PostProcessor::#{editor.camelize}\".constantize.kind_of?(Class)\n rescue\n false\n end"
]
| [
"0.7287053",
"0.725614",
"0.67848223",
"0.66996956",
"0.62745863",
"0.61968267",
"0.5919397",
"0.5857916",
"0.58336717",
"0.5826745",
"0.5820798",
"0.5733881",
"0.5703429",
"0.5697703",
"0.56916964",
"0.5678483",
"0.5641339",
"0.5613499",
"0.56020576",
"0.5601356",
"0.5584178",
"0.55724025",
"0.5567718",
"0.55567807",
"0.54649",
"0.5461176",
"0.5451185",
"0.54276586",
"0.54268265",
"0.5420836"
]
| 0.7643658 | 0 |
Returns a Project object identified by given string The following identifiers are accepted /gdc/md/ /gdc/projects/ | def [](id, options = {})
return id if id.respond_to?(:project?) && id.project?
if id == :all
Project.all
else
if id.to_s !~ %r{^(\/gdc\/(projects|md)\/)?[a-zA-Z\d]+$}
fail(ArgumentError, 'wrong type of argument. Should be either project ID or path')
end
id = id.match(/[a-zA-Z\d]+$/)[0] if id =~ /\//
response = GoodData.get PROJECT_PATH % id
Project.new response
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](id)\n return id if id.respond_to?(:is_project?) && id.is_project?\n if id == :all\n Project.all\n else\n if id.to_s !~ /^(\\/gdc\\/(projects|md)\\/)?[a-zA-Z\\d]+$/\n raise ArgumentError.new('wrong type of argument. Should be either project ID or path')\n end\n\n id = id.match(/[a-zA-Z\\d]+$/)[0] if id =~ /\\//\n\n response = GoodData.get PROJECT_PATH % id\n Project.new response\n end\n end",
"def find_project\n identifier = params[:project_id]\n scope = Project.active.has_module(:repository)\n project = scope.find_by_identifier(identifier.downcase)\n raise ActiveRecord::RecordNotFound unless project\n return project\n end",
"def find_by_id(id)\n hash = Backlogjp.base._command \"getProject\", id\n\n Project.new(hash) unless hash.empty?\n end",
"def get_project_by_id(id)\n require_relative 'telerivet/project'\n Project.new(self, self.do_request(\"GET\", get_base_api_path() + \"/projects/#{id}\"))\n end",
"def project_by_name(project_name)\n projects.find { |project| project['name'].casecmp(project_name) == 0 }\n end",
"def find_project\n identifier = get_project_identifier\n project = Project.find_by_identifier(identifier.downcase)\n raise ActiveRecord::RecordNotFound, \"No project found with identifier '#{identifier}'\" if project.nil?\n return project\n end",
"def project(id)\n self.projects(\"all\").detect { |p| p.id == id }\n end",
"def gcloud_project_id\n stdout = Open3.capture3(\"gcloud config list project\").first\n stdout.scan(/project = (.*)/).first.first\nend",
"def project(name)\n @projects.find { |p| p.name == name }\n end",
"def get_project(id)\n project = new(get(\"/rest/api/2/project/#{id}\"))\n @@project_cache[project.name] = project\n @@project_cache[project.id] = project\n @@project_cache[project.key] = project\n return project\n end",
"def project(id)\n @xml.search(\"object[@id='#{id}']\")\n end",
"def get_project_by_id_or_name(id_or_name)\n rtn = nil\n if fpermit?('site_admin', nil) || current_user().has_role?('project_reviewer') then\n in_used_projects = \"\"\n else\n in_used_projects = \"(#{Project.in_used_projects()} or #{Project.pending_projects()})\" #include pending projects for pending status.\n end\n\n case id_or_name\n when /^\\d+$/\n rtn = Project.find_by_id(id_or_name, :conditions => in_used_projects)\n when Project::NAME_REGEX\n in_used_projects = \" and #{in_used_projects}\" if(in_used_projects != \"\")\n if rtn = Project.in_used.find(:first, :select => 'id', :conditions => [\"name = ? #{in_used_projects}\", id_or_name])\n yield rtn.id\n return\n end\n end\n\n if not rtn or (rtn.status == Project::STATUS[:PENDING] and in_used_projects != \"\" and (rtn.creator != current_user().id or controller_name != 'projects' or (action_name != 'edit' and action_name != 'update'))) #project not ready. pending and not allow actions.\n flash[:warning] = \"Project '#{id_or_name}' does not exist, or it has be deactivated.\"\n redirect_to root_path\n elsif in_used_projects == \"\" and rtn.status != Project::STATUS[:READY] #admin & reviewer messages\n flash.now[:warning] = \"Project is not READY. Status is #{Project.status_to_s(rtn.status)}.\"\n end\n rtn\n end",
"def getProjectByID(id)\n ret = nil \n @Projects.each do |project| \n ret = project if project.ID == id \n end \n\n return ret \n end",
"def find_project\n identifier = get_identifier\n project = Project.find_by_identifier(identifier.downcase)\n fail(\n ActiveRecord::RecordNotFound,\n \"No project found with identifier '#{identifier}'\"\n ) if project.nil?\n project\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def init_project_by_id(id)\n require_relative 'telerivet/project'\n return Project.new(self, {'id' => id}, false)\n end",
"def find_project_by_project_name(project_name)\n row = @db.get_first_row('select * from projects where project_name = ?', project_name)\n return {\n id: row[0],\n project_name: row[1],\n target_dollar_amount: row[2]\n }\n end",
"def project(options = {})\n raise Unfuddled::Error.new(\"No options given for project, cannot query\") if options == {}\n \n raise Unfuddled::Error.new(\"Can only supply one of :id and :name\") if options.keys.include?([:id , :name])\n \n url = \"/api/v1/projects/#{options[:id]}.json\" if options.keys.include?(:id)\n url = \"/api/v1/projects/by_short_name/#{options[:name]}.json\" if options.keys.include?(:name)\n\n Unfuddled::Project.from_response( send(:get , url)[:body] , self)\n end",
"def find(project_id)\n raw_response = get_request(\"projects/#{project_id}\")\n parse_response(raw_response, :project)\n end",
"def find(project_id)\n raw_response = get_request(\"projects/#{project_id}\")\n parse_response(raw_response, :project)\n end",
"def project(*names)\n new(names.map { |name| name.is_a?(Symbol) ? self[name] : name })\n end",
"def project(project_id, params = {})\n make_get_request(\"/projects/#{project_id}\", params)\n end",
"def project_from_github(input)\n Github::ProjectMapper\n .new(Api.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end",
"def project_from_github(input)\n Github::ProjectMapper\n .new(App.config.GITHUB_TOKEN)\n .find(input[:owner_name], input[:project_name])\n rescue StandardError\n raise GH_NOT_FOUND_MSG\n end",
"def getProject(project)\r\n\t\t\t\tproject_json = JSON.parse project\r\n\t\t\t\tproject_array = project_json[\"projects\"]\r\n\t\t\t\treturn jsonToProject(project_array[0])\r\n\t\t\tend",
"def get_project (project_name)\n\t\tproject = Project.find_by_name(project_name)\n\t\tif project\n\t\t\tif (project.accessibility == 1 or (user_signed_in? and project.user == current_user))\n\t\t\t\treturn project, nil\n\t\t\telse\n\t\t\t\treturn nil, I18n.t('controllers.application.get_project.private', :project_name => project_name)\n\t\t\tend\n\t\telse\n\t\t\treturn nil, I18n.t('controllers.application.get_project.not_exist', :project_name => project_name)\n\t\tend\n\tend",
"def get_project_identifier\n identifier = params[:project_id] || params[:repository_name]\n raise ActiveRecord::RecordNotFound, 'Project identifier not specified' if identifier.nil?\n return identifier\n end",
"def find_project(name)\n login unless authenticated?\n response = RestClient.get(resource_url(\"projects/#{URI.escape(name)}\"), :cookies => @cookies)\n project = JSON.parse response.body\n return project['name'] == name ? project : nil\n rescue RestClient::ResourceNotFound\n return nil\n end",
"def find_project\n @project = Project.find_by_identifier(params[:id])\n rescue ActiveRecord::RecordNotFound\n end"
]
| [
"0.714441",
"0.63858455",
"0.63714254",
"0.63254607",
"0.625838",
"0.6231655",
"0.62274665",
"0.61855274",
"0.6158891",
"0.61544067",
"0.61487347",
"0.6116764",
"0.6111021",
"0.60941035",
"0.5968301",
"0.5968301",
"0.5963218",
"0.5962752",
"0.5957147",
"0.5939222",
"0.5939222",
"0.5919172",
"0.5906086",
"0.58709466",
"0.5823015",
"0.5811421",
"0.5806732",
"0.58057356",
"0.58020157",
"0.5777324"
]
| 0.6904942 | 1 |
Gets author of project | def author
# TODO: Return object instead
@json['project']['meta']['author']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_author()\n return @author\n end",
"def extract_author_name\n `git config user.name`.strip\n end",
"def get_author()\n @author\n end",
"def\n get_author()\n @author\n end",
"def author\n @author ||= begin\n UnfuddleAPI::People.find(self[:author_id]).username\n rescue\n ''\n end\n end",
"def author\n file.version.author.name\n end",
"def author\n page.version.author.name\n end",
"def author\n @info[:Author]\n end",
"def author\n @author ||= get_author\n end",
"def author\n @author\n end",
"def get_owner\n return self.project.get_owner\n end",
"def author\n object.user\n end",
"def author\n user\n end",
"def author\n @title_pages.each { |tp| tp.author and return tp.author }\n nil\n end",
"def author\n return User.find(self.user_id).user_name\n end",
"def author\n props[ AUTHOR_PROP_NAME ] if props\n end",
"def inner_author\n @commit.author\n end",
"def get_author\n\t\t# TODO\n\t\tauthor_id\n\tend",
"def get_author\n\t\treturn Account.find(self.account_id)\n\tend",
"def author\n \"#{user.name} (#{user.login})\"\n end",
"def author; User.get(self.author_id); end",
"def author\n\t\t@author\n\tend",
"def getAuthorName\n\t\treturn User.find(self.user_id).username\n\tend",
"def author\n authors.first\n end",
"def author\n authors.first\n end",
"def author_name\n h Settings.author_name\n end",
"def get_author\n \tUser.find(author_id)\n \tend",
"def author\n ['@',self.user.id, self.user.name.split().join].join('-')\n end",
"def author\n [author_developer.name_and_email, author_date, author_date_gmt_offset]\n end",
"def author\n @author ||= begin\n name = grit.config['user.name']\n email = grit.config['user.email']\n Grit::Actor.new(name, email)\n end\n end"
]
| [
"0.75654566",
"0.75434136",
"0.7531482",
"0.7456287",
"0.73964405",
"0.73358434",
"0.7323249",
"0.7306709",
"0.730264",
"0.72318107",
"0.7229581",
"0.72145975",
"0.71947294",
"0.71786714",
"0.71773136",
"0.71660554",
"0.715834",
"0.7139117",
"0.7107673",
"0.71068704",
"0.7090865",
"0.7053602",
"0.70236784",
"0.69800174",
"0.69800174",
"0.6970785",
"0.69593316",
"0.6955887",
"0.69542235",
"0.69484186"
]
| 0.81335694 | 0 |
Gets ruby wrapped raw project JSON data | def data
raw_data['project']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json\n if project.source_exists?\n JSON.parse(File.read(project.project_path))\n else\n []\n end\n end",
"def getProject(projectName)\n data = CLIENT.repository(projectName)\n return data\nend",
"def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, :accept => 'application/vnd.github.inertia-preview+json', :'Authorization' => 'token ' + CONFIG['OAUTH']\n result = JSON.parse(result) \n end",
"def getProject(project)\r\n\t\t\t\tproject_json = JSON.parse project\r\n\t\t\t\tproject_array = project_json[\"projects\"]\r\n\t\t\t\treturn jsonToProject(project_array[0])\r\n\t\t\tend",
"def project_json(options)\n {\n project: {\n name: options[:name],\n description: options[:description],\n passphrase: options[:passphrase],\n key: options[:key],\n organization: options[:organization]\n }\n }.to_json\n end",
"def project(project_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end",
"def get_project(project_id)\n http = Net::HTTP.new(@city_db_url, @port)\n http.read_timeout = 1000\n if @city_db_is_https\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n request = Net::HTTP::Get.new(\"/projects/#{project_id}.json\")\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.basic_auth(ENV['URBANOPT_USERNAME'], ENV['URBANOPT_PASSWORD'])\n\n response = http.request(request)\n if response.code != '200' # success\n @runner.registerError(\"Bad response #{response.code}\")\n @runner.registerError(response.body)\n @result = false\n return {}\n end\n\n result = JSON.parse(response.body, symbolize_names: true)\n return result\n end",
"def to_projjson_as_hash\n json = to_projjson\n if json\n return JSON.parse(json)\n else\n return nil\n end \n end",
"def listProjects \n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/1/projects')\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {\n 'Content-Type'=> 'application/json',\n 'X-RunDeck-Auth-Token'=> API_KEY \n}\n r = http.get(uri.path, headers)\n return r.body.force_encoding(\"UTF-8\")\n\nend",
"def project\n raw = client.get project_url\n client.factory.create(GoodData::Project, raw)\n end",
"def details\n get(\"project/details\")[\"project\"]\n end",
"def project_info(project_key)\n request = ServiceHelper.new base_url: @jira_url, path: \"rest/api/3/project\"\n request.auth 'basic', @jira_user, @jira_token\n request.headers.add 'Accept', 'application/json'\n request.append_to_route project_key\n response = request.get\n raise Exception, response.body unless response.ok?\n\n response.parsed_body\n end",
"def get_json\n return JSON(@asset_repo.get_json(@pid.gsub(\"druid:\", \"\")))\n rescue => e\n return nil\n end",
"def data\n data = @repo.working_read(@path) rescue nil\n data\n end",
"def to_project\n { project: { uuid: project_id,\n name: project['project_name'],\n client: project['client_name']\n } }\n end",
"def raw_json\n @raw_json ||= @content.gsub(/---(.|\\n)*---/, '')\n end",
"def build_project\n @id ||= @project.at('id').inner_html\n @api_url ||= \"#{CONFIG[:api_location]}/projects/#{@id}\"\n @url ||= \"http://www.pivotaltracker.com/projects/#{@id}\"\n @name = @project.at('name').inner_html\n @iteration_length = @project.at('iteration_length').inner_html\n @week_start_day = @project.at('week_start_day').inner_html\n @point_scale = @project.at('point_scale').inner_html.split(',')\n end",
"def to_json_raw_object()\n #This is a stub, used for indexing\n end",
"def project\n return forbidden unless current_account and params[:id] and (request.format.json? || request.format.js? || request.format.text?)\n project = Project.accessible(current_account).find(params[:id].to_i)\n return not_found unless project\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'project' => project.canonical(opts)}\n render_cross_origin_json\n end",
"def project\n self.format.try(:project)\n end",
"def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end",
"def getActualJsonObject()\n return $jsonObjectMain\nend",
"def get(project_name)\n response = get_request(\"/projects/#{project_name}/\")\n TheShiningSource::Project.new(response)\n end",
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def project\n request :project\n end",
"def project\n @project ||= Attask::API::Project.new(@credentials)\n end",
"def project\n service.project\n end",
"def build_project\n @id ||= @project.at('id').inner_html\n @api_url ||= \"#{CONFIG[:api_url]}projects/#{@id}\"\n @url ||= \"http://www.pivotaltracker.com/projects/#{@id}\"\n @name = @project.at('name').inner_html\n @iteration_length = @project.at('iteration_length').inner_html\n @week_start_day = @project.at('week_start_day').inner_html\n @point_scale = @project.at('point_scale').inner_html.split(',')\n end",
"def show\n render json: @project\n end",
"def fetch_json\n res = open(\"http://www.cleanairmakemore.com/widget_json.cfm\").read\n\n # Documented in views/burn/phx/data.json.\n s = res.index(\"facts\")\n json = res[0, s-4] + \"}\"\n\n # json = File.read(\"views/burn/phx/data.json\")\n json\n end"
]
| [
"0.70782727",
"0.6797672",
"0.6551246",
"0.6530466",
"0.6362855",
"0.6343553",
"0.6287911",
"0.6110015",
"0.60831463",
"0.6057243",
"0.60512817",
"0.6028828",
"0.60168654",
"0.5995319",
"0.5976462",
"0.59062135",
"0.58701104",
"0.5859514",
"0.5852959",
"0.58440536",
"0.5810694",
"0.58068496",
"0.57910264",
"0.57820934",
"0.57671154",
"0.57658404",
"0.57619077",
"0.57517743",
"0.5751265",
"0.5750872"
]
| 0.78173083 | 0 |
Deletes dashboards for project | def delete_dashboards
Dashboard.all.map { |data| Dashboard[data['link']] }.each { |d| d.delete }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n conf.delete 'dashboard'\n end",
"def destroy\n @dashboard_project.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_dashboard(dash_id)\n @dash_service.delete_dashboard(dash_id)\n end",
"def delete_dashboard( name )\n\n raise ArgumentError.new(format('wrong type. \\'name\\' must be an String, given \\'%s\\'', name.class.to_s)) unless( name.is_a?(String) )\n raise ArgumentError.new('missing name') if( name.size.zero? )\n\n endpoint = format( '/api/dashboards/db/%s', slug(name) )\n\n @logger.debug(\"Deleting dashboard #{slug(name)} (DELETE #{endpoint})\") if @debug\n\n delete(endpoint)\n end",
"def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end",
"def delete_board(dashboard_id)\n @dashboard_service.delete_board(dashboard_id)\n end",
"def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to(dashboards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_dashboard.destroy\n respond_to do |format|\n format.html { redirect_to admin_dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.dataset.all.each(&:delete)\n\n measurements.each do |measurement_name|\n table = Plugin.where(name: measurement_name).first.storage_table\n Iam.settings.DB[table.to_sym].delete\n end\n end\n Iam.settings.DB[:projects].delete\n Iam.settings.DB[:clients].delete\n end",
"def destroy\n if params[:id].to_i == session[:dashboard_id].to_i\n flash[:warning] = \"Unable to remove active dashboard (try switching)\"\n redirect_to(\"/dashboards\")\n return\n else\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n end\n respond_to do |format|\n format.html { redirect_to(dashboards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project.destroy\n @projects = Project.all\n render :index\n end",
"def destroy\n @data_dashboard.destroy\n respond_to do |format|\n format.html { redirect_to data_dashboards_url, notice: 'Data dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_public_dashboard(token, opts = {})\n data, _status_code, _headers = delete_public_dashboard_with_http_info(token, opts)\n data\n end",
"def delete(projects)\n project_ids = projects.collect { |project| project.id } \n args = {ids: project_ids.to_json}\n return @client.api_helper.command(args, \"project_delete\")\n end",
"def destroy\n @company_dashboard = CompanyDashboard.find(params[:id])\n @company_dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to(company_dashboards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @board_in_project.destroy\n respond_to do |format|\n format.html { redirect_to board_in_projects_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project.destroy\n end",
"def destroy\n @project_master.destroy\n @project_masters = ProjectMaster.all\n end",
"def destroy\n @project.destroy_all\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'The project was successfully removed.' }\n format.json { head :no_content }\n end\n end"
]
| [
"0.69312346",
"0.6843769",
"0.6836013",
"0.67823917",
"0.673084",
"0.6690916",
"0.6652889",
"0.66266125",
"0.661454",
"0.6568845",
"0.65664697",
"0.65664697",
"0.65664697",
"0.65664697",
"0.65664697",
"0.6409158",
"0.6402482",
"0.63316554",
"0.6320223",
"0.61900336",
"0.61697775",
"0.6108211",
"0.61051613",
"0.6096487",
"0.6096487",
"0.6096487",
"0.6096487",
"0.6096487",
"0.60872626",
"0.60762364"
]
| 0.80604047 | 0 |
Gets project role byt its summary | def get_role_by_summary(role_summary, role_list = roles)
role_list.each do |role|
return role if role.summary.downcase == role_summary.downcase
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_role user\n project_role_user = ProjectRoleUser.where(:project_id => self, :user_id => user).first\n if project_role_user\n project_role_user.role.name\n else\n nil\n end\n end",
"def display_role\n ROLE_LIST[self.role]\n end",
"def getProjectActorByRole\n if @role.nil? and !current_actor.superadmin\n json_response({ message: \"You don't have permission to view roles for this project\" }, :unauthorized)\n return\n end\n r = @project.roles.find(params[\"role_id\"])\n json_response(Actor.find(r.actor_id))\n end",
"def role\n @role\n end",
"def role\n return @role\n end",
"def get_role\n\t\tself.role\n\tend",
"def people_with_the_role(role)\n Seek::Roles::ProjectRelatedRoles.instance.people_with_project_and_role(self, role)\n end",
"def people_with_the_role(role)\n Seek::Roles::ProjectRelatedRoles.instance.people_with_project_and_role(self, role)\n end",
"def role_for_project(project)\n # No role on archived projects\n return nil unless project && project.active?\n if logged?\n # Find project membership\n membership = memberships.detect {|m| m.project_id == project.id}\n if membership\n membership.role\n else\n @role_non_member ||= Role.non_member\n end\n else\n @role_anonymous ||= Role.anonymous\n end\n end",
"def description_for(role)\n role_descriptions[role]\n end",
"def get_role(role_name)\n self.class.get_role(role_name)\n end",
"def get_full_role\n\t\tif role == \"lead\"\n\t\t\treturn \"Project Lead\"\n\t\telsif role == \"editor\"\n\t\t\treturn \"editor\"\n\t\tend\n\tend",
"def people_with_the_role role\n mask = Person.mask_for_role(role)\n AdminDefinedRoleProject.where(role_mask: mask,project_id: self.id).collect{|r| r.person}\n end",
"def roles\n url = \"/gdc/projects/#{pid}/roles\"\n tmp = GoodData.get(url)\n tmp['projectRoles']['roles'].map do |role_url|\n json = GoodData.get role_url\n GoodData::ProjectRole.new(json)\n end\n end",
"def role\r\n r = read_attribute(:role)\r\n r.capitalize unless r.nil?\r\n end",
"def role; end",
"def role; end",
"def get_project_roles(pid)\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n query = \"/gdc/projects/#{pid}/roles\"\n\n response = RestClient.get \"#{@api_endpoint}/proxy?writerId=#{@writer_id}&query=#{query}\", headers\n\n # parse key values for specific project roles\n\n return response\n\n end",
"def role_name\r\n Role.find(object.role_id).role_name\r\n end",
"def role_name\n object.role_name\n end",
"def projects_by_role\n return @projects_by_role if @projects_by_role\n\n @projects_by_role = Hash.new { |h, k| h[k]=[] }\n memberships.each do |membership|\n membership.roles.each do |role|\n @projects_by_role[role] << membership.project if membership.project\n end\n end\n @projects_by_role.each do |role, projects|\n projects.uniq!\n end\n\n @projects_by_role\n end",
"def get_role_info()\n make_call(NO_TIMEOUT, ABORT_ON_FAIL) { \n @conn.get_role_info(@secret) \n }\n end",
"def find_role(name)\n self.roles.find {|a| a.name == name}\n end",
"def index\n @project_roles = ProjectRole.all\n end",
"def index\n @project_roles = ProjectRole.all\n end",
"def user_role\n USER_ROLE[role]\n end",
"def show\n @project = Project.find(params[:id])\n @user_type = @project.roles.where(:user_id => session[:id]).first.name\n \n @stats = @project.get_stats\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def get_full_role\n if role == \"admin\"\n return \"Administrator\"\n elsif role == \"lead\"\n return \"Organization Lead\"\n end\n end",
"def get_role(the_role)\n self.roles.where(user_id:self.id,roleable_type:the_role).first\n end",
"def user_role\n UserRole.find_by(approval_group_id: cart.approval_group.id, user_id: user_id)\n end"
]
| [
"0.69252276",
"0.65983015",
"0.65933084",
"0.6576181",
"0.64411587",
"0.64147127",
"0.6348822",
"0.6348822",
"0.6281939",
"0.62592596",
"0.6209841",
"0.62093836",
"0.6200686",
"0.6200608",
"0.61546564",
"0.61338323",
"0.61338323",
"0.61308676",
"0.61137",
"0.61130714",
"0.610458",
"0.6057126",
"0.602809",
"0.6024924",
"0.6024924",
"0.60068834",
"0.5994229",
"0.59840816",
"0.5972679",
"0.5970985"
]
| 0.6995733 | 0 |
Returns invitations to project | def invitations
res = []
tmp = GoodData.get @json['project']['links']['invitations']
tmp['invitations'].each do |invitation|
res << GoodData::Invitation.new(invitation)
end
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invitations\n @invitations = Invitation.pending_by_user(current_user.id)\n\n respond_to do |format|\n format.html\n end\n end",
"def invitations\n\t\t@invits = current_user.receive_invites.order(\"id DESC\")\n\tend",
"def invitations()\n return MicrosoftGraph::Invitations::InvitationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def view_invitations\n @invitations = Invitation.all(:conditions => ['status = ?', 'pending'])\n end",
"def index\n @invitations = Invitation.where(organization_id: current_user.organization_id).all\n end",
"def index\n @invitations = Invitation.all\n end",
"def index\n @invitations = Invitation.all\n end",
"def index\n @invitations = Invitation.all\n end",
"def index\n @invitations = Invitation.where(receiver_id: current_user.id)\n end",
"def index\n # @invitations = Invitation.all\n end",
"def invites\n raise 'Tried to request invites from a non-server channel' unless server\n\n invites = JSON.parse(API::Channel.invites(@bot.token, @id))\n invites.map { |invite_data| Invite.new(invite_data, @bot) }\n end",
"def find_project_invitations(project_id, opts = {})\n data, _status_code, _headers = find_project_invitations_with_http_info(project_id, opts)\n data\n end",
"def index\n @pending_invitations = @organization.invitations.pending\n @declined_invitations = @organization.invitations.declined\n @contributors = @organization.contributors\n @invitation = Invitation.new(organization: @organization)\n\n authorize! @invitation\n end",
"def group_invites\n @invites = GroupsController.group_invites current_user\n end",
"def index\n @user_invitations = UserInvitation.all\n end",
"def update_invitations\n # user: nil is here to make sure invitations are linked only once\n invitations << Invitation.where(token: invitation_token, user: nil)\n end",
"def get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"userInvitations\", params)\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n @invites = Invite.all\n end",
"def index\n invitations = Invitation.where('email = ? AND status = ?', @current_user.email, 'pending')\n invitations_array = []\n\n invitations.each do |inv|\n user = User.find(inv.from_user)\n user_hash = { :id => @current_user.id, :email => user.email, :first_name => user.user_info.first_name, :last_name => user.user_info.last_name }\n\n project = Project.find(inv.project_id)\n project_hash = { :id => project.id , :project_title => project.title, :project_profile => inv.project_profile_id }\n\n invitations_array << { :id => inv.id, :user => user_hash, :project => project_hash, :date => \"#{l inv.created_at, format: :long}\" }\n end\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render json: invitations_array }\n end\n end",
"def getInvited\n rsvpInvited = []\n Invitation.where(\"study_session_id = '#{self.id}' AND status = 'invited'\").each do |invitation|\n rsvpInvited.push(User.where(\"id = '#{invitation.user_id}'\").first)\n end\n return rsvpInvited\n end",
"def index\n @inviteds = Invited.all\n end",
"def new_invites\n self.invites.all(:hide => false)\n end",
"def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end",
"def load_invitations\n @invitations ||= begin\n ids = resend_invitation_params\n ids ||= current_course.invitations.unconfirmed.select(:id)\n if ids.blank?\n []\n else\n current_course.invitations.unconfirmed.where('course_user_invitations.id IN (?)', ids)\n end\n end\n end",
"def invite\n @member = Member.new\n @projects = current_member.projects.where(admin_id: current_member.id)\n # Find all members that current member has invited.\n # Only show members that belongs to project that current_member\n # is admin for\n @members = []\n @projects.each do |p|\n if p.admin_id == current_member.id\n p.members.each do |m|\n @members << m\n end\n end\n end\n @members.uniq!\n end",
"def show\n @invites = Invite.all\n end"
]
| [
"0.76814204",
"0.7535096",
"0.73966706",
"0.7234537",
"0.71821076",
"0.70033073",
"0.70033073",
"0.70033073",
"0.6896788",
"0.68899786",
"0.68819606",
"0.6843941",
"0.68025196",
"0.6798536",
"0.67652124",
"0.67607087",
"0.67198896",
"0.66972095",
"0.66972095",
"0.66972095",
"0.66972095",
"0.66972095",
"0.668577",
"0.6672987",
"0.6672287",
"0.6667845",
"0.66553944",
"0.66553944",
"0.66206676",
"0.6597723"
]
| 0.8202656 | 0 |
Checks if this object instance is project | def project?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_for_project?\n not self.project.nil?\n end",
"def project?\n ! @project.nil?\n end",
"def project?; @is_project || false; end",
"def has_project?\n !project_id.nil? && project.visible\n end",
"def project?(p)\r\n projects.include?(p)\r\n end",
"def belongs_to_project?(project)\n (source_type == \"project\") &&\n (project_id == project.id)\n end",
"def package_project_valid?\n Project.first(:code => metadata[\"dmd-project\"], :account => {:code => metadata[\"dmd-account\"]}) != nil\n end",
"def has_project?(name)\n available_projects.has_key?(name)\n end",
"def project?(spec)\n spec.team == Settings.project_root\n end",
"def owner?(project)\n if id == project.user.id\n true\n else\n false\n end\n end",
"def project_model?(name)\n return Rake::application[name].respond_to?('project_model')\n end",
"def project_exists?(name)\n projects.include?(name)\n end",
"def valid?\n begin\n PROJECT_API.find(:first).nil?\n true\n rescue\n false\n end\n end",
"def accessible?\n admin? || owner? || @project.is_open_source?\n end",
"def member_of?(project)\n role_for_project(project).member?\n end",
"def user_project_manager?\n user_logged_in? && current_user.type == 'ProjectManager'\n end",
"def needs_project_scoping?(data)\n repository_depth(data) == 1\n end",
"def project_allowed(project)\n Chef::Cache::KNOWN_PROJECTS.include? project\n end",
"def is_a_conditional_version_project?(project_name)\n @version_projects ||= group_conditional_custom_field.possible_values\n @version_projects.include?(project_name)\n end",
"def project_blueprint?\n true\n end",
"def member_of?(project)\n !roles_for_project(project).detect { |role| role.member? }.nil?\n end",
"def inside_project?\n project_found = false\n cwd = Pathname(Dir.pwd)\n home_directory = File.expand_path('~')\n cwd.ascend do |current_path|\n project_found = File.file?(\"#{current_path.to_s}/.bebox\")\n self.project_root = current_path.to_s if project_found\n break if project_found || (current_path.to_s == home_directory)\n end\n project_found\n end",
"def can_create_projects?\n Project.can_create?\n end",
"def wl_project_allocation?\r\n\t\t\t\treturn self.wl_project_allocation != nil\r\n\t\t\t\t#return true\r\n\t\t\tend",
"def ignore_project?(task)\n task == :taxonomy && project.option(:ref_project).nil?\n end",
"def validate\n needs :project unless skip_project_check?\n end",
"def isChildproject(childproject, parentproject)\r\n\t\tisChild = false\r\n\t\tif (childproject.id != parentproject.id)\r\n\t\t\tif (childproject.is_descendant_of?(parentproject))\r\n\t\t\t\tisChild = true\r\n\t\t\tend\r\n\t\tend\t\r\n\t\treturn isChild\r\n\tend",
"def newproject?\n session.new?\n end",
"def visible?(user=User.current)\n (project.nil? || user.allowed_to?(:view_invoices, project))\n end",
"def valid?\n !project_id.nil? && !credentials.nil?\n end"
]
| [
"0.85757875",
"0.81913626",
"0.7927502",
"0.7593589",
"0.7592387",
"0.75436443",
"0.72515917",
"0.7238059",
"0.70117134",
"0.68325853",
"0.6826295",
"0.680668",
"0.6783032",
"0.6719298",
"0.6627733",
"0.66117585",
"0.65926325",
"0.6570935",
"0.65682834",
"0.648983",
"0.6478952",
"0.6467289",
"0.6466536",
"0.6445855",
"0.6392428",
"0.63892174",
"0.63009596",
"0.628812",
"0.62342876",
"0.61699003"
]
| 0.8303266 | 1 |
Gets project update date | def updated
DateTime.parse(@json['project']['meta']['updated'])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_updated\n updated_at.strftime(\"%b %d, %Y\")\n end",
"def updated_for_repo(repo)\n repo.updated_at.iso8601\n end",
"def last_edited\n self.latest_update.to_date\n end",
"def last_edited\n\t\tself.latest_update.to_date\n\tend",
"def last_updated\n repo = Grit::Repo.init_bare_or_open(File.join(path , '.git'))\n repo.commits.first.commited_date\n end",
"def date\n updated_at.strftime(\"%d %b %y %H:%M\")\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def last_update_date_time\n return @last_update_date_time\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def reporthelp_updated_at( report )\n return apphelp_date( report.updated_at )\n end",
"def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end",
"def updated\n updated_at.utc.strftime(\"%F %T\") if updated_at\n end",
"def date\n data[\"date\"] ||= (draft? ? source_file_mtime : site.time)\n end",
"def version\n updated_at.to_i\n end",
"def version\n updated_at.to_i\n end",
"def date\n commit.date\n end",
"def updated_at\n dateChanged\n end",
"def updated_at\n @gapi[\"updated\"]\n end",
"def updated\n return @poco_data[:updated] unless @poco_data == nil\n upd = pick_first_node(@poco.xpath('./poco:updated'))\n if upd != nil\n DateTime.parse(upd)\n end\n end",
"def user_returned_date\n (updated_at).strftime(\"%d/%m/%Y\")\n end",
"def updated_at\n commit.committer_date rescue Time.now\n end",
"def last_updated\n time = self.updated_at\n if time < Time.now - (3600 * 24)\n time.strftime(\"%b %-d, %Y\")\n else\n time.strftime(\"%l:%M %p\")\n end\n end",
"def timestamp\n github_updated_at.iso8601\n end",
"def modified_date\n date_field('system_modified')\n end",
"def date\n page.version.authored_date.strftime(\"%B %d, %Y\")\n end",
"def submitted_at\n self.latest_version.created_at.strftime(\"%a. %-m/%-d, %Y\")\n end",
"def date\n file.version.authored_date.strftime(\"%B %d, %Y\")\n end"
]
| [
"0.7243601",
"0.7116965",
"0.7002887",
"0.688242",
"0.6768324",
"0.6752917",
"0.6735119",
"0.6735119",
"0.6735119",
"0.6735119",
"0.67088586",
"0.67088586",
"0.66656107",
"0.6634576",
"0.66023195",
"0.65239465",
"0.650722",
"0.650722",
"0.64935714",
"0.6489516",
"0.6485808",
"0.6469381",
"0.6445912",
"0.64316064",
"0.6420097",
"0.63912153",
"0.635365",
"0.6352427",
"0.6334594",
"0.632691"
]
| 0.73746365 | 0 |
Run validation on project Valid settins for validation are (default all): ldm Checks the consistency of LDM objects. pdm Checks LDM to PDM mapping consistency, also checks PDM reference integrity. metric_filter Checks metadata for inconsistent metric filters. invalid_objects Checks metadata for invalid/corrupted objects. asyncTask response | def validate(filters = %w(ldm, pdm, metric_filter, invalid_objects))
response = GoodData.post "#{GoodData.project.md['validate-project']}", 'validateProject' => filters
polling_link = response['asyncTask']['link']['poll']
polling_result = GoodData.get(polling_link)
while polling_result['wTaskStatus'] && polling_result['wTaskStatus']['status'] == 'RUNNING'
sleep(3)
polling_result = GoodData.get(polling_link)
end
polling_result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n needs :project unless skip_project_check?\n end",
"def validate_project\n\n # project name should be 10 to 30 length, and 5 words or fewer\n validate_length_words 'Project Name', self.project_name, 10, 30, 0, 5\n\n # vision should be 1 sentence\n validate_sentences_length 'Vision', self.vision, 30, 100, 1\n\n # goal should be 1 sentence\n validate_sentences_length 'Goal', self.goal, 30, 100, 1\n\n # description, and scope should be 5 sentences!\n validate_sentences_length 'Description', self.description, 100, 500, 5\n validate_sentences_length 'Scope', self.scope, 100, 500, 5\n\n # advice needed\n validate_sentences_length 'Advice Required', self.advice_required, 50, 200, 3\n\n # randomize program and train complaints!\n validate_random_day 'Program', self.program.name\n validate_random_day 'Train', self.train.name\n end",
"def validate\n needs :project\n end",
"def check_project\n return if project.dataset_names.empty?\n return unless project.done_preprocessing?(false)\n to_run = project.next_distances(true)\n to_run = project.next_inclade(true) if to_run.nil?\n queue_job(to_run) unless to_run.nil?\n end",
"def perform_validations\n error_count = 0\n Pkg::Params::VALIDATIONS.each do |v|\n variable_name = v[:var]\n variable_value = self.instance_variable_get(\"@#{v[:var]}\")\n validations = v[:validations]\n validations.each do |validation|\n unless Pkg::ConfigValidations.send(validation, variable_value)\n warn \"Warning: variable \\\"#{variable_name}\\\" failed validation \\\"#{validation}\\\"\"\n error_count += 1\n end\n end\n end\n\n if error_count != 0\n warn \"Warning: #{error_count} validation failure(s).\"\n end\n end",
"def validate\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Started')\n add_deprecation_headers_to_response(response:, link: ClaimsApi::EndpointDeprecation::V1_DEV_DOCS)\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Completed')\n render json: validation_success\n end",
"def validate\n unless TrueClass === @obsolete or FalseClass === @obsolete then\n raise RuntimeError.new( 'task validation failed: obsolete must be true or false ')\n end\n unless @id.is_a? Integer then\n raise RuntimeError.new( 'task validation failed: id must be an Integer' )\n end\n unless @role_id.is_a? Integer or @role_id.nil? then\n raise RuntimeError.new( 'task validation failed: role_id must be nil or an Integer' )\n end\n unless @label.is_a? String then\n raise RuntimeError.new( 'task validation failed: label must be a String' )\n end\n unless @inflows.is_a? Array then\n raise RuntimeError.new( 'task validation failed: incoming flows must be an Array' )\n else\n @inflows.each do |f|\n unless f.is_a? WorkFlowFlow\n raise RuntimeError.new( 'task validation failed: an incoming flow is not a WorkFlowFlow' )\n end\n end\n end\n unless @outflows.is_a? Array then\n raise RuntimeError.new( 'task validation failed: outgoing flows must be an Array' )\n else\n @outflows.each do |f|\n unless f.is_a? WorkFlowFlow\n raise RuntimeError.new( 'task validation failed: an outgoing flow is not a WorkFlowFlow' )\n end\n end\n end\n end",
"def perform\n validate_data_from_requests\n end",
"def run_validation(vmode)\n validate(vmode)\n self\n end",
"def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_manager_validation_hash_details\n return r unless r.success?\n\n r = create_secure_data_acccess_token\n return r unless r.success?\n\n r = send_mail\n return r unless r.success?\n\n success_with_data({manager_validation_hash_id: @manager_validation_hash[:id]})\n\n end\n\n end",
"def validate\n dataset_hash = {}\n property_hash = {}\n\n assets.each do |asset|\n datasets, properties = asset.prefetch_zfs\n\n datasets.each do |ds|\n dataset_hash[ds] = true\n end\n\n properties.each do |p|\n property_hash[p] = true\n end\n end\n\n propreader = OsCtl::Lib::Zfs::PropertyReader.new\n tree = propreader.read(\n dataset_hash.keys,\n property_hash.keys,\n recursive: false,\n ignore_error: true,\n )\n\n run = Run.new(tree)\n\n assets.each do |asset|\n asset.send(:run_validation, run)\n end\n\n assets\n end",
"def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end",
"def run\n runner = self\n @test_cases.each do |path|\n next if ENV['TEST_CASE'] && !File.basename(path).match(ENV['TEST_CASE'])\n\n Aws::ModelValidators.load_json(path).tap do |test_case|\n\n models = test_case.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }\n errors = models.delete(:errors)\n\n @group.it(File.basename(path[0..-6])) do\n pending unless errors\n results = described_class.new.validate(models, apply_schema: false)\n unless runner.results_match?(results, errors)\n expect(results).to eq(errors)\n end\n end\n\n end\n end\n end",
"def validate()\n validation_errors = []\n @expected_results.each_pair do |key,expected_result|\n result_key = expected_result[\"population_ids\"].dup\n\n reported_result, errors = extract_results_by_ids(expected_result['measure_id'], result_key)\n @reported_results[key] = reported_result\n validation_errors.concat match_calculation_results(expected_result,reported_result)\n end\n\n validation_errors\n end",
"def validate\n add_deprecation_headers_to_response(response: response, link: ClaimsApi::EndpointDeprecation::V0_DEV_DOCS)\n validate_json_schema\n render json: validation_success\n end",
"def validate\n raise RuntimeError.new( 'only terminated workflows can be validated' ) unless @terminated\n @validation_errors = 0\n puts\n puts \"Start Validation of WorkFlow '#{ label }\"\n validate_workflow\n validate_reachability\n puts \"Validation of WorkFlow '#{ label }' #{\n @validation_errors > 0 ? 'FAILED' : 'successfully completed' }.\"\n puts\n end",
"def validate_project\n if current_admin.present? || current_client.present?\n params[:project][:images_attributes] = {}\n @project = Project.new(params[:project])\n client = @project.client\n @json = Hash.new\n respond_to do |format|\n if @project.valid?\n @json[\"result\"] = \"true\"\n format.json { render json: @json }\n else\n @json[\"result\"] = \"false\"\n @json[\"errors\"] = @project.errors\n format.json { render json: @json }\n end\n end\n else\n @json[\"result\"] = \"false\"\n @json[\"errors\"] = \"You need to sign in first\"\n format.json { render json: @json }\n end \n end",
"def meta_validate\n desc 'Validates a directory of contract definitions'\n task :meta_validate, :dir do |_t, args|\n if args.to_a.size < 1\n fail Pacto::UI.yellow('USAGE: rake pacto:meta_validate[<contract_dir>]')\n end\n\n each_contract(args[:dir]) do |contract_file|\n fail unless Pacto.validate_contract contract_file\n end\n puts 'All contracts successfully meta-validated'\n end\n end",
"def validate(file, options = {})\n @options = options\n doc = get_document(file)\n # validate that each file in the zip contains a valid QRDA Cat I document.\n # We may in the future have to support looking in the contents of the test\n # patient records to match agaist QRDA Cat I documents\n\n @validators.each do |validator|\n as_warning = (['CqmValidators::QrdaQdmTemplateValidator'].include? validator.class.to_s) && !@test_has_c3 ? true : false\n add_cqm_validation_error_as_execution_error(validator.validate(doc, options),\n validator.class.to_s,\n :xml_validation,\n as_warning:)\n end\n # dont' validate measures for C1 Checklist or C3 Checklist\n validate_measures(doc) unless %w[C1ChecklistTask C3ChecklistTask].include? options.task._type\n nil\n end",
"def run_validations(context)\n __run_validations__(context)\n end",
"def run_validations\n true\n end",
"def validate!\n validate_redis\n validate_workers\n validate_options\n end",
"def valid?\n run_validations!\n true\n rescue InvalidTaskError => e\n false\n end",
"def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_manager_device\n return r unless r.success?\n\n r = create_device_verification_token\n return r unless r.success?\n\n r = send_device_verification_token\n return r unless r.success?\n\n success\n\n end\n\n end",
"def run_validations\n run_callbacks :validation do\n failed_validators.clear\n validation_chain.run(self)\n @validated = true\n end\n end",
"def check # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity\n no_errors = true\n no_warnings = true\n warn = lambda { |msg|\n @logger.warn(msg)\n no_warnings = false\n }\n error = lambda { |msg|\n @logger.error(msg)\n no_warnings = no_errors = false\n }\n\n @logger.info \"Checking profile in #{@path}\"\n @logger.info 'Metadata OK.' if @metadata.valid?\n\n no_warnings = true\n if @params[:rules].empty?\n warn.call('No controls or tests were defined.')\n else\n @logger.debug \"Found #{@params[:rules].length} rules.\"\n end\n\n # iterate over hash of groups\n @params[:rules].each do |group, rules_array|\n @logger.debug \"Verify all rules in #{group}\"\n rules_array.each do |id, rule|\n next if id.start_with? '(generated '\n error.call('Avoid rules with empty IDs') if id.nil? or id.empty?\n warn.call(\"Rule #{id} has no title\") if rule[:title].to_s.empty?\n warn.call(\"Rule #{id} has no description\") if rule[:desc].to_s.empty?\n warn.call(\"Rule #{id} has impact > 1.0\") if rule[:impact].to_f > 1.0\n warn.call(\"Rule #{id} has impact < 0.0\") if rule[:impact].to_f < 0.0\n warn.call(\"Rule #{id} has no tests defined\") if rule[:checks].nil? or rule[:checks].empty?\n end\n end\n\n @logger.info 'Rule definitions OK.' if no_warnings\n no_errors\n end",
"def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end",
"def validate\n errors.clear\n instance_exec(&validate_block) if validate_block && get\n end",
"def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end"
]
| [
"0.60966474",
"0.5920944",
"0.5883326",
"0.5790503",
"0.56967425",
"0.564787",
"0.56322885",
"0.56300765",
"0.55392665",
"0.55196273",
"0.54341996",
"0.5409193",
"0.54084873",
"0.5390367",
"0.5372635",
"0.5371687",
"0.5356898",
"0.5320983",
"0.5318901",
"0.52747625",
"0.52654225",
"0.5265015",
"0.5259702",
"0.5220598",
"0.5214314",
"0.5204835",
"0.518075",
"0.5179497",
"0.5142774",
"0.51420474"
]
| 0.7684566 | 0 |
retrieve market id get market id from Vendor classfile match up market id and vendor id provide a collection of all vendor instances associated with market by id | def vendors ##DON'T NEED TO PASS IN AN ARGUMENT JUST THE VALUE FROM THE ARGUMENT!!!!
# lookup every vendor that matches this market id
FarMar::Vendor.by_market(@id)
##OMG YAY, REMEMBER THIS TO BRING IN CLASSES FOR DIFFERENT METHODS,
##bring in class object and method and pass in the id from market
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendors\n FarMar::Vendor.by_market(id)\n end",
"def market #returns the FarMar::Market instance that is associated with this vendor using the FarMar::Vendor market_id field ##WORKS\n\t\tmarkets = []\n\t\tlist = FarMar::Market.all\n\t\tlist.each do |market|\n\t\t\tif market.id == @market_id\n\t\t\t\tputs market.name\n\t\t\t\tmarkets << market\n\t\t\tend\n\t\tend\n\t\tputs markets.length.to_s + \" market(s). should be 1!\"\n\t\treturn markets\n\tend",
"def vendors\n FarMar::Vendor.by_market(self.id)\n end",
"def vendors\n return FarMar::Vendor.by_market(@market_id)\n end",
"def vendors\n FarMar::Vendor.market_vendors(@market_id)\n end",
"def vendors\n vendors_at_market = []\n vendors = FarMar::Vendor.all\n vendors.each do |vendor|\n if vendor.market_id == self.id # Since this is an instance method I am looking at the ID of the FarMar::Market object I am calling .vendors on (i.e. the \"self\")\n vendors_at_market << vendor\n end\n end\n return vendors_at_market\n end",
"def vendors\n vendors = CSV.read(VENDORS_CSV).select { |line| line[3].to_i == self.market_id }\n vendors.collect { |v| FarMar::Vendor.new(v)}\n end",
"def vendor\n FarMar::Vendor.all.find {|instance| instance.id == vendor_id}\n end",
"def market\n FarMar::Market.all.select { |market| market.id == id}\n end",
"def vendor\n sale_vendor = Vendor.new(:id, :name, :number_of_employees, :market_id)\n Vendor.all.each do |ven_id, ven|\n if ven_id == vendor_id\n sale_vendor = ven\n end\n end\n return sale_vendor\n end",
"def market\n market_where_this_vendor_sells = nil\n markets_to_check = FarMar::Market.all\n markets_to_check.each do |market_to_check|\n if self.market_id == market_to_check.id\n market_where_this_vendor_sells = market_to_check\n end#of if\n end#of do\n return market_where_this_vendor_sells\n end",
"def vendor\n FarMar::Vendor.all.select { |vendor| vendor.vendor_id == vendor_id }\n end",
"def vendor\n FarMar::Vendor.all.select { |vendor| vendor.vendor_id == vendor_id }\n end",
"def vendor(vendor_id)\n FarMar::Vendor.all.find { |vendor| vendor.id == vendor_id }\n end",
"def products\n products_by_market = []\n #gives me an array of vendors\n venders_by_market = FarMar::Vendor.by_market(@id)\n\n venders_by_market.each do | value |\n products = FarMar::Product.by_vendor(value.id)\n products_by_market.concat(products)\n end\n\n return products_by_market\n end",
"def market\n FarMar::Market.find(market_id)\n end",
"def market\n FarMar::Market.find(market_id)\n end",
"def market\n FarMar::Market.find(self.market_id)\n end",
"def vendor\n FarMar::Vendor.all.find { |vendor| vendor.id == vendor_id }\n end",
"def vendor\n id = self.vendor_id\n found_vendor = FarMar::Vendor.find(id)\n return found_vendor\n end",
"def vendor\n Vendor.all.find do |vendor|\n vendor.id.to_i == @vendor_id.to_i\n end\n end",
"def vendor\n return array_of_instances(FarMar::Vendor.all, \"vendor_id\", vendor_id).first\n end",
"def vendor\n FarMar::Vendor.find(@vendor_id)\n end",
"def vendor\n FarMar::Vendor.all.find { |vendor| vendor.id == @vendor_id }\n end",
"def market\n all_markets = FarMar::Market.all\n all_markets.each do |market|\n if market.id == self.market_id\n return market\n end\n end\n end",
"def vendor\n CSV.foreach(VENDORS_CSV) do |line|\n return FarMar::Vendor.new(line) if line[0].to_i == vendor_id\n end\n end",
"def vendor\n FarMar::Vendor.find(self.vendor_id)\n end",
"def find(id)\n result = nil\n @vendors.each do |vendor|\n result = vendor if vendor.id == id\n end\n result\n end",
"def vendor\n FarMar::Vendor.find(@vendor_id)\n end",
"def market\n Market.find(@market_id)\n end"
]
| [
"0.8072416",
"0.79924387",
"0.7924431",
"0.76777023",
"0.7669088",
"0.76245666",
"0.7323986",
"0.6869937",
"0.68620455",
"0.6855523",
"0.6814425",
"0.67456746",
"0.67456746",
"0.6721337",
"0.6629167",
"0.6595687",
"0.6595687",
"0.6540909",
"0.65010834",
"0.6476018",
"0.64711946",
"0.6453973",
"0.64528525",
"0.64284974",
"0.6391042",
"0.6380171",
"0.6353718",
"0.6308903",
"0.6247092",
"0.62461686"
]
| 0.8236412 | 0 |
Elect a primary server within this topology. | def elect_primary(description, servers); self; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elect_primary(description, servers)\n if description.replica_set_name == replica_set_name\n unless detect_stale_primary!(description)\n servers.each do |server|\n if server.primary? && server.address != description.address\n server.description.unknown!\n end\n end\n update_max_election_id(description)\n update_max_set_version(description)\n end\n else\n log_warn(\n \"Server #{description.address.to_s} has incorrect replica set name: \" +\n \"'#{description.replica_set_name}'. The current replica set name is '#{replica_set_name}'.\"\n )\n end\n self\n end",
"def select_server\n compute.servers.map { |s| [s.name, s.id] }\n end",
"def boot params={}\n Server.node = Server.start! params\n Server.semaphore = Mutex.new\n Server.workers = []; true\n end",
"def start\n retry_jobs if JR.config[:retry_jobs_at_start]\n EM.start_server(*self.config[:server], Server, self, self.storage)\n self.config[:distributors].each do |distributor|\n connect_to(distributor)\n end\n end",
"def server\n\t\treturn @server ||= self.create_server\n\tend",
"def force_primary(address)\n current_primary = admin_client.cluster.next_primary\n if current_primary.address == address\n raise \"Attempting to set primary to #{address} but it is already the primary\"\n end\n encourage_primary(address)\n\n if unfreeze_server(address)\n # Target server self-elected as primary, no further action is needed.\n return\n end\n\n step_down\n persistently_step_up(address)\n admin_client.cluster.next_primary.unknown!\n new_primary = admin_client.cluster.next_primary\n if new_primary.address != address\n raise \"Elected primary #{new_primary.address} is not what we wanted (#{address})\"\n end\n end",
"def thread\n @primary_server ? @primary_server.thread : nil\n end",
"def set_up_server\n node = Chef::Node.new\n node.name 'nothing'\n node.automatic[:platform] = 'kitchen_metal'\n node.automatic[:platform_version] = 'kitchen_metal'\n Chef::Config.local_mode = true\n run_context = Chef::RunContext.new(node, {},\n Chef::EventDispatch::Dispatcher.new(Chef::Formatters::Doc.new(STDOUT,STDERR)))\n recipe_exec = Chef::Recipe.new('kitchen_vagrant_metal',\n 'kitchen_vagrant_metal', run_context)\n\n # We require a platform, but layout in driver is optional\n recipe_exec.instance_eval get_platform_recipe\n recipe = get_driver_recipe\n recipe_exec.instance_eval recipe if recipe\n return run_context\n end",
"def start_server\n if @task.said_yes?(\"Would you like to start #{@name} server?\")\n action = Marv::Server::Actions.new(@server)\n action.start(false)\n end\n end",
"def server\n node.server\n end",
"def primary_app_server\n @primary_app_server ||= find_servers(:roles => :app, :only => {:primary => true}).first || find_servers(:roles => :app).first\n end",
"def server(name, host, user, options={})\n servers.push(DO::Server.new(name, host, user, options))\n local(name) { servers_selected.replace(servers.select { |s| s.name == name }) }\n end",
"def join\n @server.stop! if @server and @server.running?\n super\n end",
"def unfreeze_server(address)\n begin\n direct_client(address).use('admin').database.command(replSetFreeze: 0)\n rescue Mongo::Error::OperationFailure => e\n # Mongo::Error::OperationFailure: cannot freeze node when primary or running for election. state: Primary (95)\n if e.code == 95\n # The server we want to become primary may have already become the\n # primary by holding a spontaneous election and winning due to the\n # priorities we have set.\n admin_client.cluster.servers_list.each do |server|\n server.unknown!\n end\n if admin_client.cluster.next_primary.address == address\n puts \"#{Time.now} [CT] Primary self-elected to #{address}\"\n return true\n end\n end\n raise\n end\n false\n end",
"def server(name, host, user, options={})\n servers.push(DO::Server.new(name, host, user, options))\n task name do |opts, b|\n allowed = opts.map { |k,v| k if remote.include?(k) && v }.compact\n denied = opts.map { |k,v| k if remote.include?(k) && v == false }.compact\n if (allowed.empty? && denied.empty?) ||\n (!allowed.empty? && allowed.include?(name)) ||\n (!denied.empty? && !denied.include?(name))\n @_current_server = servers.find { |s| s.name == name }\n begin\n b.arity == 1 ? b.call(opts) : b.call\n ensure\n @_current_server = nil\n end\n end\n end\n end",
"def server(name, options = {}, &blk)\n add_child(:servers, Hubcap::Server.new(self, name, options, &blk))\n end",
"def delivery_chef_server\n DeliveryTruck::Helpers.delivery_chef_server(node)\n end",
"def join(server, already); end",
"def server\n servers[0]\n end",
"def start\n @serv = EventMachine::start_server \"0.0.0.0\", @port, Server, self\n \t\t\t\tif @peers\n \t\t\t\t\[email protected] do |peer|\n \t\t\t\t\t\tpeer.connection = EventMachine::connect peer.ip, peer.port, Client, self, peer\n @pm.add(peer)\n \t\t\t\t\tend\n \t\t\t\tend\n end",
"def get_server(id)\n OpenStack::Compute::Server.new(self,id)\n end",
"def get_server(id)\n OpenStack::Compute::Server.new(self,id)\n end",
"def server\n self\n end",
"def set_server\n @server = current_user.servers.find(params[:id])\n end",
"def join\n @server_thread.join if @server_thread\n end",
"def server\n @server ||= Shelf::Handler.get(options[:server]) || Shelf::Handler.default\n end",
"def init_server\n box = @boxes[@environment_name]\n if box.nil?\n launch!\n else\n @cloud.connect_to_server(box)\n end\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end",
"def set_server\n @server = Server.find(params[:id])\n end"
]
| [
"0.6445153",
"0.54944026",
"0.5484852",
"0.5451359",
"0.5447465",
"0.54417884",
"0.5406501",
"0.53859746",
"0.5379763",
"0.5375298",
"0.5346694",
"0.5250826",
"0.52389693",
"0.52299094",
"0.5220387",
"0.5218819",
"0.5205547",
"0.5151638",
"0.5149905",
"0.5144666",
"0.5117638",
"0.5117638",
"0.5113047",
"0.50687",
"0.50530297",
"0.5027066",
"0.5012619",
"0.5002957",
"0.5002957",
"0.5002957"
]
| 0.7482492 | 0 |
Sharded topologies have no replica set name. | def replica_set_name; nil; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replica_set?; false; end",
"def replica_set?; true; end",
"def replica_set?\n type == Mongo::Cluster::Topology::ReplicaSetNoPrimary ||\n type == Mongo::Cluster::Topology::ReplicaSetWithPrimary\n end",
"def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"] || \"\"\n NOT_MASTER.include?(details[\"code\"]) || err.include?(\"not master\")\n end",
"def direct?\n !replicaset?\n end",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharded ||= ($mongo_client.cluster.sharded? || single_mongos?)\nend",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharded ||= ($mongo_client.cluster.sharded? || single_mongos?)\nend",
"def single_rs_member?\n ClusterConfig.instance.single_server? && ClusterConfig.instance.replica_set_name\nend",
"def single_rs_member?\n ClusterConfig.instance.single_server? && ClusterConfig.instance.replica_set_name\nend",
"def replica_set_name\n @replica_set_name ||= options[REPLICA_SET_NAME]\n end",
"def replicas; end",
"def replicaset?\n replicaset.is_a?(String) || nodes.length > 1\n end",
"def replica_set?\n $mongo_client ||= initialize_scanned_client!\n $replica_set ||= $mongo_client.cluster.replica_set?\nend",
"def replica_set\n return nil if @machine.config.mongodb.nil?\n\n @machine.config.mongodb.replsets.find do |rs|\n rs.members.find do |member|\n member[:host] == @machine.name\n end\n end\n end",
"def self_owned?; owners.include?(Distributed) end",
"def multiple_clusters_available?\n false\n end",
"def initiate(replica_set)\n config = replica_set.config\n\n if replica_set.replica_set?\n if replica_set.key != config.key\n raise FatalError, 'Member already belongs to a different Replica Set?!'\n else\n logger.info 'Mongodb Replica set already inititated...'\n return\n end\n end\n\n begin\n replica_set.initiate(false)\n replica_set.connect\n rescue Mongo::Error::OperationFailure => rinit\n logger.info 'Failed to initiate Replica Set...'\n logger.info rinit.message\n raise\n end\n logger.info 'Mongodb Replica set inititated...'\nend",
"def star_cluster; end",
"def is_clustered_environment\n super\n end",
"def servers(servers)\n servers.select do |server|\n (replica_set_name.nil? || server.replica_set_name == replica_set_name) &&\n server.primary? || server.secondary?\n end\n end",
"def test_writers_should_not_share_a_connection_with_replicas\n refute_equal(\n (AbstractPool1DbA.connected_to(role: :writing) { Pool1DbA.connection.raw_connection }),\n (AbstractPool1DbA.connected_to(role: :reading) { Pool1DbA.connection.raw_connection })\n )\n end",
"def single_mongos?\n ClusterConfig.instance.single_server? && ClusterConfig.instance.mongos?\nend",
"def single_mongos?\n ClusterConfig.instance.single_server? && ClusterConfig.instance.mongos?\nend",
"def storm_zookeepers\n if node[:storm][:zookeeper][:servers].any?\n node[:storm][:zookeeper][:servers]\n else\n if node[:storm][:zookeeper][:cluster_name].nil?\n discover_all(:zookeeper, :server).map(&:private_ip).sort.uniq rescue \"\"\n else\n discover_all(:zookeeper, :server, node[:storm][:zookeeper][:cluster_name]).map(&:private_ip).sort.uniq rescue \"\"\n end\n end\n end",
"def replica_has_node_for_agent?(replica_nodes, agent)\n replica_nodes.each { |replica_node| return true if replica_node['certname'] == agent.hostname }\n host.logger.warn(\"replica doesn't have any nodes for certname '#{agent.hostname}'\")\n false\n end",
"def can_create_cluster?(project)\n project.clusters.empty?\n end",
"def shard; end",
"def master_has_node?(replica_node, master_nodes)\n master_nodes.each { |master_node| return true if replica_node['certname'] == master_node['certname'] }\n host.logger.warn(\"master doesn't have node with certname '#{replica_node['certname']}', which is on replica\")\n false\n end",
"def sharded?; true; end",
"def master\n can_view? && @strategy.master_node && @strategy.master_node[:nodename]\n end"
]
| [
"0.6891267",
"0.67285687",
"0.645339",
"0.643664",
"0.6387346",
"0.6276711",
"0.6276711",
"0.6241491",
"0.6241491",
"0.6145875",
"0.6053696",
"0.6028507",
"0.6027574",
"0.5945153",
"0.5669629",
"0.5662772",
"0.5561229",
"0.5559615",
"0.5517034",
"0.5479895",
"0.54232806",
"0.54016614",
"0.54016614",
"0.5385582",
"0.536791",
"0.53552276",
"0.533698",
"0.53257823",
"0.53060806",
"0.52857125"
]
| 0.70127517 | 0 |
A sharded topology is sharded. | def sharded?; true; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sharded?\n @sharded\n end",
"def shard; end",
"def sharded?; false; end",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharded ||= ($mongo_client.cluster.sharded? || single_mongos?)\nend",
"def sharded?\n $mongo_client ||= initialize_scanned_client!\n $sharded ||= ($mongo_client.cluster.sharded? || single_mongos?)\nend",
"def shard\n @pool.shard\n end",
"def shard\n self\n end",
"def set_sharding\n Rails.application.config.allow_sharding = params[:state]\n render :get_sharding\n end",
"def star_cluster; end",
"def shard_swapping_prohibited?\n ActiveSupport::IsolatedExecutionState[:active_record_prohibit_shard_swapping]\n end",
"def shard_world; end",
"def balanced_shard\n # TODO Disabling balanced shard until we rework counts to go faster\n #@_ar_sharded_balance_count ||= 0\n #@_ar_sharded_semaphore ||= Mutex.new\n #returning_shard = nil\n #\n ## Do a thread sync on the balancing agent so we don't rebalance while\n ## we are retrieving a shard class\n #@_ar_sharded_semaphore.synchronize do\n #\n # # Rebalance every 10000 lookups\n # if @_ar_sharded_balance_count.to_i > 10000\n # @_ar_sharded_laggers = []\n #\n # # Find the leaders count\n # # TODO this is a bottle neck on large sets.\n # max_count = 0\n # @_ar_cached_shard_classes.each do |shard_class|\n # curr_count = shard_class.count\n # max_count = curr_count if curr_count > max_count\n # end\n #\n # # Designate the laggers\n # # You are a lagger if you are 10% behind the leader\n # @_ar_cached_shard_classes.each do |shard_class|\n # curr_count = shard_class.count\n # @_ar_sharded_laggers << shard_class if (max_count * 0.9) > curr_count\n # end\n #\n # #After rebalancing reset the counter\n # @_ar_sharded_balance_count = 0\n # end\n #\n # # If we have laggers favor them half the time to have them catch up\n # if @_ar_sharded_laggers.present? && rand >= 0.5\n # returning_shard = @_ar_sharded_laggers.sample\n # else\n # returning_shard = random_shard\n # end\n #\n # @_ar_sharded_balance_count += 1\n #end\n #\n #returning_shard\n @_ar_cached_shard_classes.sample\n end",
"def sharded_column\n @sharded_column\n end",
"def prohibit_shard_swapping(enabled = true)\n prev_value = ActiveSupport::IsolatedExecutionState[:active_record_prohibit_shard_swapping]\n ActiveSupport::IsolatedExecutionState[:active_record_prohibit_shard_swapping] = enabled\n yield\n ensure\n ActiveSupport::IsolatedExecutionState[:active_record_prohibit_shard_swapping] = prev_value\n end",
"def can_set_write_concern?\n !sharded? || !scram_sha_256_enabled?\nend",
"def clustered_state\n super\n end",
"def save_rack_topology\n topology_policy = cluster_attributes(RACK_TOPOLOGY_POLICY_KEY)\n topology_policy.upcase! if topology_policy\n topology_enabled = (topology_policy and topology_policy != 'NONE')\n topology_hve_enabled = (topology_policy and topology_policy == 'HVE')\n\n topology = self.servers.collect do |svr|\n vm = svr.fog_server\n next if !vm or !vm.ipaddress or !vm.physical_host\n rack = vm.rack.to_s.empty? ? 'default-rack' : vm.rack\n case topology_policy\n when 'RACK_AS_RACK'\n vm.all_ip_addresses.collect { |ip| \"#{ip} /#{rack}\" }.join(\"\\n\")\n when 'HOST_AS_RACK'\n vm.all_ip_addresses.collect { |ip| \"#{ip} /#{vm.physical_host}\" }.join(\"\\n\")\n when 'HVE'\n vm.all_ip_addresses.collect { |ip| \"#{ip} /#{rack}/#{vm.physical_host}\" }.join(\"\\n\")\n else\n nil\n end\n end\n topology = topology.join(\"\\n\")\n\n conf = {\n :hadoop => {\n :rack_topology => {\n :enabled => topology_enabled,\n :hve_enabled => topology_hve_enabled,\n :data => topology\n }\n }\n }\n Chef::Log.debug('saving Rack Topology to cluster role: ' + conf.to_s)\n merge_to_cluster_role(conf)\n end",
"def shard_for(key)\n connection_name = connection_router.fetch_connection_name(key)\n shard_repository.fetch(connection_name)\n end",
"def shard_for(key)\n connection_name = cluster_routing.route(key.to_s)\n shard_repository.fetch(connection_name)\n end",
"def starship; end",
"def traffic_shaping\n Puppet.debug \"Entering traffic_shaping\"\n @networksystem=host.configManager.networkSystem\n portg=find_portgroup\n if ( resource[:traffic_shaping_policy] == :enabled )\n avgbandwidth = resource[:averagebandwidth].to_i * 1000\n peakbandwidth = resource[:peakbandwidth].to_i * 1000\n burstsize = resource[:burstsize].to_i * 1024\n enabled = 1\n\n hostnetworktrafficshapingpolicy = RbVmomi::VIM.HostNetworkTrafficShapingPolicy(:averageBandwidth => avgbandwidth, :burstSize => burstsize, :enabled => enabled, :peakBandwidth => peakbandwidth)\n\n elsif ( resource[:traffic_shaping_policy] == :disabled)\n enabled = 0\n hostnetworktrafficshapingpolicy = RbVmomi::VIM.HostNetworkTrafficShapingPolicy(:enabled => enabled)\n end\n\n hostnetworkpolicy = RbVmomi::VIM.HostNetworkPolicy(:shapingPolicy => hostnetworktrafficshapingpolicy)\n\n actualspec = portg.spec\n if (actualspec.policy != nil )\n actualspec.policy.shapingPolicy = hostnetworktrafficshapingpolicy\n else\n actualspec.policy = hostnetworkpolicy\n end\n @networksystem.UpdatePortGroup(:pgName => resource[:portgrp], :portgrp => actualspec)\n return true\n end",
"def for_share\n lock_style(:share)\n end",
"def run_w_shard(mongo, config_source, config_reader_builder,\n config_writer_builder, opt = {})\n @stop_mutex.synchronize { @stop = false }\n\n config_poll_interval = opt[:config_poll_interval] || 1\n err_retry_interval = opt[:err_retry_interval] || 10\n logger = opt[:logger] || Logger.new(STDOUT)\n opt[:is_sharded] = true\n shard_set = {}\n\n connection_opt = {\n :pool_size => opt[:pool_size],\n :pool_timeout => opt[:pool_timeout]\n }\n\n shard_coll = mongo[\"config\"][\"shards\"]\n\n loop do\n new_shard_set = {}\n\n begin\n shard_coll.find.each do |shard_doc|\n shard_id = shard_doc[\"_id\"]\n host = shard_doc[\"host\"]\n\n if shard_set.has_key? shard_id then\n shard = shard_set[shard_id]\n shard_set.delete(shard_id)\n else\n host_part1, host_part2 = host.split(\"/\")\n\n if host_part2.nil? then\n # not a replica set\n address = host_part1\n else\n address = host_part2\n end\n\n location, port = address.split(\":\")\n shard_conn = Mongo::Connection.new(location, port, connection_opt)\n shard_conn = upgrade_to_replset(shard_conn, connection_opt)\n\n if shard_conn.is_a? Mongo::ReplSetConnection then\n oplog_coll = get_oplog_collection(shard_conn, :repl_set)\n else\n oplog_coll = get_oplog_collection(shard_conn, :master_slave)\n end\n\n name = opt[:name] || \"\"\n extra_opt = {\n :name => name + \"[#{shard_id}]\"\n }\n\n shard = DaemonThread.new(Daemon.new(), host, logger)\n shard.start(mongo, oplog_coll, config_source,\n ObjectBuilder.new(config_reader_builder, shard_id),\n ObjectBuilder.new(config_writer_builder, shard_id),\n opt.merge(extra_opt))\n end\n\n new_shard_set[shard_id] = shard\n end\n rescue => e\n logger.error get_full_exception_msg(e)\n sleep err_retry_interval\n end\n\n shard_set.each do |id, daemon_thread|\n logger.info \"Shard #{id} removed: stopping sync.\"\n daemon_thread.stop\n end\n\n shard_set = new_shard_set\n\n @stop_mutex.synchronize do\n if @stop then\n shard_set.each do |id, daemon_thread|\n logger.info \"Stopping daemon: Stop sync on shard #{id}.\"\n daemon_thread.stop\n end\n\n return\n end\n end\n\n sleep config_poll_interval\n end\n end",
"def place_stone(board_x, board_y)\n if @stones.all_stones_set?\n return true #there are no stones left to be palced\n end\n\n current_stone = @stones.get_current_stone\n fit_count = @board.fit_count(current_stone, board_x, board_y)\n if fit_count < 1\n return true # we are not allowed to place a stone there\n end\n\n self.score += @stones.calculate_score( fit_count )\n @board.place_stone( @stones.go_to_next_stone, board_x, board_y, fit_count)\n self.save\n end",
"def switch_ready datapath_id\n @topology.add_sw datapath_id\n end",
"def primary_shard\n case shard_value\n when Shard, DefaultShard\n shard_value\n # associated_shards\n when ::ActiveRecord::Base\n shard_value.shard\n when Array\n shard_value.first\n when ::ActiveRecord::Relation\n Shard.default\n when nil\n Shard.current(klass.connection_classes)\n else\n raise ArgumentError, \"invalid shard value #{shard_value}\"\n end\n end",
"def worker_culling_strategy(strategy); end",
"def lock_movements?\n true\n end",
"def self_owned?; owners.include?(Distributed) end",
"def cluster_enabled_state\n super\n end"
]
| [
"0.64567375",
"0.6401802",
"0.628635",
"0.6077936",
"0.6077936",
"0.601789",
"0.5766073",
"0.5748678",
"0.56937706",
"0.56869894",
"0.56317043",
"0.5486915",
"0.5449605",
"0.5342455",
"0.5271522",
"0.50610167",
"0.4985788",
"0.49834564",
"0.49709225",
"0.49651423",
"0.49643248",
"0.4945751",
"0.49182364",
"0.48845375",
"0.4866227",
"0.48213083",
"0.48154345",
"0.47773665",
"0.47624767",
"0.4753365"
]
| 0.6496563 | 0 |
Creates a new version of the app in HockeyApp. | def create_version
Milkrun.say "Creating new version of app in HockeyApp"
body = {}.tap do |json|
json[:bundle_version] = version_code
json[:bundle_short_version] = version_name
json[:status] = 1
end
headers = {}.tap do |h|
h["X-HockeyAppToken"] = token
h["Accept"] = "application/json"
h["Content-Type"] = "application/json"
end
url = "#{base_url}/#{app_id}/app_versions/new"
response = Excon.post(url, body: body.to_json, connect_timeout: 10, headers: headers)
if response.status != 201
Milkrun.error response.data.to_s
raise "Failed to post new version to HockeyApp!"
end
Milkrun.say "New version created in HockeyApp"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 save!\n client.update_app_version!(application.apple_id, is_live?, raw_data)\n end",
"def create\n @version = @app.versions.new(version_params)\n\n respond_to do |format|\n if @version.save\n format.html { redirect_to user_app_version_path(@user, @app, @version), notice: 'Version was successfully created.' }\n format.json { render :show, status: :created, location: @version }\n else\n format.html { render :new }\n format.json { render json: @version.errors, status: :unprocessable_entity }\n end\n end\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\n @manage_app_version = Manage::AppVersion.new(manage_app_version_params)\n\n respond_to do |format|\n if @manage_app_version.save\n format.html { redirect_to @manage_app_version, notice: 'App version was successfully created.' }\n format.json { render :show, status: :created, location: @manage_app_version }\n else\n format.html { render :new }\n format.json { render json: @manage_app_version.errors, status: :unprocessable_entity }\n end\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\n @app_version = @app.app_versions.build(params[:app_version])\n # @app_version = AppVersion.new(params[:app_version])\n\n respond_to do |format|\n if @app_version.save\n format.html { redirect_to([@app, @app_version], :notice => 'App Version was successfully created.') }\n # format.html { redirect_to(@app_version, :notice => 'App Version was successfully created.') }\n format.xml { render :xml => @app_version, :status => :created, :location => @app_version }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app_version.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_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 new\n @app_version = @app.app_versions.build\n # @app_version = AppVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app_version }\n end\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_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(*args)\n if !self.is_?(App)\n self.app_name = HesCentral.application_repository_name\n end\n super(*args)\n end",
"def create\n if params[:create] == 'existing'\n @app = App.new(app_params)\n origin = @apps.find(params[:origin])\n\n @app.runtime = origin.runtime.dup\n @app.android_config = origin.android_config.dup\n @app.ios_config = origin.ios_config.dup\n @app.android_icon = origin.android_icon.dup\n @app.ios_icon = origin.ios_icon.dup\n\n @app.splash = origin.splash.dup\n\n @app.android_config['origin'] = origin.id\n @app.ios_config['origin'] = origin.id\n @app.android_config.delete('bundle_id')\n @app.ios_config.delete('bundle_id')\n\n @app.duplicate_files(origin)\n else\n @app = App.new(app_params)\n end\n\n @app.user = current_user\n\n if @app.save\n if origin\n origin.assets.each do |item|\n asset = Asset.new\n asset.app_id = @app.id\n asset.slug = item.slug\n asset.duplicate_file(item)\n asset.save!\n end\n end\n end\n\n respond_modal_with @app, location: @app\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 # 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 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 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 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\n megam_rest.post_appreq(to_hash)\n end",
"def app_version\n '0.0.1'\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_version(attributes = nil)\n add_version(Version.create(attributes || version_attributes))\n reset_version\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 megam_rest.post_appdefn(to_hash)\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 @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! :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 find_or_create_app(app_name)\n create_app(app_name)\n rescue\n @heroku.app.info(app_name)\n end"
]
| [
"0.69854003",
"0.6732899",
"0.668877",
"0.65476656",
"0.6515963",
"0.64948446",
"0.6347779",
"0.634168",
"0.6288814",
"0.6277851",
"0.6277574",
"0.62440366",
"0.62321925",
"0.62309766",
"0.62111074",
"0.6194539",
"0.6173755",
"0.61472636",
"0.60987973",
"0.6071858",
"0.60453665",
"0.6025127",
"0.6024048",
"0.60174555",
"0.60110354",
"0.5986344",
"0.5981993",
"0.5922068",
"0.59066707",
"0.59047437"
]
| 0.87121814 | 0 |
Whether the environment is valid for this provider. | def valid?
env_keys.all? { |k| env.key?(k) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment_valid?\n %w(test production development).include?(@environment)\n end",
"def valid?(request_env)\n\t\t\treturn false unless valid_fields?(request_env)\n\t\t\ttrue\n\t\tend",
"def valid_environment?\n env['USER'] == config.user && env['HOME'] == config.home_path\n end",
"def valid?\n return false if @type.nil?\n return false if @is_active.nil?\n return false if @external_url.nil?\n return false if @external_authorization_type.nil?\n true\n end",
"def validate_envs?()\n\t\tenv = @options[:env]\n\n\t\tres = subset?([env], @envs_list)\n\t\tif ! res\n\t\t\tputs \"Environment #{env}, is not valid\"\n\t\tend\n\n\t return res\t\n\tend",
"def valid?\n return false if @account.nil?\n return false if @name.nil?\n return false if !@port_restriction.nil? && @port_restriction > 65535\n return false if !@port_restriction.nil? && @port_restriction < 1\n return false if @site_assignment.nil?\n true\n end",
"def valid_without_global?\n valid?\n end",
"def valid?\n return false if @access_token_url.nil?\n return false if @client_id.nil?\n return false if @client_secret.nil?\n return false if @token_api_authentication.nil?\n true\n end",
"def valid?\n return false if !key || key_defined? || global_key?\n\n true\n end",
"def valid?\n !project_id.nil? && !credentials.nil?\n end",
"def valid?\n return false if @company_name.nil?\n return false if @is_diligence_attested.nil?\n return false if @products.nil?\n return false if @legal_entity_name.nil?\n return false if @website.nil?\n return false if @application_name.nil?\n return false if @address.nil?\n return false if @is_bank_addendum_completed.nil?\n true\n end",
"def valid?\n placement_validator = EnumAttributeValidator.new('String', [\"none\", \"waf_debug\", \"null\"])\n return false unless placement_validator.valid?(@placement)\n format_version_validator = EnumAttributeValidator.new('String', [\"1\", \"2\"])\n return false unless format_version_validator.valid?(@format_version)\n region_validator = EnumAttributeValidator.new('String', [\"US\", \"EU\"])\n return false unless region_validator.valid?(@region)\n true\n end",
"def valid?\n return false if @anchor.nil?\n return false if @cv.nil?\n return false if @nullifier.nil?\n return false if @proof.nil?\n return false if @rk.nil?\n return false if @spend_auth_sig.nil?\n true\n end",
"def valid?\n !Kontagent.configuration.base_url.nil? && !Kontagent.configuration.api_key.nil? && !Kontagent.configuration.secret_key.nil? \n end",
"def running_protected_environment?\n protected_environments.collect(&:to_sym).include?(Rails.env.to_sym)\n end",
"def valid?\n return false if @authorization_endpoint.nil?\n return false if @id_token_signed_response_alg.nil?\n return false if @id_token_signing_alg_values_supported.nil?\n return false if @issuer.nil?\n return false if @jwks_uri.nil?\n return false if @response_types_supported.nil?\n return false if @subject_types_supported.nil?\n return false if @token_endpoint.nil?\n return false if @userinfo_signed_response_alg.nil?\n true\n end",
"def valid?\n return false if @info.nil?\n return false if @schema_version.nil?\n true\n end",
"def test_environment_valid?\n return true unless @environment == \"test\"\n !!@test_url\n end",
"def valid?\n return false if @web_url.nil?\n return false if @project.nil?\n return false if @parallel_runs.nil?\n return false if @started_at.nil?\n return false if @latest_workflow.nil?\n return false if @name.nil?\n return false if @executor.nil?\n return false if @parallelism.nil?\n return false if @number.nil?\n return false if @pipeline.nil?\n return false if @duration.nil?\n return false if @created_at.nil?\n return false if @messages.nil?\n return false if @contexts.nil?\n return false if @organization.nil?\n return false if @queued_at.nil?\n true\n end",
"def valid?\n valid_saml_credentials?\n end",
"def valid?(env)\n request = Rack::Request.new(env)\n unless (access_id = request.params['AccessKeyID'])\n #puts \"AccessKeyID not found in Params\"\n return false\n end\n unless (secret_key = @accounts[access_id])\n #puts \"No SecretKey found for AccessKeyID #{access_id.inspect}\"\n return false\n end\n AuthenticatedApi::Server.valid_signature?(request, secret_key)\n end",
"def public?\n !development_environments.include?(environment_name)\n end",
"def valid?\n return false if @created_time.nil?\n return false if @last_modified_time.nil?\n return false if @token.nil?\n return false if @user_token.nil?\n return false if @card_product_token.nil?\n return false if @last_four.nil?\n return false if @pan.nil?\n return false if @expiration.nil?\n return false if @expiration_time.nil?\n return false if @barcode.nil?\n return false if @pin_is_set.nil?\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"SUSPENDED\", \"TERMINATED\", \"UNSUPPORTED\", \"UNACTIVATED\"])\n return false unless state_validator.valid?(@state)\n return false if @state_reason.nil?\n return false if @fulfillment_status.nil?\n fulfillment_status_validator = EnumAttributeValidator.new('String', [\"ISSUED\", \"ORDERED\", \"REORDERED\", \"REJECTED\", \"SHIPPED\", \"DELIVERED\", \"DIGITALLY_PRESENTED\"])\n return false unless fulfillment_status_validator.valid?(@fulfillment_status)\n instrument_type_validator = EnumAttributeValidator.new('String', [\"PHYSICAL_MSR\", \"PHYSICAL_ICC\", \"PHYSICAL_CONTACTLESS\", \"PHYSICAL_COMBO\", \"VIRTUAL_PAN\"])\n return false unless instrument_type_validator.valid?(@instrument_type)\n true\n end",
"def valid?\n valid == true\n end",
"def valid?\n return false if @merchant_id.nil?\n return false if @capacity.nil?\n return false if @date_time.nil?\n true\n end",
"def valid?\n return false if @alliance_id.nil?\n return false if @solar_system_id.nil?\n return false if @structure_id.nil?\n return false if @structure_type_id.nil?\n return true\n end",
"def valid?\n return false if @customer.nil?\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', ['new', 'used', 'expired'])\n return false unless status_validator.valid?(@status)\n return false if @token.nil?\n true\n end",
"def valid?\n wellformed? and valid_schema_version? and validates? and has_referential_integrity?\n end",
"def valid?\n return @valid\n end",
"def environment_configured?\n Rails.env.test? || required_vars.empty? || required_vars.all?{|var_name| !ENV[var_name].nil? && !ENV[var_name].empty?}\n end"
]
| [
"0.85026413",
"0.76318866",
"0.7421536",
"0.73386705",
"0.71294063",
"0.71245724",
"0.71205235",
"0.7063185",
"0.7055769",
"0.70506364",
"0.7012718",
"0.70002174",
"0.6954537",
"0.6952816",
"0.69519633",
"0.69255656",
"0.6903113",
"0.690139",
"0.68640417",
"0.6843815",
"0.6830351",
"0.68196666",
"0.68080336",
"0.6788207",
"0.6752935",
"0.67512035",
"0.674371",
"0.6734186",
"0.6734149",
"0.67251"
]
| 0.8144832 | 1 |
GET /people_tasks GET /people_tasks.json | def index
@people_tasks = TasksPerson.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @people_tasks }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasks_person }\n end\n end",
"def get_user_tasks\n render json: get_current_user.tasks\n end",
"def tasks\n @todos = Todo.all\n render json: @todos\n end",
"def tasks\n render json: [{id: 1, name: 'One'}, {id: 2, name: 'Two'}]\n end",
"def index\n @tasks = Task.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def index\n @tasks = Task.all\n\n render json: @tasks\n end",
"def show\n @task = Task.find(params[:id])\n @team_members = Person.task_assignees(@task.id)\n @users = Person.not_assignees(@task.id)\n @comments = Comment.find_by_type(@task)\n @comment = Comment.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n render :json => Project.find(params[:project_id]).tasks.find(params[:id])\n end",
"def index\n render json: {\n tasks: tasks.map(&:to_hash)\n }\n end",
"def index\n @tasks = current_user.tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tasks }\n end\n end",
"def show\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def index\n # GET /tasks\n @tasks = Task.all\n end",
"def index\n #@tasks = Task.all\n tasks = @task_list.tasks.all\n render :json => tasks\n end",
"def show\n \n @task = @project.tasks.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n render json: @task\n end",
"def index\n\n if params[:project_id].nil?\n results = current_user.tasks\n\n else\n @project = Project.user_readable(current_user).find(params[:project_id])\n results = @project.tasks\n end\n\n @tasks = paginate_results(params[:page], results)\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index \n render :json => Project.find(11).tasks\n end",
"def index\n @tasks = Task.all\n response = @tasks.map{|task| get_task_hash(task)}\n render json: response\n end",
"def index\n @tasks = Task.order_by_company_project_and_task.paginate(page: params[:page] || 1, per_page: helpers.pager_per_page)\n respond_to do |format|\n message = @tasks.present? ? \"\" : \"There are no tasks available at this time\"\n format.json do\n status = @tasks.present? ? :ok : :not_found\n render json: { response: @tasks, status: status, message: message }\n end\n format.html do\n # Only authorize html format, json is okay because we use it as\n # an api.\n authorize(:task)\n flash[:alert] = message unless message.blank?\n @tasks\n end\n end\n end",
"def index\n respond_to do |format|\n format.html do\n @task = current_user.tasks.new\n end\n format.json do\n page = (params[:page] || 1).to_i\n per_page = 5\n total_pages = (@tasks.count.to_f / per_page).ceil\n total_pages = 1 if total_pages.zero?\n @tasks = @tasks.paginate(page: page, per_page: per_page)\n render json: { tasks: @tasks, page: page, totalPages: total_pages }\n end\n end\n end",
"def tasks\n user = validate_user( request.headers[\"authentication-token\"] )\n if user.nil?\n respond_to do |format|\n format.html do\n flash[:error] = 'Not authenticated.'\n redirect_to root_url\n end\n\n format.xml { render :xml => { :status => :error, :message => 'Invalid authentication code.'}.to_xml, :status => 403 }\n\n format.json { render :json => { :status => :error, :message => 'Invalid authentication code.'}.to_json, :status => 403 }\n end\n else\n projects = Task.find_all_by_project_id( params[:id] )\n if projects\n respond_to do |format|\n format.html { \n @title = \"Dasher - Your Projects\"\n @projects = Project.find_all_by_owner(@user.id)\n }\n format.xml { render :xml => projects.to_xml( :only => [:project_id, :id, :description] ) }\n format.json { render :json => projects.to_json( :only => [:project_id, :id, :description] ) }\n end\n end\n end\n end",
"def index\n @tasks = @project.tasks.find(:all, :order => 'project_name asc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { redner json: @tasks }\n end\n\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def show\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { redner json: @task }\n end\n\n end",
"def index\n @tasks = Task.includes(:user).order(created_at: :desc).all\n render json: @tasks, each_serializer: TasksSerializer\n end",
"def show\n render json: @task\n end",
"def index\n @tasks = Task.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end"
]
| [
"0.73588705",
"0.71109337",
"0.7009187",
"0.6887127",
"0.6873431",
"0.68418485",
"0.6736645",
"0.673531",
"0.67280954",
"0.66958576",
"0.6682668",
"0.6649931",
"0.66353023",
"0.6624169",
"0.6604962",
"0.65877634",
"0.6570386",
"0.6555804",
"0.65556246",
"0.6552364",
"0.6551262",
"0.65300196",
"0.65171576",
"0.6513835",
"0.6513835",
"0.6513835",
"0.6504475",
"0.6500236",
"0.6498451",
"0.64914423"
]
| 0.7704657 | 0 |
GET /people_tasks/1 GET /people_tasks/1.json | def show
@tasks_person = TasksPerson.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tasks_person }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @people_tasks = TasksPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people_tasks }\n end\n end",
"def show\n render :json => Project.find(params[:project_id]).tasks.find(params[:id])\n end",
"def show\n @task = Task.find(params[:id])\n\n render json: @task\n end",
"def tasks\n render json: [{id: 1, name: 'One'}, {id: 2, name: 'Two'}]\n end",
"def show\n \n @task = @project.tasks.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n @team_members = Person.task_assignees(@task.id)\n @users = Person.not_assignees(@task.id)\n @comments = Comment.find_by_type(@task)\n @comment = Comment.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { redner json: @task }\n end\n\n end",
"def tasks\n @todos = Todo.all\n render json: @todos\n end",
"def index\n @tasks = Task.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def get_user_tasks\n render json: get_current_user.tasks\n end",
"def index \n render :json => Project.find(11).tasks\n end",
"def show\n @task = Task[params[:id]]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def index\n @tasks = Task.all\n\n render json: @tasks\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end",
"def index\n #@tasks = Task.all\n tasks = @task_list.tasks.all\n render :json => tasks\n end"
]
| [
"0.75819623",
"0.6937273",
"0.69366366",
"0.6923732",
"0.6905428",
"0.68815845",
"0.6829282",
"0.6826633",
"0.6778851",
"0.6767741",
"0.67472607",
"0.66577345",
"0.66504943",
"0.6614728",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600599",
"0.6600182",
"0.6586809"
]
| 0.75678724 | 1 |
GET /people_tasks/new GET /people_tasks/new.json | def new
@tasks_person = TasksPerson.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tasks_person }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n # raise params.inspect\n @task = Task.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n\n\n\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render json: @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.json { render :json => @task }\n end\n end",
"def new\n @template_task = TemplateTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_task }\n end\n end",
"def new\n if current_user\n @task = current_user.tasks.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n else\n redirect_to tasks_path, notice: 'Please Log In First.'\n end\n end",
"def create\n @tasks_person = TasksPerson.new(params[:tasks_person])\n\n respond_to do |format|\n if @tasks_person.save\n format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully created.' }\n format.json { render json: @tasks_person, status: :created, location: @tasks_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tasks_person.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.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_list }\n end\n end",
"def new\r\n @task = @current_user.tasks.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @task }\r\n end\r\n end",
"def new\n @task = Task.new(:project_id => params[:id])\n\t\t@projects = Project.sorted\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @project = Project.find(params[:project_id])\n @task = @project.tasks.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @todo_task = TodoTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo_task }\n end\n end",
"def new\n @task = Task.new\n @parent = current_user.projects.first\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @task = Task.new\n # tasks_counts\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end",
"def new\n @volunteer_task = VolunteerTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @volunteer_task }\n end\n end",
"def new\n \n if params[:id].nil?\n @projects = Project.all\n else\n @project = Project.find(params[:id])\n end\n\n @priorities = Priority.all\n @stopovers = Stopover.all\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @tasktype = Tasktype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tasktype }\n end\n end"
]
| [
"0.7775306",
"0.77416384",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7605939",
"0.7529903",
"0.74275225",
"0.7372045",
"0.73702204",
"0.73412675",
"0.7319687",
"0.7273926",
"0.7249384",
"0.72409165",
"0.7234949",
"0.72011805",
"0.719883",
"0.71716154",
"0.71378124",
"0.71150744",
"0.71140647"
]
| 0.8022029 | 0 |
POST /people_tasks POST /people_tasks.json | def create
@tasks_person = TasksPerson.new(params[:tasks_person])
respond_to do |format|
if @tasks_person.save
format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully created.' }
format.json { render json: @tasks_person, status: :created, location: @tasks_person }
else
format.html { render action: "new" }
format.json { render json: @tasks_person.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@task = Task.new(task_params)\n task = @task_list.tasks.create!(task_params)\n render json: task\n end",
"def create\n @task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n @users = User.all\n @users.each do |user|\n user.tasks << @task\n end\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n projusers = ProjectsUser.find(params[:task][:project_users_id])\n @task = projuser.tasks.build(task_params)\n\n if @task.save\n render json: @task , status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.save\n render json: full_task(@task)\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def add_user_task\n task = Task.create(task_params)\n puts \"New task: #{task}\"\n if task\n render json: {task: task}\n else\n render json: task.error.full_messages, status: 402\n end\n end",
"def create\n @task = Task.find(params[:user_task][:tasks_id])\n\tcurrent_user.craete_task!(@task)\n respond_to do |format|\n if @user_task.save\n format.html { redirect_to @user_task, notice: 'User Task was successfully created.' }\n format.json { render json: @user_task, status: :created, location: @user_task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_task(options = {})\n request(:post, \"tasks\", options)\n end",
"def create\n @task = current_user.tasks.new task_params\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @user= User.find_by_id(session[:user_id])\n @task = @user.tasks.create(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = @project.tasks.new(task_params)\n @task.user = current_user if current_user.developer?\n @statuses = Task.statuses.keys\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to edit_project_task_path(@project, @task.id), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n puts @task.errors.as_json\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = current_user.tasks.build(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = current_user.tasks.build(task_params)\n respond_to do |format|\n if @task.save \n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n task = Task.new(task_params)\n if task.save\n render json: task, status: :created\n else\n render_errors(task)\n end\n end",
"def create\n # raise params.inspect\n @task = Task.new(task_params)\n if @task.save\n redirect_to tasks_url\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n\n end\n end",
"def create\n @task = @member.tasks.new(task_params)\n @task.creator = @member\n @task.due_at ||= Time.zone.now\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path(@org), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n format.js\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @task = Task.new(task_param)\n if @task.save\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages \n end\n end",
"def create\n @task = current_user.tasks.build(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to :action => :index, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = current_user.tasks.build(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path, notice: 'Task was successfully created.' }\n format.json {render inline: \"location.reload();\" }\n format.json { render :show, status: :created, location: tasks_path }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: tasks_path }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personal_task = PersonalTask.new(personal_task_params)\n @personal_task.userid = session[:userid]\n if personal_task_params[:label] == nil || personal_task_params[:label] == \"\"\n @personal_task.label = 0\n end\n @personal_task.complete = false\n respond_to do |format|\n if @personal_task.save\n flash[:alert] = \"Task created\"\n format.html { redirect_to @personal_task }\n format.json { render action: 'show', status: :created, location: @personal_task }\n else\n format.html { render action: 'new' }\n format.json { render json: @personal_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = current_user.tasks.new(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'タスクを登録しました!' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@task = Task.new(task_params)\n\t\[email protected] = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @task.save\n\t\t\t\tformat.html { render json: @task }\n\t\t\t\tformat.json { render json: @task }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @task = Task.new(task_params)\n @task.users << current_user\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @task = Task.new(task_params)\n @task = current_user.tasks.build(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, success: t('.notice') }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.member_id = current_member.id\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n set_user\n @task = @user.tasks.new(task_params) \n if @task.save\n respond_to do |format|\n format.js {}\n end\n end\n\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, serializer: TaskSerializer\n else\n render json: { error: t('task_create_error') }, status: :unprocessable_entity\n end\n end"
]
| [
"0.70283276",
"0.6979206",
"0.69347423",
"0.68283695",
"0.67829514",
"0.67596644",
"0.6630701",
"0.6628671",
"0.6620221",
"0.6580558",
"0.6576762",
"0.6564267",
"0.6546276",
"0.65427387",
"0.65413153",
"0.6502328",
"0.64934987",
"0.6488791",
"0.6481077",
"0.6477163",
"0.6459977",
"0.6454827",
"0.64535725",
"0.6449457",
"0.6440653",
"0.6439433",
"0.6438902",
"0.64353186",
"0.6432698",
"0.6425242"
]
| 0.7100527 | 0 |
PUT /people_tasks/1 PUT /people_tasks/1.json | def update
@tasks_person = TasksPerson.find(params[:id])
respond_to do |format|
if @tasks_person.update_attributes(params[:tasks_person])
format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @tasks_person.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end",
"def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end",
"def edit_user_task\n task = Task.find(params[:id])\n \n if task.update(task_params)\n render json: {task: task, status: 201} \n else\n render json: {errors: task.errors.full_message , status: 422}\n end\n end",
"def edit_task\n puts 'edit task method'\n @task = Task.find_by(id: params[:id])\n @task.update(name: params[:new_name])\n\n render :json => @task.as_json(:only => [:id, :name])\n end",
"def update\n task = Task.find(params[:id])\n if task.update(task_params)\n render json: task\n else\n render_errors(task)\n end\n end",
"def update\n @user = current_user\n begin\n @task = Task.for_user(@user).find(params[:id])\n @task.change!(params[:task][:action])\n success = true\n error = nil\n rescue => e\n success = false\n error = e.message\n end\n render json: { task: (@task.constructor rescue nil), success: success, error: error }\n end",
"def update\n task = @task_list.tasks.find(params[:id])\n task.update_attributes(task_params)\n render nothing: true\n end",
"def update\n @task = Task.find_by(id: params[:id])\n if @task.update(task_params)\n render json: { message: I18n.t('task.update.success') }, status: 200\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n @task.update(task_params)\n end",
"def update\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to :action => :index, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_task\n respond_to do |format|\n if @task.update!(task_params)\n format.html\n format.json { respond_with_bip(@task) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task.update(task_params)\n format.json { render :show, status: :ok, location: @task }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @task.update(task_param)\n render json: get_task_hash(@task)\n else\n render json: @task.errors.full_messages\n end\n end",
"def update\n Task.associate_task(params:params, task: @task)\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = @project.tasks.find(params[:id])\n #@task = @project.tasks.update!(task_params)\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to project_url(@task), notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to action: \"index\" }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tbegin\n\t\t\t\tif @task.update(task_params)\n\t\t\t\t\tformat.html { redirect_to @task, notice: 'Task was successfully updated.' }\n\t\t\t\t\tformat.json { render json: @task, status: :ok }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :edit }\n\t\t\t\t\tformat.json { render json: @task.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\trescue ActiveRecord::RecordInvalid => error\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: { \"error\": error.message }, status: :ok }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @task.update(task_params)\n render :show, status: :ok, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n @task = Task.find(params[:id])\n @task.update(task_params)\n\n redirect_to tasks_path(@task)\n end",
"def update\n if @task.update(task_params)\n render :show, status: :ok\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n @task.update(task_params)\n redirect_to tasks_path\n end",
"def update\n @task = Task.find(params[:id])\n @task.update(task_params)\n #@task.save\n redirect_to tasks_path(@task)\n end",
"def update\n if @task.update(task_params)\n render json: @task, status: :ok, location: @task, include: [:user, :column], except: [:user_id, :column_id]\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.7054414",
"0.701209",
"0.701209",
"0.68201935",
"0.67519337",
"0.66676843",
"0.6646136",
"0.66448426",
"0.6598996",
"0.6573599",
"0.65337265",
"0.6518665",
"0.6455328",
"0.64218044",
"0.6417866",
"0.6416317",
"0.63909566",
"0.63806975",
"0.63777274",
"0.63777274",
"0.63777274",
"0.63671726",
"0.6363744",
"0.6348332",
"0.6340916",
"0.63404524",
"0.63380927",
"0.6335173",
"0.6335173",
"0.6335173"
]
| 0.71400964 | 0 |
DELETE /people_tasks/1 DELETE /people_tasks/1.json | def destroy
@tasks_person = TasksPerson.find(params[:id])
@tasks_person.destroy
respond_to do |format|
format.html { redirect_to people_tasks_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy\n name = @task.name\n @task.destroy\n\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end",
"def destroy\n @user_task = UserTask.find(params[:id]).task\n @user_task.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tasks_url }\n format.json { head :no_content }\n end\n end",
"def delete_user_task\n task = Task.find(params[:id])\n\n if task.destroy\n render json: {message: 'Task successfully deleted!'}\n else\n render json: task.errors.full_messages, status: 402\n end\n end",
"def destroy\n @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to user_tasks_url }\n format.json { head :no_content }\n end\n end",
"def delete_user_task\n task = Task.find(params[:id])\n if task.destroy\n render json: {message: 'Task successfully deleted!'}\n else\n render json: task.errors.full_messages, status: 402\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :ok }\n end\n end",
"def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end",
"def destroy\n @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task = Node.find(params[:id])\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_path}\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @task_entry.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end"
]
| [
"0.7278031",
"0.7105234",
"0.71013814",
"0.7084282",
"0.7056598",
"0.7056598",
"0.70548373",
"0.7045825",
"0.7032664",
"0.7031984",
"0.70243746",
"0.70174325",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.700849",
"0.6993263",
"0.69781923",
"0.6976344",
"0.6976344",
"0.6976344"
]
| 0.7748938 | 0 |
Updates the jira web.xml file with the soulwing (CAS library) authentication configuration | def config_web_xml()
web_xml = File.readlines(self.web_xml()).map do |line|
if line =~ /#{web_xml_token}/
template = File.open("#{DEPLOYER_HOME}/resources/jira_cas_web.xml") { |f| f.read() }
line + ERB.new(template).result(self.send(:binding))
else
line
end
end
File.open(self.web_xml(), "w") do |io|
web_xml.each { |line| io.puts(line) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_auth\r\n send_request_cgi({\r\n 'uri' => normalize_uri(target_uri.path.to_s, 'login.jsp'),\r\n 'method' => 'POST',\r\n 'cookie' => \"atlassian.xsrf.token=#{@xsrf_token}; #{@session_id}\",\r\n 'vars_post' => {\r\n 'os_username' => datastore['HttpUsername'],\r\n 'os_password' => datastore['HttpPassword'],\r\n 'os_destination' => '',\r\n 'user_role' => '',\r\n 'atl_token' => '',\r\n 'login' => 'Log+In'\r\n }\r\n })\r\n end",
"def add_authentication(xml)\n xml.tag! :Authentication do\n xml.tag! :client, @options[:login]\n xml.tag! :password, @options[:password]\n end\n end",
"def add_authentication(xml)\n xml.tag! :Authentication do\n xml.tag! :client, @options[:login]\n xml.tag! :password, @options[:password]\n end\n end",
"def configure(jira_url:, jira_username:, jira_api_token:)\n warn \"danger-jira_sync plugin configuration is missing jira_url\" if jira_url.blank?\n warn \"danger-jira_sync plugin configuration is missing jira_username\" if jira_username.blank?\n warn \"danger-jira_sync plugin configuration is missing jira_api_token\" if jira_api_token.blank?\n\n @jira_client = JIRA::Client.new(\n site: jira_url,\n username: jira_username,\n password: jira_api_token,\n context_path: \"\",\n auth_type: :basic\n )\n end",
"def set_basic_auth(config, options)\n if (login = options['login']) && (password = options['password'])\n \"#{login}:#{password}\"\n elsif (login = config.fetch('user.login') && (password = config.fetch('user.password')))\n \"#{login}:#{password}\"\n else\n nil\n end\n end",
"def update_web_application_security(doc)\n wasec = doc.elements.to_a('//webAppSecurity')\n if wasec.empty?\n @logger.debug('sso - update detects no webAppSecurity config - add it')\n add_web_app_security(doc)\n else\n srs = doc.elements.to_a('//webAppSecurity[@ssoRequireSSL]')\n if srs.empty?\n @logger.debug('sso - update detects existing webAppSecurity with no ssoRequireSSL - update it')\n update_wasec(doc, wasec)\n end\n end\n end",
"def authentication\n auth = \"\"\n auth << \"--username #{variable(:scm_username)} \" if variable(:scm_username)\n auth << \"--password #{variable(:scm_password)} \" if variable(:scm_password)\n auth << \"--no-auth-cache\" if !auth.empty?\n auth\n end",
"def update_configuration(xml, options = {})\n client = extract_client!(options)\n\n # The Artifactory api requires a content type of 'application/xml'.\n # See http://bit.ly/1l2IvZY\n headers = { \"Content-Type\" => \"application/xml\" }\n client.post(\"/api/system/configuration\", xml, headers)\n end",
"def jira_password\n jira_password = @pd_api_token || ENV['JIRA_PASSWORD']\n raise 'AlertForJira.jira_password has not been configured' unless jira_password\n jira_password\n end",
"def index\n @username = session[:cas_user]\n @login_url = CASClient::Frameworks::Rails::Filter.login_url(self)\n end",
"def configure_login_credentials\n # Clear saved cookie\n Utilities.remove_cookie\n\n account = prompt_for_account\n Utilities.log(\"Trying to login...\")\n session = Communication::SessionManager.new(account)\n session.login(force: true) do\n Utilities.log(\"Success (#{session.myself[:full_name]}).\", { type: :success })\n end\n rescue LogworkException::InvalidCredentials\n Utilities.log(\"Invalid username or password.\", { type: :error })\n rescue LogworkException::APIResourceNotFound, LogworkException::NotSuccessStatusCode\n Utilities.log(\"Seems that you have entered an invalid JIRA Server URL.\", { type: :error })\n end",
"def config(username, password, headers)\n @resource = Resource.new(URI.join(BASE_URI, VERSION), :user => username, :password => password, :headers => headers)\n end",
"def authenticate!\n response = self.AuthenticateUser(\n { :username => config[:username], :password => config[:password] },\n :is_authenticate => true,\n :allow_reauthenticate => false)\n\n auth_data = {\n :retailer_guid => response['RetailerGuid'],\n :authenticated => response['Authenticated'],\n :token => response['Token'],\n :ics_user_id => response['ICSUserID']\n }\n\n if !auth_data[:authenticated]\n raise AuthenticationError, 'authentication failed'\n end\n\n self.retailer_guid = auth_data[:retailer_guid]\n\n self.auth_header = {\n \"wsdl:AuthenticationResult\" => {\n \"wsdl:RetailerGuid\" => auth_data[:retailer_guid],\n \"wsdl:Authenticated\" => auth_data[:authenticated],\n \"wsdl:Token\" => auth_data[:token],\n \"wsdl:ICSUserID\" => auth_data[:ics_user_id],\n }\n }\n\n @authenticated = true\n end",
"def authenticate( req )\n\t\treq.server.log_error \"StageLogger {%d}>> in RubyAuthenHandler authenticate(%p)\" % \n\t\t\t[ Process.pid, req ]\n\n\t\treq.auth_type = 'Basic'\n\t\treq.auth_name = 'StageLogger'\n\t\treq.user = 'stagelogger'\n\n\t\treturn Apache::OK\n\tend",
"def auth\n cfg_get(:auth)\n end",
"def update_config_xml_File\n Puppet.alert(\" begin: update_config_xml_File \")\n file_name = get_value4key(\"ps_config_home\", resource[:web_location_attrib]) + \"/webserv/\"\n file_name += get_value4key(\"webdomainname\", resource[:webdomain_attrib]) + \"/config/config.xml\"\n text = File.read(file_name)\n ##new_contents = text.gsub(/listen-port>443/, \"listen-port>\" + get_value4key(\"webadminserverhttps\", resource[:webadmin_server_attrib] ) )\n new_contents1 = text.gsub(/9999/, get_value4key(\"webadminserverhttp\", resource[:webadmin_server_attrib] ) )\n\n File.open(file_name, \"w\") {|file| file.puts new_contents1 }\n Puppet.alert(\" end : update_config_xml_File \")\n end",
"def cas_authenticate(username,password,request)\n cas_base_url = SETTINGS.cas[:host]\n client = CASClient::Client.new(\n :cas_base_url => cas_base_url\n )\n\n service_url = read_service_url(request) \n\n # get login ticket for cas\n session[\"cas_lt\"] = client.request_login_ticket\n\n credentials = { \n :username => username,\n :password => password,\n :service => service_url,\n :lt => session[\"cas_lt\"]\n }\n\n # send login data to cas server\n uri = URI.parse(\"#{cas_base_url}/login\") unless uri.kind_of? URI\n req = Net::HTTP::Post.new(uri.path)\n req.use_ssl = (uri.scheme == 'https')\n if req.use_ssl?\n req.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n req.set_form_data(credentials)\n cas_login = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n\n response = CASClient::LoginResponse.new(cas_login)\n session[:cas_ticket] = response.ticket\n\n # we create a ServiceTicket object out of this\n st = read_ticket(response.ticket, service_url)\n\n # at this point we get a service ticket and we validate it\n validation = client.validate_service_ticket(st) unless st.nil?\n\n if validation.success\n session[:access_token] = st.user\n end unless validation.nil?\n\n return session[:access_token]\n end",
"def save\r\n SystemConfig.set :auth, to_h, true\r\n end",
"def post_config(url_prefix, xml)\n url_prefix = URI.escape(\"#{@jenkins_path}#{url_prefix}\")\n http = Net::HTTP.start(@server_ip, @server_port)\n request = Net::HTTP::Post.new(\"#{url_prefix}\")\n puts \"[INFO] PUT #{url_prefix}\" if @debug\n request.basic_auth @username, @password\n request.body = xml\n request.content_type = 'application/xml'\n response = http.request(request)\n response.code\n end",
"def auth\n @auth ||= Savon.client(\n wsdl: AUTH_WSDL,\n headers: { 'Authorization' => \"Basic #{@auth_code}\", 'SOAPAction' => [''] },\n env_namespace: :soapenv,\n logger:,\n log: true,\n log_level: @log_level,\n pretty_print_xml: true\n )\n end",
"def auth\n cfg_get(:auth)\n end",
"def config_seraph_config_xml()\n seraph_xml = File.readlines(self.seraph_config_xml()).map do |line|\n if m = /(#{Regexp.quote(self.seraph_config_xml_auth_class_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{self.cas_authenticator_class()}#{m.post_match}\"\n self.debug(new_str)\n new_str\n elsif m = /(#{Regexp.quote(self.seraph_config_xml_logout_url_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{self.cas_server_url()}/logout#{m.post_match}\"\n self.debug(new_str)\n new_str\n else\n line\n end\n end\n \n File.open(self.seraph_config_xml(), \"w\") do |io|\n seraph_xml.each { |line| io.puts(line) }\n end\n end",
"def jira_client\n options = {\n :username => @username,\n :password => @password,\n :site => @url,\n :context_path => \"\",\n :auth_type => :basic,\n :use_ssl => true\n }\n JIRA::Client.new(options)\n end",
"def set_auth(username, password)\r\n @http_client.http_adapter.set_auth(username, password)\r\n end",
"def credentials\n @credentials ||= WebCredentials.new(self.config['user'], self.config['password'], self.config['domain'])\n end",
"def login(username, pwd)\n # we don't really need the @login_token. If login fails, an exception will be thrown\n @login_token = @jira.login(username, pwd)\n puts \"Logged in user #{username} to Jira with access token #{@login_token}\" if @dry_run\n @login_token\n end",
"def add_authentication(_, request)\n request.headers['X-User-Email'] = self.class.api_user_email\n request.headers['X-User-Token'] = self.class.api_token\n end",
"def authenticate(session, cookies)\n session['account_id'] = id\n session['organization_id'] = organization_id\n refresh_credentials(cookies)\n self\n end",
"def add_web_app_security(doc)\n @logger.debug('sso - in add_web_app_security')\n wasec = REXML::Element.new('webAppSecurity', doc.root)\n wasec.add_attribute('ssoRequireSSL', 'true')\n end",
"def authentication\n username = config[:svn_username]\n return \"\" unless username\n result = \"--username #{config[:svn_username]} \"\n result << \"--password #{config[:svn_password]} \"\n result\n end"
]
| [
"0.58678955",
"0.5813508",
"0.5813508",
"0.54553145",
"0.52606964",
"0.5175465",
"0.51485616",
"0.51173985",
"0.510662",
"0.504985",
"0.5040798",
"0.50070447",
"0.49489963",
"0.49272862",
"0.49161395",
"0.4902212",
"0.48999223",
"0.48954642",
"0.4858142",
"0.48515493",
"0.48039505",
"0.47914228",
"0.47889253",
"0.47756872",
"0.4773604",
"0.47659677",
"0.4764106",
"0.47582394",
"0.47527733",
"0.4750069"
]
| 0.5831531 | 1 |
Shortcut to jira entityengine.xml file | def entityengine_xml()
"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/entityengine.xml"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_entityengine_xml()\n ee_xml = File.readlines(self.entityengine_xml()).map do |line|\n if m = /(#{Regexp.quote(self.entityengine_xml_db_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{entityengine_db}#{m.post_match}\"\n self.debug(new_str)\n new_str\n elsif m = /(#{Regexp.quote(self.entityengine_xml_schema_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{self.entityengine_schema()}#{m.post_match}\"\n self.debug(new_str)\n new_str\n else\n line\n end\n end\n \n File.open(self.entityengine_xml(), \"w\") do |io|\n ee_xml.each { |line| io.puts(line) }\n end\n end",
"def xml\n @entry ||= open(entry_url).read\n rescue => e\n raise RuntimeError, \"coult not open entry url: #{entry_url} : \\n#{e}\"\n end",
"def run\n super\n\n # first, ensure we're fingerprinted\n require_enrichment\n\n uri = _get_entity_name\n html = http_get_body(\"https://URL/plugins/servlet/oauth/users/icon-uri?consumerUri=https://www.whatismyip.com/\")\n \n if html =~ /<title>What Is My IP/ \n _create_linked_issue(\"atlassian_jira_oauth_plugin_ssrf\", {\n proof: {\n response_body: html\n }\n })\n end\n \n end",
"def entity(name, project, *attributes)\n path = Pathname.new(\"lib\").join(project, \"entities\", \"#{name}.rb\")\n\n class_name = Hanami::Utils::String.new(name).classify\n content = <<-EOF\nclass #{class_name}\n include Hanami::Entity\n attributes #{attributes.map { |a| \":#{a}\" }.join(', ')}\nend\nEOF\n\n rewrite(path, content)\n end",
"def xml; end",
"def entity\n raise \"No entity class defined for #{self.class}\"\n end",
"def engine_environment_id\n\n @eei ||= new_fei(\n :workflow_definition_url => 'ee',\n :workflow_definition_name => 'ee',\n :workflow_instance_id => '0',\n :expression_name => EN_ENVIRONMENT)\n end",
"def description\n \"This task hits the Corpwatch API and creates an entity for all found entities.\"\nend",
"def test_entity_replacement\n source = %q{<!DOCTYPE foo [\n <!ENTITY % YN '\"Yes\"'>\n <!ENTITY WhatHeSaid \"He said %YN;\">]>\n <a>&WhatHeSaid;</a>}\n\n d = REXML::Document.new( source )\n dt = d.doctype\n assert_equal( '\"Yes\"', dt.entities[ \"YN\" ].value )\n assert_equal( 'He said \"Yes\"', dt.entities[ \"WhatHeSaid\" ].value )\n assert_equal( 'He said \"Yes\"', d.elements[1].text )\n end",
"def config_web_xml()\n web_xml = File.readlines(self.web_xml()).map do |line|\n if line =~ /#{web_xml_token}/\n template = File.open(\"#{DEPLOYER_HOME}/resources/jira_cas_web.xml\") { |f| f.read() }\n line + ERB.new(template).result(self.send(:binding))\n else\n line\n end\n end\n \n File.open(self.web_xml(), \"w\") do |io|\n web_xml.each { |line| io.puts(line) }\n end \n end",
"def entity content\n end",
"def entity entity_id\n raw(\"&#{entity_id};\")\n end",
"def jira_url\n config.jira_url\n end",
"def changeset(message=\"Story:#{PTID} Implement awesome feature\")\n xml =<<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<changeset>\n <author-date type=\"datetime\">2010-05-26T17:22:11Z</author-date>\n <author-email>[email protected]</author-email>\n <author-id type=\"integer\">1</author-id>\n <author-name>Toby Matejovsky</author-name>\n <committer-date type=\"datetime\">2010-05-26T17:22:11Z</committer-date>\n <committer-email>[email protected]</committer-email>\n <committer-id type=\"integer\">1</committer-id>\n <committer-name>Toby Matejovsky</committer-name>\n <created-at type=\"datetime\">2010-05-26T17:22:11Z</created-at>\n <id type=\"integer\">3564</id>\n <message>#{message}</message>\n <repository-id type=\"integer\">6</repository-id>\n <revision>4f657b17281aaae24284bfd15e47f9c279049f9b</revision>\n</changeset>\nEOF\n end",
"def entities; end",
"def entities _args\n \"entities _args;\" \n end",
"def entity(index)\n get_field_from_relationship(workspace_id(index), @fields_extra[:entity])\n end",
"def getText\n if defined?($otrunkHelperScript)\n otImport($otrunkHelperScript)\n @otrunkHelper = OTrunkHelper.new\n end\n\n otImport($xmlReportScript) if defined?($xmlReportScript)\n \n init\n if $action\n actionStr = $action.string\n else\n actionStr = \"default_template\"\n end\n eval(actionStr)\nend",
"def run\n parsed_project_uri = parse_gitlab_uri(_get_entity_name)\n\n _set_entity_detail('project_name', parsed_project_uri.project)\n _set_entity_detail('project_uri', _get_entity_name)\n _set_entity_detail('project_account', parsed_project_uri.account)\n _set_entity_detail('repository_public', repo_public?(_get_entity_name))\n end",
"def engine_name\n @engine_name\n end",
"def entitydecl content\n end",
"def entityID\n end",
"def entityID\n end",
"def xml_for_ref_entity(co_elem)\n meta = {\"container\" => co_elem.add_element(\"ctx:#{@label}\")}\n\n if @metadata.length > 0 or @format\n meta[\"metadata-by-val\"] = meta[\"container\"].add_element(\"ctx:metadata-by-val\")\n if @format\n meta[\"format\"] = meta[\"metadata-by-val\"].add_element(\"ctx:format\")\n meta[\"format\"].text = \"info:ofi/fmt:xml:xsd:#{@format}\"\n\n if @metadata.length > 0\n meta[\"metadata\"] = meta[\"metadata-by-val\"].add_element(\"ctx:metadata\")\n meta[\"format_container\"] = meta[\"metadata\"].add_element(\"rft:#{@format}\")\n meta[\"format_container\"].add_namespace(@abbr, meta[\"format\"].text)\n meta[\"format_container\"].add_attribute(\"xsi:schemaLocation\", meta[\"format\"].text + \" http://www.openurl.info/registry/docs/info:ofi/fmt:xml:xsd:\" + @format)\n @metadata.each do |k, v|\n meta[k] = meta[\"format_container\"].add_element(\"#{@abbr}:#{k}\")\n meta[k].text = v\n end\n end\n end\n end\n if @reference[\"format\"]\n meta[\"metadata-by-ref\"] = meta[\"container\"].add_element(\"ctx:metadata-by-ref\")\n meta[\"ref_format\"] = meta[\"metadata-by-ref\"].add_element(\"ctx:format\")\n meta[\"ref_format\"].text = @reference[\"format\"]\n meta[\"ref_loc\"] = meta[\"metadata-by-ref\"].add_element(\"ctx:location\")\n meta[\"ref_loc\"].text = @reference[\"location\"]\n end\n\n @identifiers.each do |id|\n # Yes, if there's more than one, meta[\"identifier\"] will get\n # overwritten with last. I don't think this is a problem, cause\n # meta[\"identifier\"] isn't used anywhere.\n meta[\"identifier\"] = meta[\"container\"].add_element(\"ctx:identifier\")\n meta[\"identifier\"].text = id\n end\n if @private_data\n meta[\"private-data\"] = meta[\"container\"].add_element(\"ctx:private-data\")\n meta[\"private-data\"].text = @private_data\n end\n co_elem\n end",
"def string_for_class_entity e\n comment = \n\"/** <#(brief description of #{e.name})#>\n\n <#(comprehensive description)#>\n*/\"\n end",
"def issue_endpoint(issue_key)\n \"issue/#{issue_project_key(issue_key)}\"\n end",
"def run\n super\n\n # first, ensure we're fingerprinted\n require_enrichment\n\n uri = _get_entity_name\n\n headers = {}\n headers[\"Content-Type\"] = \"%{#context['com.opensymphony.xwork2.dispatcher.HttpServletResponse'].addHeader('X-Intrigue-Struts',888*888)}.multipart/form-data\"\n response = http_request(:get, uri, nil, headers) # no auth\n\n unless response\n _log_error \"No response received\"\n return\n end\n\n # show the response in the logs \n response.headers.each {|x| _log \"#{x}: #{response.headers[x]}\"}\n \n if response.headers['X-Intrigue-Struts'] =~ /788544/\n \n instance_details = { \n proof: \"#{response.headers['X-Intrigue-Struts']}\",\n }\n _create_linked_issue \"apache_struts_jakarta_parser\", instance_details\n end\n end",
"def add_jira_tickets_to_omnifocus ()\n # Get the open Jira issues assigned to you\n results = Issue.query_results\n if results.nil?\n puts \"No results from Jira\"\n exit\n end\n puts \"\\\"#{QUERY}\\\" returned #{results.size} results from #{JIRA_BASE_URL}\"\n\n # Iterate through resulting issues.\n results.each do |jira_id, issue|\n jira_issues[jira_id] = issue # cache results\n add_task(issue)\n end\nend",
"def import_xml_common(ent, node)\n REXML::XPath.each(node, \"./ctx:identifier\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"}) do |id|\n ent.add_identifier(id.get_text.value) if id and id.has_text?\n end\n\n priv = REXML::XPath.first(node, \"./ctx:private-data\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"})\n ent.set_private_data(priv.get_text.value) if priv and priv.has_text?\n\n ref = REXML::XPath.first(node, \"./ctx:metadata-by-ref\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"})\n if ref\n reference = {}\n ref.to_a.each do |r|\n if r.name == \"format\"\n reference[:format] = r.get_text.value if r.get_text\n else\n reference[:location] = r.get_text.value\n end\n end\n ent.set_reference(reference[:location], reference[:format])\n end\n end",
"def body_edit_temp_name\n 'octopolo_issue'\n end"
]
| [
"0.6398696",
"0.5248405",
"0.48659834",
"0.48535803",
"0.48516288",
"0.4803681",
"0.47713846",
"0.47287074",
"0.4721212",
"0.4706146",
"0.4703447",
"0.46532586",
"0.46518803",
"0.46467614",
"0.46467504",
"0.46376362",
"0.46367082",
"0.46184602",
"0.45869818",
"0.45743212",
"0.45682156",
"0.45681936",
"0.45681936",
"0.45558015",
"0.45448038",
"0.4515579",
"0.45148888",
"0.4502298",
"0.44933435",
"0.44737068"
]
| 0.7211464 | 0 |
Updates the jira entityengine.xml file with the correct database configs | def config_entityengine_xml()
ee_xml = File.readlines(self.entityengine_xml()).map do |line|
if m = /(#{Regexp.quote(self.entityengine_xml_db_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{entityengine_db}#{m.post_match}"
self.debug(new_str)
new_str
elsif m = /(#{Regexp.quote(self.entityengine_xml_schema_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{self.entityengine_schema()}#{m.post_match}"
self.debug(new_str)
new_str
else
line
end
end
File.open(self.entityengine_xml(), "w") do |io|
ee_xml.each { |line| io.puts(line) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_db\n require \"#{File.dirname(__FILE__)}/../conf/db_schema.rb\"\n Knj::Db::Revision.new.init_db(\"debug\" => false, \"db\" => @db, \"schema\" => Openall_time_applet::DB_SCHEMA)\n end",
"def entityengine_xml()\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/entityengine.xml\"\n end",
"def update!(**args)\n @database_version = args[:database_version] if args.key?(:database_version)\n @instance_host = args[:instance_host] if args.key?(:instance_host)\n @sql_engine = args[:sql_engine] if args.key?(:sql_engine)\n end",
"def updateDefect(defect, jiralink)\n begin\n return @db.execute(\"update v1link set jira_link=\\\"#{jiralink}\\\" where defect = \\\"#{defect}\\\"\")\n rescue SQLite3::Exception => e\n print \"Exception (v1persist): #{e}\"\n end\n end",
"def edit_build(carbon_home,location,usr,pwd,url,dialects,driver) \n\n\tFile.open(File.join(Dir.pwd,'build.xml')) do |config_file|\n\t\t# Open the document and edit the port (carbon.xml)\n\t\tconfig = Document.new(config_file)\n\t\n\t\tconfig.root.elements[14].attributes['value']=carbon_home\n\n\t\tif(dialects == 'mysql')\n\t\t\tconfig.root.elements[21].attributes['value']=location\n\t\t\tconfig.root.elements[22].attributes['value']=usr\n\t\t\tconfig.root.elements[23].attributes['value']=pwd\n\t\t\tconfig.root.elements[24].attributes['value']=url\n\t\t\tconfig.root.elements[25].attributes['value']=dialects\n\t\t\tconfig.root.elements[26].attributes['value']=driver\n\t\tend\n\n\t\tif(dialects == 'oracle')\n\t\t\tconfig.root.elements[15].attributes['value']=location\n\t\t\tconfig.root.elements[16].attributes['value']=usr\n\t\t\tconfig.root.elements[17].attributes['value']=pwd\n\t\t\tconfig.root.elements[18].attributes['value']=url\n\t\t\tconfig.root.elements[19].attributes['value']=dialects\n\t\t\tconfig.root.elements[20].attributes['value']=driver\n\t\tend\n\n\t\n\t\n\t\t# Write the result to a new file.\n\t\tformatter = REXML::Formatters::Default.new\n\t\tFile.open(File.join('result_build.xml'), 'w') do |result|\n\t\tformatter.write(config, result)\n\t\tend\n\t\n\tend \n\n\tFile.delete(File.join('build.xml'))\n\tFile.rename( File.join('result_build.xml'),File.join('build.xml') )\n\n\t#call buld.xml to setup the connection with database\n\tif(dialects == 'mysql')\n\t\tif RUBY_PLATFORM.downcase.include?(\"mswin\")\n\t\t\t`ant startServerWindows -Dscript=normal -Ddatabase.name=mysql`\n\t\telsif RUBY_PLATFORM.downcase.include?(\"linux\")\n\t\t\t`ant startServerUnix -Dscript=normal -Ddatabase.name=mysql`\n\t\tend\n\tend\n\n\tif(dialects == 'oracle')\n\t\tif RUBY_PLATFORM.downcase.include?(\"mswin\")\n\t\t\t`ant startServerWindows -Dscript=normal -Ddatabase.name=oracle`\n\t\telsif RUBY_PLATFORM.downcase.include?(\"linux\")\n\t\t\t`ant startServerUnix -Dscript=normal -Ddatabase.name=oracle`\n\t\tend\n\tend\n\nend",
"def update!(**args)\n @assertion_schema = args[:assertion_schema] if args.key?(:assertion_schema)\n @database_suffix = args[:database_suffix] if args.key?(:database_suffix)\n @default_database = args[:default_database] if args.key?(:default_database)\n @default_location = args[:default_location] if args.key?(:default_location)\n @default_schema = args[:default_schema] if args.key?(:default_schema)\n @schema_suffix = args[:schema_suffix] if args.key?(:schema_suffix)\n @table_prefix = args[:table_prefix] if args.key?(:table_prefix)\n @vars = args[:vars] if args.key?(:vars)\n end",
"def update_configuration(xml, options = {})\n client = extract_client!(options)\n\n # The Artifactory api requires a content type of 'application/xml'.\n # See http://bit.ly/1l2IvZY\n headers = { \"Content-Type\" => \"application/xml\" }\n client.post(\"/api/system/configuration\", xml, headers)\n end",
"def modify_database_yml_as_needed!\n require 'yaml'\n\n db_yaml_file = File.join('config', 'database.yml')\n db_yaml = YAML.load_file(db_yaml_file)\n\n unless db_yaml[rails_env]\n notify(\"adding environment '#{rails_env}' to database.yml\") do\n test_content = db_yaml['test']\n raise \"No default database.yml entry for 'test'?!?\" unless test_content\n\n db_yaml[rails_env] = test_content.dup\n new_yaml = YAML.dump(db_yaml)\n # Get rid of the silly '---' line that YAML.dump puts at the start.\n new_yaml = new_yaml.split(\"\\n\").map { |l| l unless l =~ /^\\-+$/i }.compact.join(\"\\n\")\n File.open(db_yaml_file, 'w') { |f| f.puts new_yaml }\n end\n end\n end",
"def update!(**args)\n @mysql_rdbms = args[:mysql_rdbms] if args.key?(:mysql_rdbms)\n @oracle_rdbms = args[:oracle_rdbms] if args.key?(:oracle_rdbms)\n @postgresql_rdbms = args[:postgresql_rdbms] if args.key?(:postgresql_rdbms)\n end",
"def import con, table, xml\n # Get all node in xml file that contains product information\n temp = getNodeValues(xml, '*//Products/Product')\n\n # Prepair data for fields that will add to database\n if !temp.nil? and temp.count > 0\n temp.each do |item|\n $catalog = item.at_xpath('Catalog').text\n if item.xpath('Price/Currency').text == 'USD'\n $price = '$' + '%0.2f' % item.xpath('Price/PriceTier/ListPrice').text.to_f\n else\n $price = ''\n end\n $appstatus = 'unknown'\n $sku = item.at_xpath('SkuCode').text\n $shorttitle = item.at_xpath('Name').text\n $platformcompatibility = ''\n $lpu = ''\n $lp2 = ''\n $lp1 = ''\n $lgs = ''\n $lex = ''\n $lpr = ''\n # --Process locale\n $us = ''\n $ca = ''\n $uk = ''\n $ie = ''\n $au = ''\n $row = ''\n $fr_fr = ''\n $fr_ca = ''\n $fr_row = ''\n $character = ''\n if $catalog.include? 'US_'\n $us = 'X'\n end\n if $catalog.include? 'UK_'\n $uk = 'X'\n end\n if $catalog.include? 'IE_'\n $ie = 'X'\n end\n if $catalog.include? 'AU_'\n $au = 'X'\n end\n if $catalog.include? 'ROW_'\n $row = 'X'\n end\n if $catalog.include? 'FR_FR_'\n $fr_fr = 'X'\n end\n if $catalog.include? 'FR_CA_'\n $fr_ca = 'X'\n else\n if $catalog.include? 'CA_'\n $ca = 'X'\n end\n end\n if $catalog.include? 'FR_ROW_'\n $fr_row = 'X'\n end\n # --End Process locale\n\n item.at_xpath('Attributes').elements.to_a.each do |i| # begin each child\n case i.attributes['Key'].text\n # Go live date maps with release date in database\n when \"releaseDate\"\n $golivedate = i.at_xpath('Values').text\n\n # long name maps with longtitle in database\n when \"longName_en\", \"longName_fr\"\n $longtitle = i.at_xpath('Values').text\n\n # Gender maps with gender in database\n when \"gender_en\", \"gender_fr\"\n genderflag = 0\n i.elements.to_a.each do |m|\n if m.name == 'Values'\n $gender = m.text.capitalize\n genderflag += 1\n end\n if genderflag == 2\n $gender = 'All'\n end\n end\n\n # Age Range Begin maps with agefrommonths in database\n when \"ageRangeBegin\"\n $agefrommonths = i.at_xpath('Values').text\n\n # Age Range End maps with agefrommonths in database\n when \"ageRangeEnd\"\n $agetomonths = i.at_xpath('Values').text\n\n # Skill maps with skill in database\n when \"skill_en\", \"skill_fr\"\n $skill = i.at_xpath('Values').text\n\n # curriculum maps with curriculum in database\n when \"curriculum_en\", \"curriculum_fr\"\n $curriculum = i.at_xpath('Values').text\n\n # Long Description maps with longdesc in database\n when \"longDescription_en\", \"longDescription_fr\"\n $longdesc = i.at_xpath('Values').text.gsub(\"\\\"\", \"\\\\\\\"\")\n\n # credits will map later\n $credits = 'unknown'\n\n #---------platformcompatibility process\n # worksWithLeapPad2_en maps with platformcompatibility in database\n when \"worksWithLeapPad2_en\", \"worksWithLeapPad2_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"LeapPad 2,\\n\"\n $lp2 = 'X'\n end\n # worksWithLeapPad_en maps with platformcompatibility in database\n when \"worksWithLeapPad_en\", \"worksWithLeapPad_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"LeapPad Explorer,\\n\"\n $lp1 = 'X'\n end\n # worksWithLeapPadUltra_en maps with platformcompatibility in database\n when \"worksWithLeapPadUltra_en\", \"worksWithLeapPadUltra_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"LeapPad Ultra,\\n\"\n $lpu = 'X'\n end\n # worksWithLeapster_en maps with platformcompatibility in database\n when \"worksWithLeapster_en\", \"worksWithLeapster_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"Leapster Explorer,\\n\"\n $lex = 'X'\n end\n # worksWithLeapsterGS_en maps with platformcompatibility in database\n when \"worksWithLeapsterGS_en\", \"worksWithLeapsterGS_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"LeapsterGS Explorer,\\n\"\n $lgs = 'X'\n end\n # worksWithLeapReader_en maps with platformcompatibility in database\n when \"worksWithLeapReader_en\", \"worksWithLeapReader_fr\"\n if i.at_xpath('Values').text == \"true\"\n $platformcompatibility += \"Leapreader,\\n\"\n $lpr = 'X'\n end\n #---------End platformcompatibility process\n\n # Special Message maps with speacialmsg in database\n when \"specialMessage_en\", \"specialMessage_fr\"\n if i.at_xpath('Values') != nil\n $specialmsg = i.at_xpath('Values').text\n end\n\n # Teaches maps with teaches in database\n when \"teaches_en\", \"teaches_fr\"\n $teaches = i.at_xpath('Values').text\n\n # License legal will be added later\n $licenselegal = 'unknown'\n\n # licensedContent will be added later\n $licnonlic = 'unknown'\n\n # License will be added later\n $license = 'unknown'\n\n # language will be added later\n $language = 'unknown'\n\n # Pricetier maps with pricetier\"\n when \"pricingTier\"\n $pricetier = i.at_xpath('Values').text + ' - ' + $price\n\n # contentType maps with category\n when \"contentType\"\n $category = i.at_xpath('Values').text\n\n # character maps with character\n when \"character\"\n i.elements.to_a.each do |m|\n if m.name=='Values'\n $character << ',' unless $character == ''\n $character << m.text\n end #if\n end # each\n\n end # end case\n end # end each child\n\n # Excute query to add data to database\n # -- Begin Process if sku has ready existed\n rowsku = con.query \"SELECT sku,us,ca,uk,ie,au,row,fr_fr,fr_ca,fr_row from #{table}\"\n skuexisted = 0\n rowsku.each_hash do |rs|\n if $sku == rs['sku']\n if rs['us'].downcase == 'x'\n $us = 'X'\n end\n if rs['ca'].downcase == 'x'\n $ca = 'X'\n end\n if rs['uk'].downcase == 'x'\n $uk = 'X'\n end\n if rs['ie'].downcase == 'x'\n $ie = 'X'\n end\n if rs['au'].downcase == 'x'\n $au = 'X'\n end\n if rs['row'].downcase == 'x'\n $row = 'X'\n end\n if rs['fr_fr'].downcase == 'x'\n $fr_fr = 'X'\n end\n if rs['fr_ca'].downcase == 'x'\n $fr_ca = 'X'\n end\n if rs['fr_row'].downcase == 'x'\n $fr_row = 'X'\n end\n\n skuexisted = 1\n break\n end # end if\n end # end each\n # -- End Process if sku has ready existed\n if skuexisted == 1\n if $pricetier.include? '$'\n con.query \"UPDATE #{table}\n SET golivedate = '#{$golivedate}', appstatus = '#{$appstatus}', shorttitle = \\\"#{$shorttitle}\\\", longtitle = \\\"#{$longtitle}\\\", gender = '#{$gender}', agefrommonths = '#{$agefrommonths}', agetomonths = '#{$agetomonths}', skill = '#{$skill}', curriculum = \\\"#{$curriculum}\\\", longdesc = \\\"#{$longdesc}\\\", credits = '#{$credits}', platformcompatibility = '#{$platformcompatibility}', specialmsg = \\\"#{$specialmsg}\\\",teaches = \\\"#{$teaches}\\\",licenselegal = '#{$licenselegal}', licnonlic = '#{$licnonlic}', license = '#{$license}', language = '#{$language}', pricetier = '#{$pricetier}', category = '#{$category}', us = '#{$us}', ca = '#{$ca}', uk = '#{$uk}', ie = '#{$ie}', au = '#{$au}', row = '#{$row}', fr_fr = '#{$fr_fr}', fr_ca = '#{$fr_ca}', fr_row = '#{$fr_row}', lpu = '#{$lpu}', lp2 = '#{$lpu}', lp1 = '#{$lp1}', lgs = '#{$lgs}', lex = '#{$lex}', lpr = '#{$lpr}', lf_char = \\\"#{$character}\\\"\n WHERE sku = '#{$sku}';\"\n else\n con.query \"UPDATE #{table}\n SET golivedate = '#{$golivedate}', appstatus = '#{$appstatus}', shorttitle = \\\"#{$shorttitle}\\\", longtitle = \\\"#{$longtitle}\\\", gender = '#{$gender}', agefrommonths = '#{$agefrommonths}', agetomonths = '#{$agetomonths}', skill = '#{$skill}', curriculum = \\\"#{$curriculum}\\\", longdesc = \\\"#{$longdesc}\\\", credits = '#{$credits}', platformcompatibility = '#{$platformcompatibility}', specialmsg = \\\"#{$specialmsg}\\\",teaches = \\\"#{$teaches}\\\",licenselegal = '#{$licenselegal}', licnonlic = '#{$licnonlic}', license = '#{$license}', language = '#{$language}', category = '#{$category}', us = '#{$us}', ca = '#{$ca}', uk = '#{$uk}', ie = '#{$ie}', au = '#{$au}', row = '#{$row}', fr_fr = '#{$fr_fr}', fr_ca = '#{$fr_ca}', fr_row = '#{$fr_row}', lpu = '#{$lpu}', lp2 = '#{$lpu}', lp1 = '#{$lp1}', lgs = '#{$lgs}', lex = '#{$lex}', lpr = '#{$lpr}', lf_char = \\\"#{$character}\\\"\n WHERE sku = '#{$sku}';\"\n end\n else\n con.query \"INSERT INTO #{table} (golivedate,appstatus,sku,shorttitle,longtitle,gender,agefrommonths,agetomonths,skill,curriculum,longdesc,credits,platformcompatibility,specialmsg,teaches,licenselegal,licnonlic,license,language,pricetier,category,us,ca,uk,ie,au,row,fr_fr,fr_ca,fr_row,lpu,lp2,lp1,lgs,lex,lpr,lf_char)\n VALUES ('#{$golivedate}','#{$appstatus}','#{$sku}',\\\"#{$shorttitle}\\\",\\\"#{$longtitle}\\\",'#{$gender}','#{$agefrommonths}','#{$agetomonths}','#{$skill}',\\\"#{$curriculum}\\\",\\\"#{$longdesc}\\\",'#{$credits}','#{$platformcompatibility}',\\\"#{$specialmsg}\\\",\\\"#{$teaches}\\\",'#{$licenselegal}','#{$licnonlic}',\n '#{$license}','#{$language}','#{$pricetier}','#{$category}','#{$us}','#{$ca}','#{$uk}','#{$ie}','#{$au}','#{$row}','#{$fr_fr}','#{$fr_ca}','#{$fr_row}','#{$lpu}','#{$lp2}','#{$lp1}','#{$lgs}','#{$lex}','#{$lpr}',\\\"#{$character}\\\");\"\n end\n end # enc each parent\n else\n raise 'An error occurred. Please try again or contact your administrator.'\n end\n end",
"def update(doc, server_dir, driver_dir, available_jars, number_instances)\n # handle client driver jars\n @driver_dir = driver_dir\n @client_jars_string = ClientJarUtils.client_jars_string(ClientJarUtils.get_jar_names(available_jars, @reg_ex))\n @logger.debug(\"client jars string #{@client_jars_string}\")\n # Find the datasource config for this service instance.\n datasources = find_datasource(doc, number_instances)\n if datasources.empty?\n @logger.debug(\"datasource #{@datasource_id} not found, creating it\")\n create_datasource(doc, @driver_dir)\n else\n modify_datasource(datasources)\n # Find the jdbc driver. Use the jdbc driver to find the shared library.\n jdbc_driver = find_jdbc_driver(doc, datasources)\n modify_jdbc_driver(jdbc_driver)\n library = find_shared_library(doc, jdbc_driver)\n ClientJarUtils.update_library(doc, @service_name, library, @fileset_id, @driver_dir, @client_jars_string)\n\n # Do not update datasource attributes. Specifically, do not update the jndi name. We do need to update the properties attributes though.\n # find the instance that contains the properties. Liberty only allows one instance of properties.\n properties_element = find_datasource_properties(datasources)\n properties_element.add_attribute('databaseName', @db_name)\n properties_element.add_attribute('user', @user)\n properties_element.add_attribute('password', @password)\n properties_element.add_attribute('serverName', @host)\n properties_element.add_attribute('portNumber', @port)\n modify_properties(properties_element)\n Utils.add_features(doc, @features)\n end\n end",
"def patch_database_config(path)\n db_config_path = File.expand_path('config/database.yml', path)\n content = <<-YML\ndevelopment:\n url: <%= ENV['DATABASE_URL'] %>\ntest:\n url: <%= ENV['DATABASE_URL'] %>\n YML\n open(db_config_path, 'w').write(content)\n end",
"def orm_patches_applied; end",
"def update_job_config(job_name, xml)\n jobs.update(job_name, xml.to_s)\n end",
"def update!\n entity_json = [{ name: @source_file.entity_name, entries: expanded_entries }]\n\n response = @api_client.update_entities_request(entity_json)\n\n handle_response(response, :entity)\n end",
"def update\n @entity = Entity.find(params[:id])\n @entity.attr_vals.clear\n EntitiesHelper.setAttrVals(params[:attr_vals], @entity)\n @entity.attributes = params[:databaseformalizer_entity]\n \n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_config_xml_File\n Puppet.alert(\" begin: update_config_xml_File \")\n file_name = get_value4key(\"ps_config_home\", resource[:web_location_attrib]) + \"/webserv/\"\n file_name += get_value4key(\"webdomainname\", resource[:webdomain_attrib]) + \"/config/config.xml\"\n text = File.read(file_name)\n ##new_contents = text.gsub(/listen-port>443/, \"listen-port>\" + get_value4key(\"webadminserverhttps\", resource[:webadmin_server_attrib] ) )\n new_contents1 = text.gsub(/9999/, get_value4key(\"webadminserverhttp\", resource[:webadmin_server_attrib] ) )\n\n File.open(file_name, \"w\") {|file| file.puts new_contents1 }\n Puppet.alert(\" end : update_config_xml_File \")\n end",
"def configure\n configure_databases_yml\n configure_propel_ini\n end",
"def database_configuration; end",
"def database_configuration; end",
"def mte_prepare_updating; send_request_to_mite(\"update\"); end",
"def updateEdOrgs(dbName)\n @db = @conn[dbName]\n @edorg_collection = @db[EDORG_COLLECTION]\n nupdated = 0\n @edorg_collection.find.each do |row|\n did_update = 0\n if row[TYPE_FIELD] != TYPE_VALUE_EDORG\n @edorg_collection.update({\"_id\" => row[\"_id\"]},{\"$set\" => {TYPE_FIELD => TYPE_VALUE_EDORG}})\n did_update = 1\n end\n body = row[BODY_FIELD]\n unless body[PARENT_REF_FIELD].nil?\n parent_refs = [ body[PARENT_REF_FIELD] ]\n @edorg_collection.update({\"_id\" => row[\"_id\"]},{\"$set\" => {BODY_FIELD+\".\"+PARENT_REF_FIELD => parent_refs}})\n did_update = 2\n end\n nupdated += 1 if did_update > 0\n end\n puts \"Updated \" + nupdated.to_s + \" document(s)\"\nend",
"def update!(**args)\n @oracle_tables = args[:oracle_tables] if args.key?(:oracle_tables)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def push_fedora(cx)\n\tComponent.reset_counters( cx.id, :master_files )\n\ttitle = (cx.title or cx.content_desc.strip)\n\tputs \"[#{cx.id}]: #{title}\"\n\tFedora.create_or_update_object( cx, title )\n\tcx.update_attribute( :date_dl_ingest, Time.now ) if cx.date_dl_ingest.nil? \n\tcx.update_metadata('allxml')\n\tcx.save! \n\tcx.master_files.each { |mf| mf.update_metadata( 'allxml' ); mf.save! } \nend",
"def update(database)\n update_record = database[:fields].inject([]) do |result, field|\n result << \"#{database[:id]}.#{field[:field]} = #{set_value(field[:value])}\"\n result\n end.join(\"\\n\")\n\n <<-EOS.chomp\n#{read(database)}\n#{update_record}\nresponse[:_db_errors][:#{database[:id]}] = #{database[:id]}.errors.full_messages unless #{database[:id]}.save\n EOS\n end",
"def sync_epe!(request_issues_update, request_issue, index)\n end_product_establishment = request_issue.end_product_establishment\n end_product = end_product_establishment.result\n prev_status = end_product_establishment.synced_status\n end_product_establishment.update!(synced_status: nil)\n end_product_establishment.sync!\n @logs.push(\"#{Time.zone.now} ContentionNotFoundRemediation::Log - Number: #{index}\"\\\n \" RIU ID: #{request_issues_update.id}. RI ID: #{request_issue.id}. EPE ID: #{end_product_establishment.id}.\"\\\n \" Previous EPE status: #{prev_status}. EP status: #{end_product.status_type_code}.\"\\\n \" Resetting EPE synced_status to null. Syncing Epe with EP.\")\n end",
"def update!(**args)\n @csv_source = args[:csv_source] if args.key?(:csv_source)\n @entity_id_field = args[:entity_id_field] if args.key?(:entity_id_field)\n end",
"def InitializeXMLdb\n end",
"def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @audit_configs = args[:audit_configs] if args.key?(:audit_configs)\n @bindings = args[:bindings] if args.key?(:bindings)\n @etag = args[:etag] if args.key?(:etag)\n @version = args[:version] if args.key?(:version)\n end"
]
| [
"0.57058316",
"0.56865704",
"0.51462287",
"0.5125705",
"0.5029244",
"0.50115347",
"0.48502994",
"0.4849333",
"0.4825936",
"0.480926",
"0.4796927",
"0.47873434",
"0.4776646",
"0.47746593",
"0.47675866",
"0.47366372",
"0.47258762",
"0.47244507",
"0.47176516",
"0.47176516",
"0.47017598",
"0.46865425",
"0.46557042",
"0.46543518",
"0.46467882",
"0.464507",
"0.4644034",
"0.4638651",
"0.46310288",
"0.46309963"
]
| 0.6346941 | 0 |
Shortcut to jira seraphconfig.xml file | def seraph_config_xml()
"#{self.build_dir()}/src/webapp/WEB-INF/classes/seraph-config.xml"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_seraph_config_xml()\n seraph_xml = File.readlines(self.seraph_config_xml()).map do |line|\n if m = /(#{Regexp.quote(self.seraph_config_xml_auth_class_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{self.cas_authenticator_class()}#{m.post_match}\"\n self.debug(new_str)\n new_str\n elsif m = /(#{Regexp.quote(self.seraph_config_xml_logout_url_token())})/.match(line)\n self.debug(m[0])\n new_str = \"#{m.pre_match}#{self.cas_server_url()}/logout#{m.post_match}\"\n self.debug(new_str)\n new_str\n else\n line\n end\n end\n \n File.open(self.seraph_config_xml(), \"w\") do |io|\n seraph_xml.each { |line| io.puts(line) }\n end\n end",
"def jira_url\n config.jira_url\n end",
"def config_file\n CONFIG_FILE\n end",
"def configuration_file_path; end",
"def inject_arkivo_config\n inject_into_file 'config/initializers/hyrax.rb', after: /^Hyrax\\.config do.*$/ do\n \"\\n # Hyrax can integrate with Zotero's Arkivo service for automatic deposit\\n\" \\\n \" # of Zotero-managed research items.\\n\" \\\n \" # Defaults to false. See README for more info\\n\" \\\n \" config.arkivo_api = true\\n\"\n end\n end",
"def configure_jira options\n url = options[:url]\n\n # This feels a bit weird, but can't see an obviously better way to share\n # command-global variables.\n options[:client] = Datamine::Jira::REST.factory url\nend",
"def config_file\n FilePath.new(@directory, 'tc-config.xml')\n end",
"def config\n<<-EOL\nManage the environment's config. Can use this to download the environment's config to jack/cfg folder or upload and apply config in jack/cfg folder to the environment.\n\nExample:\n\n$ jack config get hi-web-stag-1\n\nFor more info:\n\n$ jack help config\n\n$ jack config help upload\n\n$ jack config help download\nEOL\n end",
"def john_config_file\n ::File.join(::Msf::Config.data_directory, \"jtr\", \"john.conf\")\n end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config\n respond_to { |format| format.xml }\n end",
"def config\n @config_file\n end",
"def named_configuration_file\n super\n end"
]
| [
"0.5723253",
"0.56698084",
"0.56275",
"0.56238925",
"0.5587852",
"0.55189437",
"0.5508963",
"0.5494081",
"0.54921",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.54324466",
"0.5427807",
"0.5401616",
"0.5389811"
]
| 0.6575264 | 0 |
Updates the jira seraph_config.xml file with the soulwing authenticator. | def config_seraph_config_xml()
seraph_xml = File.readlines(self.seraph_config_xml()).map do |line|
if m = /(#{Regexp.quote(self.seraph_config_xml_auth_class_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{self.cas_authenticator_class()}#{m.post_match}"
self.debug(new_str)
new_str
elsif m = /(#{Regexp.quote(self.seraph_config_xml_logout_url_token())})/.match(line)
self.debug(m[0])
new_str = "#{m.pre_match}#{self.cas_server_url()}/logout#{m.post_match}"
self.debug(new_str)
new_str
else
line
end
end
File.open(self.seraph_config_xml(), "w") do |io|
seraph_xml.each { |line| io.puts(line) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\r\n SystemConfig.set :auth, to_h, true\r\n end",
"def add_authentication(xml)\n xml.tag! :Authentication do\n xml.tag! :client, @options[:login]\n xml.tag! :password, @options[:password]\n end\n end",
"def add_authentication(xml)\n xml.tag! :Authentication do\n xml.tag! :client, @options[:login]\n xml.tag! :password, @options[:password]\n end\n end",
"def update_ssl_config(doc)\n sso_ssl = doc.elements.to_a(\"//ssl[@id='ssoSSLConfig']\")\n if sso_ssl.empty?\n @logger.debug('sso - update detects no custom ssl config - add it')\n add_custom_ssl(doc)\n else\n @logger.debug('sso - update detects custom ssl config - update it')\n update_custom_ssl(doc, sso_ssl)\n end\n end",
"def make_jass_conf(file_name, keytab, principal)\n str = %(Client {\\n) +\n %( com.sun.security.auth.module.Krb5LoginModule required\\n) +\n %( useTicketCache=false\\n) +\n %( useKeyTab=true\\n) +\n %( keyTab=\"#{keytab}\"\\n) +\n %( principal=\"#{principal}\";\\n};)\n File.open(file_name, 'w') { |file| file.write str }\n end",
"def refresh_login\n @max_api_version = appliance_api_version\n @token = login\n self\n end",
"def seraph_config_xml()\n \"#{self.build_dir()}/src/webapp/WEB-INF/classes/seraph-config.xml\"\n end",
"def configure(jira_url:, jira_username:, jira_api_token:)\n warn \"danger-jira_sync plugin configuration is missing jira_url\" if jira_url.blank?\n warn \"danger-jira_sync plugin configuration is missing jira_username\" if jira_username.blank?\n warn \"danger-jira_sync plugin configuration is missing jira_api_token\" if jira_api_token.blank?\n\n @jira_client = JIRA::Client.new(\n site: jira_url,\n username: jira_username,\n password: jira_api_token,\n context_path: \"\",\n auth_type: :basic\n )\n end",
"def sync_configuration\n end",
"def update_config\n if File.directory?(yolo_dir) and File.exist?(yaml_path)\n @yaml = YAML::load_file yaml_path\n update_yaml_setting(@yaml, \"deployment\", \"api_token\", \"example\")\n update_yaml_setting(@yaml, \"deployment\", \"team_token\", \"example\")\n end\n end",
"def apply_grip_config(config)\n if !config.is_a?(Array)\n config = [config]\n end\n config.each do |entry|\n if !entry.key?('control_uri')\n next\n end\n client = PubControlClient.new(entry['control_uri'])\n if entry.key?('control_iss')\n client.set_auth_jwt({'iss' => entry['control_iss']}, entry['key'])\n end\n super_add_client(client)\n end\n end",
"def flush\n if @property_flush[:ensure] == :present\n config = <<-EOF\n <RIBCL VERSION=\"2.1\">\n <LOGIN USER_LOGIN=\"Administrator\" PASSWORD=\"password\">\n <USER_INFO MODE=\"write\">\n <ADD_USER USER_NAME = \"#{resource[:ilo_name]}\" USER_LOGIN = \"#{resource[:name]}\" PASSWORD = \"#{resource[:password]}\">\n <ADMIN_PRIV value = \"#{to_enable(resource[:ilo_admin])}\"/>\n <REMOTE_CONS_PRIV value = \"#{to_enable(resource[:ilo_remote])}\"/>\n <RESET_SERVER_PRIV value = \"#{to_enable(resource[:ilo_power])}\"/>\n <VIRTUAL_MEDIA_PRIV value = \"#{to_enable(resource[:ilo_media])}\"/>\n <CONFIG_ILO_PRIV value = \"#{to_enable(resource[:ilo_config])}\"/>\n </ADD_USER>\n </USER_INFO>\n </LOGIN>\n </RIBCL>\n EOF\n elsif @property_flush[:ensure] == :absent\n config = <<-EOF\n <RIBCL VERSION=\"2.1\">\n <LOGIN USER_LOGIN=\"Administrator\" PASSWORD=\"password\">\n <USER_INFO MODE=\"write\">\n <DELETE_USER USER_LOGIN = \"#{resource[:name]}\"/>\n </USER_INFO>\n </LOGIN>\n </RIBCL>\n EOF\n else\n config = <<-EOF\n <RIBCL VERSION=\"2.1\">\n <LOGIN USER_LOGIN=\"Administrator\" PASSWORD=\"password\">\n <USER_INFO MODE=\"write\">\n <MOD_USER USER_LOGIN = \"#{resource[:name]}\">\n <USER_NAME value = \"#{resource[:ilo_name]}\"/>\n <PASSWORD value = \"#{resource[:password]}\"/>\n <ADMIN_PRIV value = \"#{to_enable(resource[:ilo_admin])}\"/>\n <REMOTE_CONS_PRIV value = \"#{to_enable(resource[:ilo_remote])}\"/>\n <RESET_SERVER_PRIV value = \"#{to_enable(resource[:ilo_power])}\"/>\n <VIRTUAL_MEDIA_PRIV value = \"#{to_enable(resource[:ilo_media])}\"/>\n <CONFIG_ILO_PRIV value = \"#{to_enable(resource[:ilo_config])}\"/>\n </MOD_USER>\n </USER_INFO>\n </LOGIN>\n </RIBCL>\n EOF\n end\n file = File.new('/tmp/hponcfg', 'w')\n file.write(config)\n file.close\n execute(\"hponcfg -f /tmp/hponcfg\")\n end",
"def update_config email = nil, pin = nil, debug = false\n\n if ! email && ! pin\n STDERR.puts 'missing email and / or pin'\n STDERR.puts 'usage: lightwaverf update [email protected] 1111'\n return\n end\n\n # Login to LightWaveRF Host server\n uri = URI.parse 'https://lightwaverfhost.co.uk/manager/index.php'\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true if uri.scheme == 'https'\n\n # Thanks Fitz http://lightwaverfcommunity.org.uk/forums/topic/pauly-lightwaverf-command-line-not-working/\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n data = 'pin=' + pin + '&email=' + email\n headers = { 'Content-Type'=> 'application/x-www-form-urlencoded' }\n resp, data = http.post uri.request_uri, data, headers\n\n if resp and resp.body\n rooms = self.get_rooms_from resp.body, debug\n # Update 'room' element in LightWaveRF Gem config file\n if rooms.any?\n config = self.get_config\n config['room'] = rooms\n self.put_config config\n debug and ( p '[Info - LightWaveRF Gem] Updated config with ' + rooms.size.to_s + ' room(s): ' + rooms.to_s )\n else\n debug and ( p '[Info - LightWaveRF Gem] Unable to update config: No active rooms or devices found' )\n end\n else\n debug and ( p '[Info - LightWaveRF Gem] Unable to update config: No response from Host server' )\n end\n self.get_config\n end",
"def set_authenticator\n @authenticator = Authenticator.find(params[:id])\n end",
"def set_active_resource_credentials\n puts \"Changing credentials to something\"\n if @photocracy_mode\n $PHOTOCRACY = true\n username = APP_CONFIG[:PHOTOCRACY_USERNAME]\n password = APP_CONFIG[:PHOTOCRACY_PASSWORD]\n else\n $PHOTOCRACY = false\n username = APP_CONFIG[:PAIRWISE_USERNAME]\n password = APP_CONFIG[:PAIRWISE_PASSWORD]\n end\n active_resource_classes = [Choice, Density, Prompt, Question, Session]\n active_resource_classes.each do |klass|\n klass.user = username\n klass.password = password\n end\nend",
"def authenticate!\n response = self.AuthenticateUser(\n { :username => config[:username], :password => config[:password] },\n :is_authenticate => true,\n :allow_reauthenticate => false)\n\n auth_data = {\n :retailer_guid => response['RetailerGuid'],\n :authenticated => response['Authenticated'],\n :token => response['Token'],\n :ics_user_id => response['ICSUserID']\n }\n\n if !auth_data[:authenticated]\n raise AuthenticationError, 'authentication failed'\n end\n\n self.retailer_guid = auth_data[:retailer_guid]\n\n self.auth_header = {\n \"wsdl:AuthenticationResult\" => {\n \"wsdl:RetailerGuid\" => auth_data[:retailer_guid],\n \"wsdl:Authenticated\" => auth_data[:authenticated],\n \"wsdl:Token\" => auth_data[:token],\n \"wsdl:ICSUserID\" => auth_data[:ics_user_id],\n }\n }\n\n @authenticated = true\n end",
"def update_keystore_config(doc)\n keystore = doc.elements.to_a(\"//keyStore[@id='ssoKeyStore']\")\n if keystore.empty?\n @logger.debug('sso - update detects no ssoKeyStore ssl config - add it')\n add_key_store(doc)\n else\n @logger.debug('sso - update detects ssoKeyStore ssl config - update it')\n update_key_store(doc, keystore)\n end\n end",
"def authenticator\n @authenticator ||=\n Peatio::Auth::JWTAuthenticator.new(@keypub)\n end",
"def configure!(issuer:, logger: nil)\n @issuer = issuer\n @auth_server_id = issuer.split('/').last\n end",
"def save_config_signature\n Origen.app.session.origen_sim[\"#{id}_config\"] = config\n end",
"def update_configuration(xml, options = {})\n client = extract_client!(options)\n\n # The Artifactory api requires a content type of 'application/xml'.\n # See http://bit.ly/1l2IvZY\n headers = { \"Content-Type\" => \"application/xml\" }\n client.post(\"/api/system/configuration\", xml, headers)\n end",
"def party_config\n copy_file \"party-authority.xml\", \"tmp/party-authority.xml\", verbose: true\n end",
"def update_devise_rb\n inject_into_file 'config/initializers/devise.rb', after: \"config.sign_out_via = :delete\\n\" do <<-'RUBY'\n\n # Config Social Keys to create the SignUps\n config.sign_out_via = :get\n config.omniauth :facebook, ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"], { :scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}\n config.omniauth :twitter, ENV[\"TWITTER_KEY\"], ENV[\"TWITTER_SECRET\"], { :scope => 'r_fullprofile, r_emailaddress', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}\n config.omniauth :linkedin, ENV[\"LINKEDIN_KEY\"], ENV[\"LINKEDIN_SECRET\"], { :scope => 'r_fullprofile r_emailaddress', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}\n config.omniauth :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: \"user, public_repo\"\n config.omniauth :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], {}\n\n RUBY\n end\n\n puts 'Check your config/initializers/devise.rb which was updated to have the Social Keys used (OmniAuth linked to devise)'.colorize(:light_green)\n puts 'UPDATE your config/initializers/devise.rb if you need more data from the user, CHANGING the: SCOPE'.colorize(:light_yellow)\n end",
"def config_jira_application_properties()\n jira_props = File.readlines(self.jira_application_properties()).map do |line|\n if m = /(#{Regexp.quote(jira_home_token)})/.match(line)\n self.debug(m[0])\n new_str = \"#{self.jira_home_token()} #{self.data_dir()}\"\n self.debug(new_str)\n new_str\n else\n line\n end\n end\n \n File.open(self.jira_application_properties(), \"w\") do |io|\n jira_props.each { |line| io.puts(line) }\n end\n end",
"def user=(value)\n conf['api']['user'] = value\n end",
"def configure_login_credentials\n # Clear saved cookie\n Utilities.remove_cookie\n\n account = prompt_for_account\n Utilities.log(\"Trying to login...\")\n session = Communication::SessionManager.new(account)\n session.login(force: true) do\n Utilities.log(\"Success (#{session.myself[:full_name]}).\", { type: :success })\n end\n rescue LogworkException::InvalidCredentials\n Utilities.log(\"Invalid username or password.\", { type: :error })\n rescue LogworkException::APIResourceNotFound, LogworkException::NotSuccessStatusCode\n Utilities.log(\"Seems that you have entered an invalid JIRA Server URL.\", { type: :error })\n end",
"def start_configuration\n post \"/setup/api/configure\", password_hash\n end",
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def inject_arkivo_config\n inject_into_file 'config/initializers/hyrax.rb', after: /^Hyrax\\.config do.*$/ do\n \"\\n # Hyrax can integrate with Zotero's Arkivo service for automatic deposit\\n\" \\\n \" # of Zotero-managed research items.\\n\" \\\n \" # Defaults to false. See README for more info\\n\" \\\n \" config.arkivo_api = true\\n\"\n end\n end",
"def update!(**args)\n @apple_sign_in_config = args[:apple_sign_in_config] if args.key?(:apple_sign_in_config)\n @client_id = args[:client_id] if args.key?(:client_id)\n @client_secret = args[:client_secret] if args.key?(:client_secret)\n @enabled = args[:enabled] if args.key?(:enabled)\n @name = args[:name] if args.key?(:name)\n end"
]
| [
"0.5323589",
"0.50956655",
"0.50956655",
"0.501868",
"0.49512613",
"0.4914384",
"0.49026796",
"0.48615596",
"0.48091918",
"0.47805527",
"0.4772286",
"0.47704378",
"0.47487733",
"0.47434014",
"0.47265384",
"0.46971887",
"0.46937457",
"0.46818027",
"0.4681231",
"0.46799538",
"0.46630886",
"0.46554145",
"0.46504638",
"0.46396735",
"0.46372354",
"0.46135488",
"0.46081445",
"0.4582582",
"0.456849",
"0.45590606"
]
| 0.62757486 | 0 |
Shortcut to jiraapplication.properties file | def jira_application_properties()
"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/jira-application.properties"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_jira_application_properties()\n jira_props = File.readlines(self.jira_application_properties()).map do |line|\n if m = /(#{Regexp.quote(jira_home_token)})/.match(line)\n self.debug(m[0])\n new_str = \"#{self.jira_home_token()} #{self.data_dir()}\"\n self.debug(new_str)\n new_str\n else\n line\n end\n end\n \n File.open(self.jira_application_properties(), \"w\") do |io|\n jira_props.each { |line| io.puts(line) }\n end\n end",
"def project_setting(key)\n data.config[config[:environment]][key]\n end",
"def jira_url\n config.jira_url\n end",
"def show\n puts \"------------------- settings -------------------\"\n puts \"Application: #{application}\"\n puts \"Branch: #{branch}\"\n puts \"Stage: #{stage}\"\n puts \"Deployer: #{deployer}\"\n puts \"Local User: #{get_local_user}\"\n puts \"URL: #{webhook_url}\"\n puts \"------------------------------------------------\"\n end",
"def configure_jira options\n url = options[:url]\n\n # This feels a bit weird, but can't see an obviously better way to share\n # command-global variables.\n options[:client] = Datamine::Jira::REST.factory url\nend",
"def properties_file\n File.join(@base_path, PROP_FILE)\n end",
"def env_key; end",
"def jira_password\n jira_password = @pd_api_token || ENV['JIRA_PASSWORD']\n raise 'AlertForJira.jira_password has not been configured' unless jira_password\n jira_password\n end",
"def pref\n raw_config = File.open(\"#{Rails.root}/config/prefs.yml\")\n config = YAML.load(raw_config)\n #$prefs=config.symbolize_keys[:pref]\n config\n end",
"def read_rc_file\n \n file = File.join( ENV['HOME'], '.app47rc') \n if File.exists? file \n config_options = YAML.load_file( file) \n @options.merge!( config_options)\n end\n\n end",
"def package_settings\n properties[:package_settings]\n end",
"def package_settings\n properties[:package_settings]\n end",
"def readProperties\n @propertiesFile = \"#{File.expand_path(File.dirname($0))}/../../conf/ddbt.properties\"\n @properties = {}\n IO.foreach(@propertiesFile) do |line|\n @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n end\nend",
"def gitlab\n conf['dashboard']['gitlab']\n end",
"def default_properties_file\n # try the current directory\n file = File.expand_path(DEF_PROP_FILE_NM)\n return file if File.exists?(file)\n # try home\n home = ENV['HOME'] || ENV['USERPROFILE'] || '~'\n file = File.expand_path(DEF_PROP_FILE_NM, home)\n file if File.exists?(file)\n end",
"def configuration_file_path; end",
"def settings\n CircleCi.request(@conf, \"/project/#{username}/#{project}/settings\").get\n end",
"def library_properties_path\n path + LIBRARY_PROPERTIES_FILE\n end",
"def john_config_file\n ::File.join(::Msf::Config.data_directory, \"jtr\", \"john.conf\")\n end",
"def configuration_file\n gitpusshuten_root + '/config.rb'\n end",
"def maillist_prod_file\n Origen.app.root.to_s + '/config/maillist_prod.txt'\n end",
"def project_properties(project=nil)\n\n project = \"#{project}:\" if project\n\n result = %x[gradle #{project}properties]\n convert_values_to_hash result\n end",
"def config\n read WorkDir::BLUEPRINT_CONFIG_FILENAME\n end",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def config_file\n File.join(install_directory,'installer','rails_installer.yml')\n end",
"def write_properties\n buf = @repo_properties.merge( { :name => name,\n :description => description,\n :created => created\n } ).to_json\n File.open( properties_file, 'w' ) { |f| f.write buf }\n end",
"def expected_local_properties\n {\n 'enabled' => 'true',\n 'async-replication' => 'true',\n 'availability-enabled' => 'true',\n 'directory-deployed' => 'true',\n 'context-root' => '/myapp',\n 'location' => \"file:#{self.location_as_dir}/\",\n 'property.defaultAppName' => 'myapp',\n 'property.archiveType' => 'war',\n 'property.appLocation' => \"file:#{self.location_as_dir}/\",\n 'property.java-web-start-enabled' => 'false',\n 'deployment-order' => '100'\n }\n end",
"def application_config\n config = YAML.load_file(Rails.root + 'config/custom_cloud.yml')\n config['application']\nrescue Errno::ENOENT\n {}\nend"
]
| [
"0.7073052",
"0.56550014",
"0.5536825",
"0.54226947",
"0.53882706",
"0.5310216",
"0.52702767",
"0.5259988",
"0.51730555",
"0.51256853",
"0.5119314",
"0.5119314",
"0.5099526",
"0.5093299",
"0.5065135",
"0.50203323",
"0.49945876",
"0.49896342",
"0.49575347",
"0.49569803",
"0.49526408",
"0.49519947",
"0.49518096",
"0.49494955",
"0.49494955",
"0.49494955",
"0.4900652",
"0.490027",
"0.48912442",
"0.48856497"
]
| 0.76433784 | 0 |
Sets the jira.home property in the file: jiraapplication.properties. | def config_jira_application_properties()
jira_props = File.readlines(self.jira_application_properties()).map do |line|
if m = /(#{Regexp.quote(jira_home_token)})/.match(line)
self.debug(m[0])
new_str = "#{self.jira_home_token()} #{self.data_dir()}"
self.debug(new_str)
new_str
else
line
end
end
File.open(self.jira_application_properties(), "w") do |io|
jira_props.each { |line| io.puts(line) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jira_application_properties()\n \"#{self.build_dir()}/src/edit-webapp/WEB-INF/classes/jira-application.properties\"\n end",
"def jruby_home\n ENV['JRUBY_HOME'] || RbConfig::CONFIG['prefix']\n end",
"def set_home\n end",
"def home\n @home ||= File.expand_path('~')\n end",
"def home\n @home ||= ENV.fetch(\"HOME\").tr(\"\\\\\", \"/\")\nend",
"def nailgun_home\n ENV['NAILGUN_HOME'] || File.expand_path('tool/nailgun', jruby_home)\n end",
"def jira_url\n config.jira_url\n end",
"def home\n ENV['HOME'] || File.expand_path('~')\n end",
"def solr_home\n @solr_home ||=\n if user_configuration_from_key('solr', 'solr_home')\n user_configuration_from_key('solr', 'solr_home')\n else\n File.join(::Rails.root, 'solr')\n end\n end",
"def set_git_urls\n self.url = GitHosting.repository_path(self) if self.url.blank?\n self.root_url = self.url if self.root_url.blank?\n end",
"def set_git_urls\n self.url = GitHosting.repository_path(self) if url.blank?\n self.root_url = url if root_url.blank?\n end",
"def set_git_urls\n self.url = git_path if url.blank?\n self.root_url = url if root_url.blank?\n end",
"def jira_site\n jira_site = @pd_api_token || ENV['JIRA_SITE']\n raise 'AlertForJira.jira_site has not been configured' unless jira_site\n jira_site\n end",
"def detect_home(set_if_missing=false)\n if(ENV['HOME'] && Pathname.new(ENV['HOME']).absolute?)\n ENV['HOME']\n else\n home = File.directory?('/root') && File.writable?('/root') ? '/root' : '/tmp'\n if(set_if_missing)\n ENV['HOME'] = home\n end\n home\n end\n end",
"def configure_jira_url\n loop do\n begin\n Configuration::ConfigurationManager\n .instance.update_jira_server_url prompt.ask(\"Please enter the JIRA Server URL:\")\n break\n rescue LogworkException::InvalidURL\n Utilities.log(\"Invalid URL\", { type: :error })\n # Break in case of rspec\n Utilities.rspec_running? && break\n end\n end\n end",
"def configure_jira options\n url = options[:url]\n\n # This feels a bit weird, but can't see an obviously better way to share\n # command-global variables.\n options[:client] = Datamine::Jira::REST.factory url\nend",
"def autoproj_gem_home; @private_autoproj || Gem.user_dir end",
"def home_path\n File.expand_path(\"~\")\n end",
"def home\n @home ||= \"#{site.local_url}\"\n end",
"def findbugs_home(*dir)\n if dir.empty?\n @findbugs_home ||= project.path_to(:findbugs)\n else\n raise \"Invalid findbugs home dir '#{dir.join(', ')}\" unless dir.size == 1\n @findbugs_home = dir[0]\n self\n end\n end",
"def home\n env.home\n end",
"def kerl_environment\n { 'HOME' => kerl_path }\n end",
"def default_properties_file\n # try the current directory\n file = File.expand_path(DEF_PROP_FILE_NM)\n return file if File.exists?(file)\n # try home\n home = ENV['HOME'] || ENV['USERPROFILE'] || '~'\n file = File.expand_path(DEF_PROP_FILE_NM, home)\n file if File.exists?(file)\n end",
"def home_path\n @ssh_home\n end",
"def home\n Buildr.application.deprecated 'Use ENV[\\'JAVA_HOME\\'] instead.'\n ENV['JAVA_HOME']\n end",
"def set_log_file_path(data_file_path)\n PureHailDB.ib_cfg_set(\"log_group_home_dir\", :string, data_file_path)\n end",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
"def server_home\n FilePath.new(@build_dir, \"homes\", \"server\").ensure_directory\n end",
"def set_data_home_dir(data_home_dir)\n PureHailDB.ib_cfg_set(\"data_home_dir\", :string, data_home_dir)\n end"
]
| [
"0.6404565",
"0.5775393",
"0.56609976",
"0.5628493",
"0.55924094",
"0.54392564",
"0.5433737",
"0.5392451",
"0.53642577",
"0.53558356",
"0.5351502",
"0.5227393",
"0.52152365",
"0.5190894",
"0.5190352",
"0.5187228",
"0.51773024",
"0.5165123",
"0.51646346",
"0.514183",
"0.51341593",
"0.5122194",
"0.5072598",
"0.50577193",
"0.50287",
"0.50274426",
"0.5016209",
"0.5016209",
"0.5001197",
"0.49948692"
]
| 0.6387023 | 1 |
Places IST banner jpg in imaages directory | def config_ist_banner()
FileUtils.cp("#{UcbDeployer::RESOURCES_DIR}/ist_banner.jpg",
"#{self.build_dir()}/src/webapp/images/")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def banner_path\n path = @path[[email protected] - 4] + '_banner.png'\n path_remote = @path_remote[0...@path_remote.length - 4] + '_banner.png'\n File.exists?(path) ? path_remote : 'https://maps.avicus.net' + '/default_map_banner.png' # May need configured\n end",
"def images_path\n @imags_path ||= File.expand_path 'images/', assets_path\n end",
"def img_path(img)\n\t # Easy peasy for normal files\n\t o = File.expand_path(img, $img_path)\n\t return o if __FILE__ !~ /\\.jar!\\//\n\t # Juggling around packages:\n\t idir = File.expand_path(\"img\", EnveCollection.home)\n\t Dir.mkdir(idir) unless Dir.exist? idir\n\t h = File.expand_path(img, idir)\n\t FileUtils.copy(o, h) unless File.exist? h\n\t h\n end",
"def image\n MAIN_CDN + \"headshots/current/168x168/#{@id}.jpg\"\n end",
"def casein_config_logo\n \t'/images/logo_ss.jpg'\n end",
"def image_jpg_path\n \"%s/app/assets/images/game_images/%s.jpg\" %[Rails.root, self.name.dehumanize]\n end",
"def img_path() \"#{$dir}/sprites.gif\"; end",
"def image_jpg\r\n directory = File.expand_path File.dirname(__FILE__)\r\n specific_filename = directory + \"/\" + \"Media/1.jpg\"\r\nend",
"def home\n @page = Page.find_or_create_by(name: \"home\")\n @images = Dir.glob(\"app/assets/images/home_banner/cropped/*.jpg\")\n @twitter_client = get_twitter_client\n end",
"def find_inspire_image\n path = Dir[image_for('', 'mobile_inspire') + '*']\n path.first.split('/').last\n end",
"def kept_images(albid)\n Dir[_(albid, \"*.jpg\")].collect do |f|\n image(albid, File.basename(f))\n end\n end",
"def IMG_PATH\n SongBugs::IMG_PATH\n end",
"def access_dir\n \"/assets/#{model.imageable_type.downcase.pluralize}/\"\n end",
"def default_image_path\n \"default_interest_images/#{name.gsub(/\\s/,'').gsub(/\\W/,'_').downcase}\"\n end",
"def copy_generated_images(parent)\n img = parent.find_inspire_image\n mobile = parent.image_for img, 'mobile_inspire'\n desktop = parent.image_for img, 'desktop_inspire'\n thumbnails = parent.image_for '', 'thumbnails'\n\n FileUtils.cp(mobile, \"#{data_path}/inspire/mobile\")\n FileUtils.cp(desktop, \"#{data_path}/inspire/desktop\")\n FileUtils.cp_r(\"#{thumbnails}/.\", \"#{data_path}/thumbnails\")\n end",
"def image_location\n src || ''\n end",
"def generate_inspire_image(image_path)\n # first empty the inspire folder\n FileUtils.rm_rf(\"#{image_for('', 'mobile_inspire')}/.\", secure: true)\n FileUtils.rm_rf(\"#{image_for('', 'desktop_inspire')}/.\", secure: true)\n image = Gg::ImageProcessing.new(\"#{satellitedir}/#{image_path}\")\n i_name = image_path.split('/').last\n image.generate(image_for(i_name, 'desktop_inspire'), 'desktop')\n image.generate(image_for(i_name, 'mobile_inspire'), 'mobile')\n end",
"def attach_image_to_lob(locator,pathtotheImage)\n\n page.attach_file(locator, File.absolute_path(pathtotheImage))\n\n end",
"def image_png\r\ndirectory = File.expand_path File.dirname(__FILE__)\r\nspecific_filename = directory + \"/\" + \"Media/shop.png\"\r\nend",
"def update_image_source(img)\n @content.gsub!(img, \"/images/\" << img.gsub(@base.gsub(\"weblog\",\"\"), \"\").gsub(\".a/\", \"\") << \".jpg\")\n end",
"def copy_image_locally(img)\n begin\n # if an image is stored on typepad servers, copy it locally\n if img =~ /typepad/\n open(\"public/images/\" << img.gsub(@base.gsub(\"weblog\",\"\"), \"\").gsub(\".a/\", \"\") << \".jpg\",\"w\").write(open(img).read)\n # update the link in the content\n update_image_source(img)\n end\n rescue\n puts \"was not able to capture \" << img << \" locally\"\n end\n end",
"def absolute_images_path\n File.join(absolute_import_dir, \"images\")\n end",
"def site_image_path(src)\n rewrite_asset_path(src.expand_url(\"#{account_site_assets}/images/\"))\n end",
"def image_path filename\n File.expand_path \"../resources/#{filename}\", __dir__\nend",
"def goth_image_full_tag(goth)\n\t\timage = image_path \"goths/#{goth.name}.jpg\"\n\t\turl = \"#{root_url.chomp('/')}#{image}\"\n\t\timage_tag url, :alt => goth.name, :title => goth.name\n\tend",
"def url\n url = \"http://#{country_imghost}/images/P/#{asin}\"\n url << \".\" << country_imgcode << \".\"\n \n url << \"_\" << @transforms.join(\"_\") << \"_\" << \".jpg\"\n end",
"def giant_path\n \"g_#{image_path}\"\n end",
"def image_folder\n Dir.glob(\"#{@location}/**/#{config['IMAGE']['image_folder']}*\", File::FNM_CASEFOLD)\n end",
"def site_image_url(src)\n rewrite_asset_path(src.expand_url(\"#{account_site_assets_url}/images/\"))\n end",
"def image(name)\n File.expand_path(\"tex/#{name}\", File.dirname(__FILE__))\nend"
]
| [
"0.6503407",
"0.63239735",
"0.6185664",
"0.6161505",
"0.6141384",
"0.6141076",
"0.6140199",
"0.60203546",
"0.59374505",
"0.5884834",
"0.58692557",
"0.5857529",
"0.58498365",
"0.5837028",
"0.5834459",
"0.583369",
"0.58140457",
"0.5797562",
"0.57962584",
"0.5750768",
"0.5750231",
"0.5701415",
"0.5700867",
"0.56572056",
"0.5647149",
"0.56346774",
"0.56176674",
"0.56145597",
"0.56113595",
"0.56103665"
]
| 0.7484696 | 0 |
Remove jars from WEBINF/lib that have been installed at the container level to avoid conflicts. | def reshuffle_jars()
FileUtils.mkdir_p("#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/")
FileUtils.cp(Dir["#{UcbDeployer::RESOURCES_DIR}/soulwing-casclient-*"],
"#{self.build_dir()}/src/edit-webapp/WEB-INF/lib/")
# These have been placed in $CATALINA_HOME/lib
["mail", "activation", "javamail", "commons-logging", "log4j"].each do |jar|
FileUtils.rm_rf(Dir["#{self.build_dir()}/src/webapp/WEB-INF/lib/#{jar}-*"])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_jcl_over_slf\n dir_glob = Dir.glob(File.join @app_dir, 'WEB-INF', 'lib', 'jcl-over-slf4*.jar')\n dir_glob.each do |f|\n File.delete f\n end\n end",
"def remove_library(lib)\n lib = lib.to_s\n\n @libraries[:start].delete lib\n @libraries[:sub_session].delete lib\n @libraries[:autoload].reject!{|_,e,| e == lib }\n @libraries[:thread].each{ |_,libs| libs.delete lib }\n @libraries[:late].delete lib\n @libraries[:late_thread].each{ |_,libs| libs.delete lib }\n\n @lib_hooks.delete lib\n end",
"def remove_library(lib)\n lib = lib.to_s\n\n @libraries[:start].delete lib\n @libraries[:sub_session].delete lib\n @libraries[:autoload].reject!{|_,e,| e == lib }\n @libraries[:thread].each{ |_,libs| libs.delete lib }\n @libraries[:late].delete lib\n @libraries[:late_thread].each{ |_,libs| libs.delete lib }\n\n @lib_hooks.delete lib\n end",
"def reset_registered_jarfiles\n @registered_jarfiles = {}\n end",
"def remove_classes_and_modules\n initialize_classes_and_modules\n end",
"def clean_runtime_dirs(options)\n dirs = []\n %w(dependencies build_dependencies repo).each do |dir|\n dirs << dir if options[dir.to_sym] == true\n end\n\n return if dirs.empty?\n\n dirs.map! { |dir| \"app-root/runtime/#{dir.gsub(/_/, '-')}/*\" }\n\n out, err, rc = run_in_container_context(\"shopt -s dotglob; rm -rf #{dirs.join(' ')}\",\n chdir: @container_dir,\n expected_exitstatus: 0)\n end",
"def clean_sprockets_assets\n manifest.clean(backups_to_keep)\n end",
"def remove_jekyll_assets(files)\n files.each {|f| f.remove_jekyll_asset }\n end",
"def remove_old_deploys\n deploys = all_deploy_names true\n\n return unless deploys.length > Sunshine.max_deploy_versions\n\n lim = Sunshine.max_deploy_versions + 1\n\n rm_deploys = deploys[0..-lim]\n rm_deploys.map!{|d| \"#{self.deploys_path}/#{d}\"}\n\n @shell.call \"rm -rf #{rm_deploys.join(\" \")}\"\n end",
"def remove\n unrealize\n remove_from_dependencies\n remove_from_dependents\n end",
"def bootstrap_cleanup\n end",
"def do_not_depend_on_this\n link_to(container_libs_directory.children, tomcat_lib) if container_libs_directory.exist?\n link_to(extra_applications_directory.children, webapps) if extra_applications_directory.exist?\n end",
"def gf_scan_existing_binary_endorsed_jars(install_dir)\n jar_extensions = ['.jar']\n gf_binary_endorsed_dir = install_dir + '/glassfish/lib/endorsed'\n if Dir.exist?(gf_binary_endorsed_dir)\n Dir.entries(gf_binary_endorsed_dir).reject { |f| File.directory?(f) || !jar_extensions.include?(File.extname(f)) }\n else\n []\n end\nend",
"def remove_python_compiled_files path\n logger.debug(\"Now removing python object and compiled files from the virtualenv\")\n Find.find(path) do |path|\n if path.end_with? '.pyc' or path.end_with? '.pyo'\n FileUtils.rm path\n end\n end\n end",
"def prune_dependencies\n class_names = @classes.map {|klass| klass.name}\n @classes.each do |klass|\n klass.dependencies = klass.dependencies.uniq.keep_if {|dep| class_names.include?(dep)}\n end\n end",
"def unloaded_libraries\n (Boson::BareRunner.all_libraries - Boson.libraries.map {|e| e.name }).sort\n end",
"def clean_app()\n wd = FileUtils.pwd()\n FileUtils.rm_f( [\n '/app/assets/*',\n '/app/components/*',\n '/app/controllers/*',\n '/app/helpers/*',\n '/app/models/*',\n '/app/views/*'\n ].collect!{|e| Dir.glob(wd + e)}.flatten.compact )\n end",
"def cleanup\n reshaper_orig_cleanup\n\n # remove some unwanted pages\n pages.delete_if do |page|\n path = page.destination(source)\n path =~ /shared\\/layouts/ or\n path =~ /shared\\/includes/\n end\n\n # remove some unwanted static files\n static_files.delete_if do |file|\n file.path =~ /shared\\/includes/ or\n file.path =~ /\\.styl$/ or # stylus files should be generated into site.css\n file.path =~ /readme\\./ # readme files are for github\n end\n\n end",
"def purgeFiles\n Dir[\"#{@pagespath}/*\"].reject{ |f| f[\"#{@pagespath}/.keep\"] }.each do |filename|\n File.delete filename\n end\n\n Dir[\"#{@assetpath}/*\"].reject{ |f| f[\"#{@pagespath}/.keep\"] }.each do |filename|\n File.delete filename\n end\n end",
"def remove_unused_dependencies\n # puts 'removing unused dependencies list.'\n dependencies = @target.dependencies\n dependencies.each do |dependency|\n dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name\n end\n end",
"def clean_remote\n to_delete = remote_assets - local_compiled_assets\n to_delete.each do |f|\n delete_remote_asset(bucket.files.get(f))\n end\n end",
"def clean_installation\n clean_paths.each { |path| FileUtils.rm_rf(path) }\n end",
"def destroy(async=true)\n basedir = @config.get(\"GEAR_BASE_DIR\")\n\n path = File.join(basedir, \".httpd.d\", \"#{container_uuid}_*\")\n FileUtils.rm_rf(Dir.glob(path))\n\n reload_all(async)\n end",
"def destroy(async=true)\n basedir = @config.get(\"GEAR_BASE_DIR\")\n\n path = File.join(basedir, \".httpd.d\", \"#{container_uuid}_*\")\n FileUtils.rm_rf(Dir.glob(path))\n\n reload_all(async)\n end",
"def clean_deploy\n FileUtils.rm_rf(Dir.glob('*'), secure: true)\n end",
"def pkg_clean\n sysprint \"#{@name} clean\"\n\n FileUtils::rm_rf(@objdir, :secure => true)\n end",
"def cleanup(prefix)\n print_header \"Cleaning up ...\"\n Constants::SOFTWARE.each do |sw|\n cmd \"rm #{prefix}/#{sw}.tar.gz; rm -rf #{prefix}/#{sw}\" if File.exist? \"#{prefix}/#{sw}.tar.gz\"\n end\n end",
"def cleanup\n\tsh 'del /F /Q .\\_site\\*'\n\t# sh 'rm -rf ./_site'\nend",
"def sync_libraries\n debug 'Syncing libraries'\n processed_paths = []\n @makefile.each_library do |lib|\n sync_library(lib)\n processed_paths << lib.target_path\n end\n # Determine libraries that should be deleted from the 'libraries' folder.\n # The above is a bit of an overstatement, as it is basically impossible\n # to detect a \"library\" in a reliable way. What we actually do is just\n # deleting \"spurious\" paths inside the 'libraries' folder.\n # Note also that Drupid is not smart enough to find libraries installed\n # inside modules or themes.\n Pathname.glob(@platform.libraries_path.to_s + '/**/*').each do |p|\n next unless p.directory?\n q = p.relative_path_from(@platform.local_path + @platform.contrib_path)\n # If q is not a prefix of any processed path, or viceversa, delete it\n if processed_paths.find_all { |pp| pp.fnmatch(q.to_s + '*') or q.fnmatch(pp.to_s + '*') }.empty?\n l = Library.new(p.basename)\n l.local_path = p\n log.action(DeleteAction.new(@platform, l))\n # Do not need to delete subdirectories\n processed_paths << q\n end\n end\n end",
"def additional_dylibs dylibs, other_lib\n dylibs_to_change(other_lib).delete_if do |d|\n basenames = dylibs.map { |lib| File.basename(lib) }\n basenames.include? File.basename(d)\n end\n end"
]
| [
"0.7207337",
"0.59160626",
"0.5915155",
"0.58779615",
"0.5759871",
"0.57521474",
"0.56346065",
"0.56267524",
"0.5559628",
"0.554475",
"0.5521686",
"0.5498694",
"0.5494546",
"0.54410636",
"0.5403568",
"0.53731227",
"0.5349069",
"0.53250724",
"0.532069",
"0.52869606",
"0.52839005",
"0.5271647",
"0.52699995",
"0.52699995",
"0.5265421",
"0.5254259",
"0.52487",
"0.522736",
"0.52231324",
"0.5221483"
]
| 0.74428827 | 0 |
Switch Roles! Print 10 Write a method, array_print_10, that puts the numbers 0 9 using an array and the each method | def array_print_10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_case\n puts \" 1 2 3\" \n for n in 0..2 do #on commence à compter à 0\n print (65+n).chr + \" \" #affiche 65.chr correspond à A en ACSII donc ensuite en ajoutant n, on a B, C, \n @case_array[n][0].print_case\n print \" | \"\n @case_array[n][1].print_case\n print \" | \"\n @case_array[n][2].print_case \n puts\n end \n end",
"def print_array(array)\n (length(array)).times do |i|\n print array[i]\n end\n # raise NotImplementedError\nend",
"def display_board(person) \n puts \" #{person[0]} | #{person[1]} | #{person[2]} \"\n puts \"-----------\"\n puts \" #{person[3]} | #{person[4]} | #{person[5]} \"\n puts \"-----------\"\n puts \" #{person[6]} | #{person[7]} | #{person[8]} \"\n \nend",
"def printArrayOutput(arrayToPrint , counter)\n \n puts \"After iteration \" + (10-counter).to_s + \":\"\n p arrayToPrint\n\n end",
"def display_board(array)\n\n puts \" #{array[0]} | #{array[1]} | #{array[2]} \"\n puts \"-----------\"\n puts \" #{array[3]} | #{array[4]} | #{array[5]} \"\n puts \"-----------\"\n puts \" #{array[6]} | #{array[7]} | #{array[8]} \"\n\nend",
"def range_print_10\n array = (0..9).to_a\narray.each do |x|\n print x\nend\n\nend",
"def print_array(array)\n\n array.length.times do |array_element|\n print \"#{array_element} \"\n end\n # raise NotImplementedError\nend",
"def print_board(array)\n system('cls')\n puts\n puts \"\\033[33m 1 2 3 4 5 6 7 8 \\033[0m\"\n array.each do |row|\n puts\"\\033[33m│\\033[0m #{(row.join\" \\033[33m││\\033[0m \")} \\033[33m│\\033[0m\"\n puts \"#{\"\\033[33m╞---╡\\033[0m\"*row.count}\"\n end\n puts \"\\033[33m╘─-─╛╘─-─╛╘─-─╛╘─-─╛╘─-─╛╘─-─╛╘─-─╛╘─-─╛\\033[0m\"\nend",
"def display_board(arry)\n print \" #{arry[0]} | #{arry[1]} | #{arry[2]} \"\n print \"-----------\"\n print \" #{arry[3]} | #{arry[4]} | #{arry[5]} \"\n print \"-----------\"\n print \" #{arry[6]} | #{arry[7]} | #{arry[8]} \"\nend",
"def print_game_board(array)\n array\n puts \"\"\"\n #{array[0]} | #{array[1]} | #{array[2]}\n ----------\n #{array[3]} | #{array[4]} | #{array[5]}\n -----------\n #{array[6]} | #{array[7]} | #{array[8]}\"\"\"\nend",
"def printHelper(array)\n array.each do |sub_array|\n sub_array.each do |tile|\n if tile < 10\n print \" #{tile} \"\n else\n print \" #{tile} \"\n end\n end\n print \"\\n\"\n end\nend",
"def display_board(arrays)\n puts \" #{arrays[0]} | #{arrays[1]} | #{arrays[2]} \"\n puts \"-----------\"\n puts \" #{arrays[3]} | #{arrays[4]} | #{arrays[5]} \"\n puts \"-----------\"\n puts \" #{arrays[6]} | #{arrays[7]} | #{arrays[8]} \"\nend",
"def display_board(board_array)\n puts \" #{board_array[0]} | #{board_array[1]} | #{board_array[2]} \"\n puts \"-----------\"\n puts \" #{board_array[3]} | #{board_array[4]} | #{board_array[5]} \"\n puts \"-----------\"\n puts \" #{board_array[6]} | #{board_array[7]} | #{board_array[8]} \"\nend",
"def print_array(array)\n length(array).times do |index|\n puts array[index]\n end\n # raise NotImplementedError\nend",
"def print_output()\n\t#print \"$array= \\n\"\n\t$array.each { |i| i.each {\n\t\t\t\t\t |j|\n\t\t\t\t\t case j\n\t\t\t\t\t when 4\n\t\t\t\t\t \tprint \"•\"\n\t\t\t\t\t when 3\n\t\t\t\t\t \tprint \"x\"\n\t\t\t\t\t when 2\n\t\t\t\t\t \tprint \"*\"\n\t\t\t\t\t when 1\n\t\t\t\t\t \tprint \"█\"\n\t\t\t\t\t when 0\n\t\t\t\t\t \tprint \" \"\n\t\t\t\t\t end }\n\t\t\t\t print \"\\n\"}\nend",
"def array_print_10\n array = []\n array = \"0\".upto(\"9\").to_a\n array.each do |x|\n puts x\n end\nend",
"def printBoard(arr)\n puts \" \" + arr[0].to_s + \" | \" + arr[1].to_s + \" | \" + arr[2].to_s\n puts \"-----------------------\"\n puts \" \" + arr[3].to_s + \" | \" + arr[4].to_s + \" | \" + arr[5].to_s\n puts \"-----------------------\"\n puts \" \" + arr[6].to_s + \" | \" + arr[7].to_s + \" | \" + arr[8].to_s\nend",
"def display_board (boardArray)\n puts \" #{boardArray[0]} | #{boardArray[1]} | #{boardArray[2]} \"\n puts \"-----------\"\n puts \" #{boardArray[3]} | #{boardArray[4]} | #{boardArray[5]} \"\n puts \"-----------\"\n puts \" #{boardArray[6]} | #{boardArray[7]} | #{boardArray[8]} \"\n\n\nend",
"def display_board(moves_array)\n puts \"Welcome to Tic Tac Toe\"\n puts \" #{moves_array[0]} | #{moves_array[1]} | #{moves_array[2]} \"\n puts \"-----------\"\n puts \" #{moves_array[3]} | #{moves_array[4]} | #{moves_array[5]} \"\n puts \"-----------\"\n puts \" #{moves_array[6]} | #{moves_array[7]} | #{moves_array[8]} \"\nend",
"def display_board(boardArray)\n puts \" #{boardArray[0]} | #{boardArray[1]} | #{boardArray[2]} \"\n puts \"-----------\"\n puts \" #{boardArray[3]} | #{boardArray[4]} | #{boardArray[5]} \"\n puts \"-----------\"\n puts \" #{boardArray[6]} | #{boardArray[7]} | #{boardArray[8]} \"\nend",
"def printArray()\n index = 0\n print \"-------\"\n (0...array[0].length).each do |row|\n print \"------\"\n end\n puts \"\"\n print \"| - \"\n characters = 65\n (0...array[0].length).each do |row|\n print \"| #{characters.chr} \"\n characters += 1\n end\n puts \"|\"\n for rows in array\n print \"-------\"\n for value in rows\n print \"------\"\n end\n puts \"\"\n print \"| #{index} |\"\n index += 1\n for value in rows\n print \" #{value.to_i} |\"\n end\n puts \"\"\n end\n print \"-------\"\n (0...array[0].length).each do |row|\n print \"------\"\n end\n puts \"\"\n end",
"def print_changing_numbers\n\t\ti = 1\n\t\t#zolang i kleiner is dan 11\n\t\twhile i < 11\n\t\t\t#print de string met het nummer variabele en verhoog het daarna met 1\n\t\t\tputs \"This sentence is number #{i}\"\n\t\t\ti = i+1\n\t\tend\n\tend",
"def print_array(arr) # define method with one parameter\n\ti = 0 # set starting index value\n\twhile i < arr.length\n\t\tputs arr[i] # Returns the value in the array at index value iteration\n\n\t\ti += 1\n\tend\nend",
"def print_board_array(array)\n dic_letter = {0 => 'A', 1 => 'B', 2 => 'C'}\n # Première ligne\n puts \" \" * 3 + \"1\".center(@slot.w) + \" \" + \"2\".center(@slot.w) \\\n + \" \" + \"3\".center(@slot.w) + \"\\n\\n\"\n array.each_with_index do |row, i|\n # Parcours ligne par ligne les 3 cases (slot) d'une ligne (1/2/3)\n @slot.h.times do |j|\n # Print the 3 characters (blank, or A/B/C)\n (j == @slot.h / 2) ? (print \" #{dic_letter[i]} \") : (print \" \" * 3)\n # Parcours tous les slots d'une ligne et lit \"sa\" ligne j\n row.each_with_index do |cell, k|\n print cell[j]\n k == 2 ? (print \"\\n\") : (print \"|\")\n end\n end\n # Separator between each row\n puts ' ' * 3 + '-' * (@slot.w + 1 + @slot.w + 1 + @slot.w) if i < 2\n end\n puts \"\\n\\n\"\n end",
"def show_board\n \tputs \"-\"*16\n \tputs \"| #{@case_array[0].symbol} | #{@case_array[1].symbol} | #{@case_array[2].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[3].symbol} | #{@case_array[4].symbol} | #{@case_array[5].symbol} |\"\n \tputs \"-\"*16\n \tputs \"| #{@case_array[6].symbol} | #{@case_array[7].symbol} | #{@case_array[8].symbol} |\"\n \tputs \"-\"*16\n\tend",
"def render(num, array)\n puts\n puts \"Solution #{num+1}\"\n puts \" +---+ \"\n puts \" | #{array[0]} | \"\n puts \"+---+---+---+\"\n puts \"| #{array[1]} | #{array[2]} | #{array[3]} |\"\n puts \"+---+---+---+\"\n puts \"| #{array[4]} | #{array[5]} | #{array[6]} |\"\n puts \"+---+---+---+\"\n puts \" | #{array[7]} | \"\n puts \" +---+ \"\nend",
"def printCardArray()\n\t\tprint @cards\n\tend",
"def display_board\n puts \" #{@letter[0]} | #{@letter[1]} | #{@letter[2]} \"\n puts \" -------------\"\n puts \" #{@number[0]}| #{@board_array[0]} | #{@board_array[1]} | #{@board_array[2]} |\"\n puts \" |-----------|\"\n puts \" #{@number[1]}| #{@board_array[3]} | #{@board_array[4]} | #{@board_array[5]} |\"\n puts \" |-----------|\"\n puts \" #{@number[2]}| #{@board_array[6]} | #{@board_array[7]} | #{@board_array[8]} |\"\n puts \" ------------\"\n end",
"def draw(array=@board_array)\n\t\tputs \" a b c d e f g h \"\n\t\tputs \"___________________________________\"\n\t\tarray.each_with_index do |subarr, i|\n\t\t\tprint \" #{i+1} \"\n\t\t\tsubarr.each_with_index do |item, index|\n\t\t\t\tif index == 7\n\t\t\t\t\tprint item.to_s\n\t\t\t\telse\n\t\t\t\t\tprint item.to_s + \" | \"\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"\\n___________________________________\"\n\t\tend\n\tend",
"def printArray\n i = 0\n while (i < (@commandArray.length + 1))\n puts @commandArray.at(i)\n i += 1\n end\n end"
]
| [
"0.6275246",
"0.61135775",
"0.6067515",
"0.605335",
"0.6027156",
"0.6023017",
"0.5947229",
"0.59239376",
"0.5899214",
"0.58658105",
"0.5843036",
"0.5827367",
"0.5819852",
"0.58156735",
"0.5802928",
"0.5691142",
"0.56848645",
"0.568277",
"0.56664586",
"0.56591815",
"0.5648665",
"0.5645998",
"0.5629234",
"0.56273764",
"0.56250066",
"0.5606563",
"0.5569718",
"0.5560019",
"0.55240786",
"0.55199534"
]
| 0.6585481 | 0 |
Write a method, range_print_10, that prints the numbers 0 9 using a range and the each method | def range_print_10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_print_10\n (0..9).step(1) do |n| \n puts n \n end \n \nend",
"def range_print_10\n array = (0..9).to_a\narray.each do |x|\n print x\nend\n\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def output\n @range.each { |number| puts format(number) }\n end",
"def output\n @range.each { |number| puts format(number) }\n end",
"def output\n @range.each { |number| puts format(number) }\n end",
"def integer_print_10\nend",
"def integer_print_10\n 10.times do |x|\n print x\n end\nend",
"def printNums(min, max, step)\n # min sets the starting i, max sets where i will stop, step will set the increment/decrement values\n i = min\n while i <= max\n puts i\n \n i += step\n end\nend",
"def printNums(min,max, step)\n i = min\n while i <= max\n puts i\n\n i += step\n end\nend",
"def integer_print_10\n 10.times do |x|\n puts x \n end \nend",
"def sliced_print_range\n whole_range = (@lower..@upper).to_a\n whole_range.each_slice(@size).to_a\n end",
"def array_print_10\n array = []\n array = \"0\".upto(\"9\").to_a\n array.each do |x|\n puts x\n end\nend",
"def printable_display(numbers)\n numbers.each { |i| puts i.join('') }\n end",
"def printNums\n i = 10\n while i >= 0\n puts i\n i -= 1\n end\nend",
"def range(min, max)\n\tprint (min..max).to_a\nend",
"def array_print_10\nend",
"def output\n @range.each do |number|\n if even_split?(number, 3)\n puts \"fizz\"\n elsif even_split?(number, 5)\n puts \"buzz\"\n else\n puts number\n end\n end\n end",
"def print_nums\n i = 10\n while i >= 0\n puts i \n i -= 1\n end\nend",
"def print_range\n\n\tsum = 0\n\t\n\tfor i in 1...1000 do\n\t\t\t\t\n\t\tif i%3 == 0 or i%5 == 0\n\t\t\t\n\t\t\tsum += i\n\t\t\t\n\t\t\t#just for initial tracing\n\t\t\t#puts i \n\n\t\tend\t\n\n\tend\t \n\t\t\n\tputs sum\n\t\t\nend",
"def print_odd_numbers_r(bound=99, n=3)\n if iteration <= bound\n puts n\n print_odd_numbers_r(bound, n+2)\n end\n\nend",
"def range(limits)\r\n\tnumbers = []\r\n\tfor number in (0..limits)\r\n\t\tputs \"At the top numbers are : #{number}\"\r\n\t\tnumbers.push(number)\r\n\tend\r\n\r\n\tputs \"The numbers: \"\r\n\tfor number in numbers\r\n\t\tputs number\r\n\tend\r\nend",
"def fizzbuzz(start_num, end_num)\n for curr_num in (start_num..end_num)\n if curr_num % 15 == 0\n print \"FizzBuzz\"\n elsif curr_num % 5 == 0\n print \"Buzz\"\n elsif curr_num % 3 == 0\n print \"Fizz\"\n else\n print curr_num\n end\n print \", \" if curr_num < end_num\n end\n puts \"\"\nend",
"def fizz_buzz_to(limit)\n#starting from the number 1 up to the variable limit, do something to each integer\n 1.upto(limit).each do |num|\n#print the output of the fizzbuzz method \n puts fizzbuzz(num)\n end\nend",
"def print(num)\n puts num\nend",
"def print_instruction\n splits = sliced_print_range\n range = parsed_command_of(splits)\n report(range)\n end",
"def printNumbers()\n print($num1,1)\n print($num2,2)\nend",
"def fizzbuzz_to(limit)\n #Create a loop that starts from 1 and ends at the argument given\n 1.upto(limit) do |i|\n #Print the output of every iteration of the method 'fizzbuzz' when called with the argument of the integers 1 through the limit given\n puts(fizzbuzz(i))\n end\nend",
"def printStep(min,max, step)\n i = min\n while i <= max\n puts i\n i += step\n end\nend"
]
| [
"0.848194",
"0.84154624",
"0.72716564",
"0.72716564",
"0.72206295",
"0.72206295",
"0.72206295",
"0.6939404",
"0.6834125",
"0.66014296",
"0.6543455",
"0.653032",
"0.64792454",
"0.6423243",
"0.6173442",
"0.6123834",
"0.6095711",
"0.60792685",
"0.6077574",
"0.60465443",
"0.60432625",
"0.6006959",
"0.59569937",
"0.585251",
"0.58270967",
"0.58187366",
"0.57879406",
"0.57691306",
"0.5764682",
"0.5764656"
]
| 0.858811 | 0 |
Write a method, integer_print_10, that prints the numbers 0 9 using an integer and the times method | def integer_print_10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integer_print_10\n 10.times do |x|\n print x\n end\nend",
"def integer_print_10\n 10.times do |x|\n puts x \n end \nend",
"def q1_print_times(str, num)\n num.times {|num_here|\n p str\n }\nend",
"def repeat(string, int)\n int.times { puts string }\nend",
"def repeat(str, int)\n int.times { puts str }\nend",
"def repeat(string, int)\r\n int.times {puts string}\r\nend",
"def repeat(string, integer)\n integer.times { puts string }\nend",
"def repeat(string, int)\n int.times{puts string}\nend",
"def repeat(str, int)\n int.times { p str }\nend",
"def stringy(int)\n (int/2).times { print 10 }\n 1 if int.odd?\nend",
"def repeat (string, integer)\n integer.times{puts string}\nend",
"def range_print_10\n (0..9).step(1) do |n| \n puts n \n end \n \nend",
"def repeat(string, number)\n number.times{ puts string }\nend",
"def repeat_yourself(string,number)\n number.times { puts string }\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def puts_1_to_10\n (1..10).each { |i| puts i }\nend",
"def repeat(string, integer)\n integer.times do \n puts string\n end\nend",
"def repeat(string, number)\n number.times { puts string }\nend",
"def repeat(string, number)\n number.times { puts string }\nend",
"def repeat(str, int)\n int.times do\n puts str\n end\nend",
"def printNums\n i = 10\n while i >= 0\n puts i\n i -= 1\n end\nend",
"def number_in_a_can(number = 10)\n number.times { |n| puts \"The number is #{n}\" }\nend",
"def repeat(word, number)\n number.times { puts word}\nend",
"def repeat(string, num)\n if num < 0\n puts 'The number is not a positive integer'\n else\n puts 'The number is a positive integer.'\n end\n num.times { puts string }\nend",
"def repeat(string, number)\n number.times {puts string}\nend",
"def repeat(string, number)\n number.times {puts string}\nend",
"def repeat(word, number)\n number.times { puts word }\nend",
"def speak(integer)\n integer.times {puts \"woof!\"}\n end",
"def repeat(str, nb_times)\r\n if nb_times < 0\r\n puts 'You must provide a positive number!'\r\n return\r\n end\r\n\r\n nb_times.times { puts str }\r\nend",
"def repeat(string, int)\n int.times do\n p string\n end\nend"
]
| [
"0.8370745",
"0.8019723",
"0.6917267",
"0.68825996",
"0.6880553",
"0.6847512",
"0.6815837",
"0.6771567",
"0.6735165",
"0.67280626",
"0.6712343",
"0.67103726",
"0.6621699",
"0.66179854",
"0.6608558",
"0.6608558",
"0.6605648",
"0.65978473",
"0.65978473",
"0.6597411",
"0.6565435",
"0.6558708",
"0.65557504",
"0.6549861",
"0.6541801",
"0.6541801",
"0.6523899",
"0.65192676",
"0.6500603",
"0.64827937"
]
| 0.81304765 | 1 |
Parse file Clean balnk or empty lines form a file storing significat lines in given new file returns the number of significant lines | def parse( new_file_name = "#{@full_pathname}.clean.txt" )
lines_total = 0
lines_removed = 0
new_file = File.open( new_file_name, 'w' )
File.open( @full_pathname, 'r' ) do |f|
f.each_line do |curr_line| # Make sure each line has a valid UTF-8 sequence of characters:
curr_line = EncodingTools.force_valid_encoding( curr_line )
curr_line = ResultFileNormalizer.hints_remover( curr_line )
lines_total += 1
# Check if current line should be removed
if !ResultFileNormalizer.is_data_line?( curr_line )
# Remove the line
lines_removed += 1
else
new_file << curr_line
end
end
end
lines_total - lines_removed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file\n line_count = 0\n @text.each_line do |line|\n if line == nil || line == '' || line.size == 0 || line[0] == '#' || line[0] == \"\\n\"\n next\n end\n elements = line.split(' ')\n if elements.size > 2\n puts 'Waring : '.red + 'in file \"' + @file_name.yellow + '\" ignoring line ' + line_count.to_s.yellow + ' ( it has more than one space and is not a comment )'\n else\n if elements.size == 1\n @ret << Manga_data.new(nil, nil, nil, elements[0], nil)\n else\n @ret << Manga_data.new(nil, elements[0], elements[1], nil, nil)\n end\n end\n line_count += 1\n end\n end",
"def potential_lines(filename); end",
"def line_processor\n open(\"tmp/insert_YourFileName_lines.txt\") do |f|\n f.each do |line| \n unless line =~ /^$/\n puts line.to_s.to_textual\n end\n end\n end\n \nend",
"def filter( fin, fout )\n dropped_lines = 0\n changed_lines = 0\n tab_lines = 0\n empty_lines = 0\n total = 0\n while( line = fin.gets )\n total += 1\n lstr = line.rstrip\n\n changed_lines += 1 if ( line != ( lstr + \"\\n\" ) )\n\n if lstr.empty?\n empty_lines += 1\n else\n if empty_lines > 0\n fout.puts\n dropped_lines += empty_lines - 1\n empty_lines = 0\n end\n tab_lines += 1 if lstr =~ /\\t/\n # line.gsub!( /\\t/, \" \" )\n fout.puts lstr\n end\n end\n dropped_lines += empty_lines\n [ changed_lines, dropped_lines, tab_lines, total ]\n end",
"def line_count(file)\n\t\tf = File.new(file)\n\t\tnum_newlines = 0\n\t\twhile (c = f.getc) != nil\n\t\t\tnum_newlines += 1 if c == $/\n\t\tend\n\t\tnum_newlines\n\tend",
"def paragraph_count(all_lines_from_file)\n all_lines_from_file.split(/\\n\\n/).length\nend",
"def count_pbars(fn)\n\n blin = 0;\n nev = 0;\n\n for l in File.readlines(fn)\n w = l.split(' ')\n nw = w.length\n\n if (blin == 0) then \n if (w[0] == 'ProductPrint') and (w[1].index('mu2e::StepPointMCs_muonBeamFilter_Coll31OutRecord') != nil) then\n blin = 1\n end\n else\n if (nw == 11) and (w[10] == 'Transportation') then\n if (w[1] == '100001') then nev += 1 end\n blin = 0\n end\n end\n end\n\n puts \"nev = #{nev}\"\nend",
"def count_characters_no_spaces(all_lines_from_file)\n all_lines_from_file.gsub(/\\s+/, \"\").length\nend",
"def sentence_count(all_lines_from_file)\n all_lines_from_file.split(/\\.|\\?|\\!/).length\nend",
"def number_closed(file)\n numClosed = 0;\n line = file.gets\n if line == nil then return end\n # read additional lines\n while line = file.gets do\n # begins with \"path\", must be path specification\n if line[0...4] != \"path\" \n if (!(line.include? \"u\") && !(line.include? \"d\") &&\n !(line.include? \"l\") && !(line.include? \"r\"))\n numClosed += 1;\n end\n end\n end\n puts \"#{numClosed}\"\nend",
"def n_lines(filename); end",
"def lines(textFile)\n textFile.to_a.select {|line| /\\S/ =~ line and /^\\#/ !~ line}.length\nend",
"def parse_file\n filename = full_path_from_edict_file(@config[\"filename\"])\n ### Get all the line into memory\n file_obj = File.new(filename, \"r\")\n file_obj.each do |line|\n @added_lines.push line\n end\n end",
"def parse\n\t\tfile = File.new(@filename, \"r\")\n\t\tline = file.gets.chomp\n\t\twhile !line.nil?\n\t\t\tif line =~ /(Underflow|Overflow)/ #if exception\n\t\t\t\tline =~ /Overflow/ ? overflow = true : overflow = false\n\t\t\t\tidentifier = line[/[0-9][0-9]*/] #get exception identifier\n\t\t\t\tline = file.gets.chomp\t\t\t\t\t\n\t\t\t\tline = file.gets.chomp if line =~ /The constraints are unsat/\t\t\t\t\n\t\t\t\tline = file.gets.chomp if line =~ /KLEE: WARNING:/\t\t\t\t\n\t\t\t\t# For a given identifier, there can me multiple warnings of a potential \n\t\t\t\t# overflow/underflow, store only the last one.\n\t\t\t\t# By creating a new array, previous values are overwritten\n\t\t\t\tvalues = []\n\t\t\t\twhile line =~ /^arr[0-9]/\t#if arr value\n\t\t\t\t\tline = file.gets.chomp\n\t\t\t\t\t#~ puts \"#{identifier}: #{line}\"\t#debugging\n\t\t\t\t\tvalues.push line #store value as sring with no regard to type (rational, float, integer)\t\t\t\t\t\n\t\t\t\t\tline = file.gets.chomp\n\t\t\t\tend\n\t\t\t\tif not values.empty? #if some arr values were found, store them\t\t\t\t\t\n\t\t\t\t\toverflow ? @overflow[\"#{identifier}\"] = values : @underflow[\"#{identifier}\"] = values\n\t\t\t\tend\n\t\t\telse \n\t\t\t\tline = file.gets #if not exception warning\n\t\t\tend\n\t\tend #iterate over lines in file\n\tend",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def test_file_must_nofuzzy()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length + 1)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(2, firstcount)\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(1, firstcount)\n\t\t}\n\tend",
"def count_lines(all_lines_from_file)\n all_lines_from_file.lines.count\nend",
"def space_file_parser\n @space_names = File.open(\"text_files/space.txt\").readlines.each do |line|\n if line.include?(\"\\n\")\n line.gsub!(/\\n/, '')\n else\n line\n end\n end\nend",
"def count_paragraphs(some_file)\n file_content = open(some_file).read()\n count = 0\n file_content_split = file_content.split('')\n\n file_content_split.each_index do |index|\n count += 1 if file_content_split[index] == \"\\n\" && file_content_split[index + 1] == \"\\n\"\n end\n return count\nend",
"def count_lines()\n start_time = Time.now\n @file_lines = 0 \n last_block_position = 0\n prev_block_position = -1\n Rula.log(Logger::DEBUG,\"Reading file #{@filename} lines count\",self)\n file_handle = File.open(@filename,'rb')\n while data = file_handle.read(@@BLOCK_SIZE)\n original_size = data.length\n last_occurence = data.rindex(Rula.options[:line_separator])\n difference_in_size = original_size - last_occurence\n\n if data.length==1 then\n break\n end\n\n if !last_occurence.nil? then\n data = data[0..last_occurence]\n file_handle.pos -= difference_in_size\n end\n @file_lines += data.scan(/([^|#{Rula.options[:line_separator]}].*)#{Rula.options[:line_separator]}/).length\n \n (0...@@BUFFERS).each {|i| \n @buffers[i].add_hash(last_block_position, prev_block_position, file_handle.pos, @file_lines)\n }\n prev_block_position = last_block_position \n last_block_position = file_handle.pos\n end\n Rula.log(Logger::DEBUG,\"Counted #{@file_lines} lines for file #{@filename}\",self)\n ensure\n Rula.log(Logger::DEBUG,\"Counting lines ran #{(Time.now - start_time) * 1000} ms\",self)\n file_handle.close()\n load_buffer_data(0)\n end",
"def read_lines(file)\r\n\t\t\tbegin\r\n\t\t\t\tofile = File.new(file, \"r\")\r\n\t\t\t\twhile (line = ofile.gets)\r\n\t\t\t\t\t@lines += 1\r\n\t\t\t\t\tif line.strip == \"\"\r\n\t\t\t\t\t\t@blank_lines += 1\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\tofile.close\r\n\t\t\trescue => err\r\n\t\t\t\tputs \"Could not access #{err}\"\r\n\t\t\tend\r\n\t\tend",
"def process_input_file \n File.open(@file, 'r') do |f|\n f.each_line do |line|\n parse_line(line)\n end\n end\n end",
"def parse_file!\n File.open(@filepath, 'r') do |f|\n last_line = ''\n while this_line = f.gets\n coll = case this_line\n when /^\\s*def / : @methods\n when /^\\s*class / : @classes\n when /^\\s*module / : @modules\n when /^\\s*(attr_reader|attr_accessor|attr_writer) / : @attrs\n when /^\\s*[^a-z =]+\\s*=/ : @constants\n else nil\n end\n # add a true entry if comment precedes declaration or follows on same line\n coll << is_comment?(last_line) || has_comment?(this_line) if coll\n last_line = this_line\n end\n end\n end",
"def analyze_file\n\n path = File.join(File.dirname(__FILE__), \"test.txt\")\n file = File.open(path, 'r+')\n line_number = 1\n\n File.foreach(file) do |line|\n content = line.chomp\n \n new_line_analyzer = LineAnalyzer.new(content, line_number)\n \n @@analyzers.push(new_line_analyzer)\n\n \n # @@analyzers.each do |line|\n # p line.content\n # p line_number\n # p @@analyzers.length\n # puts \"++++++++++++++++++++\"\n # end\n\n line_number +=1\n\n \n\n end\n\n 4.times do |index| \n if index > 0 \n p @@analyzers[index-1].content\n p index\n end \n end \n\n end",
"def strip_frequency_count line\n /\\s*\\d*\\s*(.*)/.match(line).captures.first \nend",
"def modified_lines_in_file(_file)\n EMPTY_SET\n end",
"def newline_check(file_name)\n # check if the file has no newline or multiple newlines\n lines = File.open(file_name, 'r').to_a\n # if the last character of the last line with code is a newline character AND there is additional text on that line, set hasSingleNewline to true; otherwise set it to false\n hasSingleNewline = lines.last[-1] == \"\\n\" && lines.last.length > 1\n # if there isn't already a single newline at the end of the file, call the process(text) method to add one in (or delete multiple ones and add a newline in)\n if !hasSingleNewline\n text = File.read(file_name)\n # re-write the file with the final file text returned by the process(text) method\n File.open(file_name, \"w\") { |file| file.puts process(text) }\n end\nend",
"def parse_blank_line; end",
"def count_characters(all_lines_from_file)\n all_lines_from_file.gsub(/\\n+/,\"\").length\nend"
]
| [
"0.6748733",
"0.60515606",
"0.59816027",
"0.58807105",
"0.57976073",
"0.576504",
"0.57561237",
"0.5753687",
"0.5722975",
"0.5696997",
"0.56915474",
"0.5690263",
"0.56616646",
"0.5638411",
"0.56324923",
"0.56324923",
"0.5625236",
"0.5614476",
"0.5594559",
"0.55759364",
"0.5569392",
"0.55596775",
"0.5557087",
"0.5556982",
"0.5546739",
"0.55194324",
"0.5508354",
"0.550583",
"0.5505002",
"0.54977787"
]
| 0.62429416 | 1 |
GET /widgets GET /widgets.json | def index
@widgets = Widget.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @widgets }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @widget = Widget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @widget }\n end\n end",
"def widget_data\n widget = WidgetService.widget(params[:widget_id])\n render json: {\n id: widget.id,\n dataset: widget.dataset,\n visualization: widget.widget_config,\n name: widget.name,\n description: widget.description,\n metadata: widget.metadata\n }\n end",
"def set_widget\n if !logged_in?\n userresponse = RestClient::Request.new({\n method: :get,\n url: ENV['API_URL'] + 'widgets/visible?client_id='+ ENV['CLIENT_ID'] + '&client_secret=' + ENV['CLIENT_SECRET'] +'&term=',\n headers: { content_type: 'application/json'}\n }).execute do |userresponse, request, result|\n case userresponse.code\n when 400\n [ :error, JSON.parse(userresponse) ]\n when 200\n [ :success, JSON.parse(userresponse) ]\n json=JSON.parse(userresponse)\n rec = Array.new\n json[\"data\"][\"widgets\"].each do |item|\n widget= Widget.new \n widget.id=item[\"id\"]\n widget.name=item[\"name\"]\n widget.description=item[\"description\"]\n widget.kind=item[\"kind\"]\n widget.userid=item[\"user\"][\"id\"]\n widget.username=item[\"user\"][\"name\"]\n widget.owner=item[\"owner\"]\n rec << widget\n end\n @widgetlist= WidgetList.new\n @widgetlist.widgets = rec\n else\n fail \"Invalid response #{userresponse.to_str} received.\"\n end\n end\n else\n response = RestClient::Request.new({\n method: :get,\n url: ENV['API_URL'] + '/widgets',\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n rec = Array.new\n json[\"data\"][\"widgets\"].each do |item|\n widget= Widget.new \n widget.id=item[\"id\"]\n widget.name=item[\"name\"]\n widget.description=item[\"description\"]\n widget.kind=item[\"kind\"]\n widget.userid=item[\"user\"][\"id\"]\n widget.username=item[\"user\"][\"name\"]\n widget.owner=item[\"owner\"]\n rec << widget\n end\n @widgetlist= WidgetList.new\n @widgetlist.widgets = rec\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n end\n end",
"def widget_data\n widget = Widget.find(params[:widget_id])\n data = widget.get_filtered_dataset false, 10000\n render json: {id: widget.id,\n visualization: widget.visualization,\n name: widget.name,\n description: widget.description,\n data: data['data']}.to_json\n end",
"def widget_data\n widget = Widget.find(params[:widget_id])\n datasets = []\n @site.contexts.each {|c| c.context_datasets.each {|cd| datasets << cd.dataset_id}}\n if datasets.include? widget.dataset_id # To get only a widget for a dataset for this site\n data = widget.get_filtered_dataset false, 10000\n render json: {id: widget.id,\n visualization: widget.visualization,\n name: widget.name,\n description: widget.description,\n data: data['data']}.to_json\n else\n render json: {}\n end\n end",
"def get_widgets_list\n dataset_array = []\n @site.contexts.each {|c| c.context_datasets.each {|d| dataset_array << d.dataset_id}}\n dataset_array.uniq!\n widgets = WidgetService.from_datasets dataset_array\n widgets.map do |w|\n { id: w.id, name: w.name,\n visualization: w.widget_config, description: w.description }\n end\n end",
"def show\n @pwidget = Pwidget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pwidget }\n end\n end",
"def index\n @simple_widgets = SimpleWidget.all\n end",
"def show\n @component_widget = ComponentWidget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component_widget }\n end\n end",
"def widgets\n @widgets\n end",
"def index\n @entries = Entry.all\n\n if params.has_key? :widget\n show_layout = false\n else\n show_layout = true\n end\n \n respond_to do |format|\n format.html { render :layout => show_layout }\n format.json { render json: @entries }\n end\n end",
"def index\n @user_widgets = UserWidget.all\n end",
"def new\n @widget = Widget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @widget }\n end\n end",
"def widget\n @widget = \"#{params[:name].camelize}Widget\".constantize.new(current_user)\n respond_to do |format|\n format.js\n end\n end",
"def load_widgets\n if params[:all_widgets]\n @widgets = Widget.find(:all)\n else\n @widgets = @potato_man.theme_package.widgets\n end\n end",
"def find_widgets widgets_description\n @widgets.find_all widgets_description\n end",
"def get_widget_by_id(id, board_id)\n if id == nil\n raise 'Widget ID not found!'\n end\n widgets_url = URI(\"https://api.miro.com/v1/boards/#{board_id}/widgets/#{id}\")\n result = send_get(widgets_url)\n widget = JSON.parse(result)\n puts CIGREEN + \"GOT WIDGET: \" + CEND + \"#{result}\"\n return widget\nend",
"def available_widgets\n options = {:page_template => page.page_template, :block => block_type}\n UbiquoDesign::Structure.get(options)[:widgets].map(&:keys).flatten\n end",
"def find(filter)\n res = nil\n Wait.until(timeout: @timeout, interval: @interval) do\n uri = HttpClient.compose_uri(@host, @port, \"/#{API_VERSION}/widgets\", filter)\n res = HttpClient.http_get(uri)\n Response.new(res) if res.is_a?(Net::HTTPOK)\n end\n rescue Error::TimeoutError\n rescue_errors(res)\n end",
"def widget_page\n @widget = WidgetService.widget(params[:widget_id])\n @title = @widget.name\n @description = @widget.description\n\n render :widget_page, layout: 'standalone'\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def jmaki_load_widget(name)\n # Return previously parsed content (if any)\n if !@jmaki_widgets\n @jmaki_widgets = { }\n end\n previous = @jmaki_widgets[name]\n if previous\n return previous\n end\n content = \"\"\n filename = JMAKI_RESOURCES + name.tr('.', '/') + \"/widget.json\"\n File.open(filename, \"r\") do |file|\n while line = file.gets(nil)\n content += line\n end\n end\n current = jmaki_parse_json(content, filename)\n @jmaki_widgets[name] = current\n current\n end",
"def index\n authorize! :admin, :dashboard\n @twitter_blocks = TwitterBlock.paginate(\n :per_page => 20,\n :page => params[:page],\n :order => 'id ASC'\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @twitter_blocks }\n end\n end",
"def index\n # This one demonstrates standard usage.\n @widgets = Widget.all\n paginate @widgets\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('widget', '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 show\n render json: @wellist\n end",
"def show\n render json: @social_networking\n end",
"def index\n @walls = Wall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @walls }\n end\n end",
"def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end",
"def index\n render_not_found('organization') unless parent_organization\n @widgets = parent_organization.widgets\n end"
]
| [
"0.7177016",
"0.7001222",
"0.6949288",
"0.6806375",
"0.66883814",
"0.6652928",
"0.6529962",
"0.65087163",
"0.6492304",
"0.6387974",
"0.6324118",
"0.63024807",
"0.6256441",
"0.62365276",
"0.6211567",
"0.61187756",
"0.6062224",
"0.60185045",
"0.5998205",
"0.5934863",
"0.58620954",
"0.5829809",
"0.58047396",
"0.57958573",
"0.57880014",
"0.57772374",
"0.57614815",
"0.57543963",
"0.5732314",
"0.5697942"
]
| 0.75650525 | 0 |
DELETE /widgets/1 DELETE /widgets/1.json | def destroy
@widget = Widget.find(params[:id])
@widget.destroy
respond_to do |format|
format.html { redirect_to widgets_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @simple_widget.destroy\n respond_to do |format|\n format.html { redirect_to simple_widgets_url, notice: 'Simple widget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @widget = Widget.find(params[:id])\n @widget.destroy\n respond_to do |format|\n format.html { redirect_to(widgets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @widget.destroy\n respond_to do |format|\n format.html { redirect_to widgets_url, notice: 'Widget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pwidget = Pwidget.find(params[:id])\n @pwidget.destroy\n\n respond_to do |format|\n format.html { redirect_to pwidgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @component_widget = ComponentWidget.find(params[:id])\n @component_widget.destroy\n\n respond_to do |format|\n format.html { redirect_to component_widgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy_impac_widgets, widget\n\n if widget.destroy\n MnoEnterprise::EventLogger.info('widget_delete', current_user.id, 'Widget Deletion', widget)\n head status: :ok\n else\n render_bad_request('destroy widget', 'Unable to destroy widget')\n end\n end",
"def delete_widget widget\n @widgets.delete widget\n end",
"def delete_widget widget\n @widgets.delete widget\n end",
"def destroy\n @author_widget.destroy\n respond_to do |format|\n format.html {redirect_to author_widgets_url, notice: t('widget_destroy_success')}\n format.json {head :no_content}\n end\n end",
"def destroy\n @user_widget.destroy\n respond_to do |format|\n format.html { redirect_to user_widgets_url, notice: 'User widget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @widget_form.destroy\n respond_to do |format|\n format.html { redirect_to widget_forms_url, notice: 'Widget form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @thickness.destroy\n respond_to do |format|\n format.html { redirect_to thicknesses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to things_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to things_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end",
"def delete\n api_client.delete(url)\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n\n head :no_content\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end"
]
| [
"0.7491588",
"0.7396286",
"0.7394976",
"0.71619344",
"0.7030359",
"0.6919996",
"0.6899113",
"0.6899113",
"0.6814794",
"0.6786082",
"0.6743239",
"0.66606027",
"0.66476583",
"0.6640038",
"0.66333085",
"0.656067",
"0.6553023",
"0.6533894",
"0.65147823",
"0.6480145",
"0.6480145",
"0.6467124",
"0.6452809",
"0.64469355",
"0.6429388",
"0.6416514",
"0.64143425",
"0.6409089",
"0.6409089",
"0.6409089"
]
| 0.77379686 | 1 |
Setting up a Mock to simulate the requests. | def setup
@requester = Rack::MockRequest.new(SampleApp)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_request( params, response_body )\n mock_post = {}\n mock_post.expects(:set_form_data).with(params)\n #mock.expects(:[]=).with('user-agent', anything)\n\n url = Smsinabox.uri\n Net::HTTP::Post.expects(:new).with( url.path ).returns(mock_post)\n\n response = Net::HTTPSuccess.new('1.1', 200, 'OK')\n response.instance_variable_set :@body, response_body\n response.instance_variable_set :@read, true\n\n mock_http = Object.new\n mock_http.expects(:start).returns(response)\n\n Net::HTTP.expects(:new).with( url.host, url.port ).returns(mock_http)\nend",
"def mock_req\n Waxx::Req.new(ENV, {}, 'GET', \"/test/test/1\", {}, {}, {}, Time.new).freeze\n end",
"def mas_net_http_get(obj_stubs = {})\n request = Spec::Mocks::Mock.new(Net::HTTP::Get)\n Net::HTTP::Get.stub!(:new).and_return(request)\n obj_stubs.each do |method, value|\n request.stub!(method).and_return(value)\n end\n request\nend",
"def mock_request(script = \"test\" , headers = {})\n unless @mock_request\n @mock_request = mock(\"MockAgiRequest[script=#{script}]\")\n @mock_request.stub!(\n :extension => \"test\",\n :priority => \"1\",\n :context => \"default\",\n :uniqueId => \"123456789.7\", \n :language => \"en\",\n :channel => \"SIP/127.0.0.1-00000003\",\n :type => \"SIP\",\n :script => script,\n :requestURL => \"agi://fake_test_host:1234/#{script}\") #[?param1=value1¶m2=value2]. \"\n end\n @mock_request\nend",
"def require_requests_and_mock\n requests.each do |request|\n require_item(request, @request_path)\n if service::Mock.method_defined?(request.last)\n mocked_requests << request.last\n else\n service::Mock.module_eval <<-EOS, __FILE__, __LINE__\n def #{request.last}(*args)\n Fog::Mock.not_implemented\n end\n EOS\n end\n end\n end",
"def mas_net_http(response, obj_stubs = {})\n http = mock(Net::HTTP, obj_stubs)\n Net::HTTP.stub!(:new).and_return(http)\n http.stub!(:request).and_return(response)\n http.stub!(:start).and_yield(http)\n http.stub!(:use_ssl=)\n http.stub!(:verify_mode=)\n http\nend",
"def mas_net_http_post(obj_stubs = {})\n request = Spec::Mocks::Mock.new(Net::HTTP::Post)\n Net::HTTP::Post.stub!(:new).and_return(request)\n obj_stubs.each do |method, value|\n request.stub!(method).and_return(value)\n end\n request\nend",
"def setup\n if @request.present?\n @request.env['HTTP_ACCEPT'] = 'application/json'\n @request.headers['x-api-key'] = 'some_api_key'\n end\n ActiveSupport::Cache::FileStore.any_instance.stubs(:read).returns(\"anandsai_auth\")\n end",
"def setup_base_mocks\n client = mock(\"Heroku::Client\")\n Heroku::Client.expects(:new).with(\"heroku_username\", \"heroku_password\").returns(client)\n client\n end",
"def mock(*args)\n Spec::Mocks::Mock.new(*args)\n end",
"def stubbed_net_http(response, obj_stubs = {}, host = 'twitter.com', port = 80)\n http = Net::HTTP.new(host, port)\n Net::HTTP.stub!(:new).and_return(http)\n http.stub!(:request).and_return(response)\n http\nend",
"def mock\n self.known_queues = Set.new\n self.connection.close if self.connection(ensure_started: false)\n self.connection = BunnyMock.new(self.config).start\n end",
"def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end",
"def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end",
"def request\n @request ||= Rack::MockRequest.new(mack_app)\n end",
"def setup\n @controller = MainController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end",
"def mock(*args)\n Rspec::Mocks::Mock.new(*args)\n end",
"def mock_methods_for_testing! #:nodoc:\n request.headers['mock_methods'].each do |method_name, return_value|\n (class << self; self; end).instance_eval do\n define_method(method_name) { |*not_used| return_value }\n end\n end\n end",
"def setup\n # For debugging only: print the test name before it runs\n # puts \"#{self.class.name}::#{self.method_name}\"\n Sidekiq::Testing.inline!\n Rails.application.reload_routes!\n Media.any_instance.stubs(:archive_to_archive_is).returns(nil)\n Media.any_instance.stubs(:archive_to_archive_org).returns(nil)\n Media.any_instance.stubs(:archive_to_perma_cc).returns(nil)\n Media.any_instance.stubs(:archive_to_video).returns(nil)\n Media.any_instance.unstub(:parse)\n OpenURI.unstub(:open_uri)\n Twitter::REST::Client.any_instance.unstub(:user)\n Twitter::REST::Client.any_instance.unstub(:status)\n Media.any_instance.unstub(:follow_redirections)\n Media.any_instance.unstub(:get_canonical_url)\n Media.any_instance.unstub(:try_https)\n Airbrake.unstub(:configured?)\n Airbrake.unstub(:notify)\n Media.any_instance.unstub(:url)\n Media.any_instance.unstub(:original_url)\n Media.any_instance.unstub(:data_from_page_item)\n Media.any_instance.unstub(:oembed_get_data_from_url)\n Media.any_instance.unstub(:doc)\n Media::ARCHIVERS['archive_is'][:enabled] = true\n Media::ARCHIVERS['archive_org'][:enabled] = true\n clear_bucket(create: true)\n Media.stubs(:request_metrics_from_facebook).returns({ 'share_count' => 123 })\n Media.stubs(:supported_video?).returns(false)\n end",
"def mock_send_request_to_items_microservice\n items_query_params = \"?bibId=998&limit=25&offset=0\"\n stub_request(:get, \"#{ENV.fetch('ITEMS_MICROSERVICE_URL_V01', nil)}\" + items_query_params).\n with(\n headers: {\n 'Authorization' => 'Bearer testoken',\n 'Content-Type' => 'application/json'\n }).to_return(status: 200, body: ITEM_JSON_REQUEST_BODY, headers: {})\n\n items_query_params = \"?bibId=999&limit=25&offset=0\"\n stub_request(:get, \"#{ENV.fetch('ITEMS_MICROSERVICE_URL_V01', nil)}\" + items_query_params).\n with(\n headers: {\n 'Authorization' => 'Bearer testoken',\n 'Content-Type' => 'application/json'\n }).to_return(status: 200, body: ITEM_JSON_REQUEST_BODY, headers: {})\n end",
"def request(action = :echo)\n @request = Rack::MockRequest.new(RocketPants::CacheMiddleware.new(controller_class.action(action)))\n end",
"def setup\n @controller = CardioController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end",
"def mock_send_request_to_patron_creator_service\n stub_request(:post, ENV.fetch('PATRON_MICROSERVICE_URL_V02', nil))\n .to_return(\n {\n status: 201,\n body: {\n 'status' => 'success'\n }.to_json,\n headers: {}\n },\n {\n status: 500,\n body: {\n 'status' => 'failure'\n }.to_json, headers: {}\n }\n )\n end",
"def http\n if ActiveResource::HttpMock.enabled?\n ActiveResource::HttpMock.new(@site)\n else\n http_without_mock\n end\n end",
"def stub_request_for_installation_token\n self.extend WebMock::API\n stub_request(:post,\n \"https://api.github.com/app/installations/#{ENV[\"INSTALLATION_ID\"]}/access_tokens\").\n to_return(\n status: 201,\n headers: { 'Content-Type' => 'application/json; charset=utf-8' },\n body: %Q({\n \"token\": \"47b0a82c8819bfe66fa88568b9a93dc9b4a8867c\",\n \"expires_at\": \"#{Time.now.utc.xmlschema}\"\n }))\nend",
"def setup\n @controller = UserController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end",
"def __mock_reset; end",
"def flexmock_get\n @mock\n end",
"def flexmock_get\n @mock\n end",
"def setup\r\n @controller = InvoicesController.new\r\n @request = ActionController::TestRequest.new\r\n @response = ActionController::TestResponse.new\r\n\r\n @first = Invoice.find(:first) \r\n @request.user_agent = 'Firefox'\r\n @request.host = \"quentin.#{DOMAIN_NAME}\"\r\n login_as :quentin\r\n end"
]
| [
"0.7454988",
"0.73365533",
"0.6954197",
"0.6949394",
"0.6843992",
"0.6829548",
"0.6791436",
"0.66415495",
"0.6638607",
"0.6506976",
"0.64272404",
"0.63936895",
"0.6391782",
"0.6391782",
"0.63868284",
"0.62820786",
"0.6260012",
"0.62329465",
"0.62270343",
"0.62055707",
"0.61795694",
"0.6163248",
"0.61414224",
"0.6106929",
"0.6072672",
"0.60648996",
"0.60576195",
"0.60513437",
"0.60513437",
"0.6035197"
]
| 0.7829217 | 0 |
Admin only; get a sample of students for looking at data across the site | def sample_students_json
raise Exceptions::EducatorNotAuthorized unless current_educator.can_set_districtwide_access?
seed = params.fetch(:seed, '42').to_i
n = params.fetch(:n, '40').to_i
authorized_sample_students = authorized do
Student.active.sample(n, random: Random.new(seed))
end
sample_students_json = authorized_sample_students.as_json({
only: [:id, :grade, :first_name, :last_name],
include: {
school: {
only: [:id, :name, :school_type]
}
}
})
render json: {
sample_students: sample_students_json
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def index\n @interesting_things = @student.interesting_things\n @other_interesting_things = Student.where.not(id: @student.id).map do|student|\n student.interesting_things[@student.id % Student.count] || student.interesting_things.sample\n end.compact\n end",
"def students\n users\n end",
"def index\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n\n @students = $selected_course.students.collect{|student| {name: student.first + ' ' + student.last, student_id: student.id }}\n end",
"def students\n users.students\n end",
"def get_matching_students\n\t\tstudent\n\tend",
"def students\n Rollcall::Student.find_all_by_school_id schools\n end",
"def students\n @users = User.paginate(:page => params[:page], :per_page => 20).student\n @filter = \"All Students\"\n render :index\n end",
"def students\n self.course_person.all(:type => \"student\").persons\n end",
"def index\n @students = current_user.groups[0].students\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end",
"def students\n self.boating_tests.collect{|test| test.student} \n end",
"def print_students_list\n\[email protected] do |student|\n\t\tputs \"#{student[:name]} (#{student[:cohort]} cohort)\"\n\tend\nend",
"def students\n if current_user.is_admin?\n @students= User.find(:all, :conditions => \"is_teacher = '0' and is_admin = '0'\")\n respond_to do |format|\n format.xml { render :xml => @students }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def setup\n @student = students(:data1)\n end",
"def print_student_list\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\"\n end\nend",
"def all_students(teacher_user)\n counter = 0 \n while counter <= Student.all.count \n list = Student.all.map do |pupil|\n pupil.name\n end\n counter += 1\n end\n puts list\n end",
"def get_students\n registrations.select{|r| !r.instructor}.map{|r| r.user}\n end",
"def list\n @students= Student.all\n end",
"def fetch_students\n @students = []\n CSV.foreach('data/students_info.csv', headers: true, col_sep: ',') do |row|\n @students << { name: row['name'], detention: row['detention'], tt_path: row['tt_path'] }\n end\n end",
"def show\n \n if current_user.teacher.nil?\n @students = []\n @groups = []\n else\n @student = current_user.teacher.students.find(params[:id])\n @groups = current_user.teacher.groups\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def index\n @students = Student.by_registration_time\n \n @nsbe_students = Student.get_nsbe.by_registration_time\n @shpe_students = Student.get_shpe.by_registration_time\n end",
"def print_student_list\n #print the list if there is at least one student in there\n if @students.count > 0\n @students.each do |student|\n puts \"Name = #{student[:name]} (#{student[:cohort]} cohort), hobby = #{student[:hobby]}, Country = #{student[:country]}\".center(80)\n end\n end\nend",
"def index\n #@students = Student.all.page params[:page]\n if current_student.admin?\n @students = Student.page params[:page]\n else\n @student = current_student\n end\n end",
"def print_student_list\n @students.each do |student|\n puts \"#{student[:name]} (#{student[:cohort]} cohort)\".center(100)\n end\nend",
"def index\n if current_user.admin? or current_user.editor? #checks if user is admin, if so displays all of the students in database.\n @students = Student.all\n if params[:search]\n @students = Student.search(params[:search]).order(\"created_at DESC\")\n else\n @students = Student.all.order('created_at DESC')\n end\n elsif user_signed_in?\n @students = Student.all.where(:user_id => current_user.id) #Only displays the the users student. \n end\n\n\n authorize @students\n end",
"def show_students\n print_header\n print_students_list\n print_footer\nend",
"def students # Want: student id and student names on Users Table\n return User.joins(:sections).where(:sections => {:id => self.id}).all\n end",
"def index\n @people_students = People::Student.all\n end",
"def show\n @courses = @student.courses\n @groups = @student.groups\n end"
]
| [
"0.701497",
"0.6813282",
"0.6725721",
"0.6725324",
"0.6707405",
"0.6706399",
"0.6561929",
"0.646718",
"0.6463248",
"0.64573634",
"0.64201087",
"0.6418952",
"0.6411673",
"0.64110625",
"0.63979673",
"0.63894325",
"0.6331304",
"0.62793434",
"0.62716544",
"0.6265985",
"0.6256011",
"0.6242042",
"0.62349355",
"0.62261474",
"0.61759156",
"0.6168842",
"0.616422",
"0.61590725",
"0.61474234",
"0.61468095"
]
| 0.7318946 | 0 |
GET /actionables GET /actionables.json | def index
@actionables = Actionable.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end",
"def index\n @user_actions = UserAction.all\n render json: @user_actions\n end",
"def abilities\n get('/ability/')\n end",
"def accessories\n render json: { collections: Collection.published_accessories }\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 actions\n return @actions if @actions\n @actions = Client.get(\"/boards/#{id}/actions\").json_into(Action)\n end",
"def list\n List.from_response client.get(\"/actions/#{action_id}/list\")\n end",
"def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end",
"def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end",
"def index\n @action_names = ActionName.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @action_names }\n end\n end",
"def index\n @abilities = Ability.all\n end",
"def actions\n client.actions\n end",
"def my_attractions\n my_attractions = Attraction.attractions_by_user(current_user.id)\n render :json => Attraction.just_attraction_data(my_attractions), :except => @@render_exclude_options\n end",
"def index\n @my_actions = MyAction.all\n end",
"def show\n head :forbidden\n\n # @action = Action.find(params[:id])\n\n # render json: @action\n end",
"def index\n @traits = Trait.all\n @trait_action_object_hash = Trait.action_object_hash\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traits }\n end\n end",
"def index\r\n @aes_actions = Action.all\r\n end",
"def index\n @requests = Request.accessible_by(current_ability)\n\n \n\n end",
"def index\n @factions = Faction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @factions }\n end\n end",
"def index\n #@food_items automatically set to FoodItem.accessible_by(current_ability)\n\n respond_to do |format|\n format.html { render 'index', layout: !(request.xhr?) }\n format.json { render json: @food_items }\n end\n end",
"def index\n @through_tables = ThroughTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @through_tables }\n end\n end",
"def index\n @cables = Cable.all\n end",
"def index\n @cables = Cable.all\n end",
"def index\n @player_actions = PlayerAction.all\n end",
"def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end",
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def set_actionable\n @actionable = Actionable.find(params[:id])\n end",
"def index\n @task_contexts = TaskContext.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_contexts }\n end\n end",
"def index\n @modalities = Modality.all\n json_response(@modalities)\n end",
"def index\n @accessories = Accessory.all\n end"
]
| [
"0.6987696",
"0.6675143",
"0.66332257",
"0.6281451",
"0.62372965",
"0.6201639",
"0.612287",
"0.60770136",
"0.6061981",
"0.60551727",
"0.60406095",
"0.6033963",
"0.60148203",
"0.59778607",
"0.5972194",
"0.5968946",
"0.59606934",
"0.5938351",
"0.5928417",
"0.59201765",
"0.588164",
"0.5871835",
"0.5871835",
"0.5868715",
"0.5844016",
"0.5832913",
"0.5820015",
"0.5819112",
"0.5815221",
"0.58129424"
]
| 0.75978374 | 0 |
POST /actionables POST /actionables.json | def create
@actionable = Actionable.new(actionable_params)
respond_to do |format|
if @actionable.save
format.html { redirect_to @actionable, notice: 'Actionable was successfully created.' }
format.json { render :show, status: :created, location: @actionable }
else
format.html { render :new }
format.json { render json: @actionable.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @actionables = Actionable.all\n end",
"def create_actionable\n actionable_node = Neography::Node.create(\"object_id\" => self.id, \"object_type\" => self.class.to_s)\n actionable_node.add_to_index(\"actionables_nodes_index\", \"class0id\", \"#{self.class.to_s}0#{self.id}\")\n end",
"def collection_post_action(action)\n action = action.to_s.gsub('bulk_', '').to_sym\n\n raise 'expected post, patch or put http action' unless (request.post? || request.patch? || request.put?)\n raise \"expected #{resource_name} to respond to #{action}!\" if resources.to_a.present? && !resources.first.respond_to?(\"#{action}!\")\n\n successes = 0\n\n ActiveRecord::Base.transaction do\n successes = resources.select do |resource|\n begin\n resource.public_send(\"#{action}!\") if EffectiveResources.authorized?(self, action, resource)\n rescue => e\n false\n end\n end.length\n end\n\n render json: { status: 200, message: \"Successfully #{action_verb(action)} #{successes} / #{resources.length} selected #{resource_plural_name}\" }\n end",
"def set_actionable\n @actionable = Actionable.find(params[:id])\n end",
"def bulk_action_params\n params.require(:bulk_action).permit(\n :action_type,\n :description,\n :pids,\n manage_release: [:tag, :what, :who, :to],\n set_governing_apo: [:new_apo_id],\n manage_catkeys: [:catkeys]\n )\n end",
"def index\n @user_actions = UserAction.all\n render json: @user_actions\n end",
"def set_actionable\n @actionable = Actionable.find(params[:id])\n end",
"def post(action, **args); end",
"def action_params\n params.require(:new_action).permit(:action_type, :ship_id)\n end",
"def action_params\n params.require(:action).permit(:name, :status, :user_id)\n end",
"def network_action_params\n params.require(:network_action).permit(:actor_id, :owner_id, :status, :priority, :network_event_id, :action_type, :description, :member_ids => [])\n end",
"def create\n @accessory = Accessory.new(params[:accessory])\n\n if @accessory.save\n render json: @accessory, status: :created, location: @accessory\n else\n render json: @accessory.errors, status: :unprocessable_entity\n end\n end",
"def create\n @accessory_act = AccessoryAct.new(params[:accessory_act])\n\n respond_to do |format|\n if @accessory_act.save\n format.html { redirect_to @accessory_act, :notice => 'Accessory act was successfully created.' }\n format.json { render :json => @accessory_act, :status => :created, :location => @accessory_act }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @accessory_act.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def actionable_params\n params.require(:actionable).permit(:student_requested_job, :employeer_requested_student_for_job, :student_approved_for_job, :appeared_at_job, :student_did_job_well, :job_id, :student_id)\n end",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def create\n @action_idea = ActionIdea.new(action_idea_params)\n\n respond_to do |format|\n if @action_idea.save\n format.html { redirect_to @action_idea, notice: 'Action idea was successfully created.' }\n format.json { render :show, status: :created, location: @action_idea }\n else\n format.html { render :new }\n format.json { render json: @action_idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @action = params[:action_military_retreat_army_action]\n \n army = Military::Army.find(@action[:army_id])\n \n raise NotFoundError.new('army not found') if army.nil?\n raise BadRequestError.new('not owner of army') unless army.owner == current_character\n\n army.battle_retreat = @action[:retreat]\n raise BadRequestError.new('not owner of army') unless army.save \n\n respond_to do |format|\n format.html { redirect_to action_path, notice: 'Retreat army action was successfully executed.' }\n format.json { render json: {}, status: :created }\n end\n end",
"def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end",
"def actions=(action)\n @actions << action \n end",
"def actionlist_params\n params.require(:actionlist).permit(:name)\n end",
"def create\n @instance_action = InstanceAction.new(params[:instance_action])\n\n respond_to do |format|\n if @instance_action.save\n format.html { redirect_to @instance_action, notice: 'Instance action was successfully created.' }\n format.json { render json: @instance_action, status: :created, location: @instance_action }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ability_params\n params.require(:ability).permit(:child_id, :skill_id, :status)\n end",
"def actions\n client.actions\n end",
"def create\n @user_action = UserAction.new(user_action_params)\n\n respond_to do |format|\n if @user_action.save\n format.html { redirect_to @user_action, notice: 'User action was successfully created.' }\n format.json { render :show, status: :created, location: @user_action }\n else\n format.html { render :new }\n format.json { render json: @user_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @actionable.update(actionable_params)\n format.html { redirect_to @actionable, notice: 'Actionable was successfully updated.' }\n format.json { render :show, status: :ok, location: @actionable }\n else\n format.html { render :edit }\n format.json { render json: @actionable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def action_idea_params\n params.require(:action_idea).permit(:user_id, :name, :description, :references, :category, :date_created, :active, :tags)\n end",
"def create\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequestError.new('tried to join an alliance although character is already in an alliance') unless current_character.alliance.nil?\n raise UnauthorizedError.new('no character given') if params[:auto_join_alliance_action][:character_id].nil?\n raise UnauthorizedError.new('tried to access another character') if params[:auto_join_alliance_action][:character_id].to_i != current_character.id\n raise ForbiddenError.new('joining new alliance not allowed') if !current_character.can_join_or_create_alliance?\n\n\n alliance = Fundamental::Alliance.select_auto_join_alliance(current_character)\n\n raise NotFoundError.new('no suitable alliance found') if alliance.nil?\n raise ConflictError.new(\"too many members in alliance\") if alliance.full?\n raise ForbiddenError.new('auto join is disabled for this alliance') if !alliance.auto_joinable\n \n alliance.add_character(current_character)\n \n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def create\n @accounting_action = AccountingAction.new(accounting_action_params)\n\n respond_to do |format|\n if @accounting_action.save\n format.html { redirect_to @accounting_action, notice: 'Ação foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @accounting_action }\n else\n format.html { render :new }\n format.json { render json: @accounting_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_aliases(actions)\n resp = post do |req|\n req.url \"/_aliases\"\n req.body = { :actions => Array.new(actions) }\n end\n resp.body\n end",
"def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end"
]
| [
"0.6378845",
"0.59932905",
"0.5918275",
"0.5736906",
"0.57261574",
"0.5713055",
"0.5677671",
"0.5586333",
"0.55838335",
"0.5547208",
"0.55451936",
"0.55003744",
"0.54988986",
"0.5453329",
"0.5431675",
"0.53686136",
"0.5320863",
"0.53139377",
"0.5297027",
"0.5290968",
"0.5283099",
"0.5275274",
"0.5272801",
"0.5249919",
"0.5239801",
"0.5233249",
"0.5230429",
"0.52281564",
"0.52188087",
"0.5207178"
]
| 0.66605294 | 0 |
PATCH/PUT /actionables/1 PATCH/PUT /actionables/1.json | def update
respond_to do |format|
if @actionable.update(actionable_params)
format.html { redirect_to @actionable, notice: 'Actionable was successfully updated.' }
format.json { render :show, status: :ok, location: @actionable }
else
format.html { render :edit }
format.json { render json: @actionable.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n head :forbidden\n\n #@action = Action.find(params[:id])\n\n #if @action.update_attributes(params[:action])\n # head :no_content\n # else\n # render json: @action.errors, status: :unprocessable_entity\n # end\n end",
"def patch(action, **args); end",
"def update\n @editability = Editability.find(params[:id])\n\n respond_to do |format|\n if @editability.update_attributes(params[:editability])\n format.html { redirect_to @editability, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @editability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @action_object.update(action_object_params)\n format.html { redirect_to action: 'index', notice: 'Objeto de Ação alterado com sucesso.'}\n format.json { render :show, status: :ok, location: @action_object }\n else\n format.html { render :edit }\n format.json { render json: @action_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cable = Cable.find(params[:id])\n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cable.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n @usertable = Usertable.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @usertable.update_attributes(params[:usertable])\r\n format.html { redirect_to @usertable, notice: 'Your mood 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: @usertable.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @accessory_act = AccessoryAct.find(params[:id])\n\n respond_to do |format|\n if @accessory_act.update_attributes(params[:accessory_act])\n format.html { redirect_to @accessory_act, :notice => 'Accessory act was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @accessory_act.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cable = Cable.find(params[:id])\n authorize! :update, @cable\n \n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { redirect_to @cable, notice: 'Cable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render status: 501, json: { errors: ['Action not implemented yet!'] }\n end",
"def update\n respond_to do |format|\n if @action_item.update(action_item_params)\n format.html { redirect_to @action_item, notice: 'Action item was successfully updated.' }\n format.json { render :show, status: :ok, location: @action_item }\n else\n format.html { render :edit }\n format.json { render json: @action_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @orderable_concept = OrderableConcept.find(params[:id])\n\n respond_to do |format|\n if @orderable_concept.update_attributes(params[:orderable_concept])\n format.html { redirect_to @orderable_concept, notice: 'Orderable concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orderable_concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @default_ability.update(default_ability_params)\n format.html { redirect_to @default_ability, notice: 'Default ability was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @default_ability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end",
"def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end",
"def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end",
"def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n if @stable.update_attributes(params[:stable])\n format.html { redirect_to @stable, notice: 'Stable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @equipment_things_to_check.update(equipment_things_to_check_params)\n format.html { redirect_to @equipment_things_to_check, notice: 'Equipment things to check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @equipment_things_to_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @anything.update(anything_params)\n format.html { redirect_to @anything, notice: 'Anything was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @anything.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @accessory = Accessory.find(params[:id])\n\n if @accessory.update_attributes(params[:accessory])\n head :no_content\n else\n render json: @accessory.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @my_action.update(my_action_params)\n format.html { redirect_to @my_action, notice: 'My action was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_action }\n else\n format.html { render :edit }\n format.json { render json: @my_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @action_file = ActionFile.find(params[:id])\n\n respond_to do |format|\n if @action_file.update_attributes(params[:action_file])\n format.html { redirect_to @action_file, notice: 'Action file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @action_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @payable_action = PayableAction.find(params[:id])\n\n respond_to do |format|\n if @payable_action.update_attributes(params[:payable_action])\n flash[:notice] = 'PayableAction was successfully updated.'\n format.html { redirect_to([:admin, @payable_action]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payable_action.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end"
]
| [
"0.6737716",
"0.6182605",
"0.61328727",
"0.600249",
"0.59972954",
"0.5982557",
"0.593613",
"0.59163475",
"0.5911129",
"0.5909275",
"0.58852",
"0.58827823",
"0.5874014",
"0.58598995",
"0.58342785",
"0.58342785",
"0.58342785",
"0.58342785",
"0.5832853",
"0.58304155",
"0.58228785",
"0.58188695",
"0.581072",
"0.5809106",
"0.57964206",
"0.5796258",
"0.57881576",
"0.57847816",
"0.5781092",
"0.5776431"
]
| 0.68141884 | 0 |
DELETE /actionables/1 DELETE /actionables/1.json | def destroy
@actionable.destroy
respond_to do |format|
format.html { redirect_to actionables_url, notice: 'Actionable was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end",
"def delete(action, **args); end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @accessory_act = AccessoryAct.find(params[:id])\n @accessory_act.destroy\n\n respond_to do |format|\n format.html { redirect_to accessory_acts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @action_name = ActionName.find(params[:id])\n @action_name.destroy\n\n respond_to do |format|\n format.html { redirect_to action_names_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 @action_item.destroy\n respond_to do |format|\n format.html { redirect_to action_items_url, notice: 'Action item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actionlist.destroy\n respond_to do |format|\n format.html { redirect_to actionlists_url, notice: 'Actionlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def destroy\n @dosha_action.destroy\n respond_to do |format|\n format.html { redirect_to dosha_actions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n head :forbidden\n # @action = Action.find(params[:id])\n # @action.destroy\n\n # head :no_content\n end",
"def destroy\n @editability = Editability.find(params[:id])\n @editability.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @payable_action = PayableAction.find(params[:id])\n @payable_action.destroy\n\n respond_to do |format|\n format.html { redirect_to(payable_actions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @usertable = Usertable.find(params[:id])\r\n @usertable.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to usertables_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @medium_mission = MediumMission.find(params[:id])\n @medium_mission.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_missions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actiontype.destroy\n respond_to do |format|\n format.html { redirect_to actiontypes_url, notice: 'Actiontype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adhoc_deliverable = Deliverable.find(params[:id])\n #delete adhoc deliverable from database\n @adhoc_deliverable.destroy\n\n respond_to do |format|\n format.html { redirect_to adhoc_deliverables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stable = Stable.find(params[:id])\n @stable.destroy\n\n respond_to do |format|\n format.html { redirect_to stables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cable = Cable.find(params[:id])\n @cable.destroy\n authorize! :destroy, @cable\n\n respond_to do |format|\n format.html { redirect_to cables_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @xaction = Xaction.find(params[:id])\n @xaction.destroy\n\n respond_to do |format|\n format.html { redirect_to xactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @action_object.destroy\n respond_to do |format|\n format.html { redirect_to action_objects_url, notice: 'Objeto de Ação apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end",
"def delete_resource_action(type, id = nil, data = nil)\n api_resource(type, id, \"Detaching\") do |resource|\n delete_resource_main_action(type, resource, data)\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @instance_action = InstanceAction.find(params[:id])\n @instance_action.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_actions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n\n head :no_content\n end"
]
| [
"0.7239529",
"0.685737",
"0.6722556",
"0.6682913",
"0.6567606",
"0.6560132",
"0.655953",
"0.655689",
"0.6553568",
"0.6549024",
"0.653393",
"0.65276504",
"0.65073866",
"0.6505469",
"0.6480941",
"0.64697516",
"0.64576954",
"0.64461267",
"0.6445829",
"0.6438733",
"0.64309037",
"0.64295256",
"0.6414886",
"0.6413744",
"0.6394826",
"0.63804084",
"0.6372066",
"0.6371681",
"0.6368974",
"0.636574"
]
| 0.7415544 | 0 |
method showing lives remaining | def show_lives
puts "Lives remaining: #{@players[0].name}: #{@players[0].life}/3 - #{@players[1].name}: #{@players[1].life}/3"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_lives(lives)\n puts \"#{lives} Lives left\"\n end",
"def take_life\n @lives -= 1\n end",
"def looses_life\n @lives -= 1\n end",
"def show_state\n if @life_points <= 0\n puts \"#{@name} is dead... \\n...Monde de merde...\"\n else\n puts \"#{@name} has #{@life_points} life points left.\"\n end\n end",
"def lives_lost\n @lives -= 1\n pp \"INCORRECT -- YOU HAVE #{@lives} LIVES LEFT\"\n end",
"def reduce_life\n if @lives > 0\n @lives -= 1\n end\n end",
"def deduct_life\n @lives -= 1\n end",
"def lose_life\n @lives -= 1\n end",
"def lose_life\n @lives -= 1\n end",
"def lose_life\n @lives -= 1\n end",
"def lose_life\n @lives -= 1\n end",
"def life_count\n puts \"#{@player1.name}'s lives: #{@player1.lives}\\n#{@player2.name}'s lives: #{@player2.lives}\"\n end",
"def time_remaining\n\n end",
"def time_remaining\n end",
"def lose_life()\r\n @life -= 1\r\n end",
"def life\n return @life\n end",
"def player_lives_status(player, num_lives)\n \"\\n#{player_name(player)} has #{num_lives} lives/life left.\\n\"\nend",
"def remove_life \r\n @lives -= 1 # this is part of class and objects above\r\n end",
"def get_time_remaining\n\n end",
"def subtract_point \n\t\t@lives -= 1\n\tend",
"def get_away()\n @health -= 10\n puts @health\n end",
"def lives_decriment\n\t\tlives_will_change!\n\t\tself.lives -= 1 \n\t\tself.hp = self.level+5\n\t\tself.save!\n\t\tif self.lives <=0 \n\t\t\t# restarts NPC's renders user-wizards unusable\n\t\t\tif self.user_id == 1\n\t\t\t\tself.default_values()\n\t\t\telse\n\t\t\t\tputs \"Game Over for #{self.name}!\"\n\t\t\t\tself.level = 0\n\t\t\tend\n\t\tend\n\tend",
"def status\n \"#{@name}: #{@lives}/3 \"\n end",
"def remaining\n [0, @duration - elapsed].max\n end",
"def current_stat\n \"#{@lives}/#{@total_lives}\"\n end",
"def show_state\n if @life_points < 0\n @life_points = 0\n end\n puts \"#{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end",
"def wrong \n @lives -= 1\n end",
"def remaining_hours\n \n end",
"def lose_life\n @life -= 1\n end",
"def show_state\n if @life_points <= 0\n puts \">>> #{@name} a 0 points de vie\"\n else\n puts \">>> #{@name} a #{@life_points} points de vie\"\n end\n end"
]
| [
"0.75132436",
"0.7385032",
"0.73500735",
"0.730432",
"0.7229958",
"0.72146595",
"0.7208545",
"0.708957",
"0.708957",
"0.708957",
"0.708957",
"0.68156254",
"0.67217946",
"0.67131567",
"0.66743046",
"0.66627496",
"0.6622638",
"0.66155505",
"0.66103446",
"0.65931404",
"0.65896255",
"0.6567224",
"0.6548389",
"0.654286",
"0.65224594",
"0.65143013",
"0.6502064",
"0.64995897",
"0.64788413",
"0.64753884"
]
| 0.7464693 | 1 |
Parse the uploaded file. Resulting data will be in data | def parse(uploaded_file)
parser_class =
case uploaded_file.content_type
when "application/vnd.ms-excel"
ExcelParser
when "text/csv", "application/octet-stream", "text/plain"
CSVParser
else
self.errors << "Do not know how to parse #{uploaded_file.original_filename}. " +
"Expects .csv or .xls (Excel) files."
nil
end
if parser_class
@data = parser_class.new(self).parse(uploaded_file)
end
self.valid?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file(file)\n if file && !file.instance_of?(String)\n parse_contents(file)\n elsif file.instance_of?(String)\n data = File.read(file)\n parse_contents(data)\n else\n self.load_errors = \"No file was selected to upload.\"\n end\n end",
"def uploaded_data=(file)\n self.data = []\n if !file.kind_of?(String)\n self.name = file.original_filename\n self.content_type = file.content_type.chomp\n self.data = file.read\n end\n end",
"def parse\n parse_file\n self\n end",
"def parse\n uploader = FileUpload.new(params[:contacts])\n uploader.parse\n \n unless uploader.errors.empty?\n @uploader = uploader\n render :action=>:new\n return\n end\n \n @columns = uploader.columns.map{|col| [(col+\" (column #{uploader.columns.index(col)+1})\").downcase,col.downcase]}\n @columns.unshift([\"Select\",nil])\n\n # Security reason this has been saved in Session. \n session[:filename] = uploader.new_filename\n\n end",
"def parse_image_data(image_data)\n @tempfile = Tempfile.new('item_image')\n @tempfile.binmode\n @tempfile.write Base64.decode64(image_data[:content])\n @tempfile.rewind\n\n uploaded_file = ActionDispatch::Http::UploadedFile.new(\n tempfile: @tempfile,\n filename: image_data[:filename]\n )\n\n uploaded_file.content_type = image_data[:content_type]\n uploaded_file\n end",
"def parse_file\n @filecontent ||= File.read(@filepath)\n end",
"def parse\n file = File.read(@file)\n @data = JSON.parse(file)\n end",
"def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end",
"def parse_image_data(image_data)\n @tempfile = Tempfile.new('item_image')\n @tempfile.binmode\n @tempfile.write Base64.decode64(image_data[:content])\n @tempfile.rewind\n\n uploaded_file = ActionDispatch::Http::UploadedFile.new(\n tempfile: @tempfile,\n filename: image_data[:filename]\n )\n\n uploaded_file.content_type = image_data[:content_type]\n uploaded_file\n end",
"def read\n File.read(uploaded.path)\n end",
"def parse_file(filename); end",
"def parse\n @chunks = parse_chunks extract_chunks decode_blob @blob\n end",
"def parse\n read_header\n parse_text_segment\n parse_data_segment\n @data = nil\n end",
"def parse(rawdata)\n end",
"def parse_upload\n\t@worksheet = (params[:uploaded_doc][:workbook])\n \t@file_path = [Rails.root, 'public', 'upload', @worksheet.original_filename].join('/')\n\t@worksheet_class = (params[:uploaded_doc][:workbook]).class\n\t@worksheet_type = (params[:uploaded_doc][:workbook]).content_type\n\t@worksheet_name = (params[:uploaded_doc][:workbook]).original_filename \n\tFile.open(Rails.root.join('public', 'uploads', @worksheet.original_filename), 'r') do |file|\n\t\t@worksheet_array << file.gets \n\tend\n=begin\t@worksheet_array = RubyXL::Parser.parse(params[:uploaded_doc][:workbook]).worksheets[0].extract_data\n \t@worksheet = RubyXL::Parser.parse(Rails.root.join('public', 'uploads', (params[:uploaded_doc][:workbook]).original_filename , 'w'))#.worksheets[0].extract_data\n\tFile.open(Rails.root.join('public', 'uploads', @worksheet.original_filename), 'r') do |file|\n\t\t@worksheet_array << file.gets \n\tend\n\n=end\n end",
"def uploaded_file\n instance_read(:uploaded_file)\n end",
"def contents\n file_upload.read\n end",
"def parse(data); end",
"def process\n validate_file_type(@file_name, 'csv')\n convert_csv_file_to_object\n end",
"def parse_files\n options.each do |type, filename|\n begin\n content[type] = FCSV.read(filename)\n rescue CSV::MalformedCSVError\n $stderr.puts \"Error parsing #{filename}: #{$!.message}\"\n exit 1\n rescue Errno::ENOENT, Errno::EACCES\n $stderr.puts \"Error reading #{filename}: #{$!.message}\"\n exit 1\n end\n end\n end",
"def parsed_file\n data.split(\"\\n\").map do |line|\n line.split(' ')\n end\n end",
"def file=(data)\n self.file.assign(data)\n # uploaded photos need metadata immediately in order to\n # \"Sync obs. w/ photo metadata\"\n if data.is_a?(ActionDispatch::Http::UploadedFile)\n extract_metadata(data.path)\n end\n end",
"def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end",
"def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end",
"def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end",
"def convertRawData(data)\n @raw_data['file'] = data\n @helper.post(@fields, @files, @raw_data)\n end",
"def parse path\n\t\theaders, body = path.read.split(\"\\n\\n\", 2) # Two newlines marks end of headers\n\t\t@headers = parse_headers(headers)\n\t\t@body = parse_body(self.content_type, body)\n\tend",
"def parse_upload\n expected_params[:upload] ||= ParameterDeclaration.new(:upload, :upload, {})\n params[:upload]\n end",
"def parsed_file_name\n data_file_name.split('.')[0]\n end",
"def extract_data!(options)\n if options.has_key?(:data)\n data = options.delete :data\n \n if Array === data\n data.each.with_index do |filepath, idx|\n if filepath.is_a?(Faraday::UploadIO)\n options[\"data[#{idx}]\"] = filepath\n else\n mime_type = extract_mimetype(filepath)\n options[\"data[#{idx}]\"] = Faraday::UploadIO.new(filepath, mime_type)\n end\n end\n elsif data.is_a?(Faraday::UploadIO)\n options[\"data\"] = data\n else\n mime_type = extract_mimetype(data)\n options[\"data\"] = Faraday::UploadIO.new(data, mime_type)\n end\n end\n end"
]
| [
"0.7450316",
"0.68234205",
"0.6747816",
"0.6613368",
"0.6561181",
"0.6537654",
"0.65263605",
"0.64798194",
"0.64629877",
"0.63639116",
"0.6350962",
"0.63383764",
"0.6289999",
"0.6227038",
"0.6218328",
"0.62134504",
"0.62112314",
"0.6200922",
"0.61911684",
"0.6182405",
"0.6147711",
"0.6136117",
"0.60943276",
"0.60943276",
"0.60943276",
"0.60943276",
"0.60940593",
"0.60712755",
"0.60299313",
"0.60220176"
]
| 0.718122 | 1 |
Returns array of keys that do not have value in the hash Given +required_keys+ should be an array of +string+ | def missing_keys_from(required_keys)
required_keys.select{ |k| self.get(k).to_s.empty? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reject_keys *keys\n reject{|k, _| keys.include? k}\n end",
"def reject_keys!(hash, keys)\n hash.reject { |k, _| keys.include?(k) }\n end",
"def arg_hash_keys_required(required_keys, *args)\n args.each do |h|\n missing = required_keys - h.keys\n raise ArgumentError, \"Hash is missing required keys (#{missing.join(', ')}). Got:\\n#{h.inspect}\" if missing.length > 0\n end\n end",
"def require_keys(*p_valid_keys)\n l_missing_keys = []\n p_valid_keys.flatten!\n p_valid_keys.each do |k|\n l_missing_keys << k unless self.has_key?(k)\n end\n\n unless l_missing_keys.empty?\n raise ArgumentError.new(\"Missing required key(s): #{l_missing_keys.map(&:inspect).join(', ')}\")\n end\n\n end",
"def without(*keys)\n keys = keys.flatten\n pairs = each_pair.filter { |k, _| !k.in?(keys) }\n pairs.to_h\n end",
"def exclude(*keys)\n reject { |key, _| keys.include?(key) }\n end",
"def not_matched_keys\n @not_matched.keys\n end",
"def omit(hash, *keys)\n hash.select { |k| not keys.include?(k) }\n end",
"def konly(*x)\n reject{ |k,v| !x.include?(k) }\n end",
"def incorrect_keys(the_input, invalid_hash = Array.new, the_array)\n the_input.each_key do |key|\n unless the_array.include?(key.to_s)\n invalid_hash << key\n end\n end\n raise K2IncorrectParams.new(invalid_hash) if invalid_hash.present?\n end",
"def checked_keys(params_hash)\n params_hash.reject{ |key, value| value.blank? || value == '0' }.keys\n end",
"def filter_keys(data, *expected_keys)\n excess_keys = data.keys - expected_keys\n excess_keys.each do |key|\n data.delete(key)\n end\n return data\nend",
"def without(*keys)\n keys = keys.to_sargs\n self.reject { |k| keys.include?(k) } || self\n end",
"def unmatched_keys; end",
"def missing_keys; end",
"def deny_keys(*keys)\r\n tmp = self.clone\r\n tmp.delete_if {|k,v| keys.include?(k) }\r\n tmp\r\n end",
"def filter_search_keys(search_keys)\n search_keys.delete_if { |_key, value| value.empty? }\n end",
"def accept_keys!(hash, keys)\n reject_keys!(hash, hash.keys - keys)\n end",
"def unused_keys\n keys - fetched_keys\n end",
"def delete_all_keys_except(hash_record, except_array = [])\n hash_record.select do |key|\n except_array.include?(key)\n end\n end",
"def arg_hash_keys_limit(required_keys, optional_keys, *args)\n args.each do |h|\n missing = required_keys - h.keys\n extra = h.keys - required_keys - optional_keys\n \n unless missing.empty? && extra.empty?\n msg = \"\"\n msg << \"Hash is missing required keys (#{missing.join(', ')}).\\n\" unless missing.empty?\n msg << \"Hash has extra keys which aren't allowed (#{extra.join(', ')}).\\n\" unless extra.empty?\n msg << \" Got: #{h.inspect}\"\n raise ArgumentError, msg\n end\n end\n end",
"def validate_keys(*valid_keys)\n valid_keys.flatten!\n @hash.each_key do |k|\n unless valid_keys.include?(k)\n raise ArgumentError.new(\"Unknown key: #{k.inspect}. Valid keys are: #{valid_keys.map(&:inspect).join(', ')}\")\n end\n end\n end",
"def unrecognized_keys(expected, given)\n given.keys - expected\n end",
"def fast_assert_valid_keys(valid_keys)\n unknown_keys = keys - valid_keys\n raise(ArgumentError, \"Unknown key(s): #{unknown_keys.join(\", \")}\") unless unknown_keys.empty?\n end",
"def removed_keys\n @removed_keys ||= []\n end",
"def filter_keys(issue_keys)\n issue_keys.reject { |k| k =~ /^#{key}-0+$/ }\n end",
"def assert_required_keys(*keys)\n keys.flatten.each do |key|\n raise ArgumentError, \"Required key: #{key.inspect}\" unless key?(key)\n end\n end",
"def remove_keys(*keys)\n @rye_opts[:keys] ||= []\n @rye_opts[:keys] -= keys.flatten.compact\n @rye_opts[:keys].uniq!\n self # MUST RETURN self\n end",
"def arg_hash_keys_exact(exact_keys, *args)\n args.each do |h|\n missing = exact_keys - h.keys\n extra = h.keys - exact_keys\n raise ArgumentError, \"Hash keys don't match required set (#{exact_keys.join(', ')}). \" +\n \"Missing required keys (#{missing.join(', ')}); extra keys not allowed (#{extra.join(', ')}).\\n\" +\n \"Got:\\n#{h.inspect}\" if (missing.length > 0) || (extra.length >0)\n end\n end",
"def clever_validate_keys(ssh_keys)\n ssh_keys.is_a? Array and\n # check each entry\n ssh_keys.map { |entry|\n not entry.nil? and\n entry['key'].is_a? String and entry['key'].length > 0 and\n entry['type'].is_a? String and entry['type'].length > 0 and\n (entry['comment'].nil? or\n (entry['comment'].is_a? String and entry['comment'].length > 0))\n # any false results invalidates the whole set\n }.reduce(:&)\n end"
]
| [
"0.7145525",
"0.71454954",
"0.70673525",
"0.6754895",
"0.6680012",
"0.6556928",
"0.6548558",
"0.6508701",
"0.6506007",
"0.64663833",
"0.6448933",
"0.6435034",
"0.6412506",
"0.6409251",
"0.6377574",
"0.6377338",
"0.6374554",
"0.6373801",
"0.6331329",
"0.6328221",
"0.63118696",
"0.629837",
"0.6209566",
"0.6171858",
"0.61715263",
"0.6164006",
"0.6151336",
"0.61363775",
"0.6112455",
"0.6093221"
]
| 0.81626594 | 0 |
Make Update expression 'SET = :' : points to a value from the expression_attribute_value | def make_update_expression_values(event,attr_values)
update_string = 'SET '
event.each do |k,v|
update_string += "#{make_expression_key(k,"names")} = #{attr_values[k].key(v)}, "
end
return update_string[0...-2]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_expression_value\n @expression_value = ExpressionValue.find(params[:id])\n end",
"def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end",
"def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end",
"def expr=(p1)\n #This is a stub, used for indexing\n end",
"def update\n set_line = self.class.columns.map { |attr| \"#{attr} = ?\" }.join(\", \")\n\n DBConnection.execute(<<-SQL, *attribute_values, self.id)\n UPDATE\n #{self.class.table_name} \n SET\n #{set_line}\n WHERE\n id = ?\n SQL\n end",
"def update\n eqs = self.class.columns.map { |column| \"#{column} = ?\"}.join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values, id)\n UPDATE\n #{self.class.table_name}\n SET\n #{eqs}\n WHERE\n id = ?\n SQL\n end",
"def set_expression\n @expression = Expression.find params[:id]\n end",
"def edit_symptom(db, id, category, value)\n $db.execute( <<-SQL\n UPDATE symptoms\n SET \"#{category}\"=\"#{value}\"\n WHERE id=\"#{id}\";\n SQL\n )\nend",
"def update\n\n DBConnection.execute2(<<-SQL, attribute_values)\n UPDATE\n #{class_obj.table_name}\n SET\n #{sql_update_set}\n WHERE\n id = #{self.id}\n SQL\n\n end",
"def setq(sym, expr)\n\t\tif expr.is_a?(String)\n\t\t\tif expr.match(/\\(list/)\t\n\t\t\t\tstr = \"(setq #{sym.to_s} #{expr.to_s})\" \n\t\t\telse\t\n\t\t\t\tstr = \"(setq #{sym.to_s} \\\"#{expr.to_s}\\\")\" \n\t\t\tend\t\n\t\t\tputs str\n\t\telse\n\t\t\tstr = \"(setq #{sym.to_s} #{expr.to_s})\" \n\t\t\tputs str\n\n\t\tend\t\n\t\tlisp_eval str\n\tend",
"def expression(expression_string)\n state_depth_must_be(States::ATTRIBUTE)\n raise 'expression already defined' if @current_attribute.expression\n @current_attribute.expression = expression_string\n end",
"def test_assignment_binds_are_substituted\n table = Table.new(:users)\n um = Arel::UpdateManager.new Table.engine\n bp = Nodes::BindParam.new '?'\n um.set [[table[:name], bp]]\n visitor = Class.new(Arel::Visitors::ToSql) {\n include Arel::Visitors::BindVisitor\n }.new Table.engine.connection\n\n assignment = um.ast.values[0]\n actual = visitor.accept(assignment, collector) {\n \"replace\"\n }\n assert actual\n value = actual.value\n assert_like \"\\\"name\\\" = replace\", value\n end",
"def set_attr_value( m_name, args )\n \n dup_m_name = m_name.gsub(/=$/, '')\n if( extended_attribute = find_in_extended_attr( dup_m_name ) )\n extended_attribute.update_attributes( :values => args )\n elsif( schema = find_attr_in_schema( dup_m_name ) )\n self.extended_attributes.build( :extended_attributes_schema => schema, :values => args )\n end\n \n end",
"def ^ (name, value = nil, &block) update_attribute name, value, &block end",
"def parsed_expression=(value)\n @parsed_expression = value\n end",
"def update!(**args)\n @dimension = args[:dimension] if args.key?(:dimension)\n @expression = args[:expression] if args.key?(:expression)\n @operator = args[:operator] if args.key?(:operator)\n end",
"def update!(**args)\n @column = args[:column] if args.key?(:column)\n @operator = args[:operator] if args.key?(:operator)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @equivalent_attribute_id = args[:equivalent_attribute_id] if args.key?(:equivalent_attribute_id)\n end",
"def update!(**args)\n @case_sensitive = args[:case_sensitive] if args.key?(:case_sensitive)\n @expression_value = args[:expression_value] if args.key?(:expression_value)\n @field = args[:field] if args.key?(:field)\n @field_index = args[:field_index] if args.key?(:field_index)\n @kind = args[:kind] if args.key?(:kind)\n @match_type = args[:match_type] if args.key?(:match_type)\n end",
"def update_attribute key, value\n setter = :\"#{key}=\"\n send(setter, value) if respond_to?(setter)\n save(:changes => true, :validate => false)\n end",
"def update\n column_sets = self.class.columns.map { |attr_name| \"#{attr_name} = ?\" }.join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values, self.id)\n UPDATE\n #{self.class.table_name}\n SET\n #{column_sets}\n WHERE\n #{self.class.table_name}.id = ?\n SQL\n # ...\n end",
"def update!(**args)\n @comparison_type = args[:comparison_type] if args.key?(:comparison_type)\n @comparison_value = args[:comparison_value] if args.key?(:comparison_value)\n @expression = args[:expression] if args.key?(:expression)\n @match_type = args[:match_type] if args.key?(:match_type)\n @type = args[:type] if args.key?(:type)\n end",
"def sql_update_set\n attributes.keys.map { |attr_name| \"#{attr_name} = ?\" }\n .join(\", \")\n end",
"def expression=(_arg0); end",
"def update_column name, value\n name = name.to_s\n self.dynamic_record.send \"#{name}=\", value\n self.raw_write_attribute name, value\n end",
"def set_fauxsql_attribute(attribute_name, value)\n options = fauxsql_options[attribute_name]\n value = value.send(options[:type]) if options and options[:type]\n \n attribute = Fauxsql.dereference_fauxsql_attribute(value)\n Fauxsql.dirty!(self){ fauxsql_attributes[attribute_name] = attribute } \n end",
"def store_expression expression, variable_name\r\n command 'storeExpression', expression, variable_name\r\n end",
"def set_variable(expr, value)\n @variables[expr] = value.to_s.force_encoding(Encoding::UTF_8)\n end",
"def set_attribute params\n sequel_db = get_db params[:database]\n sequel_db.transaction do\n attribute_record = sequel_db[:attributes].where( :object_id => params[:persistence_id], :name => params[:name].to_s ) # convert name to String as Symbol breaks sqlite\n\n if attribute_record.empty?\n # If the attribute doesn't exist, we must INSERT and not UPDATE\n attribute_record.insert :object_id => params[:persistence_id], :name => params[:name].to_s, :value => params[:value] # convert name to String as Symbol breaks sqlite\n else\n attribute_record.update :value => params[:value]\n end\n end\n nil\n end",
"def update_statement(properties, query)\n conditions_statement, bind_values = conditions_statement(query.conditions)\n\n statement = \"UPDATE #{quote_name(query.model.storage_name(name))}\"\n statement << \" SET #{properties.map { |property| \"#{quote_name(property.field)} = ?\" }.join(', ')}\"\n statement << \" WHERE #{conditions_statement}\" unless conditions_statement.blank?\n\n return statement, bind_values\n end"
]
| [
"0.6285116",
"0.62565255",
"0.62565255",
"0.6079802",
"0.6028029",
"0.6019261",
"0.6008429",
"0.5959494",
"0.5922933",
"0.5892387",
"0.587297",
"0.5806208",
"0.5790991",
"0.57007587",
"0.5645627",
"0.5605947",
"0.55957127",
"0.5564535",
"0.5555585",
"0.5554237",
"0.555319",
"0.55468494",
"0.5500502",
"0.5495155",
"0.5481827",
"0.54792076",
"0.5466882",
"0.54596305",
"0.5443371",
"0.5426862"
]
| 0.723983 | 0 |
create a new archive by merging this and another archive | def merge(other)
assert_archive other
data = deep_clone(@data)
merge_data data, other.as_json, other.uri
self.class.new data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge!(other)\n assert_archive other\n clear_caches\n\n merge_data @data, other.as_json, other.uri\n nil\n end",
"def merge(other); end",
"def merge(other)\n self.merge_actors(other)\n self.compress_history()\n end",
"def merge(source); end",
"def merge_with other\n m_next = @metadata.merge_with other.metadata\n files_res = {}\n\n # my files\n @files.each { |f| files_res[f.src] = f }\n\n # overrides\n other.files.each { |f| files_res[f.src] = f }\n\n # result\n f_next = files_res.collect { |k, v| v }\n\n Package.new m_next, f_next\n end",
"def archive!\n archive\n save!(validate: false)\n end",
"def merge(other)\n self.class.new(*structures, other)\n end",
"def merge(other, sibling_compression_counter = nil)\n self.merge_actors(other)\n self.remove_duplicates()\n self.compress_history(sibling_compression_counter)\n end",
"def merge; end",
"def create_archive\n created = false\n empty = true\n Dir.mktmpdir do |tmpdir|\n # create manifest\n tmpmf = File.join(tmpdir, DulHydra.export_set_manifest_file_name)\n # create the zip archive\n zip_name = \"export_set_#{Time.now.strftime('%Y%m%d%H%M%S')}.zip\"\n zip_path = File.join(tmpdir, zip_name)\n Zip::ZipFile.open(zip_path, Zip::ZipFile::CREATE) do |zip_file|\n CSV.open(tmpmf, 'wb') do |manifest|\n manifest << archive_manifest_header\n pids.each do |pid|\n # get Fedora object\n begin\n object = ActiveFedora::Base.find(pid, :cast => true) \n # skip if object is not content-bearing or user lacks :read permission\n next unless object.has_content? and user.can?(:read, object)\n content_ds = object.datastreams[DulHydra::Datastreams::CONTENT]\n # use guaranteed unique file name based on PID and dsID \n temp_file_path = File.join(tmpdir, content_ds.default_file_name)\n # write content to file\n File.open(temp_file_path, 'wb', :encoding => 'ascii-8bit') do |f|\n content_ds.write_content(f)\n end\n # Use original source file name, if available; otherwise the generated file name\n # Note that we keep the path of the source file in order to reduce likelihood\n # name conflicts, and since it is easy to flatten zip contents on extraction.\n # However, we don't want the path of the generated temp file, just the basename.\n file_name = object.source.first || File.basename(temp_file_path)\n # discard leading slash, if present\n file_name = file_name[1..-1] if file_name.start_with? '/'\n # add file to archive\n zip_file.add(file_name, temp_file_path)\n # add row to manifest\n manifest << archive_manifest_row(file_name, object)\n rescue ActiveFedora::ObjectNotFoundError => e\n logger.error e\n next\n end\n end # document_list\n end # manifest\n # check if the zip file is emtpy\n empty = (zip_file.size == 0)\n # write manifest \n zip_file.add(DulHydra.export_set_manifest_file_name, tmpmf) unless empty\n end # zip_file\n # update_attributes seems to be the way to get paperclip to work \n # when not using file upload form submission to create the attachment\n created = !empty && update_attributes({:archive => File.new(zip_path, \"rb\")})\n end # tmpdir is removed\n created\n end",
"def merge_zip merged_build\n debug_msg \"Merging zip for #{merged_build}\"\n \n tmp = temp_dir\n \n title = merged_build.builds.map do |build| \n automation_by_name(build.name).name + \" v#{build.version}\"\n end.join(', ')\n names = merged_build.builds.map do |build| \n automation_by_name(build.name).short_name\n end.join(',')\n options = []\n options << \"-o\" << tmp\n options << '--title' << title\n options << '--names' << names\n merged_build.builds.each do |build|\n options << File.join(@public_dir, build.to_s)\n end\n SDoc::Merge.new.merge(options)\n \n prepare tmp\n \n tmp\n end",
"def archive!\n DocumentArchive.create!(:consumer_id => self.consumer_id, :suggested_standard_document_id => self.suggested_standard_document_id, :rejected_at => Time.now, :suggested_at => self.suggested_at, :source => self.source, :file_content_type => self.file_content_type, :cloud_service_full_path => self.cloud_service_full_path, :original_file_name => self.original_file_name)\n end",
"def merge!(other)\n other.read_present.each do |k, v|\n write(k, v)\n end\n\n self\n end",
"def merge!; end",
"def join(other)\n new(entries.merge(other.entries) { |_name, old, new| old + new })\n end",
"def archive\n @repo.archive(sha, nil, :format => 'tgz', :prefix => \"#{safe_name}/\")\n end",
"def merge!(other)\n case other\n when Hash\n data = other\n when FileStore\n data = other.to_h\n end\n data.each do |name, value|\n @data[name.to_s] = value \n end\n end",
"def merge!(other); end",
"def archive_incremental(source_directory, destination_dir, file_prefix, file_suffix, tag_prefix)\n @project.from_directory do\n latest_tag_count = @project.latest_tag_count(tag_prefix)\n\n if latest_tag_count == 0\n archive_single(source_directory, File.join(destination_dir, file_prefix + file_suffix))\n else\n destination_file = File.join(destination_dir,\n \"#{file_prefix}_#{format(\"%04d\", latest_tag_count)}#{file_suffix}\")\n tag = @project.latest_tag(tag_prefix)\n log.debug \"creating #{destination_file} with files newer than #{tag}\"\n\n log.debug \"files that changed since then: #{@project.git.changed_files_since(tag)}\"\n list = @project.git.changed_files_since(tag).select do |file|\n File.expand_path(file) =~ /^#{File.expand_path(source_directory)}\\//\n end.map do |file|\n Pathname.new(file).relative_path_from Pathname.new(source_directory)\n end\n @project.from_directory source_directory do\n `tar -cJf #{destination_file} #{list.join(\" \")}`\n end\n\n destination_file\n end\n end\n end",
"def merge(other_image)\n raise 'an image class must be supplied' unless other_image.is_a? Image\n raise 'cannot merge if the user is different' unless other_image.user == user\n raise 'cannot merge if the account_id is different' unless other_image.account_id == account_id\n raise 'cannot merge if the state is different' unless other_image.state == state\n\n new_image = Image.new\n new_image.user = @user\n new_image.entries = entries + other_image.entries\n new_image\n end",
"def merge(with); end",
"def archive_single(source_directory, destination_file)\n log.debug \"creating #{destination_file}\"\n @project.from_directory source_directory do\n `tar -cJf #{destination_file} *`\n end\n\n destination_file\n end",
"def merge(other)\n result = super\n\n result.sources = other.sources + self.sources\n result\n end",
"def merge( other )\n clone.merge!( other )\n end",
"def merge other\n if empty? then\n @parts = other.parts\n return self\n end\n\n other.parts.each do |other_part|\n self.parts.delete_if do |self_part|\n self_part.file and self_part.file == other_part.file\n end\n\n self.parts << other_part\n end\n\n self\n end",
"def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end",
"def merge!( other )\n my_keys = @ini.keys\n other_keys =\n case other\n when IniFile; other.instance_variable_get(:@ini).keys\n when Hash; other.keys\n else raise \"cannot merge contents from '#{other.class.name}'\" end\n\n (my_keys & other_keys).each do |key|\n @ini[key].merge!(other[key])\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = other[key]\n end\n\n self\n end",
"def merge(other)\n attributes = @attributes.merge(other.attributes)\n excluded = @excluded.dup.concat(other.excluded)\n self.class.new(prefix, attributes, excluded)\n end",
"def merge(other)\n other.each { |entry| self << entry }\n self\n end",
"def wonkofile_merge(old, new)\n res = old.merge new\n # changing versions is not allowed by adding another version index (we might end up with a version in the index that\n # we don't have an actual version file for)\n res['versions'] = old['versions']\n res\nend"
]
| [
"0.7187005",
"0.61873007",
"0.6131283",
"0.6020542",
"0.59257907",
"0.59120613",
"0.5880315",
"0.5879201",
"0.5868103",
"0.5865944",
"0.5838",
"0.57779586",
"0.57763475",
"0.577431",
"0.5706385",
"0.56874985",
"0.5685824",
"0.56599903",
"0.5657604",
"0.56480783",
"0.5635691",
"0.56303924",
"0.5623839",
"0.5604704",
"0.56028706",
"0.55871016",
"0.55771583",
"0.55674255",
"0.55532753",
"0.55513316"
]
| 0.7257923 | 0 |
destructively merge this with the given archive | def merge!(other)
assert_archive other
clear_caches
merge_data @data, other.as_json, other.uri
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(other)\n assert_archive other\n\n data = deep_clone(@data)\n merge_data data, other.as_json, other.uri\n\n self.class.new data\n end",
"def merge!; end",
"def merge!(with); end",
"def restore_archive\n end",
"def archive!\n archive\n save!(validate: false)\n end",
"def merge!(other); end",
"def merge(other, sibling_compression_counter = nil)\n self.merge_actors(other)\n self.remove_duplicates()\n self.compress_history(sibling_compression_counter)\n end",
"def merge(source); end",
"def archive!\n self.update_attribute(:archived, true)\n end",
"def archive!\n self.update_attribute(:archived, true)\n end",
"def archive!\n self.update_attribute(:archived, true)\n end",
"def merge(other); end",
"def merge; end",
"def merge other\n if empty? then\n @parts = other.parts\n return self\n end\n\n other.parts.each do |other_part|\n self.parts.delete_if do |self_part|\n self_part.file and self_part.file == other_part.file\n end\n\n self.parts << other_part\n end\n\n self\n end",
"def merge(other)\n self.merge_actors(other)\n self.compress_history()\n end",
"def merge(with); end",
"def merge!(other)\n other.read_present.each do |k, v|\n write(k, v)\n end\n\n self\n end",
"def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n $el.append_to_file timestamp, nil, filename\n $el.append_to_file content, nil, filename\n end",
"def unarchive\n unless in_zip?\n zips, gzs = selected_items.partition(&:zip?).tap {|z, others| break [z, *others.partition(&:gz?)]}\n zips.each do |item|\n FileUtils.mkdir_p current_dir.join(item.basename)\n Zip::File.open(item) do |zip|\n zip.each do |entry|\n FileUtils.mkdir_p File.join(item.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(item.basename, entry.to_s)) { true }\n end\n end\n end\n gzs.each do |item|\n Zlib::GzipReader.open(item) do |gz|\n Gem::Package::TarReader.new(gz) do |tar|\n dest_dir = current_dir.join (gz.orig_name || item.basename).sub(/\\.tar$/, '')\n tar.each do |entry|\n dest = nil\n if entry.full_name == '././@LongLink'\n dest = File.join dest_dir, entry.read.strip\n next\n end\n dest ||= File.join dest_dir, entry.full_name\n if entry.directory?\n FileUtils.mkdir_p dest, mode: entry.header.mode\n elsif entry.file?\n FileUtils.mkdir_p dest_dir\n File.open(dest, 'wb') {|f| f.print entry.read}\n FileUtils.chmod entry.header.mode, dest\n elsif entry.header.typeflag == '2' # symlink\n File.symlink entry.header.linkname, dest\n end\n unless Dir.exist? dest_dir\n FileUtils.mkdir_p dest_dir\n File.open(File.join(dest_dir, gz.orig_name || item.basename), 'wb') {|f| f.print gz.read}\n end\n end\n end\n end\n end\n else\n Zip::File.open(current_zip) do |zip|\n zip.select {|e| selected_items.map(&:name).include? e.to_s}.each do |entry|\n FileUtils.mkdir_p File.join(current_zip.dir, current_zip.basename, File.dirname(entry.to_s))\n zip.extract(entry, File.join(current_zip.dir, current_zip.basename, entry.to_s)) { true }\n end\n end\n end\n ls\n end",
"def merge_zip merged_build\n debug_msg \"Merging zip for #{merged_build}\"\n \n tmp = temp_dir\n \n title = merged_build.builds.map do |build| \n automation_by_name(build.name).name + \" v#{build.version}\"\n end.join(', ')\n names = merged_build.builds.map do |build| \n automation_by_name(build.name).short_name\n end.join(',')\n options = []\n options << \"-o\" << tmp\n options << '--title' << title\n options << '--names' << names\n merged_build.builds.each do |build|\n options << File.join(@public_dir, build.to_s)\n end\n SDoc::Merge.new.merge(options)\n \n prepare tmp\n \n tmp\n end",
"def merge!(hash); end",
"def set_unarchive_flag\n self.just_unarchived = true\n end",
"def archive(branch_or_tag = nil)\n git 'archive', branch_or_tag || 'HEAD', binmode: true\n end",
"def merge!( other )\n my_keys = @ini.keys\n other_keys =\n case other\n when IniFile; other.instance_variable_get(:@ini).keys\n when Hash; other.keys\n else raise \"cannot merge contents from '#{other.class.name}'\" end\n\n (my_keys & other_keys).each do |key|\n @ini[key].merge!(other[key])\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = other[key]\n end\n\n self\n end",
"def archive(branch_or_tag = nil)\n working_dir do\n git 'archive', branch_or_tag || 'HEAD', :binmode => true\n end\n end",
"def archive\n delete_content\n filename = 'archive.' + $el.file_name_nondirectory(buffer_file_name)\n timestamp = \"--- archived on #{Time.now.strftime('%Y-%m-%d at %H:%M')} --- \\n\"\n append_to_file timestamp, nil, filename\n append_to_file content, nil, filename\n end",
"def merge!(other)\n return self if other.nil?\n\n my_keys = @ini.keys\n other_keys = case other\n when IniFile\n other.instance_variable_get(:@ini).keys\n when Hash\n other.keys\n else\n raise Error, \"cannot merge contents from '#{other.class.name}'\"\n end\n\n (my_keys & other_keys).each do |key|\n case other[key]\n when Hash\n @ini[key].merge!(other[key])\n when nil\n nil\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n (other_keys - my_keys).each do |key|\n @ini[key] = case other[key]\n when Hash\n other[key].dup\n when nil\n {}\n else\n raise Error, \"cannot merge section #{key.inspect} - unsupported type: #{other[key].class.name}\"\n end\n end\n\n self\n end",
"def archive\n self.snapshot_action = \"archive\"\n self.discard\n end",
"def merge(...)\n self.clone.merge!(...)\n end",
"def archive\n self.archived_at = Time.current\n end"
]
| [
"0.66228884",
"0.62758654",
"0.6235372",
"0.62330544",
"0.6205354",
"0.62046945",
"0.6178792",
"0.6118874",
"0.60017157",
"0.60017157",
"0.60017157",
"0.59287244",
"0.5926497",
"0.5888809",
"0.5877875",
"0.5868271",
"0.58376217",
"0.5812669",
"0.58084846",
"0.5777846",
"0.57665724",
"0.57324725",
"0.5720049",
"0.57123375",
"0.57097906",
"0.57057613",
"0.5687374",
"0.56760156",
"0.56728506",
"0.56430584"
]
| 0.7215412 | 0 |
Gets the countdownDisplayBeforeRestartInMinutes property value. The number of minutes before the restart time to display the countdown dialog for pending restarts. | def countdown_display_before_restart_in_minutes
return @countdown_display_before_restart_in_minutes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end",
"def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end",
"def restart_count\n return @restart_count\n end",
"def minutes\n (@seconds.abs / 60) % 60 * (@seconds < 0 ? -1 : 1)\n end",
"def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end",
"def automatic_restart_time\n data[:automatic_restart_time]\n end",
"def automatic_restart_time\n data[:automatic_restart_time]\n end",
"def countdown\n time_left = self.time_remaining\n m = (time_left / 60).to_s\n s = (time_left % 60)\n s = s >= 10 ? s.to_s : \"0#{s}\"\n \"0#{m}:#{s}\"\n end",
"def minutes\n (seconds % 3600) / 60\n end",
"def restart_count=(value)\n @restart_count = value\n end",
"def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end",
"def password_minutes_of_inactivity_before_lock\n return @password_minutes_of_inactivity_before_lock\n end",
"def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end",
"def password_minutes_of_inactivity_before_screen_timeout\n return @password_minutes_of_inactivity_before_screen_timeout\n end",
"def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end",
"def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end",
"def minutes() 60 * seconds end",
"def passcode_minutes_of_inactivity_before_lock\n return @passcode_minutes_of_inactivity_before_lock\n end",
"def work_profile_password_minutes_of_inactivity_before_screen_timeout\n return @work_profile_password_minutes_of_inactivity_before_screen_timeout\n end",
"def minutes\n _nudge[1]\n end",
"def minute(padded = false)\n min = (seconds_since_start_of_hour / M_SECS).to_i\n if padded && min < 10\n min = \"0#{min}\"\n end\n min\n end",
"def work_profile_password_minutes_of_inactivity_before_screen_timeout=(value)\n @work_profile_password_minutes_of_inactivity_before_screen_timeout = value\n end",
"def seconds\n @seconds.abs % 60 * (@seconds < 0 ? -1 : 1)\n end",
"def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end",
"def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end",
"def passcode_minutes_of_inactivity_before_screen_timeout\n return @passcode_minutes_of_inactivity_before_screen_timeout\n end",
"def passcode_minutes_of_inactivity_before_lock=(value)\n @passcode_minutes_of_inactivity_before_lock = value\n end",
"def calc_mins_till\n (@difference.round(2) / 60.00).round(2)\n end",
"def beginning_of_minute\n change(sec: 0)\n end",
"def beginning_of_minute\n change(sec: 0)\n end"
]
| [
"0.77445376",
"0.5822122",
"0.58177066",
"0.5649487",
"0.561191",
"0.55909705",
"0.55909705",
"0.55469835",
"0.54971653",
"0.5386674",
"0.53762263",
"0.53762263",
"0.5256719",
"0.5256719",
"0.51962405",
"0.51962405",
"0.5191844",
"0.51666063",
"0.5147846",
"0.5135285",
"0.5131239",
"0.51228094",
"0.510936",
"0.50803053",
"0.50803053",
"0.5047757",
"0.50103724",
"0.50092953",
"0.5000577",
"0.5000577"
]
| 0.82854724 | 0 |
Sets the countdownDisplayBeforeRestartInMinutes property value. The number of minutes before the restart time to display the countdown dialog for pending restarts. | def countdown_display_before_restart_in_minutes=(value)
@countdown_display_before_restart_in_minutes = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countdown_display_before_restart_in_minutes\n return @countdown_display_before_restart_in_minutes\n end",
"def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end",
"def restart_count=(value)\n @restart_count = value\n end",
"def reset_times_after_display\n @@resets_after_display = true\n end",
"def work_profile_password_minutes_of_inactivity_before_screen_timeout=(value)\n @work_profile_password_minutes_of_inactivity_before_screen_timeout = value\n end",
"def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end",
"def password_minutes_of_inactivity_before_screen_timeout=(value)\n @password_minutes_of_inactivity_before_screen_timeout = value\n end",
"def passcode_minutes_of_inactivity_before_screen_timeout=(value)\n @passcode_minutes_of_inactivity_before_screen_timeout = value\n end",
"def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end",
"def password_minutes_of_inactivity_before_lock=(value)\n @password_minutes_of_inactivity_before_lock = value\n end",
"def passcode_minutes_of_inactivity_before_lock=(value)\n @passcode_minutes_of_inactivity_before_lock = value\n end",
"def automatic_restart=(value)\n @automatic_restart = value\n end",
"def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end",
"def automatic_restart_time\n data[:automatic_restart_time]\n end",
"def automatic_restart_time\n data[:automatic_restart_time]\n end",
"def beginning_of_minute\n change(sec: 0)\n end",
"def beginning_of_minute\n change(sec: 0)\n end",
"def restart_count\n return @restart_count\n end",
"def countdown\n time_left = self.time_remaining\n m = (time_left / 60).to_s\n s = (time_left % 60)\n s = s >= 10 ? s.to_s : \"0#{s}\"\n \"0#{m}:#{s}\"\n end",
"def redisplay_delay\r\n 20\r\n end",
"def countdown(seconds)\n seconds.downto(0).each do |remaining|\n if remaining <= 5\n puts \" #{remaining} \" if @verbose\n elsif remaining % 60 == 0\n minutes = remaining / 60\n puts \"Retrying in #{minutes} minutes...\" if @verbose\n end\n sleep 1\n end\n end",
"def lazy_min=(newmin)\n newmin = newmin.to_f\n \n #Add hours for every 60 minutes given.\n if newmin > 60 or newmin < 0\n hours = (newmin.to_f / 60.0).floor\n newmin -= (hours.to_f * 60.0)\n self.add_hours(hours)\n end\n \n #Convert any decimals to setting the second.\n diff = newmin - newmin.floor\n self.lazy_sec = diff * 60 if diff > 0.0\n \n #Set the actual minute.\n @t_min = newmin.floor\n \n self\n end",
"def setMinutes(minutes)\r\n\t\t\t\t\t@minutes = minutes\r\n\t\t\t\tend",
"def set_time_left(value)\n if value\n @time_left.set_text(\"#{value} seconds left before crashing.\")\n else\n @time_left.set_text(\"Select an option:\")\n end\n end",
"def enable_restart\n println _INTL('Changes have been made: the game must restart')\n @restart = true\n end",
"def minute(padded = false)\n min = (seconds_since_start_of_hour / M_SECS).to_i\n if padded && min < 10\n min = \"0#{min}\"\n end\n min\n end",
"def average_restarts=(value)\n @average_restarts = value\n end",
"def minutes\n (@seconds.abs / 60) % 60 * (@seconds < 0 ? -1 : 1)\n end",
"def maintenance_start_time=(value)\n @maintenance_start_time = value\n end",
"def restart_category=(value)\n @restart_category = value\n end"
]
| [
"0.7300913",
"0.5887486",
"0.5757111",
"0.5319283",
"0.52962637",
"0.5211868",
"0.5211868",
"0.51519156",
"0.51368046",
"0.51368046",
"0.5113679",
"0.5015245",
"0.49272695",
"0.49153465",
"0.49153465",
"0.49071556",
"0.49071556",
"0.4846544",
"0.4619251",
"0.45845246",
"0.4573155",
"0.4570038",
"0.4518871",
"0.45153725",
"0.45068756",
"0.44890937",
"0.44628513",
"0.43865263",
"0.4359076",
"0.42992485"
]
| 0.8163413 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.