query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Override the accessor: The Jekyll::Rendereer calls document.content, so this seems like the best way to set our "page" content with what we want.
def content zones = {} keys = %w[content preferences] if page['block_instances'].length # create zone buckets page['block_instances'].each do |i| # go through all content if site.config.event? keys.each do |key| i[key].each do |k, v| if placeholder?(v) # maintain the {{ t.foo }} variables v.gsub!(/(\{\{\s*t\.[a-z_.]+\s*\}\})/, '{% raw %}\1{% endraw %}') i[key][k] = render_with_substitutions(v, 'event' => site.data['event'], 'mappable' => site.data['mappable']) end end end unless site.data['mappable'].nil? || site.data['mappable'].empty? perform_substitution!(i, 'mappable' => site.data['mappable']) end end zones[i['zone']] = [] if zones[i['zone']].nil? zones[i['zone']] << i end # sort each bucket by widget weight zones.each do |k, zone| zone.sort! { |x, y| x['weight'] <=> y['weight'] } end end zones.to_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content\n return @content if @content\n content, id = self.get_page_content\n content = master.render(content)\n Ruhoh::Converter.convert(content, id)\n end", "def set_resource_content\n @page = Page.available.homepage.first!\n end", "def documentation_content_for(page)\n # Get the content\n content = page.compiled_content.to_s\n\n # Insert navigation\n content.gsub!(\"<p class=''>{{nav}}</p>\") do\n children = page.children\n children = children.select { |c| documentation_authorizer.can_view_page?(c) }\n items = children.map { |c| \"<li><a href='#{documentation_doc_root}/#{c.full_permalink}'>#{c.title}</a></li>\" }.join\n \"<ul class='pages'>#{items}</ul>\"\n end\n\n # Set the document root as appropriate\n content.gsub!(\"{{docRoot}}\", documentation_doc_root)\n\n # Return HTML safe content\n content.html_safe\n end", "def content\n page.formatted_data\n end", "def add_page_to_doc\n @page_content.each { |line| @doc_content += line}\n @pages_in_doc += 1\n if !@doc_start_page\n @doc_start_page = current_page()\n end\n return @doc_content\n end", "def content=(value)\n @content = value\n end", "def content=(value)\n @content = value\n end", "def content=(value)\n @content = value\n end", "def content=(value)\n @content = value\n end", "def content=(value)\n @content = value\n end", "def content=(value)\n @content = value\n end", "def content=(v)\n @content = v\n end", "def get_content()\n return super()\n end", "def content\n super\n @renderer = @widget.content\n div :id => 'doc3' do\n if @renderer.render? :header\n div :id => 'hd' do\n if @renderer.render? :top_line\n render_top_line\n end\n if @renderer.render? :title\n h1 @page_title || 'Missing :page_title'\n end \n end\n end\n div :id => 'bd' do\n render_body\n end\n if @renderer.render? :footer\n div :id => 'ft' do\n render_footer\n end\n end\n end\n end", "def content\n @content ||= content!\n end", "def content=(value) # must prepend self otherwise do not update blog_content\n self.blog_content ||= BlogContent.new\n self.blog_content.content = value\n self.content_updated_at = Time.now\n end", "def set_content(content)\n @content = content\n end", "def content=(content)\n @content = content\n end", "def set_page\n end", "def content=(value)\n # Reflow the content headers based on the child's levels (raise exception if level exceeds 6)\n m = Markdown.new(value.to_s)\n\n # Reassign the parent of the children to the current object and ensure the new depth is valid\n @children = m.children\n @children.each do |c|\n c.instance_variable_set(:@parent, self)\n validate_levels(c)\n end\n\n @content = m.content\n end", "def with_content(content)\n @content = content\n self\n end", "def setContent(content)\r\n\t\t\t\t\t@content = content\r\n\t\t\t\tend", "def setContent(content)\r\n\t\t\t\t\t@content = content\r\n\t\t\t\tend", "def render_md page, content\n markdown(content || self.body) # HACK\n end", "def render_md page, content\n markdown(content || self.body) # HACK\n end", "def page; self end", "def content\n MarkdownService.new.render(body).html_safe \n end", "def page_content(page_id, id, params = {})\n content(Voog::API::Contents::ParentKind::Page, page_id, id, params)\n end", "def doc_content\n @doc_content\n end", "def set_document_content(frame_id:, html:)\n {\n method: \"Page.setDocumentContent\",\n params: { frameId: frame_id, html: html }.compact\n }\n end", "def render\n relative_permalinks_are_deprecated\n\n payload = site_payload\n\n Jekyll::Hooks.trigger :site, :pre_render, self, payload\n\n render_docs(payload)\n render_pages(payload)\n\n Jekyll::Hooks.trigger :site, :post_render, self, payload\n nil\n end", "def content=(new_content)\n @content = new_content\n end", "def create_page_content(page_id, data)\n create_content(Voog::API::Contents::ParentKind::Page, page_id, data)\n end", "def content=(value)\n return if value == self.content\n self.add_current_locale\n self.default_content = false\n super\n end", "def content\n return @content unless @content.nil?\n\n @content = @ref\n @opts[:content_path].each do |node|\n @content = @content.send(node)\n end\n @content\n end", "def content \n @content\n end", "def set_content\n @content = @slide.contents.friendly.find(params[:id])\n @content_types = ContentType.all\n end", "def content\n div :id => 'doc3' do\n div :id => 'hd' do\n render_top_line\n h1 @page_title || 'Missing :page_title' \n end\n div :id => 'bd' do\n render_body\n end\n div :id => 'ft' do\n render_footer\n end\n end\n end", "def content_en=(value) # must prepend self otherwise do not update blog_content\n self.blog_content_en ||= BlogContent.new\n self.blog_content_en.content = value\n self.content_updated_at = Time.now\n end", "def content\n @content\n end", "def content\n @content\n end", "def convert_markdown\n self.html_content = Raptor::Markdown.render(self.content)\n end", "def page\n\t\t\teditor.page\n\t\tend", "def content_manipulation\n self.summary = markup_manipulation self.summary if self.summary.present?\n self.content = markup_manipulation self.content if self.content.present?\n end", "def set_page(name, version, content)\n p \"set page: #{name} : #{version.class}\"\n page = wiki.page(name, version)\n if !page.nil?\n path = page_path(name, version)\n FileUtils.mkdir_p(File.dirname(path))\n File.open(path, 'w') do |f|\n f.write(content)\n end\n end\n end", "def render_document\n info = {\n :registers => { :site => site, :page => payload[\"page\"] },\n :strict_filters => liquid_options[\"strict_filters\"],\n :strict_variables => liquid_options[\"strict_variables\"],\n }\n\n output = document.content\n if document.render_with_liquid?\n Jekyll.logger.debug \"Rendering Liquid:\", document.relative_path\n output = render_liquid(output, payload, info, document.path)\n end\n\n Jekyll.logger.debug \"Rendering Markup:\", document.relative_path\n output = convert(output.to_s)\n document.content = output\n\n Jekyll.logger.debug \"Post-Convert Hooks:\", document.relative_path\n document.trigger_hooks(:post_convert)\n output = document.content\n\n if document.place_in_layout?\n Jekyll.logger.debug \"Rendering Layout:\", document.relative_path\n output = place_in_layouts(output, payload, info)\n end\n\n output\n end", "def cache_markdown_content\n self.markdown_content = GitHub::Markdown.render(content)\n end", "def page\n @proxying ? @page.document : @page\n end", "def content= (new_content)\n @content = new_content\n end", "def body_content\n end", "def content\n\t\t@content\n\tend", "def page\n self.class.page\n end", "def content\n @content ||= revisions['master'].content\n end", "def include_content=(value)\n @include_content = value\n end", "def set_page\n page = find_page(params[:id])\n @url = page[0]\n @title = page[1]\n @contents = find_file(page[2])\n end", "def content \n \trenderer = SyntaxRenderer.new(optionize [\n \t:with_toc_data,\n \t#{:hard_wrap,\n \t:xhtml,\n \t:prettify\n \t])\n \n \tmarkdown = Redcarpet::Markdown.new(renderer, optionize([\n \t:fenced_code_blocks,\n \t:no_intra_emphasis,\n \t:tables,\n \t:superscript,\n \t:autolink,\n \t:strikethrough,\n \t:space_after_headers,\n \t:with_toc_data,\n \t:quote,\n \t:lax_spacing\n \t]))\n \n \treturn markdown.render(parse_links(@content)) \n\tend", "def setContent(value) \n @obj.setContent(value) \n end", "def page\n @page ||= revision.try(:page)\n end", "def set_page_data\n @page_title = \"Dragos | My Portfolio\"\n @seo_keywords = \"Dragos Portfolio\"\n end", "def content!\n @raw = nil # force to reload it\n self.content\n end", "def contents\n self.content\n end", "def content\n @content \n end", "def parse\n super\n if next_page_url\n @doc = get_document(URI(next_page_url))\n self.parse\n end\n self\n end", "def show\n @editable = @page\n @title = PageTitle.new I18n.t(\"page_titles.about.#{@page.slug}\")\n\n # no layout\n render html: @page.content.html_safe, layout: false if @page.content_in_html?\n end", "def content(name, content, opts = {})\n page = Islay::Pages.definitions[name]\n raise \"The page '#{name}' has not been defined\" if page.nil?\n raise \"The content '#{content}' has not been defined\" if page.contents[content].nil?\n\n if record = page.record\n config = record.content_with_config(content)\n\n case config[:type]\n when :markdown then render_markdown(config[:value], opts[:level] || 1)\n when :text then simple_format(config[:value])\n when :string, :color then config[:value]\n when :image\n if opts[:url_only]\n version_image_url(config[:value].asset, opts[:version]) if config[:value]\n else\n version_image_tag(config[:value].asset, opts[:version]) if config[:value]\n end\n end\n end\n end", "def view_context\n super.tap { |actual_view_context| actual_view_context.content_for :meta_description, @page.meta_description }\n end", "def contents\n rendered_contents\n end", "def generate_content\n @pdf = Prawn::Document.new(\n info: self.metadata,\n top_margin: @format[:header_size] + @format[:top_margin],\n bottom_margin: @format[:footer_size] + @format[:bottom_margin]\n )\n add_page_body\n add_page_header\n add_page_footer\n add_page_numbering\n end", "def render\n content\n end", "def set_resource\n @page = current_site.pages.available.homepage.first!\n end", "def assign_pages!\n payload[\"page\"] = document.to_liquid\n payload[\"paginator\"] = (document.pager.to_liquid if document.respond_to?(:pager))\n end", "def content\n @content\n end", "def page\n @page ||= retrieve_page\n end", "def page\n @page ||= retrieve_page\n end", "def begin_page(arg = nil)\n @content << \" \"\n end", "def render(options = {}, locals = {}, &block)\n if options.is_a?(Hash) && path = options.delete(:cms_page)\n site = CmsSite.find_by_hostname(request.host.downcase)\n page = CmsPage.load_from_file(site, path) if site && ComfortableMexicanSofa.configuration.seed_data_path\n page ||= site && site.cms_pages.find_by_full_path(path)\n if page\n cms_app_layout = page.cms_layout.try(:app_layout)\n options[:layout] ||= cms_app_layout.blank?? nil : cms_app_layout\n options[:inline] = page.content\n @cms_page = page\n super(options, locals, &block)\n else\n raise ActionView::MissingTemplate.new([path], path, \"CMS page not found\", nil)\n end\n else\n super(options, locals, &block)\n end\n end", "def edit_with_rexml\n require 'rexml/document'\n doc = REXML::Document.new(read)\n yield doc if block_given?\n self.content = doc.to_s\n save\n end", "def begin_page(arg = nil)\n @content << \"\"\n end", "def content\n @content = content_class.published.find(params[:id])\n end", "def html\n Markdown.render(self.content)\n end", "def html\n Markdown.render(self.content)\n end", "def content\n end", "def content\n end", "def content\n end", "def content\n\t\treturn Redcarpet.new(parse_links(@content)).to_html\n\tend", "def content(force_reload = false)\n @content = read_attribute(:content)\n @content = nil if force_reload\n @content ||= begin\n self.cms_tags = [] # resetting\n cms_layout ? CmsTag.process_content(self, cms_layout.merged_content) : ''\n end\n end", "def add\n if page.url && !Ink.config['docs_mode']\n Ink.site.pages << page unless Helpers::Path.find_page(page)\n end\n end", "def page_object\n @page\n end", "def page_object\n @page\n end", "def render\n erb_page = ERB.new(content).result(binding)\n Kramdown::Document.new(erb_page).to_html.html_safe\n end", "def perform\n page_ref.ensure_attributes :content\n # The recipe_page will assert path markers and clear our content\n # if changes during page parsing were significant\n if content_needed?\n if page_ref.recipe_page_ready? # Ready to build\n # reload if persisted? # Possibly the recipe_page changed us\n recipe_page.ensure_attributes :content # Parse the page into one or more recipes\n end\n content_to_parse =\n (recipe_page&.selected_content(anchor_path, focus_path) if anchor_path.present? && focus_path.present?) ||\n page_ref.trimmed_content\n return unless content_to_parse.present?\n ps = ParserServices.parse entity: self, content: content_to_parse\n new_content = ps.annotate\n nc1 = ParsingServices.new(self).parse_and_annotate content_to_parse\n return unless new_content.present? # Parsing was a success\n accept_attribute :content, new_content, true # Force the new content\n end\n # super if defined?(super)\n end", "def body_content\n raise NotImplementedError\n end", "def set_PostContent(value)\n set_input(\"PostContent\", value)\n end", "def set_PostContent(value)\n set_input(\"PostContent\", value)\n end", "def publish\n self.status = 'published'\n self.pubilshed_at = DateTime.now\n self.html = Markdown.parse self.content\n self.slug = self.title.parameterize\n\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)\n self.html = md.render(self.content)\n\n save\n end", "def content\n return @content if application.cache_pages? && @content\n\n @content = if file?\n IO.read(path)\n elsif io?\n path.read\n else\n path\n end\n end", "def blog_page(&block)\n content_for(:blog_content, &block)\n render :partial => 'layouts/blog/blog_page'\n end", "def content; end", "def content; end", "def content; end", "def content; end" ]
[ "0.68852824", "0.67624646", "0.67619675", "0.6447814", "0.6438497", "0.6417692", "0.6417692", "0.6417692", "0.6417692", "0.6417692", "0.6417692", "0.63165885", "0.61453617", "0.61395913", "0.6132145", "0.6120535", "0.6111205", "0.608347", "0.6077901", "0.60763055", "0.6067383", "0.60418826", "0.60418826", "0.6037099", "0.6037099", "0.601391", "0.59690595", "0.59617823", "0.5942303", "0.59366256", "0.5935213", "0.5927825", "0.5917259", "0.59013283", "0.58833456", "0.5874608", "0.5869284", "0.58675694", "0.58668023", "0.58618027", "0.58618027", "0.586142", "0.58524024", "0.5844661", "0.58382744", "0.58275753", "0.5827415", "0.58061874", "0.58056974", "0.5802753", "0.57989097", "0.5797435", "0.57962763", "0.5789431", "0.57824993", "0.57785785", "0.5773938", "0.57709515", "0.57705724", "0.5766616", "0.575783", "0.5753419", "0.57403344", "0.57290995", "0.57262766", "0.5725233", "0.5723046", "0.57222337", "0.5718085", "0.571471", "0.57113993", "0.57102287", "0.5698076", "0.5698076", "0.5686268", "0.5682835", "0.56762475", "0.5665102", "0.56639665", "0.5654754", "0.5654754", "0.56543833", "0.56543833", "0.56543833", "0.56524134", "0.56483424", "0.56381345", "0.5637743", "0.5637743", "0.56376535", "0.56337094", "0.5630441", "0.56281704", "0.56281704", "0.56208634", "0.562042", "0.56199634", "0.5619367", "0.5619367", "0.5619367", "0.5619367" ]
0.0
-1
marking objects for destruction brute force version. Only works if you save parent. Going through each element and destroy it is not very efficient
def mark_children_for_removal work_graphics.each do |work_graphic| work_graphic.destroy end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #primitives in structs are without parent\n parent and parent.children.delete self\n end", "def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end", "def destroy_and_child\n materials.each do |material|\n material.destroy\n end\n measures.each do |measure|\n measure.destroy\n end\n destroy\n end", "def destroy\n super\n\n @children.each do |_child_name, child_group|\n child_group.each(&:destroy)\n end\n\n @children = {}\n end", "def recursively_destroy!\n children.each { |c| c.recursively_destroy! }\n destroy\n end", "def finish\n @children.each { |kid| \n kid[:link].finish()\n kid[:link] = nil\n kid[:residue].finish()\n kid[:residue] = nil\n }\n\n @ring_positions.each { |pos,node| \n node.finish()\n }\n\n remove_relations\n \n end", "def obj_purge(obj,klass)\n obj_manipulate obj,klass do |man|\n man.in_session do \n parents = find_by_member(obj.name, :find_mode => :exact, :transaction => true)\n transaction do\n parents.each do |par|\n obj_remove par, par.class, obj\n end\n obj_delete obj, obj.class\n end\n end\n end\n end", "def destroy\n @parent = nil\n @root = nil\n end", "def remove\n each { |x| x.parent.children.delete(x) }\n end", "def destroy_cascade\n self.save\n self.children.each do |child|\n child.destroy_cascade\n end\n self.asset_ws_files.destroy\n self.permissions.destroy\n self.changes.destroy\n self.destroy\n end", "def destroy_related\n \tdestroyable_ages = []\n\t \tage_bracket_ids = self.age_brackets.pluck(:id)\n \t\t\tage_bracket_ids.each do |id|\n \t\t\t\tagesets = AgeSet.where(age_bracket_id: id)\n if agesets.any? && agesets.count == 1\n destroyable_ages << agesets\n end\n\t\t\tend\n\t \tdestroyable_ages.each { |age| age.first.age_bracket.destroy }\n\t \tself.destroy \n end", "def remove_from_parents\n ordered_by.each do |parent|\n parent.ordered_members.delete(self) # Delete the list node\n parent.members.delete(self) # Delete the indirect container Proxy\n parent.save! # record the changes to the ordered members\n end\n end", "def orphan_child_categories\n self.children.each do |child|\n child.parent_id = nil\n child.save\n end\n end", "def finalize\n @list.each do |bp|\n bp.related_bp.each { |bp| bp.remove! }\n bp.remove!\n end\n clear\n end", "def destroy_zombies(parent_model, parent_association_name)\n if zombies_possible?(parent_association_name)\n destroy_zombie_child_of(parent_model)\n end\n end", "def destroy\n super do\n graph.delete [source.to_term, nil, nil]\n parent.delete [parent, nil, source.to_term]\n end\n end", "def destroy_orphaned_tags\n sweeper = TagSweeper.send(:new)\n sweeper.send(:controller=, ActionController::Base.new)\n\n klasses = ActiveRecord::Base.descendants.select do |klass|\n klass.respond_to?(:acts_as_tag?) && klass.acts_as_tag?\n end\n\n klasses.each do |klass|\n relation = klass\n\n klass.reflect_on_all_associations(:has_and_belongs_to_many).each do |ref|\n relation = relation.where <<-SQL\n #{klass.table_name}.id NOT IN (\n SELECT DISTINCT join_table.#{ref.foreign_key}\n FROM #{ref.options[:join_table]} join_table\n )\n SQL\n end\n\n ActiveRecord::Base.connection.transaction do\n relation.each do |record|\n puts \"Destroy #{klass.name}: #{record.to_s}\"\n\n if record.destroy\n sweeper.expire_caches_for(record)\n end\n end\n end\n end\n end", "def retrieve_all_children\n self.to_be_removed = false\n self.save\n\n self.tags.each do |i|\n i.to_be_removed = false\n i.save\n end\n end", "def delete_tree\n @root = nil # In ruby it will be taken care by garbage collector\n end", "def destroy_children()\n # self.children.each do |c|\n # class_const = Service.class_map[c.service_id]\n # raise NoClassError.new(\"Pas de classe rattachée au service=#{c.service_id}\") if class_const.nil?\n # child = class_const[c.id]\n # child.destroy()\n # end\n end", "def destroy_with_children\n destroyed_comment_ids = []\n self.descendants.each do |comment|\n comment.destroy\n destroyed_comment_ids << comment.id\n end\n\n self.destroy ? destroyed_comment_ids << self.id : false\n end", "def teardown\n @root.remove!(@left_child1)\n @root.remove!(@right_child1)\n @root = nil\n end", "def destroy_dependents\n self.clouds.each do |cloud| cloud.destroy end\n self.groups.each do |group| group.destroy end\n self.roles.each do |role| role.destroy end\n self.recipes.each do |recipe| recipe.destroy end\n self.questions.each do |question| question.destroy end\n end", "def destroy_descendants\n return if right.nil? || left.nil? || skip_before_destroy\n \n if acts_as_nested_set_options[:dependent] == :destroy\n descendants.each do |model|\n model.skip_before_destroy = true\n model.destroy\n end\n else\n base_class.delete_all scoped(left_column_name => { '$gt' => left }, right_column_name => { '$lt' => right })\n end\n \n # update lefts and rights for remaining nodes\n diff = right - left + 1\n base_class.all(scoped(left_column_name => { '$gt' => right })).each do |node|\n node.update_attributes left_column_name => node.left - diff\n end\n base_class.all(scoped(right_column_name => { '$gt' => right })).each do |node|\n node.update_attributes right_column_name => node.right - diff\n end\n \n # Don't allow multiple calls to destroy to corrupt the set\n self.skip_before_destroy = true\n end", "def destroy\n object_data.each {|o| ObjectDatum.find_by_guid(o.guid).destroy if o && ObjectDatum.find_by_guid(o.guid)}\n super\n end", "def remove_marked\n @objects.remove_marked\n end", "def cleanup_relationships\n @involved_relationships = self.relationships\n @iterations = @involved_relationships.length\n @iterations.times do |i|\n @involved_relationships[i].destroy\n end\n end", "def destroy_descendants\n return if right.nil? || left.nil? || skip_before_destroy\n\n if acts_as_nested_set_options[:dependent] == :destroy\n descendants.each do |model|\n model.skip_before_destroy = true\n model.destroy\n end\n else\n c = nested_set_scope.where(left_field_name.to_sym.gt => left, right_field_name.to_sym.lt => right)\n scope_class.where(c.selector).delete_all\n end\n\n # update lefts and rights for remaining nodes\n diff = right - left + 1\n\n # scope_class.with(:safe => true).where(\n scope_class.where(\n nested_set_scope.where(left_field_name.to_sym.gt => right).selector\n ).inc(left_field_name => -diff)\n\n # scope_class.with(:safe => true).where(\n scope_class.where(\n nested_set_scope.where(right_field_name.to_sym.gt => right).selector\n ).inc(right_field_name => -diff)\n\n # Don't allow multiple calls to destroy to corrupt the set\n self.skip_before_destroy = true\n end", "def destroy_tree_from_leaves\n self.subdirectories.each do |subdirectory|\n subdirectory.destroy_tree_from_leaves\n end\n self.subdirectories.reload\n self.cfs_files.each do |cfs_file|\n cfs_file.destroy!\n end\n self.cfs_files.reload\n self.destroy!\n end", "def destroy_old_objs(obj, to_save)\n if obj.respond_to?(:stix_id) && !obj.stix_id.nil?\n obj_to_destroy = obj.class.find_by_stix_id(obj.stix_id)\n if obj_to_destroy.present?\n # Get rid of old indicator things\n obj_to_destroy.stix_markings.destroy_all\n if obj.class == Indicator\n obj_to_destroy.observables.destroy_all\n obj_to_destroy.indicators_course_of_actions.destroy_all\n obj_to_destroy.confidences.destroy_all\n obj_to_destroy.indicator_ttps.destroy_all\n obj_to_destroy.sightings.destroy_all\n # get rid of old stix package things\n elsif obj.class == StixPackage\n obj_to_destroy.indicators_packages.destroy_all\n obj_to_destroy.exploit_target_packages.destroy_all\n obj_to_destroy.packages_course_of_actions.destroy_all\n obj_to_destroy.contributing_sources.destroy_all\n obj_to_destroy.ttp_packages.destroy_all\n # get rid of old COA things\n elsif obj.class == CourseOfAction\n obj_to_destroy.parameter_observables.destroy_all\n # Exploit Targets \n elsif obj.class == ExploitTarget\n obj_to_destroy.exploit_target_vulnerabilities.destroy_all\n obj_to_destroy.exploit_target_course_of_actions.destroy_all\n # Vulnerabilities dont need anything because we just destroy stix markings\n elsif obj.class == Vulnerability\n elsif obj.class == Ttp\n obj_to_destroy.ttp_attack_patterns.destroy_all\n obj_to_destroy.ttp_exploit_targets.destroy_all\n # Attack Patterns dont need anything because we just destroy stix markings\n elsif obj.class == AttackPattern\n end\n end\n # Get rid of old cybox object things\n elsif obj.respond_to?(:cybox_object_id) && !obj.cybox_object_id.nil?\n obj_to_destroy = obj.class.find_by_cybox_object_id(obj.cybox_object_id)\n if obj_to_destroy.present?\n obj_to_destroy.stix_markings.destroy_all\n end\n end\n\n if obj_to_destroy.present? && obj.id != obj_to_destroy.id\n to_save -= [obj_to_destroy]\n obj_to_destroy.destroy\n end\n\n to_save\n end", "def before_destroy\n\t\tsuper\n\t\tchrome_pdf_tasks.each { |t| t.destroy }\n\t\tdiff_stream.each { |c| c.destroy }\n\n\t\t# save photo list, so we can traverse it\n\t\tp = photos.collect { |x| x }\n\t\t# destroys the association\n\t\tremove_all_photos\n\t\t# remove orphan photos\n\t\tp.each do |photo|\n\t\t\t# destroy photos if we are the only book\n\t\t\tsuccess = true\n\t\t\tsuccess = photo.destroy if photo.books.count == 0\n\t\t\tPB.logger.error \"Could not destroy photo #{photo.id}\" unless success\n\t\tend\n\tend", "def clear\n @parent = nil\n end", "def mark_for_destruction(attributes)\n self.class.embeddings.each do |embed|\n if attributes[embed]\n updates = attributes[embed].map { |model| model[:id] }.compact\n destroy = updates.empty? ? send(\"_super_#{embed}\".to_sym).select(:id) : send(\"_super_#{embed}\".to_sym).select(:id).where('id NOT IN (?)', updates)\n destroy.each { |model| attributes[embed] << { :id => model.id, :_destroy => '1' } }\n end\n end\n\n attributes\n end", "def cleanup\n self.objectives.destroy_all\n end", "def unregister_parent( parent_array )\n \n if @parents.delete( parent_array )\n parent_array.reverse_each_range do |this_object, this_parent_index|\n update_for_parent_delete_at( parent_array, this_parent_index, this_object )\n end\n @cascade_controller.unregister_parent( parent_array )\n parent_array.unregister_child( self )\n end\n \n return self\n \n end", "def remove_act\n # outdent children in case remove_act doesn't delete\n self.children.each do |child|\n child.outdent\n child.remove_act\n end\n \n # check if parent should update completeness\n old_parent = self.parent\n\n self.permissions.destroy_all\n self.destroy\n \n # refresh parent completeness\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end", "def delete_all_behaviors!\n @behaviors.each { |beh| beh.parent = nil }\n @behaviors = []\n end", "def cleanup_relationships\n @involved_relationships = Relationship.where(:cause_id => self.id)\n @iterations = @involved_relationships.length\n @iterations.times do |i|\n @involved_relationships[i].destroy\n end\n end", "def destroy_if_orphaned\n destroy unless has_bookmarks?\n end", "def destroy_associated_objects\r\n # KKL Verlauf\r\n verlaeufe = KKLVerlauf.find(:all, :conditions => [\"KtoNr = ?\", self.KtoNr])\r\n verlaeufe.each do |verlauf|\r\n verlauf.destroy()\r\n end\r\n\r\n # EEKonto\r\n eeKonten = EeKonto.find(:all, :conditions => [\"KtoNr = ?\", self.KtoNr])\r\n eeKonten.each do |ee|\r\n ee.destroy()\r\n end\r\n\r\n # ZEKonto\r\n zeKonten = ZeKonto.find(:all, :conditions => [\"KtoNr = ?\", self.KtoNr])\r\n zeKonten.each do |ze|\r\n ze.destroy()\r\n end\r\n\r\n end", "def destroy(also_opinions=false)\n opinions.each(&:destroy) if also_opinions\n super() \n end", "def orphan_self_and_children\n self.class.transaction do\n orphan_children\n orphan\n end\n end", "def eject!\n #removes the first node\n node = @store.first\n @store.remove(node.key)\n\n #get rid of the map's reference to the deleted node\n @map.delete(node.key)\n end", "def nuke\n self.open_graph_event.destroy unless self.open_graph_event.nil?\n self.teamsheet_entries.destroy_all\n self.messages.destroy_all\n self.activity_items.destroy_all\n self.result.destroy unless self.result.nil?\n self.destroy\n end", "def ensure_unique_in_chain\n self.entity.spots.each { |s| remove_duplicate_blueprint(s) }\n self.entity.apply_to_children do |entity|\n remove_duplicate_blueprint(entity)\n entity.spots.each { |s| remove_duplicate_blueprint(s) }\n end\n end", "def cleanup_dfs\n # clean up vertices attributes set during dfs\n @vertices.values.each do |vertex|\n vertex.color = nil\n vertex.predecessor = nil\n vertex.discovery = nil\n vertex.finish = nil\n end\n @time = 0\n end", "def destroy_descendants\n return if self.descendants.empty?\n tree_search_class.destroy(self.descendants.map(&:_id))\n end", "def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end", "def delete_orphans\n count = 0\n mapper.dataset.each do |content|\n unless valid_path?(content)\n content.destroy\n count += 1\n end\n end\n @dirty ||= (count > 0)\n count\n end", "def cleanup\n cleanup_nonces\n cleanup_associations\n end", "def remove_finished_children\n # We call #to_a to get a copy of children, since we will remove\n # children in the block. Note that we can't use #delete_if here\n # since #children is a relation enumerator (not the relation list\n # itself)\n children = each_child.to_a\n for child in children\n child, info = child\n if info[:success].evaluate(child)\n remove_child(child)\n end\n end\n end", "def destroy_with_mark\n Project.transaction do\n self.deleted_at = Time.now\n self.save\n\n self.entries.each do |entry|\n entry.destroy\n end\n self.tasks.each do |task|\n task.destroy\n end\n self.milestones.each do |milestone|\n milestone.destroy\n end\n self.accountings.each do |accounting|\n accounting.destroy\n end\n self.responsibilities.each do |responsibility|\n responsibility.mark_as_deleted\n end\n end\n end", "def orphan_children\n self.class.transaction do\n children(true).each{|child| child.orphan}\n end\n end", "def destroy_ancestors\n parent = self.parent\n self.destroy\n if parent and parent.children.first.blank?\n parent.destroy_ancestors\n end\n end", "def clear_garbage\n self.tmp_garbage.each do |relation, record|\n if record.is_a? Array\n record.each { |r| r.destroy }\n else\n record.destroy\n end\n end if self.tmp_garbage.present?\n self.tmp_garbage = {}\n end", "def cleanup(paths)\n item = path_tree.descend(paths)\n item.cleanup \n save_path_tree\n # print what happened here\n print_depth item\n end", "def erase_all\n entities_to_erase = []\n for entity in Sketchup.active_model.entities\n entities_to_erase.push entity\n end\n\n for entity in entities_to_erase\n if entity.valid?\n entity.erase!\n end\n end\n end", "def remove_all\n @list.each_key do |key|\n @list[key].each do |o|\n if o\n o.sprite.remove\n @list[key].delete(o)\n end\n end\n @list.delete(key)\n end\n end", "def orphan\n parent.disown self if parent\n @parent = nil\n end", "def demolish\n @children.each_value(&:demolish)\n end", "def delete_unmarked_objects(&block)\n deleted_ids = []\n each_blob { |blob| deleted_ids += blob.delete_unmarked_entries(&block) }\n deleted_ids\n end", "def destroy_content_objects\n content_objects.map { |x| x.destroy } \n end", "def unregister_parent( parent_array )\n \n if @parent_local_maps\n @parent_local_maps.delete( parent_id = parent_array.__id__ )\n @local_parent_maps.delete( parent_id )\n end\n \n return self\n\n end", "def finalize\n Pez.destroy_all\n Comida.destroy_all\n Tiburon.destroy_all\n end", "def destroy_or_remove_from_descendants\n if !!self.tree_destroy_descendants\n destroy_descendants\n else\n remove_from_descendants\n end\n end", "def remove_entity\n #traversal all the parent node\n #and remove all the entity of them\n msg = Message.new\n msg.result = true\n ActiveRecord::Base.transaction do\n entity = Entity.find_by_id(params[:entity_id])\n\n #previous_dept = entity.department\n\n #entity.department_id = nil\n #if entity.update_attribute(\"department_id\",nil)\n #if entity_group_item = EntityGroupItem.find_by_entity_id_and_entity_group_id(entity.id,previous_dept.entity_group.id)\n #entity_group_item.destroy\n #end\n\n #previous_dept.ancestors.each do |d|\n # if entity_group_item = EntityGroupItem.find_by_entity_id_and_entity_group_id(entity.id,d.entity_group.id)\n # entity_group_item.destroy\n # end\n #end\n #end\n msg.result = entity.update_attribute(\"department_id\",nil)\n end\n render :json=>msg\n end", "def collection_recursive_destroy(c)\n c.children.each do |child_c|\n collection_recursive_destroy(child_c)\n end\n \n #destroy all child documents\n c.documents.each do |d|\n d.destroy\n end\n \n c.destroy\n end", "def remove_all\n @owner.transaction do\n self.each { |obj| @owner.send(@remove_proc, obj) }\n end\n @members.clear\n @loaded = false # gmosx: IS this needed?\n end", "def undo_mark_for_destruction\n template_divisions.each { |div| div.reload if div.marked_for_destruction? } if exam_been_uploaded?\n end", "def destroy entity\n entity.parent = nil\n # index = entities.index(entity)\n # return if index.nil? || index < static_entity_length - 1\n # entities.delete_at index\n # players.delete entity\n # entity.destroy\n\n # @todo It might make sense to destroy the entity completely now. It\n # will still have a reference in the index, but that shouldn't impact\n # the current state of the plot.\n return if static.include?(entity)\n entities.delete entity\n players.delete entity\n end", "def clean_children\n\n return unless @children\n\n @children.each do |child_fei|\n #next unless child.is_a?(FlowExpressionId)\n get_expression_pool.remove(child_fei)\n end\n end", "def sell_pets \n self.dogs.each do |dog|\n dog.owner = nil\n dog.mood = \"nervous\"\n self.dogs.delete(dog)\n end \n self.cats.each do |cat|\n cat.owner = nil\n cat.mood = \"nervous\"\n self.cats.delete(cat)\n end\n end", "def ref_cleanup(xmldoc)\n xmldoc.xpath(\"//p/ref\").each do |r|\n parent = r.parent\n parent.previous = r.remove\n end\n end", "def _post_transaction_rewind\n @objects.each { |e| e.instance_variable_set(:@parent,self) }\n end", "def remove_parent_placeholers\n self.key.split('/')[0..-2].inject(\"\") do |x,y|\n x << y + '/'\n asset = Asset.find_by_key(x)\n unless asset.nil?\n asset.destroy if asset.is_placeholder_directory?\n end\n x\n end\n end", "def destroy\n tag_ids.clone.each { |tag_id| destroy_tag(tag_id) }\n super\n end", "def destroy_all\n all.each do |n|\n n.destroy\n end\n end", "def destroy_descendants # already protected by a transaction within #destroy\n return if self[right_col_name].nil? || self[left_col_name].nil? || self.skip_before_destroy\n reloaded = self.reload rescue nil # in case a concurrent move has altered the indexes - rescue if non-existent\n return unless reloaded\n dif = self[right_col_name] - self[left_col_name] + 1\n if acts_as_nested_set_options[:dependent] == :delete_all\n base_set_class.delete_all( \"#{scope_condition} AND (#{prefixed_left_col_name} BETWEEN #{self[left_col_name]} AND #{self[right_col_name]})\" ) \n else \n set = base_set_class.find(:all, :conditions => \"#{scope_condition} AND (#{prefixed_left_col_name} BETWEEN #{self[left_col_name]} AND #{self[right_col_name]})\", :order => \"#{prefixed_right_col_name} DESC\") \n set.each { |child| child.skip_before_destroy = true; remove_descendant(child) } \n end\n base_set_class.update_all(\"#{left_col_name} = CASE \\\n WHEN #{left_col_name} > #{self[right_col_name]} THEN (#{left_col_name} - #{dif}) \\\n ELSE #{left_col_name} END, \\\n #{right_col_name} = CASE \\\n WHEN #{right_col_name} > #{self[right_col_name]} THEN (#{right_col_name} - #{dif} ) \\\n ELSE #{right_col_name} END\",\n scope_condition)\n end", "def delete_all\n @objects.each do |o|\n o.delete \n end\n\n @objects.clear\n end", "def clean_up(*args)\n # Remove all orphan Entries and Products\n SemiStatic::Entry.all{|e| e.destroy if e.tag.nil?}\n SemiStatic::Product.all{|p| p.destroy if p.entry.nil?}\n\n # Get rid of newsletter tags where the actual newsletter has been deleted\n SemiStatic::Tag.select{|t| t.newsletter_id.present? && t.newsletter.nil?}.each{|t| t.destroy}\n\n # There was a bug where some Entry.master_entry_id were not reset to nil, fix these\n SemiStatic::Entry.where.not(:master_entry_id => nil).each{|e| e.master_entry_id = nil; e.save;}\n end", "def clean_document!\n self.questions.destroy_all\n self.comments.destroy_all\n self.timeline_events().each{|event| event.destroy}\n self.document_items.each{|item| item.timeline_events.destroy_all}\n end", "def unset_children(e, children_elements)\n return if !e || !children_elements\n\n id_field = @db_fields[:id]\n id = e.send(id_field)\n if children_elements[id].is_a? Array\n children_elements[id].each do |child|\n unset_children(child, children_elements)\n end\n end\n children_elements.delete(id)\n end", "def detach\r\n @cards.each{|e| e.detach}\r\n @symbols_card.each{|e| e.detach}\r\n @cards_rotated.each{|e| e.detach}\r\n detach_specific_resources\r\n end", "def destroy\n final_parent.delete(source.statements)\n\n parent.statements.each do |statement|\n parent.delete_statement(statement) if\n statement.subject == source.rdf_subject || \n statement.object == source.rdf_subject\n end\n\n super { source.clear }\n end", "def destroy_taggings\n Tagging.where(:tag_id => self.id).each do |tagging|\n tagging.not_orphans = true\n tagging.destroy\n end\n end", "def clean_up\n if self.deleted?\n # clean room type mapping\n RoomTypeChannelMapping.find_all_by_room_type_id(self.id).each do |rtcm|\n rtcm.update_attribute(:deleted, true)\n end\n # clean master rate mapping\n RoomTypeMasterRateMapping.find_all_by_room_type_id(self.id).each do |rtmr|\n RoomTypeMasterRateChannelMapping.find_all_by_room_type_master_rate_mapping_id(rtmr.id).each do |rtc|\n rtc.update_attribute(:deleted, true)\n end\n rtmr.update_attribute(:deleted, true)\n end\n # clean availability link from\n RoomTypeInventoryLink.find_all_by_room_type_from_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n # clean availability link to\n RoomTypeInventoryLink.find_all_by_room_type_to_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n end\n end", "def delete(o); removeObject o end", "def remove_rendering_relationship\n parent_objects = parents\n return if parent_objects.empty?\n parent_objects.each do |work|\n if work.rendering_ids.include(id)\n new_rendering_ids = work.rendering_ids.delete(id)\n work.update(rendering_ids: new_rendering_ids)\n end\n end\n end", "def perform_some_actions\n # It is to be called while destroying a Child record\n # But must not be called while destroying the parent record\n unless self.parent.destroyed?\n\n end\n end", "def freshen_parent_and_child_indexes\n freshen_parent_and_child_indexes(0)\n end", "def update_children_when_delete\n if self.to_be_removed == true\n self.tag_types.each do |m|\n if m.to_be_removed == false\n m.to_be_removed = true\n m.save\n end\n end\n end\n end", "def procreate!( offspring = @options[:offspring] )\n @children = []\n offspring.times{ @children << mutant_offspring }\n @children.reject!{ |child| child.to_s == to_s } unless @options[:allow_clones]\n @children\n end", "def invalidate!\r\n fail_if_invalid()\r\n # Unlink this entity from any other objects.\r\n for type, entities in @links\r\n for entity in entities\r\n next if entity.deleted?\r\n if used_by?( entity )\r\n entity.unlink( self )\r\n end\r\n end\r\n end\r\n # Release any reference to other objects.\r\n @parent = nil\r\n @links = {}\r\n # The entity is then flagged as invalid.\r\n @valid = false\r\n nil\r\n end", "def delete!\n if parent\n parent.remove_child(id)\n @parent = nil\n end\n collection.remove(_id: id)\n self.id = nil\n true\n end", "def delete\n extract.children.to_a.each(&:extract)\n end", "def delete_branch\n #we'll get all descendants by level descending order. That way we'll make sure deletion will come from children to parents\n children_to_be_deleted = self.class.find(:all, :conditions => \"id_path like '#{self.id_path},%'\", :order => \"level desc\")\n children_to_be_deleted.each {|d| d.destroy}\n #now delete my self :)\n self.destroy\n end", "def detach parent\n\n # the ordinary *able table\n parent.send( self.class.to_s.underscore.pluralize).delete self\n\n # case child.class.to_s\n # when \"Event\",\"WageEvent\"\n # ev = Eventable.where( event: child, eventable: self)\n # ev.delete_all\n # when \"Printer\"\n # pr = Printable.where( printer: child, printable: self)\n # pr.delete_all\n # else\n # children = eval child.class.to_s.downcase.pluralize\n # children.delete child\n # end\n rescue\n false\n end", "def destroy\n save_graph = RDF::Graph.new\n fill_save_graph save_graph\n save_graph.each do |s|\n puts s.inspect\n end\n Db.delete_data( save_graph, :graph => klass.object_graph )\n end", "def prune\n @set.clear\n end", "def destroy\n super\n parent.unlist_item(@sym)\n end" ]
[ "0.6851682", "0.6746977", "0.6646924", "0.65748346", "0.64702755", "0.64254194", "0.63182765", "0.62679046", "0.61741376", "0.61004126", "0.6043362", "0.60281384", "0.6025435", "0.60194993", "0.60027665", "0.59834915", "0.5973925", "0.59564304", "0.59363323", "0.59327054", "0.5917236", "0.5906678", "0.58944166", "0.5890677", "0.5886509", "0.58785164", "0.5862415", "0.5843797", "0.5837099", "0.583248", "0.58289677", "0.5819043", "0.58079356", "0.5802978", "0.5801554", "0.5798257", "0.57867897", "0.57747924", "0.57688475", "0.57660073", "0.5755827", "0.5754859", "0.5748127", "0.5745771", "0.5741336", "0.5733903", "0.5726105", "0.5721089", "0.5713576", "0.5688348", "0.56848955", "0.5677648", "0.5664449", "0.5661688", "0.5658906", "0.56283104", "0.56261", "0.56210697", "0.56034976", "0.56025064", "0.558101", "0.5571123", "0.55711067", "0.55689436", "0.5568235", "0.55635643", "0.5562834", "0.5553806", "0.5552716", "0.55518866", "0.5537093", "0.55324644", "0.55264837", "0.55153847", "0.55109984", "0.5506469", "0.5504308", "0.5492553", "0.54900426", "0.5489496", "0.5488272", "0.54848063", "0.5482451", "0.5476398", "0.54699033", "0.5460027", "0.54563516", "0.5438987", "0.54115343", "0.5410343", "0.54070723", "0.5400918", "0.53987354", "0.5397713", "0.5397474", "0.53970665", "0.53952235", "0.5393161", "0.5384447", "0.5384214" ]
0.639375
6
=============================================================================== helper de cadastro
def texto_longo_ecm_new_cadastro_item(form_item, params) view = "" unless params view.concat(text_area :cadastro, "item_#{form_item.id}", options={:cols=>form_item.opcoes[:largura], :rows=>form_item.opcoes[:altura]}) else view.concat(text_area :cadastro, "item_#{form_item.id}", options={:value=>params["item_#{form_item.id}"], :cols=>form_item.opcoes[:largura], :rows=>form_item.opcoes[:altura]}) end return view end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mi_carrera\n\n\tend", "def set_cadastro\n @cadastro = Cadastro.find(params[:id])\n end", "def agregar_compra(producto, unidades = 1)\n DB.execute(\"insert into compras values ( ?, ?)\", producto, unidades)\nend", "def suivre; end", "def diario\n fechas()\n @ejercicios = Ejercicio.find(:all)\n @asientos = Contabilidad.librodiario(params[:fechadesde], params[:fechahasta])\n\n \n end", "def informacoes_da_conta(local)\n\t\t\t\t\traise NotImplementedError.new('Sobreescreva este método na classe referente ao banco que você esta criando')\n\t\t\t\tend", "def cargar_caravana_evento(caravana,collar,ev_parto,ev_serv) \n vaca = Vaca.where(\"nodo_id = ?\",collar).first \n vaca.caravana = caravana\n\n cargar_evento(vaca,ev_parto,\"parto\")\n \n cargar_evento(vaca,ev_serv,\"inseminada\")\n\n if !ev_serv.nil? && ev_serv.length>6\n serv = DateTime::strptime(ev_serv,\"%d%m%Y\") \n vaca.celos.create!(comienzo: serv,probabilidad: \"alta\",caravana:caravana, causa: \"aumento de actividad\")\n end\n\n vaca.save \n end", "def render_cadastro(anuncio, template=\"anuncios/cadastro\")\n \t\trender template, locals: {\n \t\t\tanuncio: anuncio,\n \t\t\tmarcas: Marca.por_nome\n \t\t}\n \tend", "def processar_dados\n if params[:opcao] == 'arquivo'\n @file_content = params[:arquivo].read\n elsif params[:opcao] == 'text-area'\n @file_content = params[:file_content]\n else\n redirect_to :action => \"entrar_arquivo\"\n end\n end", "def create\n obtener_datos()\n @ventum = current_user.ventum.new(cliente:@cliente, clave:@clave, fecha:@fecha, iva:@iva, subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal, distribuidor: @distribuidor, status: \"En proceso\")\n respond_to do |format|\n if(@ventum.save)\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta almacenada exitosamente!.' }\n else\n format.html { redirect_to eventos_path, notice: 'Fallo el almacenamiento de la venta.' }\n end\n \n end\n end", "def create\n @movimento = Movimento.new(params[:movimento])\n @movimento.entidade_id = current_usuario.entidade_id\n @movimento.valor = params[:movimento][:valor].gsub(',','.')\n @movimento.usuario_id = current_usuario.id\n #@movimento.updated_by = current_usuario.id\n @movimento.data_vencimento = @movimento.data_pagamento if current_usuario.entidade_id == 1\n respond_to do |format|\n if @movimento.save\n flash[:notice] = 'Movimento cadastrado com sucesso.'\n format.html { redirect_to(@movimento) }\n format.xml { render :xml => @movimento, :status => :created, :location => @movimento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @movimento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def dados_do_arquivo\n\t\t\t\t\treturn if self.invalid?\n\n\t\t\t\t\t# contador dos registros do lote\n\t\t\t\t\tcontador = 1\n\n\t\t\t\t\t# Metodo 'monta_header' implementado no module -> BrBoleto::Remessa::Cnab400::Helper::Header\n\t\t\t\t\tarquivo = [monta_header] \n\t\t\t\t\tcontador += 1\n\n\t\t\t\t\tpagamentos.each do |pagamento|\n\t\t\t\t\t\tarquivo << monta_detalhe(pagamento, contador)\n\t\t\t\t\t\tcontador += 1\n\t\t\t\t\tend\n\n\t\t\t\t\t# Metodo 'monta_trailer' implementado no module -> BrBoleto::Remessa::Cnab400::Helper::Trailer\n\t\t\t\t\tarquivo << monta_trailer(contador)\n\n\t\t\t\t\tretorno = ActiveSupport::Inflector.transliterate(arquivo.join(\"\\n\")).to_ascii.upcase\n\t\t\t\t\tretorno << \"\\n\"\n\t\t\t\t\tretorno.encode(retorno.encoding, :universal_newline => true).encode(retorno.encoding, :crlf_newline => true)\n\t\t\t\tend", "def from_ficha\r\n ficha = FichaOdontologica.find(params[:ficha])\r\n @paciente= ficha.paciente\r\n @area= Area.find_by_nombre('Odontología')\r\n @consulta= ConsultaOdontologica.new\r\n get_doctores_odontologia\r\n end", "def create\n @comanda = Comanda.new\n @comanda.idFuncionario = current_funcionario.id\n @comanda.mesa = params[:comanda][:mesa]\n @comanda.dataAbertura = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n\n respond_to do |format|\n if @comanda.save\n format.html { redirect_to @comanda, notice: 'Comanda criada com Sucesso' }\n format.json { render :show, status: :created, location: @comanda }\n else\n format.html { render :new }\n format.json { render json: @comanda.errors, status: :unprocessable_entity }\n end\n end\n end", "def grabar_concesionario\n # puts 'AQUI'\n @concesionario = Concesionario_vehiculos.new\n @usuario = Usuario.new\n @rif=params[:rif]\n @nombre=params[:nombre]\n @correo=params[:correo]\n @telefono=params[:telefono]\n @ciudad=params[:ciudad]\n @direccion=params[:direccion]\n @marca=params[:marca]\n #------\n @nombre_usuario=params[:nombre_usuario]\n @contrasena=params[:contrasena]\n # puts ''+@nombre_usuario+''\n @usuario.grabar_usuario_concesionario(@nombre_usuario, @contrasena);\n # puts '+++++++++++++++++++++++++++++++++++++++++++++++++++++++metio usuario'\n @concesionario.grabar_concesionario(@rif,@nombre,@correo,@telefono,@ciudad,@direccion,@marca,@nombre_usuario)\n render :text => $tirajson\n end", "def create\n @connection = ActiveRecord::Base.establish_connection\n\n nome = params[:nome]\n email = params[:email]\n username = params[:username]\n senha = params[:senha]\n senha = Digest::SHA1.hexdigest senha\n telefone = params[:telefone]\n tipo = params[:tipo][:tipo].to_i\n data_nasc = params[:dataNasc]\n\n sql = \"INSERT INTO Cadastro(nome, email, username, senha, telefone, tipo, isActive)\n VALUES('#{nome}', '#{email}', '#{username}', '#{senha}', '#{telefone}', #{tipo}, true);\"\n puts sql\n result = @connection.connection.insert(sql)\n puts result\n sql = \"INSERT INTO Usuario(idCadastro, dataNasc)\n VALUES(#{result}, '#{data_nasc}');\"\n puts sql\n result = @connection.connection.insert(sql)\n\n redirect_to login_path\n end", "def prepare; end", "def prepare; end", "def prepare; end", "def create\n @arquivo = Arquivo.new(params[:arquivo])\n\n @arquivo.residencial = current_user.apartamento.residencial\n\n respond_to do |format|\n if @arquivo.save\n format.html { redirect_to @arquivo, notice: 'Arquivo foi criado com sucesso.' }\n format.json { render json: @arquivo, status: :created, location: @arquivo }\n\n comentario = Comentario.new\n comentario.user = current_user\n comentario.comentavel_id = @arquivo.id\n comentario.comentavel_type = \"Arquivo\"\n comentario.conteudo = \"Novo arquivo\"\n comentario.titulo = \"Novo arquivo\"\n\n comentario.save\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @arquivo.errors, status: :unprocessable_entity }\n end\n end\n end", "def asignaturas\n @seccion = \"Asignaturas\"\n @titulo = \"Asignaturas\"\n if params[:orden]\n case params[:orden]\n when \"Código\"\n @orden = \"codigo\"\n when \"Nombre\"\n @orden = \"nombre\"\n when \"Créditos\"\n @orden = \"unidades_credito\"\n when \"Tipo\"\n @orden = \"tipo\"\n else\n @orden = \"codigo\"\n end\n else\n @orden = \"codigo\"\n end\n \n @carreras = [\"Biología\", \"Computación\", \"Geoquímica\", \"Física\", \"Matemática\", \"Química\", \"Complementaria\"]\n @categorias = ['Código', 'Nombre', 'Créditos','Tipo'] #Este es el orden que se mostrará en el select de la vista\n @categoria_seleccionada = params[:orden]\n\n @asignatura_datos = [] #En este arreglo se guardan los pares \"Codigo - Nombre\" de cada asignatura para mostrar en el campo de busqueda\n Asignatura.order('nombre').all.each do |asignatura|\n #En este foro se agregan uno a uno los valores de cada asignatura al arreglo de la manera indicada arriba\n @asignatura_datos << asignatura.codigo.to_s + \" - \" + asignatura.nombre.to_s\n end\n end", "def create\n @achadoperdido = Achadoperdido.new(achadoperdido_params)\n @achadoperdido.data_entrega = @achadoperdido.morador_id != nil ? Time.zone.now : nil\n\n respond_to do |format|\n if @achadoperdido.save\n format.html { redirect_to @achadoperdido, notice: 'Cadastro realizado com sucesso.' }\n format.json { render :show, status: :created, location: @achadoperdido }\n else\n format.html { render :new }\n format.json { render json: @achadoperdido.errors, status: :unprocessable_entity }\n end\n end\n end", "def prepare_result; end", "def create\n nueva_compra\n respond_to do |format|\n Compra.transaction do\n if @compra.guardar(compra_params, params[:guardar_si_o_si].present?)\n format.html { redirect_to @compra, notice: t('mensajes.save_success', recurso: 'la compra') }\n format.json { render :show, status: :created, location: @compra }\n else\n get_pago\n format.html { render :form }\n format.json { render json: @compra.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def prepare()\n end", "def create\n @usuario = Usuario.new(parametros_de_usuario)\n @usuario.celular = params[:area] + params[:numero]\n @usuario.fh_sesion = Time.now.strftime(\"%Y%m%d%H%M\")\n @usuario.f_creado = Time.now\n @usuario.f_actualizado = Time.now\n\n celulart = params[:area] + params[:numero]\n respond_to do |format|\n if Usuario.exists?(celulart)\n @usuario = Usuario.find(celulart)\n if @usuario.f_eliminado == nil\n\n format.html { redirect_to usuarios_url, notice: '*** ERROR usuario existe ***' }\n else\n format.html { redirect_to usuarios_url, notice: '*** Advertencia: usuario eliminado por un administrador ***' } \n end\n else\n if Usuario.any?\n @usuario.rol = 'opera'\n else\n @usuario.rol = 'admin'\n end\n if @usuario.save\n if session[:rol_usuario] == nil\n session[:celular_usuario] = @usuario.celular\n end\n format.html { redirect_to @usuario, notice: '*** Cuenta creada ***' }\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def retornoBusqueda()\nreturn @busqueda\nend", "def recarga_doctores\n @area= Area.find(params[:id_area])\n\n end", "def setar_data\n if params[\"laudo\"]\n unless params[\"laudo\"][\"data_formatada\"].blank?\n $data_formatada = params[\"laudo\"][\"data_formatada\"]\n end\n else\n if params['voluntario'] and params['voluntario']['criterios'] and params['voluntario']['criterios']['data_formatada']\n $data_formatada = params['voluntario']['criterios']['data_formatada']\n end\n end\n end", "def auditoria_antes(accion, tabla, objeto)\n auditoria = Auditoria.new\n auditoria.usuario = current_usuario.login\n auditoria.ip = request.remote_ip\n auditoria.accion = accion\n auditoria.tabla = tabla\n auditoria.pista_antes = objeto.to_json\n auditoria.sistema = \"RUE\"\n auditoria.save\n\n auditoria.id\n\n end", "def imprimir_todo\n\n # aqui guardo todos los datos que necesito para imprimirlos en las variable\n\n @width_layout = '955'\n @form_title = ''\n @imprimo='1'\n \n #@ordenes_de_despacho_aux=OrdenDespachoDetalle.find(:all, :conditions=>\"id in #{params[:ordenes_despachos_id]}\")\n\n\n @factura_orden_despacho_otra= FacturaOrdenDespacho.find(:all, :conditions=>\"orden_despacho_detalle_id in #{params[:parciales_id]} and secuencia='#{params[:secuencia]}' and monto_factura>0\")\n\n factura_orden_despacho_count=FacturaOrdenDespacho.count(:all, :conditions=>\"orden_despacho_detalle_id in #{params[:parciales_id]} and secuencia='#{params[:secuencia]}' and monto_factura>0\")\n\n@factura_orden_despacho=FacturaOrdenDespacho.find(:first, :conditions=>\"orden_despacho_detalle_id in #{params[:parciales_id]} and secuencia='#{params[:secuencia]}' and monto_factura>0\")\n\n\nsolicitu=OrdenDespacho.find(OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id).solicitud_id\n\n@solicitudes = Solicitud.find(:all,:conditions => ['id = ?', solicitu])\n\n unless @solicitudes[0].nil?\n if !@solicitudes[0].cliente.persona_id.nil?\n \n\t@es_no=1\n\t@datos_cliente=Persona.find(@solicitudes[0].cliente.persona_id) unless @solicitudes[0].nil?\n else\n\t@es_no=2\n\t@datos_cliente=Empresa.find(@solicitudes[0].cliente.empresa_id) unless @solicitudes[0].nil?\n end\n end\n@numero_desembolso=OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id\n\n@orden_despacho= OrdenDespacho.find(:all,:conditions => ['id = ?', @numero_desembolso])\n\n\n@oficina= Oficina.find(:all,:conditions => ['id = ?', @solicitudes[0].oficina_id]) unless @solicitudes[0].nil?\n\n\n@parametros_general=ParametroGeneral.find(:first)\n\n @condition = \" orden_despacho_id = #{@factura_orden_despacho.orden_despacho_detalle.orden_despacho_id} and cantidad > 0\"\n\n @total = OrdenDespachoDetalle.count(:conditions=>@condition)\n @list = OrdenDespachoDetalle.find(:all, :conditions => ['orden_despacho_id = ? and cantidad > 0', @factura_orden_despacho.orden_despacho_detalle.orden_despacho_id])\n\n\t@total_saldo_entregar=0\n\t@total_precio_total=0\n\tcont=0\n diferencia=0.00\n @total_monto_confirmado=0.00\n\twhile cont< @total\n #if OrdenDespacho.find(@numero_desembolso).estatus_id==20000 || OrdenDespacho.find(@numero_desembolso).estatus_id==20010 || OrdenDespacho.find(@numero_desembolso).estatus_id==20020\n\t \n # codigo nuevo al 3/9/2013 \n if ( ((@list[cont].cantidad * @list[cont].costo_real)!=@list[cont].monto_financiamiento) and (@list[cont].monto_recomendado!=0))\n \n @total_saldo_entregar+=@list[cont].monto_recomendado\n diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion \n \n else\n \n @total_saldo_entregar+=@list[cont].monto_financiamiento\n diferencia=@list[cont].monto_financiamiento - @list[cont].monto_facturacion\n end\n #codigo nuevo al 3/9/2013 \n \n \n #else\n\t #@total_saldo_entregar+=@list[cont].monto_recomendado\n #diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion\n #end\n\n @total_monto_confirmado+=@list[cont].monto_facturacion\n\n logger.debug \"monto financiamiento = \" << @list[cont].monto_financiamiento.to_s\n logger.debug \"monto facturacion = \" << @list[cont].monto_facturacion.to_s\n logger.debug \"diferencia = \" << diferencia.to_s\n if diferencia < 0\n diferencia=diferencia * -1 \n\n end\n \n\t@total_precio_total+=diferencia\n\n #@total_precio_total+=@list[cont].monto_facturacion\n\tcont+=1\t\n\tend\n\n\n@marca=params[:marca]\n\n#@vista = 'view_factura_orden_despacho_parciales'\n\n end", "def create\n #@funcionario = Funcionario.find(params[:marcacaoponto][:funcionario_id])\n \t #@funcionario.marcar_ponto(\"aowpa\")\n \t #flash[:notice] = 'Ponto Criado!'\n #format.html { redirect_to(marcacaopontos_path) }\n #format.xml { head :ok }\n @marcacaoponto = Marcacaoponto.new(params[:marcacaoponto])\n respond_to do |format|\n if @marcacaoponto.save\n flash[:notice] = 'Marcacao de Ponto criada com sucesso.'\n format.html { redirect_to(marcacaopontos_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @marcacaoponto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n Cabcompra.transaction do\n @cabcompra = Cabcompra.new(params[:cabcompra])\n @comprobante = Tipocomprobante.find(@cabcompra.tipocomprobante_id)\n if ((@comprobante.tcom_discriminaiva.to_s == 'No') || ((params[:rencompras][:rcom_netorenglon].nil?) || (params[:rencompras][:rcom_netorenglon][0].to_i > 0)))\n idplanilla = Cabcompra.maximum(:id, :conditions => [\"sucursal_id = ?\", session[:sucursal]]) \n @cabcompra.id = [idplanilla.to_i + 1, session[:sucursal]]\n # busco y grabo proveedor_id \n str_tokens = \"\"\n str_tokens = params[:proveedor][:prov_cuit].split(\"|\") if params[:proveedor]\n \n @proveedor = Proveedor.find(:first, :conditions => [\"sucursal_id = ? and prov_codigo = ? \", session[:sucursal], str_tokens[2].lstrip] ) if str_tokens[2] \n @cabcompra.proveedor_id = @proveedor.id[0] if str_tokens[2] \n $proveedor = @proveedor.id[0] if str_tokens[2] #para la validacion de proveedores 1 y 2\n @proveedor.prov_cuit = params[:proveedor][:prov_cuit].to_s if str_tokens[2] # por si vuelve con error\n @cabcompra.ccom_ultmod = DateTime.now\n @cabcompra.ccom_usuario = session[:user].usur_nombre\n @cabcompra.ccom_hastacompro = (params[:cabcompra][:ccom_hastacompro].nil? || params[:cabcompra][:ccom_hastacompro].to_i == 0) ? params[:cabcompra][:ccom_desdecompro] : params[:cabcompra][:ccom_hastacompro]\n str_tokens = @cabcompra.id.to_s.split(\",\") \n $plaegid = params[:cabcompra][:cabplaegreso_id]\n $sucursal = session[:sucursal]\n #graba compra o gasto segun el comprobante tenga o no iva\n if (params[:cabcompra][:ccom_iva].nil? || params[:cabcompra][:ccom_iva].to_d == 0 )\n @cabcompra.ccom_gastocompra = 'GASTO'\n else\n @cabcompra.ccom_gastocompra = 'COMPRA'\n end\n @cabcompra.ccom_gastocompra = 'COMPRA' if @comprobante.tcom_cabecera.to_s == 'S' #para los comprobantes de retenciones\n respond_to do |format|\n if @cabcompra.save\n if ((@comprobante.tcom_discriminaiva.to_s == 'Si') && (params[:rencompras][:rcom_netorenglon][0].to_d > 0) && @comprobante.tcom_cabecera.to_s == 'N') \n grabarenglonescompra()\n end\n \n flash[:notice] = 'El comprobante ha sido creado.'\n if @cabcompra.cabplaegreso_id > 0\n format.html { redirect_to(:controller => 'cabcompras', :action => 'index', :nrope => @cabcompra.ccom_nroplaegreso, :idpe => @cabcompra.cabplaegreso_id) }\n else\n format.html { redirect_to(:controller => 'cabcompras', :action => 'comprobantes', :id => 0) }\n end\n format.xml { render :xml => @cabcompra, :status => :created, :location => @cabcompra }\n else\n params[:idpe] = params[:cabcompra][:cabplaegreso_id]\n params[:nrope] = params[:cabcompra][:ccom_nroplaegreso]\n \n @alicuotaivas = Alicuotaiva.find(:all) \n @rencompra = Rencompra.new\n @jurisdiccions = Jurisdiccion.find(:all, :order =>\"juri_nombre\")\n @cabplaegreso = Cabplaegreso.find([params[:idpe], session[:sucursal]])\n @conceptoegresos = Conceptoegreso.find(:all, :order =>\"cegr_detalle\")\n @tipocomprobantes = Tipocomprobante.find(:all, :order =>\"tcom_nombre\")\n @iva = Tipocomprobante.find(@cabcompra.tipocomprobante_id) \n \n format.html { render :action => \"new\" }\n format.xml { render :xml => @cabcompra.errors, :status => :unprocessable_entity }\n end\n end\n else\n render :text => \"<h7> El comprobante no se guardo porque no cargo ningun detalle (renglón) </h7>\", :layout => 'application' \n end\n end\n end", "def cadastro_params\n params.require(:cadastro).permit(:nome, :idade, :data_de_nascimento, :filhos, :programa_assistencial, :nome_do_programa, :endereco, :bairro, :cep, :regiao, :cidade, :estado, :telefone, :celular, :ocupacao, :instituicao, :equipe, :observacao)\n end", "def create\n @aviso = Aviso.new(aviso_params)\n \n @aviso.dataDeInsercao = Time.now\n @aviso.inseridoPor = \"Gustavo Soares\" #adicionar gem devise\n\n @aviso.atualizadoPor = \"Gustavo Soares\" #adicionar gem devise\n @aviso.dataDeAtualizacao = Time.now\n\n respond_to do |format|\n if @aviso.save\n format.html { redirect_to @aviso, notice: 'Aviso was successfully created.' }\n format.json { render :show, status: :created, location: @aviso }\n else\n format.html { render :new }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario = Usuario.find(params[:usuario_id])\n @copenometro = Copenometro.new(copenometro_params)\n @copenometro.usuario = @usuario\n\n respond_to do |format|\n if @copenometro.save\n format.html { redirect_to @usuario, notice: 'Agregado con Exito' }\n format.json { render :show, status: :created, location: @copenometro }\n else\n format.html { render :new }\n format.json { render json: @copenometro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @transferencia = Transferencia.new(transferencia_params)\r\n @transferencia.valor = dinheiro_fomatado params[:transferencia][:valor]\r\n set_conta_cliente(@transferencia.cliente_id)\r\n @transferencia.conta_id = Transferencia.checar_numero_conta(params[:transferencia][:numero])\r\n case @transferencia.tipo\r\n when 'transferência'\r\n retorno = Transferencia.valida_transferencia(session[:usuario_email], params[:usu][:senha])\r\n if retorno[:status] == 'falhou'\r\n respond_to do |format|\r\n flash[:alert] = retorno[:msn]\r\n format.html { render :new }\r\n end\r\n else\r\n salvar @transferencia, @cliente_autor\r\n end\r\n else\r\n salvar @transferencia, @cliente_autor\r\n end\r\n end", "def prepare\n end", "def from_ficha\n ficha = FichaNutricionalAdulto.find(params[:ficha])\n @paciente= ficha.paciente\n @area= Area.find_by_nombre('Nutrición')\n @consulta= ConsultaNutricionalAdulto.new\n get_doctores_nutricion\n end", "def prepare\n end", "def prepare\n end", "def create \n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n @conta = Conta.new(nome: params[:nome], status: params[:status])\n @conta.pai = pai\n @conta.data_criacao = Time.now\n \n respond_to do |format|\n if @conta.save\n #format.html { redirect_to @conta, notice: 'Conta was successfully created.' }\n #format.json { render :show, status: :created, location: @conta }\n format.json { render json: @conta.to_json, status: :created }\n #@conta.to_json\n else\n #format.html { render :new }\n format.json { render json: @conta.errors, status: :unprocessable_entity } \n end\n end\n end", "def create\n # valor = params[:pedido][:valor]\n # params[:pedido][:valor] = valor.split( ',').join('.')\n conta = Conta.find_by_cliente_id(params[:pedido][:cliente_id])\n @proteinas_disponiveis = Proteina.where(:disponibilidade => true)\n @acompanhamentos_disponiveis = Acompanhamento.where(:disponibilidade => true)\n @guarnicoes_disponiveis = Guarnicao.where(:disponibilidade => true)\n @saladas_disponiveis = Salada.where(:disponibilidade => true)\n @bebidas_disponiveis = Bebida.where(:disponibilidade => true)\n @sobremesas_disponiveis = Sobremesa.where(:disponibilidade => true)\n #descricao = \"\"\n @pedido = Pedido.new(pedido_params)\n @pedido.conta_id = conta.id.to_i\n # if @pedido.cliente.nil?\n # @pedido.cliente = Cliente.find(current_usuario.cliente.id)\n # @pedido.conta = Conta.find_by_cliente_id(current_usuario.id)\n # end\n # ENTRADAS #\n # acompanhamentos = params[:pedido][:acompanhamento_ids]\n # acompanhamentos.each do |id|\n # if !id.blank?\n # acompanhamento = Acompanhamento.find(id.to_i)\n # @pedido.pedidos_acompanhamentos.new(:acompanhamento_id => id)\n # #@pedido.acompanhamentos << acompanhamento\n # end\n # end\n ###### FINAL ENTRADAS ########\n acompanhamentos = Acompanhamento.where(:disponibilidade => true).count\n for i in 0...acompanhamentos do\n if !params[\"acompanhamento_#{i}\"].blank?\n @pedido.pedidos_acompanhamentos.new(:acompanhamento_id => params[\"acompanhamento_#{i}\"], :quantidade => params[\"quantidade_acompanhamento_#{i}\"])\n end\n end\n\n proteinas = Proteina.where(:disponibilidade => true).count\n for i in 0...proteinas do\n if !params[\"proteina_#{i}\"].blank?\n @pedido.pedidos_proteinas.new(:proteina_id => params[\"proteina_#{i}\"], :quantidade => params[\"quantidade_proteina_#{i}\"])\n end\n end\n\n guarnicoes = Guarnicao.where(:disponibilidade => true).count\n for i in 0...guarnicoes do\n if !params[\"guarnicao_#{i}\"].blank?\n @pedido.pedidos_guarnicoes.new(:guarnicao_id => params[\"guarnicao_#{i}\"], :quantidade => params[\"quantidade_guarnicao_#{i}\"])\n end\n end\n\n saladas = Salada.where(:disponibilidade => true).count\n for i in 0...saladas do\n if !params[\"salada_#{i}\"].blank?\n @pedido.pedidos_saladas.new(:salada_id => params[\"salada_#{i}\"], :quantidade => params[\"quantidade_salada_#{i}\"])\n end\n end\n\n bebidas = Bebida.where(:disponibilidade => true).count\n for i in 0...bebidas do\n if !params[\"bebida_#{i}\"].blank?\n @pedido.pedidos_bebidas.new(:bebida_id => params[\"bebida_#{i}\"], :quantidade => params[\"quantidade_bebida_#{i}\"])\n end\n end\n\n sobremesas = Sobremesa.where(:disponibilidade => true).count\n for i in 0...sobremesas do\n if !params[\"sobremesa_#{i}\"].blank?\n @pedido.pedidos_sobremesas.new(:sobremesa_id => params[\"sobremesa_#{i}\"], :quantidade => params[\"quantidade_sobremesa_#{i}\"])\n end\n end\n\n\n #@pedido.proteinas << Proteina.where(:nome => params[:proteina]).first\n\n # debugger\n # if !params[:arroz].nil?\n # descricao = \"Arroz \"+ params[:arroz] + \",\"\n # end\n # if params[:feijao] = \"Sim\"\n # descricao = descricao + \" Feijao, \"\n # end\n\n # if params[:farofa] == \"Sim\"\n # descricao = descricao + \" Farofa,\"\n # end\n\n # descricao = descricao + params[:proteina] + \", \" + params[:acompanhamento] + \" Salada: \"+ params[:salada]\n # @pedido.descricao = descricao\n # itens = params[:pedido][:item_de_pedidos_attributes]\n\n # if !itens.nil?\n # for i in 0..params[:pedido][:item_de_pedidos_attributes].count do\n # if itens[\"#{i}\"] != nil\n # if itens[\"#{i}\"][:produto_id].blank?\n # itens.delete(\"#{i}\")\n # end\n # else\n # itens.delete(\"#{i}\")\n # end\n # end\n # end\n # if !itens.blank?\n # @pedido.calcular_valor\n # else\n # @pedido.item_de_pedidos.destroy_all\n # @pedido.valor = 0\n # end\n # if !itens.nil?\n # params[:pedido][:item_de_pedidos_attributes].replace(itens)\n # end\n\n @pedido.situacao = \"Em processamento\"\n #parametros[:valor] = @pedido.valor\n\n respond_to do |format|\n if @pedido.save\n @pedido.calcular_valor\n @pedido.conta.calcular_saldo\n #@pedido.adicionar_conta\n #proteina = @pedido.proteina\n #proteina.decrescer\n format.html { redirect_to @pedido }\n format.json { render action: 'show', status: :created, location: @pedido }\n else\n format.html { render action: 'new' }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @compra = Compra.new(compra_params)\n @compra.remaining = @compra.cantidad\n @compra.code = Item.find(compra_params[:producto]).identificador\n respond_to do |format|\n if @compra.save\n format.html { redirect_to compras_path, notice: 'Compra was successfully created.' }\n format.json { render :show, status: :created, location: @compra }\n else\n format.html { render :new }\n format.json { render json: @compra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n\n @amostra = Amostra.new(amostra_params) \n\n respond_to do |format|\n\n if [email protected]?\n\n fabricante = Empresa.find_by_nome(@amostra.fabricante)\n if(fabricante)\n @amostra.fabricante_rua = fabricante.rua\n @amostra.fabricante_numero = fabricante.numero\n @amostra.fabricante_bairro = fabricante.bairro\n @amostra.fabricante_cidade = fabricante.cidade\n @amostra.fabricante_UF = fabricante.UF\n @amostra.fabricante_CEP = fabricante.CEP\n @amostra.fabricante_CNPJ = fabricante.CNPJ\n @amostra.fabricante_telefone = fabricante.telefone\n end\n\n end\n\n if [email protected]?\n\n solicitante = Empresa.find_by_nome(@amostra.solicitante)\n if(solicitante)\n @amostra.solicitante_rua = solicitante.rua\n @amostra.solicitante_numero = solicitante.numero\n @amostra.solicitante_bairro = solicitante.bairro\n @amostra.solicitante_cidade = solicitante.cidade\n @amostra.solicitante_UF = solicitante.UF\n @amostra.solicitante_CEP = solicitante.CEP\n @amostra.solicitante_CNPJ = solicitante.CNPJ\n @amostra.solicitante_telefone = solicitante.telefone\n end\n\n end\n\n if [email protected]?\n\n assinatura = Assinatura.find_by_nome(@amostra.assinatura)\n if(assinatura)\n @amostra.assinatura_tipo_conselho = assinatura.tipo_conselho\n @amostra.assinatura_numero_conselho = assinatura.numero_conselho\n end\n\n end\n\n if([email protected]_resultados.nil?) \n @amostra.parametro_resultados.each do |parametro_resultado|\n\n if !parametro_resultado.parametro.nil?\n\n parametro = Parametro.find_by_nome(parametro_resultado.parametro)\n parametro_resultado.referencia_parametro = parametro.referencia\n parametro_resultado.metodo_parametro = parametro.metodo\n parametro_resultado.valor_referencia_parametro = parametro.valor_referencia\n\n end\n end\n end\n\n \n\n if @amostra.save\n if !user_is_estagiario? \n if(session[:id_amostra_copy].nil?)\n format.html { redirect_to edit_amostra_path(@amostra) }\n format.json { head :no_content }\n else\n @parametro_resultados_from_amostra = ParametroResultado.where(amostra_id: session[:id_amostra_copy])\n @parametro_resultados_from_amostra.each do |parametro_resultado| \n copy_parametros_resultados(@amostra.id, parametro_resultado)\n end\n format.html { redirect_to edit_amostra_path(@amostra), notice: 'Amostra copiada com sucesso!' }\n format.json { render action: 'edit', status: :created, location: @amostra }\n end\n else\n format.html { redirect_to amostras_path, notice: 'Amostra criada com sucesso!' }\n format.json { render action: 'index', status: :created, location: @amostra }\n end \n else\n format.html { render action: 'new' }\n format.json { render json: @amostra.errors, status: :unprocessable_entity }\n end\n\n \n end\n end", "def recuperar_dados(arquivo)\n @tools.leitura arquivo\n end", "def create\n\n\n calcular_horas params[:tiempo_cita], params[:fecha_inicio],params[:hora_inicio], params[:minutos_inicio], params[:am_pm_inicio], params[:hora_final], params[:minutos_final], params[:am_pm_final], params[:se_repite], params[:dias], params[:fecha_final], params[:odontologo_id]\n #obj_horas_disponibles = {\n # 'hora' => params[:hora],\n # 'mes' => params[:mes],\n # 'ano' => params[:ano],\n # 'odontologo_id' => params[:odontologo_id]\n #}\n\n\n #@horas_disponible = HorasDisponible.new(obj_horas_disponibles)\n\n respond_to do |format|\n if 4 == 4\n format.html { redirect_to horas_disponibles_path, notice: 'Horas disponible was successfully created.' }\n format.json { render json: @horas_disponible, status: :created, location: @horas_disponible }\n else\n format.html { render action: \"new\" }\n format.json { render json: @horas_disponible.errors, status: :unprocessable_entity }\n end\n end\n end", "def entrada_de_dados(*args)\n @conta = ContaLuz.new\n\n @conta.qtd_kw_gasto = args[0]\n @conta.valor_pagar = args[1]\n @conta.numero_leitura = args[2]\n @conta.mes = args[3]\n @conta.ano = args[4]\n @conta.emissao = args[5]\n @conta.vencimento = args[6]\n\n @lista_contas << @conta\n end", "def nombre_completo\n\tprimer_nombre+\" \"+primer_apellido\n#fin del metodo\nend", "def create\n @caixa = Caixa.new(caixa_params)\n @caixa.data = Time.now\n\n if caixa_params[:status] && (current_caixa.try(:status) && current_caixa.try(:id) != @caixa.id)\n redirect_to caixas_path, alert: \"Não foi possível atualizar, já há um caixa em aberto.\" and return\n end\n\n respond_to do |format|\n if @caixa.save\n format.html { redirect_to caixas_path, notice: 'Caixa foi criado(a) com sucesso.' }\n format.json { render :show, status: :created, location: @caixa }\n else\n format.html { render :new }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def status_da_divulgacao(topico)\n end", "def create_ofertas\n\n\n\n arr_ofertas = []\n params.select { |par, val| par.starts_with?('oferta') && val.present? }.each do |puja|\n mid = puja.first.delete('oferta_')\n eliminar = params[\"delflag#{mid}\"] == '1'\n oferta = Oferta.new :mercado_id => mid, :seleccion_id => current_user.current_seleccion(session).id, :valor => puja.last.to_f, :estado => Oferta::PENDIENTE\n oferta.estado = Oferta::CANCELADA if eliminar\n\n oferta = oferta.save_if_valid\n arr_ofertas << I18n.t('mercado.oferta.oferta_creada', {:jugador => oferta.mercado.jugador.nombre, :valor => oferta.valor})\n end\n\n flash.now[:notice] = arr_ofertas.join '<br/>'\n\n # actualizamos los datos\n datos_ofertas\n\n respond_to do |format|\n format.js\n end\n\n end", "def create\n # catalogo_params[:usalaux1] = '0'\n # catalogo_params[:usalaux2] = '0'\n # catalogo_params[:estransaccional] = '0'\n\n @catalogo = Catalogo.new(catalogo_params)\n\n respond_to do |format|\n if @catalogo.save\n format.html { redirect_to @catalogo, notice: 'Catalogo was successfully created.' }\n format.json { render :show, status: :created, location: @catalogo }\n else\n load_Obj\n @papa = Catalogo.select(:id, :codigo, :nombre).where(\"estransaccional = ? AND activo = ? AND nivel_id = ? AND grupo_id = ? \", false, true, catalogo_params[:nivel_id], catalogo_params[:grupo_id] )\n format.html { render :new }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def crear\n # byebug\n ruta = Ruta.new\n ruta.nombre = params[:ruta][:nombre]\n ruta.descripcion = params[:ruta][:descripcion]\n ruta.subruta = params[:ruta][:subruta]\n ruta.save\n redirect_to action: \"index\"\n\n # respond_to do |format|\n # if @ruta.save\n # format.html { redirect_to @ruta, notice: \"Rutum was successfully created.\" }\n # format.json { render :show, status: :created, location: @ruta }\n # else\n # format.html { render :new }\n # format.json { render json: @ruta.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n if session[:orcamento_id].present?\n @orcamento = Orcamento.find(session[:orcamento_id])\n else\n @orcamento = Orcamento.new\n @orcamento.cliente = Cliente.find(params[:orcamento][:cliente_id])\n @orcamento.save\n \n session[:orcamento_id] = @orcamento.id\n end\n \n handle_orcamento_update\n end", "def aprovar\n @oferta = Oferta.new\n @oferta.cotacao = Cotacao.find(params[:id])\n @oferta.cotacao.update_attributes(:status => Status.find_by_descricao('Aprovado'))\n\n @oferta.administrador = Administrador.first\n @oferta.data_inicio = @oferta.cotacao.data_inicio\n @oferta.data_fim = @oferta.cotacao.data_fim\n @oferta.valor_convite = @oferta.cotacao.valor\n @oferta.status = Status.find 2\n\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.json { render :json => @oferta }\n end\n end", "def guarda_nombres_comunes_todos\n dame_nombres_comunes_todos\n\n if x_nombre_comun_principal.present?\n a = adicional ? adicional : Adicional.new(especie_id: id)\n a.nombres_comunes = x_nombres_comunes.encode('UTF-8', {invalid: :replace, undef: :replace, replace: ''})\n a.nombre_comun_principal = x_nombre_comun_principal.force_encoding(\"UTF-8\")\n\n if a.changed?\n a.save\n reload\n end\n end\n end", "def solicitudes_atrasadas\n end", "def initialize(params)\n @id = params[:id]\n @nombre = params[:nombre]\n @genero = params[:genero]\n @id_tropicos = params[:id_tropicos]\n @color1 = params[:color1]\n @color2 = params[:color2]\n @forma_vida1 = params[:forma_vida1]\n @forma_vida2 = params[:forma_vida2]\n @descripcion_es = params[:descripcion_es]\n @descripcion_en = params[:descripcion_en]\n @distribucion_es = params[:distribucion_es]\n @distribucion_en = params[:distribucion_en]\n @thumbnail = params[:thumbnail]\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def prepare\n end", "def saveObject(params)\r\n \r\n @solicitudlabexa.usuario_id = params[:usuario][:identificador].to_i\r\n if params[:asignatura].nil?\r\n @solicitudlabexa.asignatura=Asignatura.new\r\n @solicitudlabexa.asignatura.titulacion_id=params[:titulacion][:titulacion_id] unless params[:titulacion].nil? \r\n @solicitudlabexa.asignatura.curso=params[:nivel]\r\n @solicitudlabexa.asignatura.id=0\r\n else\r\n @solicitudlabexa.asignatura_id = params[:asignatura][:id].to_i\r\n end\r\n @solicitudlabexa.fechasol=Date.today\r\n @solicitudlabexa.npuestos=params[:npuestos]\r\n @solicitudlabexa.curso=params[:nivel].to_s == '0' ? 'optativa' : params[:nivel].to_s\r\n @solicitudlabexa.comentarios=Iconv.conv('ascii//translit//ignore', 'utf-8', params[:comentarios].to_s)\r\n @solicitudlabexa.horaini=params[:horaini][:comienzo]\r\n @solicitudlabexa.horafin=params[:horafin][:fin]\r\n @solicitudlabexa.asignado=\"N\"\r\n \r\n pref=\"\"\r\n @especiales=Laboratorio.where('especial=?',\"t\").to_a \r\n for especial in @especiales do\r\n nombre=especial.ssoo.to_s\r\n if params[:\"#{nombre}\"] and params[:\"#{nombre}\"].to_s!='in'\r\n pref+=especial.nombre_lab.to_s+'-'+nombre+'-'+params[:\"#{nombre}\"]+\";\"\r\n end\r\n end\r\n @solicitudlabexa.preferencias=pref\r\n\r\n if params[:fecha]=~ /[0-3]?[0-9]\\-[0-1]?[0-9]\\-[0-9]{4}/\r\n @solicitudlabexa.fecha=formato_europeo(params[:fecha])\r\n else\r\n @solicitudlabexa.fecha=nil\r\n end\r\n end", "def create\n @comentario_autenticado = ComentarioAutenticado.new(comentario_autenticado_params)\n #@comentario_autenticado.autor = current_user.nome_completo\n #@comentario_autenticado.usuario = current_user\n\n respond_to do |format|\n if @comentario_autenticado.save\n format.html { redirect_to @comentario_autenticado, notice: 'Comentario autenticado was successfully created.' }\n format.json { render :show, status: :created, location: @comentario_autenticado }\n else\n format.html { render :new }\n format.json { render json: @comentario_autenticado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @parametro_financeiro = ParametroFinanceiro.new(params[:parametro_financeiro])\n @parametro_financeiro.usuario_id = current_usuario.id\n @parametro_financeiro.entidade_id = current_usuario.entidade_id\n\n respond_to do |format|\n if @parametro_financeiro.save\n format.html { redirect_to(@parametro_financeiro, :notice => 'Parametro cadastrado com sucesso.') }\n format.xml { render :xml => @parametro_financeiro, :status => :created, :location => @parametro_financeiro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @parametro_financeiro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create \n @lancamentorapido = Lancamentorapido.new(params[:lancamentorapido])\n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n respond_to do |format|\n if @lancamentorapido.save\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully created.' } \n# format.html { redirect_to '/lancamentorapidos'}\n format.json { render json: lancamentorapidos_path, status: :created, location: @lancamentorapido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orden_cobro = OrdenCobro.new(params[:orden_cobro])\n\n respond_to do |format|\n if @orden_cobro.save\n\tlog = Log.new(:NombreTable => \"orden_cobros\", :Fecha => Date.today, :Hora => Time.now, :Usuario => current_user.username, :AccionRealizada => \"Create\")\n\tlog.save\n format.html { redirect_to @orden_cobro, notice: 'Orden cobro was successfully created.' }\n format.json { render json: @orden_cobro, status: :created, location: @orden_cobro }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orden_cobro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @empresa = Empresa.new(empresa_params)\n @empresa.creador = current_user.id\n @empresa.modificador = current_user.id\n\n respond_to do |format|\n if @empresa.save\n format.html { redirect_to @empresa, notice: 'Empresa was successfully created.' }\n format.json { render :show, status: :created, location: @empresa }\n else\n format.html { render :new }\n format.json { render json: @empresa.errors, status: :unprocessable_entity }\n end\n end\n end", "def inject(obj)\n obj.instance_eval do\n\n def cedente\n self.contribuicao.instituicao.nome.to_s.remover_acentos\n end\n\n def dados_sacado\n dados = \"\"\n cidade_uf = self.contribuicao.pessoa.cidade ? self.contribuicao.pessoa.cidade.nome.as_campo(15) : \"\".as_campo(15)\n cidade_uf += self.contribuicao.pessoa.cidade ? self.contribuicao.pessoa.cidade.estado.sigla.as_campo(2) : \"\".as_campo(2)\n # NOME - 35\n dados += self.contribuicao.pessoa.nome ? self.contribuicao.pessoa.nome.as_campo(35) : \"\".as_campo(35)\n # ENDERECO - 40\n dados += self.contribuicao.pessoa.endereco_minimo.as_campo(40)\n if self.contribuicao.pessoa.endereco.blank?\n # BAIRRO - 12\n dados += self.contribuicao.pessoa.endereco_cobranca_bairro ? self.contribuicao.pessoa.endereco_cobranca_bairro.as_campo(12) : \"\".as_campo(12)\n # CIDADE - 15 e UF - 2\n dados += cidade_uf\n # CEP - 8\n dados += self.contribuicao.pessoa.endereco_cobranca_cep ? self.contribuicao.pessoa.endereco_cobranca_cep.as_campo(8) : \"\".as_campo(8)\n else\n # BAIRRO - 12\n dados += self.contribuicao.pessoa.bairro ? self.contribuicao.pessoa.bairro.as_campo(12) : \"\".as_campo(12)\n # CIDADE - 15 e UF - 2\n dados += cidade_uf\n # CEP - 8\n dados += self.contribuicao.pessoa.cep ? self.contribuicao.pessoa.cep.as_campo(8) : \"\".as_campo(8)\n end\n # REGISTRO - 6 + CAMPO LIVRE - 20\n dados += 0.as_campo(6,0) + CAMPO_LIVRE_20 + \" \".as_campo(5)\n dados += self.contribuicao.pessoa.cpf ? self.contribuicao.pessoa.cpf.to_i.as_campo(15,0) : 0.as_campo(15,0)\n dados += \" \"\n dados.remover_acentos\n end\n\n def vencimento\n self.data_referencia\n end\n\n # Formacao do nosso numero\n # {XXXXXXXXXX}-{D}\n # {XXXXXXXXXX} -> ID DA CONTRIBUICAO\n # {D} -> Digito verificador mod11(Codigo da agencia cedente + ID DA CONTRIBUICAO)\n def nosso_numero\n self.id.as_campo(10,0).to_s\n end\n\n def digito_nosso_numero\n (agencia.as_campo(4).to_s + nosso_numero).modulo11_mercantil { |valor| [0,1].include?(valor) ? 0 : (11 - valor) }\n end\n\n def valor_documento\n self.valor\n end\n\n def numero_carteira\n \"06\"\n end\n\n def quantidade_moeda\n \"000000000000000\"\n end\n\n def especie_documento\n \"OU\"\n end\n\n def aceite\n \"N\"\n end\n\n def instrucoes_bancarias\n instrucoes = \"\"\n if self.contribuicao.contrato_cobranca.conta.instrucoes_bancarias\n (0..5).each do |ix|\n instrucoes += (self.contribuicao.contrato_cobranca.conta.instrucoes_bancarias.split(Conta::QUEBRA_INSTRUCAO_BANCARIA)[ix]).to_s.as_campo(70)\n end\n end\n instrucoes.remover_acentos\n end\n\n def instrucoes_sacado\n instrucoes = \"\"\n if self.contribuicao.contrato_cobranca.conta.instrucoes_bancarias\n (0..2).each do |ix|\n instrucoes += (self.contribuicao.contrato_cobranca.conta.instrucoes_sacado.split(Conta::QUEBRA_INSTRUCAO_SACADO)[ix]).to_s.as_campo(40)\n end\n end\n instrucoes.remover_acentos\n end\n\n def mensagem_sacado\n # mensagem = \"Pagamento referente a manutencao de menores carentes assistidas pela Cidade dos Meninos Sao Vicente de Paulo.\".as_campo(130)\n mensagem = \"\".as_campo(130)\n # mensagem += \"visite nosso site:www.redesolidariedade.org.br ou (31)3228-9236\".as_campo(130)\n mensagem += \"\".as_campo(130)\n # mensagem += \"Ser anjo e voce ser capaz de iluminar no momento em que o outro e trevas!\".as_campo(130)\n mensagem += \"\".as_campo(130)\n mensagem += \"\".as_campo(1560)\n end\n\n def agencia\n self.contribuicao.contrato_cobranca ? self.contribuicao.contrato_cobranca.conta.agencia.to_f.as_campo(4,0) : 0.as_campo(4,0)\n end\n\n def codigo_cedente\n self.contribuicao.contrato_cobranca ? self.contribuicao.contrato_cobranca.numero_contrato.to_f.as_campo(9,0) : 0.as_campo(9,0)\n end\n\n def cnpj_cedente\n self.contribuicao.contrato_cobranca.conta.cnpj.gsub(/\\.|\\/|\\-|\\s/,'').as_campo(14)\n end\n\n def indicador_ano\n \"S\"\n end\n\n def instrucao_codificada\n \"0000\"\n end\n\n end\n end", "def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end", "def create\n respond_to do |format|\n if usuario_do_setor_principal\n @aquisicao = Aquisicao.new(\n params.require(:aquisicao).permit(:produto_id, :quantidade)\n )\n @aquisicao.setor = Setor.principal\n @aquisicao.usuario = current_usuario\n\n if @aquisicao.save\n format.html { redirect_to @aquisicao, notice: 'Aquisição registrada com sucesso.' }\n format.json { render :show, status: :created, location: @aquisicao }\n else\n set_produtos\n format.html { render :new }\n format.json { render json: @aquisicao.errors, status: :unprocessable_entity }\n end\n else\n @aquisicao.errors.add :base, aviso_apenas_usuario_do_setor_principal\n format.html { render :new, notice: @aquisicao.errors }\n format.json { render json: @aquisicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def verificar_datos_cliente_id_y_tipo_cliente\n\n @cliente_id = params['cliente_id'] # params.permit(:tipo_cliente) #params['cliente_id'] #require(:ciudadt).permit(:cliente_id)\n @tipo_cliente = params['tipo_cliente'] # \"klk\" # params['tipo_cliente'] # params.require(:ciudadt).permit(:tipo_cliente)\n\n #tambien lo guardo en la session para fines de acceso general desde cualquier parte del servicor 9controladores)\n session[:cliente_id] = @cliente_id\n session[:tipo_cliente] = @tipo_cliente\n \nend", "def create\n @cegonha = Cegonha.new(params[:cegonha])\n @cegonha.carros = 0\n\n if !(params[:cegonha][:pagamento_attributes]).nil?\n\n converter_string_to_bigdecimal(@cegonha, params[:cegonha][:pagamento_attributes])\n end\n\n if @cegonha.motorista\n motoristas = Motorista.all\n motorista_existente = motoristas.collect{|motorista| if motorista.cpf == @cegonha.motorista.cpf; motorista; end}\n motorista_existente.delete(nil)\n\n if !motorista_existente.empty?\n @cegonha.motorista = Motorista.find(motorista_existente[0][:id])\n @cegonha.motorista.update_attributes(params[:cegonha][:motorista_attributes])\n end\n end\n if @cegonha.empresa\n empresas = Empresa.all\n empresa_existente = empresas.collect{|empresa| if empresa.cnpj == @cegonha.empresa.cnpj; empresa; end}\n empresa_existente.delete(nil)\n if !empresa_existente.empty?\n @cegonha.empresa = Empresa.find(empresa_existente[0][:id])\n @cegonha.empresa.update_attributes(params[:cegonha][:empresa_attributes])\n end\n end\n\n\n respond_to do |format|\n if @cegonha.save\n if params[:editar_localizacao]\n redirect_to edit_cegonha_path(@cegonha, :editar_localizacao => true, :cegonha => @cegonha) and return\n end\n format.html { redirect_to @cegonha, notice: 'Cegonha foi criada com sucesso.' }\n format.json { render json: @cegonha, status: :created, location: @cegonha }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cegonha.errors, status: :unprocessable_entity }\n end\n end\n end", "def prepare!; end", "def prepare!; end", "def create\n @orcamento = Orcamento.new(orcamento_params)\n\n respond_to do |format|\n if @orcamento.save\n format.html { redirect_to @orcamento, notice: 'Orcamento criado com sucesso!' }\n format.json { render :show, status: :created, location: @orcamento }\n else\n format.html { render :new }\n format.json { render json: @orcamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def grabar_comprador\n @comprador_vehiculo=Comprador_Vehiculo.new\n \n \n \n @cedula=params[:cedula]\n @nombres=params[:nombres]\n @apellidos=params[:apellidos]\n @telefono=params[:telefono]\n @direccion=params[:direccion]\n @correo=params[:correo]\n @fecha_nacimiento=params[:fecha_nacimiento]\n @sexo=params[:sexo]\n #------\n @nusuario=params[:nusuario]\n @password=params[:password]\n # puts ''+ @nusuario + ''\n @imagen=params[:imagen]\n \n if buscar_u(params[:nusuario]) \n \n # $tirajson = '{ \"success\": \"false\", \"exito\": \"false\", \"msg\": \" el nombre de usuario ya existe\" }'\n else\n grabar_usuario(@nusuario, @password,@imagen);\n \n @comprador_vehiculo.grabar_comprador1(@cedula,@nombres,@apellidos,@telefono,@direccion,@correo,@fecha_nacimiento,@sexo,@nusuario)\n render :text => $tirajson\n valor = 0 \n end\n \n \n \n \n end", "def create\n @usuario = Usuario.new(params[:usuario])\n @usuario.perfil = Perfil.where(\"nome=?\",\"Usuário\").first if @usuario.perfil.nil?\n #if @usuario.senha_flag.blank?\n @usuario.senha_segura = encrypt(@usuario.senha_flag,nil)\n #end\n if params[:peso_novo]\n if @usuario.peso.nil? || params[:peso_novo].to_f != @usuario.peso.peso\n @usuario.pesos << Peso.new(:data=>@usuario.peso.data,:peso=>@usuario.peso.peso) unless (@usuario.peso.nil? || params[:peso_novo].to_f == @usuario.peso.peso)\n # @usuario.peso.create(:peso=>params[:peso_novo],:data=>Date.current,:usuario=>@usuario)\n @usuario.peso = Peso.new(:peso=>params[:peso_novo],:data=>Date.current)\n end\n end\n \n respond_to do |format|\n if @usuario.save\n flash[:success] = \"Cadastro efetuado com sucesso, bem-vindo à Aliments\"\n flash[:subtitle] = \"Para iniciar efetue o login\"\n format.html { redirect_to(@usuario, :notice => 'Usuario was successfully created.') }\n format.xml { render :xml => @usuario, :status => :created, :location => @usuario }\n else\n flash[:error] = \"Não foi possível efetuar seu cadastro.\"\n flash[:subtitle] = \"Verifique os erros e tente novamente\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n Coligacao.transaction do\n coligacao_partido = params[:coligacao].delete :coligacao_partido\n cargo_eleicao = params[:coligacao].delete :cargo_eleicao\n\n if cargo_eleicao[:municipio_id]\n @cargo_eleicao = CargoEleicao.find(:first, conditions: [\"eleicao_id = ? and cargo_id = ? and municipio_id = ?\", cargo_eleicao[:eleicao_id], cargo_eleicao[:cargo_id], cargo_eleicao[:municipio_id]])\n elsif cargo_eleicao[:uf_id]\n @cargo_eleicao = CargoEleicao.find(:first, conditions: [\"eleicao_id = ? and cargo_id = ? and uf_id = ?\", cargo_eleicao[:eleicao_id], cargo_eleicao[:cargo_id], cargo_eleicao[:uf_id]])\n else\n @cargo_eleicao = CargoEleicao.find(:first, conditions: [\"eleicao_id = ? and cargo_id = ?\", cargo_eleicao[:eleicao_id], cargo_eleicao[:cargo_id]]) unless @cargo_eleicao\n end\n\n @coligacao = Coligacao.new(params[:coligacao])\n\n if @cargo_eleicao\n @coligacao.cargo_eleicao = @cargo_eleicao\n end\n\n if @coligacao.save\n redirect_to @coligacao, notice: 'Coligacao criada com sucesso!'\n else\n ActiveRecord::Rollback\n render action: \"new\"\n end\n end\n end", "def create\n @contrato = Contrato.new(contrato_params)\n\n respond_to do |format|\n if @contrato.save\n @contrato.anadir_conceptosdepago(@contrato.fecha_inicio, @contrato.fecha_fin)\n format.html { redirect_to @contrato, notice: 'Contrato fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @contrato }\n else\n format.html { render :new }\n format.json { render json: @contrato.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @material_apoyo = MaterialApoyo.new(params[:material_apoyo])\n begin\n data = params[:archivo][:datafile]\n ext = data.original_filename.split('.').last\n nombre = \"material_apoyo_#{@material_apoyo.id}.#{ext}\"\n archivo = \"#{Rails.root}/attachments/material_apoyo/#{nombre}\"\n\n @material_apoyo.nombre = nombre\n @material_apoyo.tipo_material_apoyo_id = 'TEXT'\n @material_apoyo.nombre_original = data.original_filename\n @material_apoyo.url = archivo\n data = data.tempfile\n File.open(\"#{archivo}\", \"wb\") {|file| file.write data.read; file.close}\n if @material_apoyo.save\n flash[:mensaje] += \"Material de apoyo Agregado\"\n params[:cursos_ids].each_key do |curso_id| \n idioma_id,tipo_categoria_id,tipo_nivel_id = curso_id.split \",\"\n MaterialApoyoCurso.create(:material_apoyo_id => @material_apoyo.id, :curso_idioma_id => idioma_id, :curso_tipo_categoria_id => tipo_categoria_id, :curso_tipo_nivel_id => tipo_nivel_id)\n end\n end \n rescue Exception => e\n flash[:mensaje] = \"Error: #{e.message}\"\n end\n redirect_to :action => 'index'\n end", "def create\n @coment = Comentar.new(comentar_params)\n \n user_id = @coment.user_id\n disciplinacurso_id= @coment.disciplinacurso_id\n professor_id= @coment.professor_id\n semestre_id= @coment.semestre_id\n \n verifica_comentario = Comentar.where(\"user_id=:user_id and disciplinacurso_id=:disciplinacurso_id and professor_id=:professor_id and semestre_id=:semestre_id\",{user_id:user_id, disciplinacurso_id:disciplinacurso_id,professor_id:professor_id,semestre_id:semestre_id}).exists?\n \n if !verifica_comentario then\n @comentario = @coment.comentario.split(' ')\n @comentario = @comentario.map{|comentario| remover_acentos(comentario).gsub /[^\\w\\s]/, ''}#remove acentuação\n \n @compara = Restricao.all\n @restricao = []\n @restricao = @compara.map{|compara| remover_acentos(compara.palavra).downcase}\n \n stemmer = Lingua::Stemmer.new(:language => \"pt\")\n \n @resultado = []\n @resultado = @comentario.select{ |comentario| @restricao.include?(stemmer.stem(comentario.downcase))}.map{ |comentario| comentario}\n \n @permite = true\n if @resultado.present? then \n @permite = false\n end\n \n respond_to do |format|\n if (@permite) then\n if @coment.save\n format.html { redirect_to '/demonstra_comentarios', notice: 'Comentário Incluído!'}\n format.html { render :new }\n format.json { render json: @coment.errors, status: :unprocessable_entity }\n end\n else \n format.html { redirect_to '/comentars/new', notice: 'O comentário não está nos padrões permitidos! Favor refazer.' }\n end \n end \n else message = 'Você já realizou um comentário para esta disciplina neste semestre!'\n redirect_to '/comentars/new', notice: message\n \n end\n end", "def exec(conn)\n\t\t\tputs 'migrando dados de membros'\n\t\t\tPessoa.delete_all\n\t\t\trs = conn.exec(@sql_recupera_membros)\n \terros = []\n\t \tquantidade_acertos = 0\n\t\t\trs.each do |row|\n \tbegin\n\n\t\t\t\t\tmembro = Membro.new do |m|\n\t\t\t\t\t\tm.id_sys = row['cod_membro']\n\t\t\t\t\t\tm.nome = row['nom_membro']\n\t \tm.nome_curto = row['nom_carteirinha_membro']\n\t \tm.data_nascimento = row['dta_nascimento']\n\t \tm.sexo = masculino?(row['dig_sexo'])\n\t\t\t\t\tend\n \t\n\t\t\t\t\tmembro.save\n\n \tputs \"#{membro.nome} importada\"\n\t\t\t\t\tquantidade_acertos = quantidade_acertos + 1\n \trescue => err\n \terros[erros.size] = {:cod_membro => membro.id, :nome => membro.nome, :err => err}\n \tputs \"erro na importacao: #{membro.nome}\" \n \tend\n\t\t\tend\t\n\n\t \tputs 'migracao de Membro finalizada com sucesso' if erros.size == 0\n \tputs \"migracao de Membro finalizada com #{erros.size} erros\" if erros.size > 0\n\t\t\tputs \"#{quantidade_acertos} membros criados\" if quantidade_acertos > 0\n\t\t\tputs \"relatorio de gerado em tmp/membros_com_erro.txt\"\n \n \tgera_log_de_erro erros, 'Membro', 'tmp/membros_com_erro.txt'\n \n\t\tend", "def create\n @despesa = Despesa.new(despesa_params)\n @despesa.user_id = current_user.id\n #@despesa.valor = format_valor\n\n respond_to do |format|\n if @despesa.save\n format.html { redirect_to condominio_despesas_path(condominio_id: @despesa.condominio_id), notice: 'Despesa was successfully created.' }\n format.json { render :show, status: :created, location: @despesa }\n else\n format.html { render :new }\n format.json { render json: @despesa.errors, status: :unprocessable_entity }\n end\n end\n end", "def mi_horario\n\n\tend", "def create\n @evento = Evento.new(params[:evento])\n @evento.user = current_user\n @evento.residencial = current_user.apartamento.residencial\n\n respond_to do |format|\n if @evento.save\n format.html { redirect_to @evento, notice: 'Evento foi criado com sucesso.' }\n format.json { render json: @evento, status: :created, location: @evento }\n\n comentario = Comentario.new\n comentario.user = current_user\n comentario.comentavel_id = @evento.id\n comentario.comentavel_type = \"Evento\"\n comentario.conteudo = \"Novo evento\"\n comentario.titulo = \"Novo evento\"\n\n comentario.save\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @evento.errors, status: :unprocessable_entity }\n end\n end\n end", "def metodos_con(letras,*clase) # puede ser metodos de una clase, una lista de clases, o una lista de metodos\n if not clase.none? # si no hay parametros busca en los metodos_observados\n self.get_metodos_de(clase) # aca los setea en @metodos_observados\n end\n @metodos_observados.select{|metodo| metodo[0..letras.size].include? letras}\n end", "def crear_mov_movimiento\n deudas_comp = com_compra.totales_por_comprobante\n build_mov_movimiento\n\n mov_movimiento.tipo_movimiento = MovMovimiento.tipo_movimientos[:egreso]\n mov_movimiento.hoja = hoja\n mov_movimiento.fecha = com_compra.fecha\n mov_movimiento.ciclo = com_compra.ciclo\n mov_movimiento.emp_clasificacion = com_compra.emp_clasificacion\n mov_movimiento.emp_cuentab = emp_cuentab\n mov_movimiento.concepto = concepto\n mov_movimiento.emp_proveedor = com_compra.emp_proveedor\n mov_movimiento.emp_locacion_id = deudas_comp[comprobante][3]\n mov_movimiento.factura = com_compra.factura\n mov_movimiento.comprobante = deudas_comp[comprobante][4]\n mov_movimiento.tipo_comprobante = deudas_comp[comprobante][5]\n\n # obtiene el porcentaje de pago que se hizo\n porc = monto / com_compra.suma_valores[emp_cuentab.moneda][:total]\n # calcula la cantidad en cada sección\n mov_movimiento.subtotal = com_compra.suma_valores[emp_cuentab.moneda][:subtotal] * porc\n mov_movimiento.iva = com_compra.suma_valores[emp_cuentab.moneda][:iva] * porc\n mov_movimiento.ieps = com_compra.suma_valores[emp_cuentab.moneda][:ieps] * porc\n mov_movimiento.total = monto\n\n #mov_movimiento.save\n end", "def iniciarBodega\n Cliente.destroy_all\n #1. Crear clientes\n if(Cliente.all.count==0)\n clientesIniciar\n end\n #2. Crear Bodega\n ib = Bodega.iniciarBodega(true) #True porque se inicia\n \n #3. Mandar a producir Stock si es Bajo\n ProducirMateriasPrimas.new.producirStockBajo\n render json: \"Iniciada\"\nend", "def create\n @produto = Produto.new(params[:produto])\n @produto.empresa = session[:usuario].empresa\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pregoestitulo = Pregoestitulo.new(pregoestitulo_params)\n\n pregao = Pregao.where('data = ?', @pregoestitulo.date).first\n\n if pregao.blank?\n pregao = Pregao.new\n pregao.data = @pregoestitulo.date\n pregao.flagativo = true\n pregao.save\n end\n\n @pregoestitulo.pregao_id = pregao.id\n\n respond_to do |format|\n if @pregoestitulo.save\n format.html { redirect_to @pregoestitulo, notice: 'Título incluído com sucesso.' }\n format.json { render :show, status: :created, location: @pregoestitulo }\n else\n format.html { render :new }\n format.json { render json: @pregoestitulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orden_trabajo = OrdenTrabajo.new(orden_trabajo_params)\n \n calcula_tinetas!\n actualiza_fecha!\n\n respond_to do |format|\n if actualiza_materias! != false\n if @orden_trabajo.save\n format.html { redirect_to @orden_trabajo, notice: 'La orden de trabajo se creo correctamente.' }\n format.json { render :show, status: :created, location: @orden_trabajo }\n else\n format.html { render :new }\n format.json { render json: @orden_trabajo.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new }\n format.json { render json: @orden_trabajo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @informativo_obra = InformativoObra.new(informativo_obra_params)\n\n @status = Statusobra.find_by_statusobra_type(\"Salvo\")\n @informativo_obra.statusobra_id = @status.id\n\n respond_to do |format|\n if @informativo_obra.save\n format.html { redirect_to @informativo_obra, notice: 'Informativo de obra foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @informativo_obra }\n else\n format.html { render :new }\n format.json { render json: @informativo_obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @libro = Libro.new(params[:libro])\n\n respond_to do |format|\n if @libro.save\n\t\tguardar_log(session[:usuario_id], self.class.name,__method__.to_s, @libro,nil )\n format.html { redirect_to @libro, :notice => 'Libro creado exitosamente.' }\n format.json { render :json => @libro, :status => :created, :location => @libro }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @libro.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end", "def set_cadastro_usuario\n @cadastro_usuario = CadastroUsuario.find(params[:id])\n end", "def create\n\n @var=params[:despachar]\n if !(params[:enviar].nil?)\n\n @ordenes=params[:enviar]\n @ordenes.each do |orden|\n if orden[1] != \"no\"\n @orden = Orden.find(orden[1])\n @orden.empleado_id = @var[\"recolector\"]\n @orden.estado = \"Asignada para Recoleccion\"\n NUESTRO_LOG.info \"Se despacho la orden correctamente\"\n @orden.save\n end\n end\n end\n @ordenprincipal = Orden.find(@var[\"orden\"])\n @ordenprincipal.estado = \"Asignada para Recoleccion\"\n @ordenprincipal.empleado_id = @var[\"recolector\"]\n @ordenprincipal.save\n redirect_to(despachador_path, :notice => t('rutarecolecciones'))\n\n end", "def create\n @jugadore = Jugadore.new(params[:jugadore])\n\n respond_to do |format|\n if @jugadore.save\n newAuditoria = Auditoria.new\n newAuditoria.tabla = params[:controller]\n newAuditoria.action = params[:action]\n newAuditoria.usuario = User.all.first.id\n newAuditoria.clave = @jugadore.id\n newAuditoria.save\n format.html { redirect_to @jugadore, notice: 'Jugadore was successfully created.' }\n format.json { render json: @jugadore, status: :created, location: @jugadore }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jugadore.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6171839", "0.59500235", "0.5908083", "0.58400655", "0.58154124", "0.5770937", "0.5720225", "0.56514174", "0.5649546", "0.56271476", "0.56078136", "0.5564297", "0.556201", "0.5546432", "0.55187553", "0.5514774", "0.5500641", "0.5500641", "0.5500641", "0.5492789", "0.5489904", "0.548218", "0.54818195", "0.5472215", "0.5471568", "0.5468457", "0.5462599", "0.54606783", "0.54506147", "0.54470956", "0.5437007", "0.5430491", "0.54301316", "0.5428166", "0.5427499", "0.54230845", "0.5416182", "0.5415801", "0.54001486", "0.53996915", "0.53996915", "0.5395405", "0.53917956", "0.53879577", "0.53780925", "0.53772074", "0.5376984", "0.53752196", "0.5373072", "0.5368664", "0.5362206", "0.5361903", "0.53591466", "0.5347797", "0.5338317", "0.533569", "0.53356016", "0.5335282", "0.5331694", "0.53251857", "0.53251857", "0.53251857", "0.53251857", "0.53251857", "0.53251857", "0.53251857", "0.53231263", "0.5322665", "0.5322249", "0.53208786", "0.5319321", "0.5315645", "0.53108525", "0.53099686", "0.53046024", "0.5304516", "0.5300551", "0.5298105", "0.5298105", "0.52946717", "0.528143", "0.52789354", "0.52788293", "0.52731824", "0.5272565", "0.5263909", "0.526331", "0.5255507", "0.52526534", "0.5250424", "0.5250266", "0.52480465", "0.5241409", "0.5241209", "0.52347684", "0.52312005", "0.52261496", "0.52247167", "0.52227426", "0.5215083", "0.5212028" ]
0.0
-1
Reset counters in seller when change the seller of store
def reset_seller_counters(store) # Reset counter cache to new seller Seller.reset_counters(store.seller_id, :stores) # Recount all stores_count for all sellers tree SellerAppCountWorker.perform_at(1.minutes.from_now, store.seller.id) if store.seller_id_was && Seller.exists?(store.seller_id_was) # Reset counter cache to old seller Seller.reset_counters(store.seller_id_was, :stores) # Recount all stores_count for all sellers tree SellerAppCountWorker.perform_at(1.minutes.from_now, store.seller_id_was) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_counter_cache\n User.reset_counters(@listing.seller_id, :active_listings)\n end", "def hire_seller\r\n\t\t@sellers += 1\r\n\t\tputs \"*\"*50\r\n\t\tputs \"You just hired a new seller, you now have #{@sellers} sellers working for you.\"\r\n\t\tputs \"*\"*50\r\n\tend", "def recount_actives_stores(store)\n if corporate = store.store\n corporate.active_stores_count = corporate.stores.actives.count\n corporate.save\n end\n end", "def reset_counter; end", "def set_sales_seller\n @sales_seller = Sales::Seller.find(params[:id])\n end", "def set_seller\n @seller = @commerce.sellers.friendly.find(params[:id])\n end", "def sellers\r\n @sellers ||= SellersController.new(configuration: @configuration)\r\n end", "def set_seller\n @seller = Seller.find(params[:id])\n end", "def set_seller\n @seller = Seller.find(params[:id])\n end", "def set_seller\n @seller = Seller.find(params[:id])\n end", "def set_seller\n @seller = Seller.find(params[:id])\n end", "def set_seller\n @seller = Seller.find(params[:id])\n end", "def set_seller\n @seller = Seller.find(params[:id])\n end", "def dealer_win\n @dealer_win += 1\n end", "def before_save\n self.offers_count = self.offers.count\n end", "def set_seller\n @seller = Seller.find(params[:id])\n end", "def reset\r\n @spend = 0\r\n end", "def set_seller\n @seller = Seller.find(params[:seller_id])\n end", "def reset_discounts\n @discounts = []\n end", "def set_seller\n @seller = Seller.set_corresponding_seller(params[:id], session[:admin_id], session[:user_id])\n if @seller\n @seller\n else\n invalid_seller\n end\n end", "def dec_manufacturer_count\n if !self.is_stub? && self.manufacturer.present?\n self.manufacturer.update_attribute :products_count, self.manufacturer.products_count -= 1\n end\n end", "def dec_count\n role = self.role == 'Manager' ? :manager_count : :employee_count\n self.company.count.update_attribute(role, self.company.count.read_attribute(role)-1)\n end", "def update_shop(update_sales = true)\n deplenish_articles\n replenish_articles\n add_trade_flow_articles\n flush_rebuy_items\n apply_random_sales if update_sales\n end", "def reset\n @count = 0\n end", "def reset_followers_count!\n self.class.update_counters id, followers_count: -followers_count\n self[:followers_count] -= followers_count\n end", "def reset_sales_stuff\n\t @last_sale = nil\n\t\t@sale = nil\n\t\t@item = nil\n\t\t@copy = nil\n\t\t@customers = nil\n\t\t@first_name_field.setStringValue(\"\")\n\t\t@last_name_field.setStringValue(\"\")\n\t\t@item_id_field.setStringValue(\"\")\n\t\t@price_field.setStringValue(\"\")\n\t\t@format_field.setStringValue(\"\")\n\t\t@title_field.setStringValue(\"\")\n\t\t@type_field.setStringValue(\"\")\n\t\t@notification_label.setStringValue(\"\")\t\n\t\t@status_label.setStringValue(\"\")\n\t\t@customers_table.reloadData\t\n\tend", "def inc_manufacturer_count\n if !self.is_stub? && self.manufacturer.present?\n self.manufacturer.update_attribute :products_count, self.manufacturer.products_count += 1\n end\n end", "def set_sale\n @sale = Sale.find(1)\n end", "def set_sale\n @sale = Sale.find(1)\n end", "def single_sell_in_day_remover(item)\r\n item.sell_in -= 1\r\n end", "def set_reseller\n @reseller = Reseller.find(params[:id])\n end", "def number_of_sellers(login=nil)\n count_by_frbr(login, :is_sold_by, :how_many_roles?) \n end", "def set_seller_account\n @seller_account = SellerAccount.find(params[:id])\n end", "def reset\n @gold_coins = 0\n @health_points = 10\n @lives = 5\n end", "def deal_with_other_offers\n if self.selling?\n if self.sender.nil? == false\n self.sender.active_offers_for_textbook(self.textbook_id).each do |offer|\n offer.update_status(3)\n\n if self.sender_id == offer.sender_id\n\t Offer.notify_buyer_book_sold(offer.reciever,offer.sender,textbook)\n\t else\n\t Offer.notify_buyer_book_sold(offer.sender,offer.reciever,textbook)\n\t end\n\t end\n end\n\tif self.reciever.nil? == false\n\t self.reciever.active_offers_for_textbook(self.textbook_id).each do |offer|\n\t offer.update_status(4)\n\n if self.sender_id == offer.sender_id\n\t Offer.notify_seller_book_bought(offer.reciever,offer.sender,textbook)\n\t else\n\t Offer.notify_seller_book_bought(offer.sender, offer.reciever, textbook)\n\t end\n\t end\n\tend\n else\n if self.sender.nil? == false\n self.sender.active_offers_for_textbook(self.textbook_id).each do |offer|\n offer.update_status(4)\n\n if self.sender_id == offer.sender_id\n\t Offer.notify_seller_book_bought(offer.reciever, offer.sender, textbook)\n\t else\n\t Offer.notify_seller_book_bought(offer.sender, offer.reciever, textbook)\n\t end\n\t end\n\tend\n\tif self.reciever.nil? == false\n\t self.reciever.active_offers_for_textbook(self.textbook_id).each do |offer|\n\t offer.update_status(3)\n\n if self.sender_id == offer.sender_id\n Offer.notify_buyer_book_sold(offer.reciever, offer.sender, textbook)\n\t else\n Offer.notify_buyer_book_sold(offer.sender, offer.reciever, textbook)\n\t end\n\t end\n\tend\n end\n end", "def seller_with_cache\n if self.purchase_invoice? && !self.seller_without_cache\n @seller_cache || @seller_cache = Organization.probono\n else\n self.seller_without_cache\n end\n end", "def seller\n\t\tself.sellers.last\n\tend", "def set_selleraccount\n @selleraccount = Selleraccount.find(params[:id])\n end", "def inc_books\n\t\t@books += 1\n\tend", "def sellings_count\n sellings.count\n end", "def add_sellers_items_from_cart(items, seller)\n \t\tsellers_items = items.select {|item| item.product.user_id == seller}\n\t\tsellers_items.each do |item|\n\t\t\titem.cart_id = nil\n\t\t\titems << item\n\t\tend\n\tend", "def reset_items(trade_win, item_win, unit)\n trade_win.items.each do |item|\n unit.gain_item(item, trade_win.item_number(item))\n end\n trade_win.clear_data\n trade_win.refresh\n item_win.refresh\n end", "def decrease_sell_in(item)\n item.sell_in -= 1\n end", "def _update_counts_after_destroy\n _default_after_commit increment: false\n end", "def enshelf(picked_shelf)\n\t\t@shelf_num = picked_shelf\n\tend", "def reset!\n runner.tick!\n @changes = Hash.new { |h, k| h[k] = Accumulator.new }\n end", "def reset!\n @_store = {:default => Configatron::Store.new}\n end", "def reset_items_unit2; reset_items(@trade_win2, @item_window2,@tb_unit2); end", "def _update_counts_after_destroy\n _wrap_in_counter_culture_active do\n self.class.after_commit_counter_cache.each do |hash|\n # decrement counter cache\n change_counter_cache(hash.merge(:increment => false))\n end\n end\n end", "def set_count\n @count = Counter.find(params[:id])\n @product = @count.link.product\n end", "def advance_shops(include_sales = false)\n @timing = initial_timing\n @data.each_value{ |shop| shop.update_shop(include_sales) }\n end", "def stock_setting\n @seller = Spree::Seller.find(params[:id])\n end", "def changeItemSupplier(itemId)\n locationItem = Item.where(id: itemId)\n previousSupplierItem = Location.where(id:locationItem.lastSupplier).first.items.where(name:locationItem.name).first\n if(locationItem != previousSupplierItem)\n if(previousSupplierItem.amount > (locationItem.restockTo - locationItem.amount))\n previousSupplierItem.increment!(:amount, -(locationItem.restockTo - locationItem.amount))\n # PRETEND CASH ISN\"T A THING YET\n # locationItem.location.company.increment!(:cash, -previousSupplierItem.price * (locationItem.restockTo - locationItem.amount))\n locationItem.update(amount: locationItem.restockTo)\n else\n locationItem.increment!(:amount, previousSupplierItem.amount)\n # PRETEND CASH ISN\"T A THING YET\n # locationItem.location.company.increment!(:cash, -previousSupplierItem.price * previousSupplierItem.amount)\n previousSupplierItem.amount = 0\n end\n if(previousSupplierItem.amount <= previousSupplierItem.restockPoint)\n changeItemSupplier(previousSupplierItem.id)\n end\n end\n end", "def index\n @sellers = @commerce.sellers\n end", "def inc_count\n role = self.role == 'Manager' ? :manager_count : :employee_count\n self.company.count.update_attribute(role, self.company.count.read_attribute(role)+1)\n end", "def reset_trades(x, user_id)\n\n\n end", "def initialize_supply_count(card_name, count)\n current_counts = supply_count\n current_counts.store(card_name, count)\n update_attributes( supply_count: current_counts )\n end", "def bookkeeping_before_betting()\n @dealer.reset() ## very important to reset dealer\n @players.delete_if{|player| player.amount <= 0} ## remove broke players\n if @players.size == 0\n puts \"**********WE NEED MORE PLAYERS**************\"\n exit() # exit if no more players left\n end\n @players.each do | player|\n player.reset() ## reset remaining players\n end # end reset\n end", "def reset_counter!\n return if counter == 0\n sql(:execute, %(\n INSERT INTO knifeswitch_counters (name,counter)\n VALUES (?, 0)\n ON DUPLICATE KEY UPDATE counter=0\n ), namespace)\n end", "def after_pagination\n recalculate_rate!\n self.sess_items = 0\n super\n end", "def set_items_sold\n @items_sold = ItemsSold.find(params[:id])\n end", "def increase_pets_sold(petshop,sold)\n petshop[:admin][:pets_sold]+=sold\n end", "def show_seller_name\n @sellers = Seller.order(:name)\n end", "def reset\n @items = Hash.new\n @item_id_count = 0\n end", "def index\n @sellers = Seller.all\n end", "def set_sell\n @sell = Sell.find(params[:id])\n end", "def set_sell\n @sell = Sell.find(params[:id])\n end", "def increment_instance_carts\n @how_many_carts += 1\n end", "def increment_customers\n self.num_customers += 1\n end", "def start_deal\n @deal_count = 0\n end", "def reset\n self.repetitions = 0\n self.interval = 0\n self.due = Date.today\n self.studied_at = Date.today\n save\n end", "def decrease_loan_count(decrease_no=1)\n if self.is_subscription_item_count_membership?\n self.loan_count = self.loan_count - decrease_no\n\t self.save\n end\n end", "def after_update(product)\n expire_cache_for(product)\n print \"product sweeper!\"\n end", "def exchange_user_to_reseller_calls_table_values\n if Confline.get_value2(\"Calls_table_fixed\", 0).to_i == 0\n\n sql = \"UPDATE calls SET partner_price = user_price;\"\n ActiveRecord::Base.connection.update(sql)\n sql = \"UPDATE calls SET user_price = reseller_price;\"\n ActiveRecord::Base.connection.update(sql)\n sql = \"UPDATE calls SET reseller_price = partner_price;\"\n ActiveRecord::Base.connection.update(sql)\n sql = \"UPDATE calls SET partner_price = NULL\"\n ActiveRecord::Base.connection.update(sql)\n\n Confline.set_value2(\"Calls_table_fixed\", 1, 0)\n else\n flash[:notice] = \"Calls table already fixed. Not fixing again.\"\n end\n end", "def index\n @sales_sellers = Sales::Seller.all\n end", "def set_default_view_count\n self.price ||=1\n end", "def update_dislike_count\n Recommendable.redis.set \"#{redis_key}:dislike_count\", disliked_by.count\n end", "def initialize( seller)\n self.seller = seller\n self.sign_up_time = seller.display_created_at\n self.state = seller.state\n end", "def reset!\n stop_poller if @poller\n @poller = nil\n @selected_environment = :production\n @client_ready = false\n @server_ready = false\n @registry = {} \n end", "def pay_workers\r\n\t\t@cash -= (@sellers + @thieves)*10\r\n\tend", "def push_sale\n\n details = {\n name: self.customer.name,\n location: self.location,\n quantity: self.quantity,\n product: self.product.name,\n sold_at: self.created_at.strftime('%l:%M %p %A')\n }\n Pusher['flamingmoe'].trigger('sale', details)\n logger.debug(\"pushed sale details to pusher.com: #{details.inspect}\")\n\n push_counts\n end", "def set_spore_type_count\n @spore_type_count = SporeTypeCount.find(params[:id])\n end", "def reset!\n @products = []\n end", "def reset!\n @products = []\n end", "def reset_counter\n @run_count = 0\n end", "def decrement_customers\n self.num_customers -= 1\n end", "def purchase\n \t@stock -= 1\n end", "def reset_counters!\n reload!\n self.class.counter_columns.each do |cc|\n counter = self.send(cc.name)\n counter.reset! unless counter.nil?\n end\n save\n end", "def reset!\n @warehouse = Warehouse.new\n restock\n end", "def settle_item_purchase(seller, buyer, item)\n seller.credits += item.price + Integer((item.price * SELL_BONUS).ceil)\n buyer.credits -= item.price\n end", "def reset_checks\n @counter = 0\n end", "def update_stock_for_seller(seller, fetch_fba_qty)\n stock_values = {}\n inf_variant_ids = Spree::QuantityInflation.pluck(:variant_id)\n var_ids = Spree::Variant.where(:id=>inf_variant_ids).pluck(:product_id)\n # products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true AND kit_id IS NULL\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true AND kit_id IS NULL\"))\n products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true\"))\n products.each do |product|\n variants = []\n variants << (product.variants.present? ? product.variants : product.master)\n variants = variants.flatten\n type = STOCKCONFIG[product.stock_config_type] == \"default\" ? STOCKCONFIG[seller.stock_config_type] : STOCKCONFIG[product.stock_config_type]\n smps = seller.seller_market_places.where(:is_active=>true)\n mps = seller.market_places.where(\"spree_market_places.id IN (?)\", smps.map(&:market_place_id))\n variants.each do |variant|\n begin\n Spree::Variant.fetch_qty_from_fba(smps.first,variant) if fetch_fba_qty\n variant = variant.reload\n stock_products = variant.stock_products.where(\"sellers_market_places_product_id IN (?)\", product.sellers_market_places_products.where(\"market_place_id IN (?)\",smps.map(&:market_place_id)).map(&:id))\n if stock_products.present?\n case type\n when \"fixed_quantity\"\n stock_values.merge!(variant.id=>Spree::StockProduct.fixed_quantity_setting(stock_products, variant, mps)) if !fetch_fba_qty\n when \"percentage_quantity\"\n stock_values.merge!(variant.id=>Spree::StockProduct.fixed_quantity_setting(stock_products, variant, mps))\n #stock_values.merge!(variant.id=>Spree::StockProduct.percentage_quantity_setting(stock_products, variant, mps))\n when \"flat_quantity\"\n stock_values.merge!(variant.id=>Spree::StockProduct.flat_quantity_setting(stock_products, variant, mps))\n end # end of case\n end\n rescue Exception => e\n end\n end # end of variant loop\n end # end of product loop\n return update_stock_market_places(stock_values)\n end", "def subscriptions_reset\n self.subscriptions = Subscription.defaults\n end", "def seller\n @seller or raise MissingSeller\n end", "def update_others!\n if status_changed?\n\n if waiting_for_sell? || declined?\n ::Users::Notification.where(related_model_type:'Trading::BuyRequest', related_model_id: self.id).update_all(status: ::Users::Notification::Status::DELETED)\n end\n\n if waiting_for_sell?\n self.items.each{|item| item.status = ::Item::Status::BUYING; item.save; }\n\n elsif declined? || canceled?\n\n self.items.each{|item| item.activate! }\n\n elsif sold?\n\n self.items.each{|item| item.deactivate! }\n ::NotificationMail.create_from_mail(buyer.parent_id, seller.parent_id, UserMailer.new_buy_request_to_seller_parent(self) )\n\n end\n end\n end", "def fetch_fba_quantity\n sellers = Spree::Seller.all\n sellers.each do |seller|\n begin\n @res = view_context.update_stock_for_seller(seller, true)\n rescue Exception => e\n \n end \n end \n redirect_to :back, :notice => \"FBA quantity fetch successfully\" \n end", "def set_sale\n @sale = Sale.find(params[:sale_id].to_i)\n end", "def increase_pets_sold(shop, sold_amount)\n shop[:admin][:pets_sold] += sold_amount\nend", "def inc_stock\n\t\t@stock += 1\n\tend", "def redis_view(model, stores)\n stores.each do |store|\n inc_member(store, model.id)\n end\n end" ]
[ "0.68718934", "0.6710743", "0.62266004", "0.59057367", "0.5828847", "0.5812863", "0.58118725", "0.5791982", "0.5791982", "0.5791982", "0.5791982", "0.5791982", "0.5791982", "0.5769071", "0.5741195", "0.56977665", "0.5670078", "0.56671", "0.5660644", "0.5642519", "0.56270856", "0.561329", "0.5604649", "0.55904233", "0.55823666", "0.55798954", "0.5557652", "0.55460477", "0.55460477", "0.55036825", "0.5470984", "0.5450666", "0.5447469", "0.5433751", "0.5427551", "0.5402085", "0.5396466", "0.5393437", "0.53875184", "0.53874433", "0.53815544", "0.5377472", "0.5374953", "0.53634834", "0.53443843", "0.5338889", "0.53387237", "0.5331989", "0.5328007", "0.5319762", "0.5312453", "0.5300228", "0.5300119", "0.5298616", "0.5298461", "0.5295682", "0.5287871", "0.52804744", "0.5278174", "0.52572984", "0.52534795", "0.5251441", "0.52468175", "0.5244579", "0.52442294", "0.52388483", "0.52388483", "0.52370477", "0.52354395", "0.52301407", "0.5220757", "0.5213877", "0.5208213", "0.5207612", "0.52043366", "0.5196675", "0.51954997", "0.5189786", "0.5185795", "0.51824385", "0.51821125", "0.51820207", "0.5178355", "0.5178355", "0.51774305", "0.517416", "0.5167913", "0.51675045", "0.5166356", "0.5160617", "0.5156061", "0.5155412", "0.5152148", "0.51498103", "0.51496655", "0.5149585", "0.5144677", "0.5143319", "0.5139952", "0.5124622" ]
0.8447676
0
Public: Creates a snapshot for a VM. The VM must be running in order to create a snapshot. Snapshot names must be unique. name The desired name of the snapshot. The name must be unique. Examples
def create_snapshot(name) unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? unless running_response.data message = 'The VM must be running in order to take a snapshot.' return Response.new :code => 1, :message => message end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? snapshots_response = snapshots return snapshots_response unless snapshots_response.successful? if snapshots_response.data.include? name message = "There is already a snapshot named '#{name}'." return Response.new :code => 1, :message => message end command = "#{vmrun_cmd} snapshot " command << "#{conf_file_response.data} \"#{name}\" 2>&1" Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_snapshot(snapshot_name)\n execute(:create_snapshot, VmId: vm_id, SnapName: snapshot_name)\n end", "def create_snapshot(name)\n Fission::Action::Snapshot::Creator.new(self).create_snapshot(name)\n end", "def create_snapshot(snap_id, snap_name)\n memory_dumps = true\n memory_dumps = CONFIG[:memory_dumps] \\\n unless CONFIG[:memory_dumps].nil?\n\n snapshot_hash = {\n :name => snap_id,\n :description => \"OpenNebula Snapshot: #{snap_name}\",\n :memory => memory_dumps,\n :quiesce => true\n }\n\n begin\n @item.CreateSnapshot_Task(snapshot_hash).wait_for_completion\n rescue StandardError => e\n error = \"Cannot create snapshot for VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n\n snap_id\n end", "def create_snapshot(vm, name)\n task = vm.CreateSnapshot_Task(\n name: name,\n memory: false,\n quiesce: false)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end", "def create_snapshot(uuid, snapshot_name)\n stdout = execute_prlctl('snapshot', uuid, '--name', snapshot_name)\n return Regexp.last_match(1) if stdout =~ /{([\\w-]+)}/\n\n raise Errors::SnapshotIdNotDetected, stdout: stdout\n end", "def snapshot name\n Aptly::create_mirror_snapshot name, @name\n end", "def create_db_snapshot(identifier, name)\n request({\n 'Action' => 'CreateDBSnapshot',\n 'DBInstanceIdentifier' => identifier,\n 'DBSnapshotIdentifier' => name,\n :parser => Fog::Parsers::AWS::RDS::CreateDBSnapshot.new\n })\n end", "def create_snapshot(snapshot, description = nil)\n ensure_uri && ensure_client\n if snapshot.is_a?(OneviewSDK::Resource) || snapshot.is_a?(Hash)\n name = snapshot[:name] || snapshot['name']\n description ||= snapshot[:description] || snapshot['description']\n else\n name = snapshot\n end\n data = generate_snapshot_data(name, description)\n response = @client.rest_post(\"#{@data['uri']}/snapshots\", { 'body' => data }, @api_version)\n @client.response_handler(response)\n true\n end", "def create_snapshot subscription, snapshot_name, labels: nil\n subscriber.create_snapshot name: snapshot_path(snapshot_name),\n subscription: subscription_path(subscription),\n labels: labels\n end", "def revert_to_snapshot(name)\n raise Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n command = \"#{vmrun_cmd} revertToSnapshot #{vmx_path.shellescape} \\\"#{name}\\\" 2>&1\"\n output = `#{command}`\n\n response = Fission::Response.new :code => $?.exitstatus\n response.output = output unless response.successful?\n\n response\n end", "def volume_create_from_snap(source, name, snapshot_id)\n retries = 3\n begin \n @log.info \"Creating volume #{name} from snapshot id #{snapshot_id}...\"\n ret = @cloud_stack.create_volume(name, ZONE, nil, snapshot_id)\n id = ret[\"createvolumeresponse\"][\"jobid\"]\n wait_for_job id\n rescue Exception => e\n retries -= 1\n if retries > 0\n @log.error \"Failed. #{e.message}. Retrying...\"\n retry\n end\n raise e\n end\n vol_id = ret[\"createvolumeresponse\"][\"id\"]\n @log.info \"Created volume id: #{vol_id}\"\n vol_id\n end", "def revert_to_snapshot(name)\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n if Fusion.running?\n message = 'It looks like the Fusion GUI is currently running. '\n message << 'A VM cannot be reverted to a snapshot when the Fusion GUI is running. '\n message << 'Exit the Fusion GUI and try again.'\n return Response.new :code => 1, :message => message\n end\n\n conf_file_response = conf_file\n return conf_file_response unless conf_file_response.successful?\n\n snapshots_response = snapshots\n return snapshots_response unless snapshots_response.successful?\n\n unless snapshots_response.data.include? name\n message = \"Unable to find a snapshot named '#{name}'.\"\n return Response.new :code => 1, :message => message\n end\n\n command = \"#{vmrun_cmd} revertToSnapshot \"\n command << \"#{conf_file_response.data} \\\"#{name}\\\" 2>&1\"\n\n Response.from_command(`#{command}`)\n end", "def restore_snapshot(snapshot_name)\n execute(:restore_snapshot, VmId: vm_id, SnapName: snapshot_name)\n end", "def create_snapshot(volume_id, options = {})\n action = 'CreateSnapshot'\n params = {\n 'Action' => action,\n 'VolumeId' => volume_id\n }\n params['Description'] = options[:description] unless options[:description].blank?\n\n response = send_query_request(params)\n parser = Awsum::Ec2::SnapshotParser.new(self)\n snapshot = parser.parse(response.body)[0]\n if options[:tags] && options[:tags].size > 0\n create_tags snapshot.id, options[:tags]\n end\n snapshot\n end", "def create_snapshot(metadata={})\n Azure::Blobs.create_snapshot(self, metadata)\n end", "def generate_snapshot_data(name, description = nil)\n { type: 'Snapshot', description: description, name: name }\n end", "def vm_create_evm_snapshot(vm, options = {})\n require \"OpenStackExtract/MiqOpenStackVm/MiqOpenStackInstance\"\n\n log_prefix = \"vm=[#{vm.name}]\"\n\n miq_openstack_instance = MiqOpenStackInstance.new(vm.ems_ref, openstack_handle)\n miq_snapshot = miq_openstack_instance.create_evm_snapshot(options)\n\n # Add new snapshot image to the vms table. Type is TemplateOpenstack.\n miq_templates.create!(\n :type => \"ManageIQ::Providers::Openstack::CloudManager::Template\",\n :vendor => \"openstack\",\n :name => miq_snapshot.name,\n :uid_ems => miq_snapshot.id,\n :ems_ref => miq_snapshot.id,\n :template => true,\n :location => \"unknown\"\n )\n\n # Add new snapshot to the snapshots table.\n vm.snapshots.create!(\n :name => miq_snapshot.name,\n :description => options[:desc],\n :uid => miq_snapshot.id,\n :uid_ems => miq_snapshot.id,\n :ems_ref => miq_snapshot.id\n )\n return miq_snapshot.id\n rescue => err\n _log.error \"#{log_prefix}, error: #{err}\"\n _log.debug { err.backtrace.join(\"\\n\") }\n raise\n end", "def create_vapp_snapshot(vmId, description=\"New Snapshot\")\n create_snapshot_action(vmId, description, :vapp)\n end", "def snapshot(table, snapshot_name, *args)\n # Table name should be a string\n raise(ArgumentError, 'Table name must be of type String') unless table.is_a?(String)\n\n # Snapshot name should be a string\n raise(ArgumentError, 'Snapshot name must be of type String') unless\n snapshot_name.is_a?(String)\n\n table_name = TableName.valueOf(table)\n if args.empty?\n @admin.snapshot(snapshot_name, table_name)\n else\n args.each do |arg|\n ttl = arg[TTL]\n ttl = ttl ? ttl.to_java(:long) : -1\n snapshot_props = java.util.HashMap.new\n snapshot_props.put(\"TTL\", ttl)\n max_filesize = arg[MAX_FILESIZE]\n max_filesize = max_filesize ? max_filesize.to_java(:long) : -1\n snapshot_props.put(\"MAX_FILESIZE\", max_filesize)\n if arg[SKIP_FLUSH] == true\n @admin.snapshot(snapshot_name, table_name,\n org.apache.hadoop.hbase.client.SnapshotType::SKIPFLUSH, snapshot_props)\n else\n @admin.snapshot(snapshot_name, table_name, snapshot_props)\n end\n end\n end\n end", "def create_snapshot(options)\n snapshot = ec2.snapshots.new\n snapshot.volume_id = options['volume_id']\n snapshot.description = options['description']\n\n attempts = 0\n\n begin\n snapshot.save\n snapshot.reload\n rescue Fog::Compute::AWS::Error\n sleep 5\n attempts += 1\n if attempts == 5\n log \"Error communicating with API; Unable to save volume `#{options['volume_id']}` (Desc: #{options['description']})\"\n end\n return unless attempts == 5\n end\n\n options['tags'].each do |k,v|\n begin\n ec2.tags.create({resource_id: snapshot.id, key: k, value: v})\n rescue Errno::EINPROGRESS , Errno::EISCONN\n log \"API Connection Error\"\n sleep 1\n retry\n rescue Fog::Compute::AWS::Error\n log \"Failed attaching tag `'#{k}' => #{v}` to #{options['snapshot_type']} snapshot #{snapshot.id}\"\n sleep 1\n retry\n end\n end\n\n end", "def get_snapshot(name)\n results = get_snapshots\n results.find { |snap| snap['name'] == name }\n end", "def create(body = {}, params = {})\n response = client.put \"/_snapshot/{repository}/{snapshot}\", update_params(params, body: body, action: \"snapshot.create\", rest_api: \"snapshot.create\")\n response.body\n end", "def create_snapshot(vmId, description=\"New Snapshot\")\n @logger.warn 'DEPRECATION WARNING: use [create,revert]_vapp_snapshot instead.'\n create_snapshot_action(vmId, description, :vapp)\n end", "def new_snapshot!(time = Time.now)\n snapshot_path = time.strftime(dir.path + '/%Y-%m-%dT%H:%M%z')\n Snapshot.new(self, snapshot_path).create!(current.path)\n end", "def delete_snapshot(snapshot_name)\n execute(:delete_snapshot, VmID: vm_id, SnapName: snapshot_name)\n end", "def create\n @snapshot = current_account.snapshots.new(params[:snapshot])\n\n respond_to do |format|\n if @snapshot.save\n flash[:notice] = 'Snapshot was successfully created.'\n format.html { redirect_to(@snapshot) }\n format.xml { render :xml => @snapshot, :status => :created, :location => @snapshot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_snapshot(droplet) # rubocop:disable MethodLength,Metrics/AbcSize\n fail_if_shutdown(droplet)\n\n logger.info \"Start creating snapshot for droplet id: #{droplet.id} name: #{droplet.name}.\"\n\n today = DateTime.now\n name = \"#{droplet.name}_#{today.strftime('%Y_%m_%d')}\"\n # noinspection RubyResolve\n snapshot_size = api.snapshots(droplet).size\n\n logger.debug 'Wait until snapshot will be created.'\n\n api.create_snapshot droplet.id, name\n\n snapshot_size += 1\n\n logger.info \"Snapshot name: #{name} created successfully.\"\n logger.info \"Droplet id: #{droplet.id} name: #{droplet.name} snapshots: #{snapshot_size}.\"\n\n # Cleanup snapshots.\n cleanup_snapshots droplet, snapshot_size if clean\n rescue => e\n case e.class.to_s\n when 'DoSnapshot::SnapshotCleanupError'\n raise e.class, e.message, e.backtrace\n when 'DoSnapshot::DropletPowerError'\n return\n else\n raise SnapshotCreateError.new(droplet.id), e.message, e.backtrace\n end\n end", "def create_snapshot_action(id, description=\"New Snapshot\", type=:vapp)\n params = {\n \"method\" => :post,\n \"command\" => \"/vApp/#{type}-#{id}/action/createSnapshot\"\n }\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CreateSnapshotParams(\n \"xmlns\" => \"http://www.vmware.com/vcloud/v1.5\") {\n xml.Description description\n }\n end\n response, headers = send_request(params, builder.to_xml, \"application/vnd.vmware.vcloud.createSnapshotParams+xml\")\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end", "def restore_snapshot(vm, name)\n snapshot = enumerate_snapshots(vm).find { |s| s.name == name }\n\n # No snapshot matching \"name\"\n return nil if snapshot.nil?\n\n task = snapshot.snapshot.RevertToSnapshot_Task(suppressPowerOn: true)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end", "def copy_snapshot(source_snapshot_id, source_region, target_region, name, description)\n ec2 = AWS::EC2.new(:region => target_region).client\n snap = ec2.copy_snapshot(:source_region => source_region, :source_snapshot_id => source_snapshot_id,\n :description => description)\n if snap\n #add expiry tag if snapshots_expire_in setting > 0. if 0 they never expire\n if SNAPSHOTS_EXPIRE_IN > 0\n ec2.create_tags(:resources => [snap.data[:snapshot_id]], :tags => [{:key => \"expiring\", :value =>\n (Time.now + SNAPSHOTS_EXPIRE_IN.to_i.days).to_s}, {:key => \"Name\", :value => name}])\n end\n return snap.data[:snapshot_id]\n end\n\n return \"\"\n end", "def createEBSSnapshot(client=nil,description='',volume_id=nil)\n return false if volume_id.nil? || client.nil?\n # Fetch the Volume Name. This will be used in the description of the snapshot\n resp = client.describe_volumes({dry_run: false, volume_ids: [volume_id] })\n resp.volumes[0].tags.each do |t|\n if t.key=='Name'\n description = t.value unless t.value.empty?\n break\n end\n end\n # puts \"Taking snapshot of volume #{volume_id}...\"\n return client.create_snapshot({\n dry_run: false,\n volume_id: volume_id,\n description: description\n })\nend", "def createNewSnapshot\n snap_id = @deploy.getResourceName(@config[\"name\"]) + Time.new.strftime(\"%M%S\").to_s\n\n attempts = 0\n begin\n MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_snapshot(\n cache_cluster_id: @config[\"identifier\"],\n snapshot_name: snap_id\n )\n rescue Aws::ElastiCache::Errors::InvalidCacheClusterState => e\n if attempts < 10\n MU.log \"Tried to create snapshot for #{@config[\"identifier\"]} but cache cluster is busy, retrying a few times\"\n attempts += 1\n sleep 30\n retry\n else\n raise MuError, \"Failed to create snpashot for cache cluster #{@config[\"identifier\"]}: #{e.inspect}\"\n end\n end\n \n attempts = 0\n loop do\n MU.log \"Waiting for snapshot of cache cluster #{@config[\"identifier\"]} to be ready...\", MU::NOTICE if attempts % 20 == 0\n MU.log \"Waiting for snapshot of cache cluster #{@config[\"identifier\"]} to be ready...\", MU::DEBUG\n\n snapshot_resp = MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).describe_snapshots(snapshot_name: snap_id)\n attempts += 1\n break unless snapshot_resp.snapshots.first.snapshot_status != \"available\"\n sleep 15\n end\n\n return snap_id\n end", "def create_from_snapshot(snapshot_name, properties, volume_template = nil, is_permanent = true)\n snapshot = get_snapshot(snapshot_name)\n raise IncompleteResource, 'Snapshot not found!' unless snapshot\n storage_pool_uri = nil\n volume_template_uri = if volume_template.nil?\n storage_pool_uri = @data['storagePoolUri']\n get_volume_template_uri(isRoot: true, family: 'StoreServ')\n else\n raise IncompleteResource, 'Volume Template not found!' unless volume_template.retrieve!\n storage_pool_uri = volume_template['storagePoolUri']\n volume_template['uri']\n end\n\n data = {\n 'properties' => properties.merge('storagePool' => storage_pool_uri, 'snapshotPool' => storage_pool_uri),\n 'snapshotUri' => snapshot['uri'],\n 'templateUri' => volume_template_uri,\n 'isPermanent' => is_permanent\n }\n\n response = @client.rest_post(\"#{BASE_URI}/from-snapshot\", { 'body' => data }, @api_version)\n self.class.new(@client, client.response_handler(response))\n end", "def create_snapshot_action(id, description=\"New Snapshot\", type=:vapp)\n params = {\n \"method\" => :post,\n \"command\" => \"/vApp/#{type}-#{id}/action/createSnapshot\"\n }\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CreateSnapshotParams(\n \"xmlns\" => \"http://www.vmware.com/vcloud/v1.5\") {\n xml.Description description\n }\n end\n response, headers = send_request(params, builder.to_xml, \"application/vnd.vmware.vcloud.createSnapshotParams+xml\")\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end", "def create_snapshot(rds_resource, db_instance_name)\n id = \"snapshot-#{rand(10**6)}\"\n db_instance = rds_resource.db_instance(db_instance_name)\n db_instance.create_snapshot({\n db_snapshot_identifier: id\n })\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't create DB instance snapshot #{id}:\\n #{e.message}\"\nend", "def delete_snapshot(vm, name)\n snapshot = enumerate_snapshots(vm).find { |s| s.name == name }\n\n # No snapshot matching \"name\"\n return nil if snapshot.nil?\n\n task = snapshot.snapshot.RemoveSnapshot_Task(removeChildren: false)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end", "def create_snapshot request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/disks/#{request_pb.disk}/createSnapshot\"\n body = request_pb.snapshot_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def generate_snapshot_data(name, description = nil)\n { description: description, name: name }\n end", "def create_snapshot(device, options = {})\n # TODO - add in new param commit=explicit once the API is availible\n params = {:device => device, \n :suffix => options[:suffix], \n :description => options[:description], \n :tag => options[:tag],\n :max_snaps => options[:max_snaps],\n :prefix_override => options[:prefix_override],\n :commit => \"explicit\",\n :api_version => 1.0}\n # Perform API call to snapshot the volume attached to the device on the instance\n STDERR.puts \"Performing RightScale API call to create a new snapshot\"\n #STDERR.puts \"HERE IS THE URL: #{@api_url}/create_ebs_snapshot.js (PARAMS: #{params.inspect})\"\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.post @api_url+\"/create_ebs_snapshot.js\",params\n json = body.nil? ? nil: JSON.load(body)\n STDERR.puts \"CREATED_SNAP: #{json}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"create_snapshot(#{device}, #{options.inspect})\")\n end", "def snap(cmd, snap)\n nodes = getnodes.map{|x| x.name}\n out = `vagrant snapshot list`\n snaps = out.include?(\"No snapshots\") ? [] : out.split.uniq.sort\n curr_snap = snaps.last\n next_snap = curr_snap ? curr_snap[0..-2] + (curr_snap[-1].to_i + 1).to_s : \"snap1\"\n\n if cmd == \"save\"\n puts(\":: Creating snapshot for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n snap ||= next_snap\n Sys.exec(\"vagrant snapshot save #{snap}\")\n elsif cmd == \"restore\"\n puts(\":: Restoring previous snapshot for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n snap ||= curr_snap\n Sys.exec(\"vagrant snapshot restore #{snap}\")\n elsif cmd == \"delete\"\n puts(\":: Deleting previous snapshot for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n snap ||= curr_snap\n Sys.exec(\"vagrant snapshot delete #{snap}\")\n elsif cmd == \"list\"\n puts(\":: Listing snapshots for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n puts(snaps)\n end\n end", "def user_created_snapshot _user, snapshot\n the_case = snapshot.case\n\n data = {\n category: 'Snapshots',\n action: 'Created a Snapshot',\n label: snapshot.name,\n value: the_case.snapshots.count,\n bounce: false,\n }\n\n create_event data\n end", "def createRDSSnapshot(client=nil,db_instance=nil,snapshot_name=nil,tags=[])\n return false if db_instance.nil? || client.nil?\n if snapshot_name.nil?\n snapshot_name=\"#{db_instance}-#{Time.now.to_i}\"\n end\n unless tags.instance_of? Array\n puts \"\\e[31mtags must be an Array\\e[0m\"\n return false\n end\n begin\n puts \"\\e[32mTaking snapshot of db instance #{db_instance}. Snapshot will be named #{snapshot_name}\\e[0m\"\n resp = client.create_db_snapshot({\n db_snapshot_identifier: snapshot_name,\n db_instance_identifier: db_instance,\n tags: tags\n })\n rescue Exception => e\n puts \"\\e[31m#{e.message}\\e[0m\"\n return false\n end\n return resp\nend", "def delete_snapshot(name)\n Fission::Action::Snapshot::Deleter.new(self).delete_snapshot(name)\n end", "def clone_snapshot(snapshot_name, table, restore_acl = false, clone_sft = nil)\n @admin.cloneSnapshot(snapshot_name, TableName.valueOf(table), restore_acl, clone_sft)\n end", "def create_snapshot\n @attributes[:create_snapshot]\n end", "def create_volume_snapshot_post_with_http_info(create_volume_snapshot_param, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SnapshotApi.create_volume_snapshot_post ...\"\n end\n # verify the required parameter 'create_volume_snapshot_param' is set\n if @api_client.config.client_side_validation && create_volume_snapshot_param.nil?\n fail ArgumentError, \"Missing the required parameter 'create_volume_snapshot_param' when calling SnapshotApi.create_volume_snapshot_post\"\n end\n # resource path\n local_var_path = \"/createVolumeSnapshot\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(create_volume_snapshot_param)\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SnapshotApi#create_volume_snapshot_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def revert_to_snapshot(name)\n Fission::Action::Snapshot::Reverter.new(self).revert_to_snapshot(name)\n end", "def create_db_snapshot( options = {} )\n raise ArgumentError, \"No :db_snapshot_identifier provided\" if options.does_not_have?(:db_snapshot_identifier)\n raise ArgumentError, \"No :db_instance_identifier provided\" if options.does_not_have?(:db_instance_identifier)\n\n params = {}\n params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier]\n params['DBInstanceIdentifier'] = options[:db_instance_identifier]\n\n return response_generator(:action => \"CreateDBSnapshot\", :params => params)\n end", "def create_snapshot_bundle\n # we shouldn't specify -k $EC2_PRIVATE_KEY since we assume private keys are already appended to /root/.ssh/authorized_keys\n # but it's a required parameter -- doh!\n run \"#{ec2_cmd('ec2-bundle-vol')} -v #{volume_to_bundle} -d #{bundling_directory} -k $EC2_PRIVATE_KEY -u #{@ec2_user_id} -s #{volume_size}\"\n end", "def create(name, image_name, client = Client.new)\n image = client.snapshots.all.find { |x| x.name == image_name }\n\n raise \"Found a droplet with name #{name} WTF\" if exist?(name, client)\n\n new(client.droplets.create(new_droplet(name, image, client)), client)\n end", "def create_ebs_backup(options = {})\n params = options.merge( { :commit => \"explicit\", :api_version => 1.0 } )\n STDERR.puts \"Performing RightScale API call to create a new snapshot\"\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.post @api_url+\"/create_ebs_backup.js\", params\n json = body.nil? ? nil: JSON.load(body)\n STDERR.puts \"CREATED_SNAPS: #{json}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"create_ebs_backup(#{options.inspect})\")\n end", "def create_volume_snapshot_post(create_volume_snapshot_param, opts = {})\n create_volume_snapshot_post_with_http_info(create_volume_snapshot_param, opts)\n return nil\n end", "def create_snapshot( dashboard = {} )\n\n raise ArgumentError.new('dashboard must be an Hash') unless( dashboard.is_a?(String) )\n\n endpoint = '/api/snapshots'\n @logger.debug(\"Creating dashboard snapshot (POST #{endpoint})\") if @debug\n\n post(endpoint, dashboard)\n end", "def snapshot(cart_name)\n raise NotImplementedError(\"snapshot\")\n end", "def create_snapshots(isCopy)\n ec2 = AWS::EC2.new.client\n\n #get all volumes tagged as \"backup\"\n volumes = ec2.describe_volumes(:filters => [:name => 'tag-key', :values => ['backup']])\n snapshots = []\n\n #loop thru and create snapshots for all these volumes\n if volumes \n volumes.data[:volume_set].each do |v|\n name = get_tagvalue(v, \"Name\")\n snap = ec2.create_snapshot(:volume_id => v[:volume_id], :description => \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n if snap\n snapshots << snap.data\n #add name tag\n ec2.create_tags(:resources => [snap.data[:snapshot_id]], :tags => [{:key => \"Name\", :value => name + \" backup\"}])\n\n #now copy snapshots to another region\n if isCopy\n copy_snapshot(snap.data[:snapshot_id], AWSCONFIG[:default_region], AWSCONFIG[:backup_region], \n name + \" backup\", \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n end\n end\n end\n end\n\n return snapshots\n end", "def create(name)\n p \"Doing a create ...\"\n params = {:backup => {:lineage => \"ns_backup_test_lineage\", :name => name, :volume_attachment_hrefs => [@volume_attachment_href_1, @volume_attachment_href_2]}}\n return @test_client.backups.create(params)\nend", "def create_vm(opts = {})\n opts = opts.with_indifferent_access.reverse_merge(\n VSphereConfig.create_vm_defaults.symbolize_keys || {}\n )\n\n opts[:template_path] = compute.image if compute.image\n\n VSphere.with_connection do |vs|\n dest_folder = opts[:dest_folder]\n vm_name = opts[:name] || \"#{compute.image}-\"\\\n \"#{SecureRandom.hex(4)}-#{Time.new.strftime(\"%Y%m%d\")}\"\n exception_cb = lambda do |_p1|\n LabManager.logger.warn(\n \"Failed attempt to create virtual machine: template_name: #{opts[:template_path]}\"\\\n \", vm_name: #{vm_name}\"\n )\n end\n\n Retryable.retryable(\n tries: VSphereConfig.create_vm_defaults[:vm_clone_retry_count],\n on: [RbVmomi::Fault, CreateVMError, Fog::Compute::Vsphere::NotFound],\n exception_cb: exception_cb,\n sleep: ->(n) { Random.rand(n*3..n*3+10.0) }\n ) do\n LabManager.logger.info \"creating machine with name: #{vm_name} options: #{opts.inspect}\"\n machine = vs.vm_clone(\n 'datacenter' => opts[:datacenter],\n 'datastore' => opts[:datastore],\n 'template_path' => opts[:template_path],\n 'name' => vm_name,\n 'cluster' => opts[:cluster],\n 'linked_clone' => opts[:linked_clone],\n 'dest_folder' => dest_folder,\n 'power_on' => opts[:power_on],\n 'wait' => true\n )\n\n setup_network_interfaces({\n uuid: machine['new_vm']['uuid'],\n connection: vs,\n network_name: VSphereConfig.create_vm_defaults[:network_interface_name]\n })\n\n fail CreateVMError, \"Creation of (#{vm_name}) machine failed, retrying\" unless machine || machine['vm_ref']\n set_provider_data(machine['new_vm'], vs: vs)\n end\n\n add_machine_to_drs_rule(\n vs,\n group: opts[:add_to_drs_group],\n machine: \"#{dest_folder}/#{vm_name}\",\n datacenter: opts[:datacenter]\n ) if opts[:add_to_drs_group]\n end\n poweron_vm unless compute.provider_data['power_state'] == 'poweredOn'\n rescue\n # Try to free unsuccessfully started/configured/... VM\n begin\n terminate_vm\n rescue\n nil\n end if instance_uuid\n raise\n end", "def create_snapshot\n @current_snapshot = @bitmap.to_json if @bitmap\n end", "def addVm(name, &block)\n self.synchronize do\n vm = OmfEc::Vm::VirtualMachine.new(name, self)\n if @vms.find {|v| v.name == name}\n error \"vm: #{name} - already added.\"\n else\n @vms << vm\n OmfEc.experiment.add_vm(vm)\n block.call(vm) if block\n end\n end\n end", "def snapshot_params\n params.require(:snapshot).permit(:name, :snapshot)\n end", "def restore_from_snap(last_snapshot, options = {})\n options[:device] = \"/dev/sdk\" unless options[:device]\n options[:vol_nickname] = last_snapshot[\"nickname\"] unless options[:vol_nickname]\n \n # 5 - Unmount and detach the current EBS volume (forcing to detach the device we're gonna need later for attching ours...)\n umount_and_detach_device({:device => options[:device]})\n # 6- Create the volume from the latest snapshot, attach it to the instance and then mount it\n STDERR.puts \"Creating new DB volume from snapshot #{last_snapshot['aws_id']}\"\n vol = ( options[:new_size_gb] ? create_volume_from_snap_size_gb(last_snapshot[\"aws_id\"],options[:vol_nickname],options[:new_size_gb] ) : create_volume_from_snap(last_snapshot[\"aws_id\"],options[:vol_nickname] ) )\n unless vol.nil?\n \tSTDERR.puts \"Attaching new DB volume: #{vol['aws_id']}\"\n \tatt = attach_volume(vol['aws_id'], options[:device])\n \twait_for_attachment(options[:device])\n \tFileUtils.mkdir_p self.MountPoint\n \tres = `mount -t xfs -o noatime #{options[:device]} #{self.MountPoint}`\n \traise EBSRemoteExecException.new(nil,$?,\"Error mounting newly created volume (#{vol['aws_id']}) on #{options[:device]}:\\n\"+res) if $? != 0 \n else\n\t raise \"create volume failed from snapshot\"\n end\n end", "def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def delete_snapshot(name)\n result = get_snapshot(name)\n response = @client.rest_delete(result['uri'], { 'If-Match' => result['eTag'] }, @api_version)\n @client.response_handler(response)\n true\n end", "def snap_delete(volume,snapshot)\n output = @filer.invoke(\"snapshot-create\",\"volume\",volume,\"snapshot\",snapshot)\n if (output.results_status() == \"failed\")\n raise \"Error #{output.results_errno} creating snapshot #{snapshot} on #{volume}: #{output.results_reason()}\\n\"\n end\n end", "def snapshot esurl, snapurl, options\n elastic esurl\n set_opts(options)\n set_repository snapurl, options\n initiate_snapshot snapurl\n end", "def build_snapshot\n raise \"build_snapshot not implemented in #{self}\"\n end", "def create_snap # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function\n uri = URI.parse(url)\n #account = '/Compute-' + @id_domain + '/' + @user\n account = '/Compute-' + id_domain + '/cloud_storage'\n create_data = Hash.new\n create_data = { 'account' => account, 'instance' => container }\n create_data['machineimage'] = @machine_image if !@machine_image.nil?\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field 'Cookie', authcookie\n request.add_field 'Content-type', 'application/oracle-compute-v3+json'\n http.request(request, create_data.to_json)\n end", "def create_vm(name, &block)\n raise('This function need to be executed after ALL_VM_GROUPS_UP event') unless self.has_topic\n raise(\"The Virtual machine #{name} is not defined in this group\") unless vm(name)\n @topic.create(:virtual_machine, {:label => name}) do |vm|\n vm_topic = vm.resource\n if vm_topic.error?\n error app.inspect\n else\n vm_topic.on_subscribed do\n block.call(vm_topic) if block\n end\n end\n end\n end", "def prepare\n if requires_snapshot?\n info \"Preparing vm #{name} ...\"\n restart { immutate }\n wait_for_boot\n pause\n snapshot\n end\n true\n end", "def create_snapshot request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_snapshot_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def snapshot_disk(disk_id, metadata)\n metadata = Hash[metadata.map { |key, value| [key.to_s, value] }]\n\n with_thread_name(\"snapshot_disk(#{disk_id})\") do\n volume = @ec2_resource.volume(disk_id)\n devices = []\n volume.attachments.each { |attachment| devices << attachment.device }\n\n name = ['deployment', 'job', 'index'].collect { |key| metadata[key] }\n\n unless devices.empty?\n name << devices.first.split('/').last\n metadata['device'] = devices.first\n end\n\n snapshot = volume.create_snapshot(description: name.join('/'))\n logger.info(\"snapshot '#{snapshot.id}' of volume '#{disk_id}' created\")\n\n metadata.merge!(\n 'director' => metadata['director_name'],\n 'instance_index' => metadata['index'].to_s,\n 'instance_name' => metadata['job'] + '/' + metadata['instance_id'],\n 'Name' => name.join('/')\n )\n\n %w[director_name index job].each do |tag|\n metadata.delete(tag)\n end\n\n TagManager.create_tags(snapshot, **metadata)\n ResourceWait.for_snapshot(snapshot: snapshot, state: 'completed')\n snapshot.id\n end\n end", "def patch_virtualization_vmware_virtual_machine_snapshot(moid, virtualization_vmware_virtual_machine_snapshot, opts = {})\n data, _status_code, _headers = patch_virtualization_vmware_virtual_machine_snapshot_with_http_info(moid, virtualization_vmware_virtual_machine_snapshot, opts)\n data\n end", "def create_share_snapshot_post(create_share_snapshot_param, opts = {})\n create_share_snapshot_post_with_http_info(create_share_snapshot_param, opts)\n return nil\n end", "def volume_create(name)\n @log.info \"Creating volume #{name} from offering id #{DISK_OFFERING}...\"\n ret = @cloud_stack.create_volume(name, ZONE, DISK_OFFERING)\n id = ret[\"createvolumeresponse\"][\"jobid\"]\n wait_for_job id\n vol_id = ret[\"createvolumeresponse\"][\"id\"]\n @log.info \"Created volume id: #{vol_id}\"\n vol_id\n end", "def create_share_snapshot_post_with_http_info(create_share_snapshot_param, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SnapshotApi.create_share_snapshot_post ...\"\n end\n # verify the required parameter 'create_share_snapshot_param' is set\n if @api_client.config.client_side_validation && create_share_snapshot_param.nil?\n fail ArgumentError, \"Missing the required parameter 'create_share_snapshot_param' when calling SnapshotApi.create_share_snapshot_post\"\n end\n # resource path\n local_var_path = \"/createShareSnapshot\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(create_share_snapshot_param)\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SnapshotApi#create_share_snapshot_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def snapshot_disk(disk_id, metadata)\n metadata = Hash[metadata.map { |key, value| [key.to_s, value] }]\n\n with_thread_name(\"snapshot_disk(#{disk_id})\") do\n volume = @ec2_client.volumes[disk_id]\n devices = []\n volume.attachments.each { |attachment| devices << attachment.device }\n\n name = ['deployment', 'job', 'index'].collect { |key| metadata[key] }\n name << devices.first.split('/').last unless devices.empty?\n\n snapshot = volume.create_snapshot(name.join('/'))\n logger.info(\"snapshot '#{snapshot.id}' of volume '#{disk_id}' created\")\n\n ['agent_id', 'instance_id', 'director_name', 'director_uuid'].each do |key|\n TagManager.tag(snapshot, key, metadata[key])\n end\n TagManager.tag(snapshot, 'device', devices.first) unless devices.empty?\n TagManager.tag(snapshot, 'Name', name.join('/'))\n\n ResourceWait.for_snapshot(snapshot: snapshot, state: :completed)\n snapshot.id\n end\n end", "def snapshot_disk(disk_id, metadata)\n metadata = Hash[metadata.map { |key, value| [key.to_s, value] }]\n\n with_thread_name(\"snapshot_disk(#{disk_id})\") do\n volume = @ec2_resource.volume(disk_id)\n devices = []\n volume.attachments.each { |attachment| devices << attachment.device }\n\n name = ['deployment', 'job', 'index'].collect { |key| metadata[key] }\n name << devices.first.split('/').last unless devices.empty?\n\n snapshot = volume.create_snapshot(name.join('/'))\n logger.info(\"snapshot '#{snapshot.id}' of volume '#{disk_id}' created\")\n\n\n tags = {}\n ['agent_id', 'instance_id', 'director_name', 'director_uuid'].each do |key|\n tags[key] = metadata[key]\n end\n tags['device'] = devices.first unless devices.empty?\n tags['Name'] = name.join('/')\n TagManager.tags(snapshot, tags)\n\n ResourceWait.for_snapshot(snapshot: snapshot, state: 'completed')\n snapshot.id\n end\n end", "def create_kvm_instance(name, opts={})\n cmd = \"virt-install -n #{name} --ram #{opts[:memory]} --disk \" <<\n \"path=#{File.join(KVM_HOME, 'storage', \"#{name}.qcow2\")},device=disk,bus=virtio,format=qcow2 \" <<\n \"-v --import --noautoconsole --vcpus=#{opts[:vcpus]},maxvcpus=#{opts[:maxvcpus]}\" \n unless(system(cmd))\n raise \"Failed to create KVM instance!\"\n end \nend", "def save_snapshot\n return unless @current_snapshot\n current_state = @bitmap.to_json\n return if snapshots_match?(@current_snapshot, current_state)\n\n @snapshots << @current_snapshot\n end", "def clone_volume_snapshot_post_with_http_info(clone_volume_snapshot_param, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SnapshotApi.clone_volume_snapshot_post ...\"\n end\n # verify the required parameter 'clone_volume_snapshot_param' is set\n if @api_client.config.client_side_validation && clone_volume_snapshot_param.nil?\n fail ArgumentError, \"Missing the required parameter 'clone_volume_snapshot_param' when calling SnapshotApi.clone_volume_snapshot_post\"\n end\n # resource path\n local_var_path = \"/cloneVolumeSnapshot\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(clone_volume_snapshot_param)\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SnapshotApi#clone_volume_snapshot_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def takeSnapshot(description= nil)\n\n #@return : the Snapshot instance for this snapshot\t\n\t\t response = RestClient.post(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/snapshots\",\n\t\t \t\"selenium_test_id=#{@testId}\")\n\t\t hash = /(?<=\"hash\": \")((\\w|\\d)*)/.match(response)[0]\n\t\t snap = Snapshot.new(hash, @testId)\n\t\t if description != nil\n\t\t \tsnap.setDescription(description)\n\t\t end\n\t\t return snap\n\n\tend", "def vm_build_image (image_name, template)\n output_box = template[:box]\n unless File.directory?(Packer::OUTPUT_DIR)\n mkdir(Packer::OUTPUT_DIR)\n end\n if !$dry_run then\n build_image(template)\n else\n touch output_box\n end\n\n version_entry = {\n \"version\" => \"#{template[:vars]['image_version']}\",\n \"providers\" => [{\n \"name\" => \"virtualbox\",\n \"url\" => File.absolute_path(output_box),\n \"checksum_type\" => \"sha1\",\n \"checksum\" => Digest::SHA1.file(output_box).hexdigest\n }]\n }\n\n # Insert the new version entry into its correspondent vagrant JSON file\n vagrant_json_update(image_name, version_entry)\nend", "def create_snapshot_hash name\n { name: name,\n description: \"#{name} Description\",\n delete_options: {\n :decision_data => true,\n :conditions_with_images => true,\n :incomes => true,\n :assets => true,\n :expenses => true,\n :hud1_fields => false,\n :payment_schedule => true,\n },\n dts: [\n 'All Documents Received',\n 'Approval',\n 'Denial Reason',\n ]\n }\nend", "def copy_snapshots! snaps\n # account_snapshots = account.snapshots\n # backed_up_snapshots = self.snapshots\n # backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n if snaps.count > 0\n VfSnapshots.verbose \"\\n#{snaps.count} to copy, here we go.\"\n else\n VfSnapshots.verbose \"\\nNothing to copy.\"\n end\n begin\n tags = { tags: [\n {\n key: \"Account\",\n value: account.name,\n },\n ]\n }\n\n snaps.each_with_index do |snapshot,idx|\n VfSnapshots.verbose \"\\n[#{idx+1} of #{snaps.length}] Copying #{account.name} #{snapshot.description}\"\n\n # modify the source snapshot to share with the backup account\n snapshot.modify_attribute(attribute:'createVolumePermission', operation_type: 'add', user_ids: [ account.account_id ], create_volume_permission: { add: [{ user_id: account_id }] } )\n # get it in the backup account\n shared_snapshot = ec2.snapshot(snapshot.id)\n region = 'us-east-1'\n new_desc = \"#{account.name} #{snapshot.description}\"\n copy_response = shared_snapshot.copy(\n description: new_desc,\n source_region: region,\n destination_region: region,\n )\n ec2.snapshot(copy_response.snapshot_id).create_tags tags\n # puts \"Sleeping...\"\n # sleep 1\n # puts \"Woke!\"\n end\n rescue Aws::EC2::Errors::ResourceLimitExceeded\n VfSnapshots.verbose \"\\nThrottled!\"\n exit\n end\n end", "def clone_vm(src_name, options = {})\n dst_name = \"vagrant_temp_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}\"\n\n args = ['clone', src_name, '--name', dst_name]\n args.concat(['--dst', options[:dst]]) if options[:dst]\n\n # Linked clone options\n args << '--linked' if options[:linked]\n args.concat(['--id', options[:snapshot_id]]) if options[:snapshot_id]\n\n # Regenerate SourceVmUuid of the cloned VM\n args << '--regenerate-src-uuid' if options[:regenerate_src_uuid]\n\n execute_prlctl(*args) do |_, data|\n lines = data.split('\\r')\n # The progress of the clone will be in the last line. Do a greedy\n # regular expression to find what we're looking for.\n if lines.last =~ /Copying hard disk.+?(\\d{,3}) ?%/\n yield $1.to_i if block_given?\n end\n end\n read_vms[dst_name]\n end", "def create_kvm(kvm_name, template, options)\n ensure_name_availability!(kvm_name)\n clone_kvm(kvm_name, template)\n device = mount_kvm_volume(kvm_name)\n address = update_kvm_ip(kvm_name)\n update_hostname(kvm_name)\n make_console_accessible(kvm_name)\n unmount_kvm_volume(kvm_name, device)\n create_kvm_instance(kvm_name, options)\n puts \"KVM Node #{kvm_name} available at: #{address}\"\nend", "def build_snapshot\n Sherlock::Models::Snapshot.new(\n :node_id => snapshot_json[:node_id],\n :timestamp => Time.now\n )\n end", "def take_a_snapshot\n raise NotImplementedError\n end", "def make_backup\n @backup = editor.create_snapshot\n end", "def create_virtual_machine(vm)\n kubevirt_client.create_virtual_machine(vm)\n end", "def set_snapshot\n @snapshot = Snapshot.find(params[:id])\n end", "def restore_snapshot(uuid, snapshot_id)\n # Sometimes this command fails with 'Data synchronization is currently\n # in progress'. Just wait and retry.\n retryable(on: VagrantPlugins::Parallels::Errors::ExecutionError, tries: 2, sleep: 2) do\n execute_prlctl('snapshot-switch', uuid, '-i', snapshot_id)\n end\n end", "def create_blob_snapshot(container, blob, options={})\n query = { 'comp' => 'snapshot'}\n StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n headers = StorageService.common_headers\n unless options.empty?\n StorageService.add_metadata_to_headers(options[:metadata], headers)\n add_blob_conditional_headers(options, headers)\n end\n\n response = call(:put, uri, nil, headers, options)\n\n response.headers['x-ms-snapshot']\n end", "def create_volume( options = {} )\n options = { :availability_zone => '' }.merge(options)\n raise ArgumentError, \"No :availability_zone provided\" if options[:availability_zone].nil? || options[:availability_zone].empty?\n options = { :size => '' }.merge(options)\n options = { :snapshot_id => '' }.merge(options)\n params = {\n \"AvailabilityZone\" => options[:availability_zone],\n \"Size\" => options[:size],\n \"SnapshotId\" => options[:snapshot_id]\n }\n return response_generator(:action => \"CreateVolume\", :params => params)\n end", "def roll_back_to_share_snapshot_post(param, opts = {})\n data, _status_code, _headers = roll_back_to_share_snapshot_post_with_http_info(param, opts)\n return data\n end", "def create_vm(cpu, ram, capacity, name, cluster)\n return nil if cluster.networks.empty?\n\n vm_config = creation_config(cpu, ram, capacity, add_prefix(name), cluster.networks.first)\n vm = @folder.CreateVM_Task(config: vm_config, pool: cluster.resource_pool).wait_for_completion\n VSphere::VirtualMachine.new vm, folder: self\n end", "def delete_snapshot(snapshot_id)\n log \"\\e[0;31m:: Deleting snapshot:\\e[0m #{snapshot_id}\"\n\n begin\n ec2.delete_snapshot(snapshot_id)\n sleep 0.2\n rescue Fog::Compute::AWS::NotFound\n log \"Failed to delete snapshot: #{snapshot_id}; setting { 'protected' => true }\"\n ec2.tags.create({resource_id: snapshot_id, key: 'protected', value: 'true'})\n rescue Fog::Compute::AWS::Error\n log \"API Error\"\n end\n\n end", "def snapshot_disk(disk_id, metadata={})\n # TODO: Get vhd from 'vhd' container in vm storage account and use blob client to snapshot it\n end", "def create_stored_virtual_machine(vm)\n kubevirt_client.create_stored_virtual_machine(vm)\n end", "def create_volume(size_or_snapshot_id, options = {})\n options = {:device => '/dev/sdh'}.merge(options)\n if size_or_snapshot_id.is_a?(Numeric)\n volume = @ec2.create_volume availability_zone, :size => size_or_snapshot_id\n else\n volume = @ec2.create_volume availability_zone, :snapshot_id => size_or_snapshot_id\n end\n if options[:tags]\n @ec2.create_tags(volume.id, options[:tags])\n end\n while volume.status != 'available'\n volume.reload\n end\n if options[:device]\n attach volume, options[:device]\n end\n volume\n end" ]
[ "0.87295747", "0.8101503", "0.7989879", "0.7883372", "0.77501374", "0.73471594", "0.7126852", "0.6777018", "0.6686673", "0.66147506", "0.65359205", "0.6513703", "0.64694715", "0.644606", "0.63948697", "0.6331971", "0.6325482", "0.62572885", "0.6255418", "0.6215297", "0.6199741", "0.61865777", "0.6139279", "0.61366415", "0.61033404", "0.6094587", "0.6077592", "0.6060783", "0.60589045", "0.60487133", "0.6042283", "0.6038331", "0.6032528", "0.60318416", "0.59314924", "0.588239", "0.5852549", "0.5847393", "0.5785008", "0.5766776", "0.57106125", "0.57065034", "0.56766415", "0.56669426", "0.5661693", "0.5628755", "0.5628482", "0.56083715", "0.56070143", "0.55432075", "0.55268514", "0.55144554", "0.5506339", "0.5422934", "0.5411999", "0.5397817", "0.53834635", "0.5364797", "0.53395295", "0.53307086", "0.531917", "0.5317839", "0.5308475", "0.5297916", "0.52856266", "0.5281147", "0.52765924", "0.5257774", "0.5238144", "0.5234471", "0.5218773", "0.5210217", "0.52048963", "0.5194344", "0.51880956", "0.51799864", "0.51783144", "0.51768845", "0.5156053", "0.5150151", "0.51425123", "0.5134356", "0.5126371", "0.51230365", "0.50993633", "0.5099239", "0.5091582", "0.5089296", "0.5082234", "0.5070339", "0.5062529", "0.50500226", "0.5046743", "0.50462735", "0.5041904", "0.5027766", "0.502735", "0.5013482", "0.49943468", "0.49892557" ]
0.847478
1
Public: Reverts the VM to the specified snapshot. The snapshot to revert to must exist and the Fusion GUI must not be running. name The snapshot name to revert to. Examples
def revert_to_snapshot(name) unless exists? return Response.new :code => 1, :message => 'VM does not exist' end if Fusion.running? message = 'It looks like the Fusion GUI is currently running. ' message << 'A VM cannot be reverted to a snapshot when the Fusion GUI is running. ' message << 'Exit the Fusion GUI and try again.' return Response.new :code => 1, :message => message end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? snapshots_response = snapshots return snapshots_response unless snapshots_response.successful? unless snapshots_response.data.include? name message = "Unable to find a snapshot named '#{name}'." return Response.new :code => 1, :message => message end command = "#{vmrun_cmd} revertToSnapshot " command << "#{conf_file_response.data} \"#{name}\" 2>&1" Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revert_to_snapshot(name)\n raise Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n command = \"#{vmrun_cmd} revertToSnapshot #{vmx_path.shellescape} \\\"#{name}\\\" 2>&1\"\n output = `#{command}`\n\n response = Fission::Response.new :code => $?.exitstatus\n response.output = output unless response.successful?\n\n response\n end", "def revert_to_snapshot(name)\n Fission::Action::Snapshot::Reverter.new(self).revert_to_snapshot(name)\n end", "def restore_snapshot(snapshot_name)\n execute(:restore_snapshot, VmId: vm_id, SnapName: snapshot_name)\n end", "def restore_snapshot(vm, name)\n snapshot = enumerate_snapshots(vm).find { |s| s.name == name }\n\n # No snapshot matching \"name\"\n return nil if snapshot.nil?\n\n task = snapshot.snapshot.RevertToSnapshot_Task(suppressPowerOn: true)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end", "def revert_snapshot(snap_id)\n snapshot_list = self['snapshot.rootSnapshotList']\n snapshot = find_snapshot_in_list(snapshot_list, snap_id)\n\n return unless snapshot\n\n begin\n revert_snapshot_hash = { :_this => snapshot }\n snapshot\n .RevertToSnapshot_Task(\n revert_snapshot_hash\n ).wait_for_completion\n rescue StandardError => e\n error = \"Cannot revert snapshot of VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n end", "def delete_snapshot(snapshot_name)\n execute(:delete_snapshot, VmID: vm_id, SnapName: snapshot_name)\n end", "def delete_snapshot(name)\n Fission::Action::Snapshot::Deleter.new(self).delete_snapshot(name)\n end", "def snapshot name\n Aptly::create_mirror_snapshot name, @name\n end", "def revert_vapp_snapshot(vmId)\n revert_snapshot_action(vmId, :vapp)\n end", "def delete_snapshot(vm, name)\n snapshot = enumerate_snapshots(vm).find { |s| s.name == name }\n\n # No snapshot matching \"name\"\n return nil if snapshot.nil?\n\n task = snapshot.snapshot.RemoveSnapshot_Task(removeChildren: false)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end", "def revert_snapshot_action(id, type=:vapp)\n params = {\n \"method\" => :post,\n \"command\" => \"/vApp/#{type}-#{id}/action/revertToCurrentSnapshot\"\n }\n response, headers = send_request(params)\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end", "def revert_snapshot_action(id, type=:vapp)\n params = {\n \"method\" => :post,\n \"command\" => \"/vApp/#{type}-#{id}/action/revertToCurrentSnapshot\"\n }\n response, headers = send_request(params)\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end", "def restore_snapshot(project_id, snapshot_id)\n params = { query: [project_id, snapshot_id] }\n\n response = endpoint(name: 'Snapshots', params: params).do_post\n\n # We restore a project so its endpoint is different\n response.patch_endpoint_with endpoint(name: 'Projects', params: { query: [project_id] })\n\n resource 'Project', response\n end", "def restore_snapshot(uuid, snapshot_id)\n # Sometimes this command fails with 'Data synchronization is currently\n # in progress'. Just wait and retry.\n retryable(on: VagrantPlugins::Parallels::Errors::ExecutionError, tries: 2, sleep: 2) do\n execute_prlctl('snapshot-switch', uuid, '-i', snapshot_id)\n end\n end", "def delete_snapshot(name)\n result = get_snapshot(name)\n response = @client.rest_delete(result['uri'], { 'If-Match' => result['eTag'] }, @api_version)\n @client.response_handler(response)\n true\n end", "def revert_snapshot(vmId)\n @logger.warn 'DEPRECATION WARNING: use [create,revert]_vapp_snapshot instead.'\n revert_snapshot_action(vmId, :vapp)\n end", "def create_snapshot(snapshot_name)\n execute(:create_snapshot, VmId: vm_id, SnapName: snapshot_name)\n end", "def create_snapshot(name)\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = running?\n return running_response unless running_response.successful?\n\n unless running_response.data\n message = 'The VM must be running in order to take a snapshot.'\n return Response.new :code => 1, :message => message\n end\n\n conf_file_response = conf_file\n return conf_file_response unless conf_file_response.successful?\n\n snapshots_response = snapshots\n return snapshots_response unless snapshots_response.successful?\n\n if snapshots_response.data.include? name\n message = \"There is already a snapshot named '#{name}'.\"\n return Response.new :code => 1, :message => message\n end\n\n command = \"#{vmrun_cmd} snapshot \"\n command << \"#{conf_file_response.data} \\\"#{name}\\\" 2>&1\"\n\n Response.from_command(`#{command}`)\n end", "def create_snapshot(name)\n Fission::Action::Snapshot::Creator.new(self).create_snapshot(name)\n end", "def restore(body = {}, params = {})\n response = client.post \"/_snapshot/{repository}/{snapshot}/_restore\", update_params(params, body: body, action: \"snapshot.restore\", rest_api: \"snapshot.restore\")\n response.body\n end", "def create_snapshot(snap_id, snap_name)\n memory_dumps = true\n memory_dumps = CONFIG[:memory_dumps] \\\n unless CONFIG[:memory_dumps].nil?\n\n snapshot_hash = {\n :name => snap_id,\n :description => \"OpenNebula Snapshot: #{snap_name}\",\n :memory => memory_dumps,\n :quiesce => true\n }\n\n begin\n @item.CreateSnapshot_Task(snapshot_hash).wait_for_completion\n rescue StandardError => e\n error = \"Cannot create snapshot for VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n\n snap_id\n end", "def snap_delete(volume,snapshot)\n output = @filer.invoke(\"snapshot-create\",\"volume\",volume,\"snapshot\",snapshot)\n if (output.results_status() == \"failed\")\n raise \"Error #{output.results_errno} creating snapshot #{snapshot} on #{volume}: #{output.results_reason()}\\n\"\n end\n end", "def snap_delete(volume,snapshot)\n output = @filer.invoke(\"snapshot-delete\",\"volume\",volume,\"snapshot\",snapshot)\n if (output.results_status() == \"failed\")\n raise \"Error #{output.results_errno} deleting snapshot #{snapshot} on #{volume}: #{output.results_reason()}\\n\"\n end\n end", "def snap(cmd, snap)\n nodes = getnodes.map{|x| x.name}\n out = `vagrant snapshot list`\n snaps = out.include?(\"No snapshots\") ? [] : out.split.uniq.sort\n curr_snap = snaps.last\n next_snap = curr_snap ? curr_snap[0..-2] + (curr_snap[-1].to_i + 1).to_s : \"snap1\"\n\n if cmd == \"save\"\n puts(\":: Creating snapshot for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n snap ||= next_snap\n Sys.exec(\"vagrant snapshot save #{snap}\")\n elsif cmd == \"restore\"\n puts(\":: Restoring previous snapshot for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n snap ||= curr_snap\n Sys.exec(\"vagrant snapshot restore #{snap}\")\n elsif cmd == \"delete\"\n puts(\":: Deleting previous snapshot for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n snap ||= curr_snap\n Sys.exec(\"vagrant snapshot delete #{snap}\")\n elsif cmd == \"list\"\n puts(\":: Listing snapshots for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n puts(snaps)\n end\n end", "def restore_from_snap(last_snapshot, options = {})\n options[:device] = \"/dev/sdk\" unless options[:device]\n options[:vol_nickname] = last_snapshot[\"nickname\"] unless options[:vol_nickname]\n \n # 5 - Unmount and detach the current EBS volume (forcing to detach the device we're gonna need later for attching ours...)\n umount_and_detach_device({:device => options[:device]})\n # 6- Create the volume from the latest snapshot, attach it to the instance and then mount it\n STDERR.puts \"Creating new DB volume from snapshot #{last_snapshot['aws_id']}\"\n vol = ( options[:new_size_gb] ? create_volume_from_snap_size_gb(last_snapshot[\"aws_id\"],options[:vol_nickname],options[:new_size_gb] ) : create_volume_from_snap(last_snapshot[\"aws_id\"],options[:vol_nickname] ) )\n unless vol.nil?\n \tSTDERR.puts \"Attaching new DB volume: #{vol['aws_id']}\"\n \tatt = attach_volume(vol['aws_id'], options[:device])\n \twait_for_attachment(options[:device])\n \tFileUtils.mkdir_p self.MountPoint\n \tres = `mount -t xfs -o noatime #{options[:device]} #{self.MountPoint}`\n \traise EBSRemoteExecException.new(nil,$?,\"Error mounting newly created volume (#{vol['aws_id']}) on #{options[:device]}:\\n\"+res) if $? != 0 \n else\n\t raise \"create volume failed from snapshot\"\n end\n end", "def delete\n ensure_service!\n service.delete_snapshot name\n true\n end", "def restore\n db = resolve_db(:allow_default => true)\n to_name = db[:name]\n to_url = db[:url]\n\n backup_id = args.shift\n\n if backup_id =~ /^http(s?):\\/\\//\n from_url = backup_id\n from_name = \"EXTERNAL_BACKUP\"\n from_uri = URI.parse backup_id\n backup_id = from_uri.path.empty? ? from_uri : File.basename(from_uri.path)\n else\n if backup_id\n backup = pgbackup_client.get_backup(backup_id)\n abort(\"Backup #{backup_id} already deleted.\") if backup[\"destroyed_at\"]\n else\n backup = pgbackup_client.get_latest_backup\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = File.basename(to_uri.path, '.*')\n backup_id = \"#{backup_id} (most recent)\"\n end\n\n from_url = backup[\"to_url\"]\n from_name = \"BACKUP\"\n end\n\n message = \"#{db[:pretty_name]} <---restore--- \"\n padding = \" \" * message.length\n display \"\\n#{message}#{backup_id}\"\n if backup\n display padding + \"#{backup['from_name']}\"\n display padding + \"#{backup['created_at']}\"\n display padding + \"#{backup['size']}\"\n end\n\n if confirm_command\n restore = transfer!(from_url, from_name, to_url, to_name)\n restore = poll_transfer!(restore)\n\n if restore[\"error_at\"]\n message = \" ! An error occurred and your restore did not finish.\"\n message += \"\\n ! The backup url is invalid. Use `pgbackups:url` to generate a new temporary URL.\" if restore['log'] =~ /Invalid dump format: .*: XML document text/\n abort(message)\n end\n end\n end", "def create_snapshot(vm, name)\n task = vm.CreateSnapshot_Task(\n name: name,\n memory: false,\n quiesce: false)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end", "def snapshot(table, snapshot_name, *args)\n # Table name should be a string\n raise(ArgumentError, 'Table name must be of type String') unless table.is_a?(String)\n\n # Snapshot name should be a string\n raise(ArgumentError, 'Snapshot name must be of type String') unless\n snapshot_name.is_a?(String)\n\n table_name = TableName.valueOf(table)\n if args.empty?\n @admin.snapshot(snapshot_name, table_name)\n else\n args.each do |arg|\n ttl = arg[TTL]\n ttl = ttl ? ttl.to_java(:long) : -1\n snapshot_props = java.util.HashMap.new\n snapshot_props.put(\"TTL\", ttl)\n max_filesize = arg[MAX_FILESIZE]\n max_filesize = max_filesize ? max_filesize.to_java(:long) : -1\n snapshot_props.put(\"MAX_FILESIZE\", max_filesize)\n if arg[SKIP_FLUSH] == true\n @admin.snapshot(snapshot_name, table_name,\n org.apache.hadoop.hbase.client.SnapshotType::SKIPFLUSH, snapshot_props)\n else\n @admin.snapshot(snapshot_name, table_name, snapshot_props)\n end\n end\n end\n end", "def restore_db_instance_from_snapshot( options = {} )\n raise ArgumentError, \"No :db_snapshot_identifier provided\" if options.does_not_have?(:db_snapshot_identifier)\n raise ArgumentError, \"No :db_instance_identifier provided\" if options.does_not_have?(:db_instance_identifier)\n raise ArgumentError, \"No :db_instance_class provided\" if options.does_not_have?(:db_instance_class)\n\n params = {}\n params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier]\n params['DBInstanceIdentifier'] = options[:db_instance_identifier]\n params['DBInstanceClass'] = options[:db_instance_class]\n\n params['Port'] = options[:port].to_s if options.has?(:port)\n params['AvailabilityZone'] = options[:availability_zone] if options.has?(:availability_zone)\n\n return response_generator(:action => \"RestoreDBInstanceFromDBSnapshot\", :params => params)\n end", "def delete_fusion_vm_snapshot(options)\n clone_list = []\n if options['clone'].to_s.match(/\\*/) or options['clone'].to_s.match(/all/)\n clone_list = get_fusion_vm_snapshots(options)\n clone_list = clone_list.split(\"\\n\")[1..-1]\n else\n clone_list[0] = options['clone']\n end\n clone_list.each do |clone|\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n message = \"Information:\\tDeleting snapshot \"+clone+\" for #{options['vmapp']} VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion deleteSnapshot '#{fusion_vmx_file}' '#{clone}'\"\n execute_command(options,message,command)\n end\n return\nend", "def revert_to(version)\n revert version\n self\n end", "def rollback\n self.revert_to self.previous_version\n end", "def make_backup\n @backup = editor.create_snapshot\n end", "def rollback!\n self.revert_to! self.previous_version\n end", "def clone_snapshot(snapshot_name, table, restore_acl = false, clone_sft = nil)\n @admin.cloneSnapshot(snapshot_name, TableName.valueOf(table), restore_acl, clone_sft)\n end", "def restore(snapshot, signatures, validation_token = nil, relations = nil)\n @snapshot = snapshot\n @signatures = signatures\n @validation_token = validation_token\n @relations = relations\n model = JSON.parse(Crypto::Bytes.new(snapshot).to_s)\n restore_from_snapshot_model(model)\n end", "def previous_snapshot(snapname)\n prev = nil\n tags.each do |tag|\n if tag == snapname\n return prev\n else\n prev = tag\n end\n end\n raise 'Snapshot not found'\n end", "def create_db_snapshot(identifier, name)\n request({\n 'Action' => 'CreateDBSnapshot',\n 'DBInstanceIdentifier' => identifier,\n 'DBSnapshotIdentifier' => name,\n :parser => Fog::Parsers::AWS::RDS::CreateDBSnapshot.new\n })\n end", "def delete_db_snapshot(group_name)\n \n request({\n 'Action' => 'DeleteDBSnapshot',\n 'DBSnapshotIdentifier' => group_name,\n \n :parser => Fog::Parsers::AWS::RDS::DeleteDBSnapshot.new\n })\n end", "def restore(name)\n Session.instance.load name\n end", "def restore\n authorize @page\n @version = @page.versions.find(params['version_id'])\n @page = @version.reify\n @page.reify_page_slots!\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to page_versions_path(@page), notice: 'Page version was successfully restored.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :versions }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def roll_back_to_volume_snapshot_post(roll_back_to_volume_snapshot_param, opts = {})\n data, _status_code, _headers = roll_back_to_volume_snapshot_post_with_http_info(roll_back_to_volume_snapshot_param, opts)\n return data\n end", "def get_snapshot(name)\n results = get_snapshots\n results.find { |snap| snap['name'] == name }\n end", "def revert\n end", "def reach_checkpoint(name)\n scenario_indent = ' ' * 4\n step_indent = ' ' * 6\n\n step 'a computer'\n if VM.snapshot_exists?(name)\n $vm.restore_snapshot(name)\n else\n checkpoint = CHECKPOINTS[name]\n checkpoint_description = checkpoint[:description]\n parent_checkpoint = checkpoint[:parent_checkpoint]\n steps = checkpoint[:steps]\n if parent_checkpoint\n if VM.snapshot_exists?(parent_checkpoint)\n $vm.restore_snapshot(parent_checkpoint)\n else\n reach_checkpoint(parent_checkpoint)\n end\n post_snapshot_restore_hook(parent_checkpoint)\n end\n debug_log(scenario_indent + \"Checkpoint: #{checkpoint_description}\",\n color: :white, timestamp: false)\n step_action = 'Given'\n if parent_checkpoint\n parent_description = CHECKPOINTS[parent_checkpoint][:description]\n debug_log(step_indent + \"#{step_action} #{parent_description}\",\n color: :green, timestamp: false)\n step_action = 'And'\n end\n steps.each do |s|\n begin\n step(s)\n rescue StandardError => e\n debug_log(scenario_indent +\n \"Step failed while creating checkpoint: #{s}\",\n color: :red, timestamp: false)\n raise e\n end\n debug_log(step_indent + \"#{step_action} #{s}\",\n color: :green, timestamp: false)\n step_action = 'And'\n end\n $vm.save_snapshot(name)\n end\n # VM#save_snapshot restores the RAM-only snapshot immediately\n # after saving it, in which case post_snapshot_restore_hook is\n # useful to ensure we've reached a good starting point, so we run\n # it in all cases, including even when've just saved a new snapshot.\n post_snapshot_restore_hook(name)\nend", "def rollback_snapshot id, locked: false\n\t\[email protected] \"#{self.class}##{__method__}\"\n\t\[email protected] \"#{self.class}##{__method__}: \" + \"id: #{id}\"\n\t\[email protected] \"#{self.class}##{__method__}: \" + \"locked: #{locked}\"\n\n\t\tsnapshot = nil\n\t\tlock_success = false\n\t\tupdate_db_success = false\n\n\t\tbegin\n\t\t\tunless locked\n\t\t\t\tlock_success = @@m.try_lock\n\t\t\t\[email protected] \"#{self.class}##{__method__}: \" + \"try_lock: #{lock_success}\"\n\t\t\t\tunless lock_success\n\t\t\t\t\traise \"Couldn't get lock. Please try again later.\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\[email protected] \"#{self.class}##{__method__}: \" + \"transaction start\"\n\t\t\tActiveRecord::Base.transaction do\n\t\t\t\[email protected] \"#{self.class}##{__method__}: \" + \"rollback snapshot start\"\n\t\t\t\tsnapshot = Snapshot.find( id )\n\t\t\t\tZfsController.rollback_snapshot @config, snapshot\n\t\t\t\[email protected] \"#{self.class}##{__method__}: \" + \"rollback snapshot end\"\n\t\t\tend\n\t\t\[email protected] \"#{self.class}##{__method__}: \" + \"transaction end\"\n\n\t\t\tsnapshot\n\t\trescue\n\t\t\traise\n\t\tensure\n\t\t\tunless locked\n\t\t\t\tif lock_success\n\t\t\t\t\[email protected] \"#{self.class}##{__method__}: \" + \"unlock start\"\n\t\t\t\t\t@@m.unlock\n\t\t\t\t\[email protected] \"#{self.class}##{__method__}: \" + \"unlock end\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def delete\n @service.delete_snapshot(self)\n end", "def delete_snapshot(uuid, snapshot_id)\n # Sometimes this command fails with 'Data synchronization is currently\n # in progress'. Just wait and retry.\n retryable(on: VagrantPlugins::Parallels::Errors::ExecutionError, tries: 2, sleep: 2) do\n execute_prlctl('snapshot-delete', uuid, '--id', snapshot_id)\n end\n end", "def cmd_restore argv\n setup argv\n filepath = @hash['filepath']\n clear_existing = to_boolean(@hash['boolean'])\n response = @api.restore(filepath, clear_existing)\n msg response\n return response\n end", "def revert\n @name_1 = @ori_backdrop1\n @name_2 = @ori_backdrop2\n end", "def snapshot esurl, snapurl, options\n elastic esurl\n set_opts(options)\n set_repository snapurl, options\n initiate_snapshot snapurl\n end", "def delete_snapshot snapshot\n subscriber.delete_snapshot snapshot: snapshot_path(snapshot)\n end", "def backup_game(game_name)\n games = GameList.from_config\n game = games.find_game(game_name)\n\n couldnt_find_game!(game_name) unless game\n run_backup!(game)\n end", "def create_snapshot(uuid, snapshot_name)\n stdout = execute_prlctl('snapshot', uuid, '--name', snapshot_name)\n return Regexp.last_match(1) if stdout =~ /{([\\w-]+)}/\n\n raise Errors::SnapshotIdNotDetected, stdout: stdout\n end", "def recreate_view name\n view_structure = ActiveRecord::Base.connection.select_value(\"select definition from pg_views where viewname='#{name}'\")\n if view_structure\n execute \"DROP VIEW IF EXISTS #{name}\"\n execute \"CREATE VIEW #{name} AS #{view_structure};\"\n end\n end", "def restore(*args)\n argv = to_pointer([\"restore\"] + args)\n rrd_restore(args.size+1, argv) == 0\n ensure\n free_pointers\n end", "def restore_checkpoint\n @api.send(\"world.checkpoint.restore()\")\n end", "def patch_virtualization_vmware_virtual_machine_snapshot(moid, virtualization_vmware_virtual_machine_snapshot, opts = {})\n data, _status_code, _headers = patch_virtualization_vmware_virtual_machine_snapshot_with_http_info(moid, virtualization_vmware_virtual_machine_snapshot, opts)\n data\n end", "def revert\n @version = PaperTrail::Version.find(params[:id])\n if @version.reify\n @version.reify.save!\n else\n @version.item.destroy\n end\n link_name = params[:redo] == \"true\" ? \"undo\" : \"redo\"\n link = view_context.link_to(link_name, revert_version_path(@version.next, :redo => !params[:redo]), class: \"btn btn-warning\", :method => :post)\n redirect_to :back, :notice => \"Undid #{@version.event}. #{link}\".html_safe\n end", "def snapshot(cart_name)\n raise NotImplementedError(\"snapshot\")\n end", "def delete_snapshot(snapshot_id)\n log \"\\e[0;31m:: Deleting snapshot:\\e[0m #{snapshot_id}\"\n\n begin\n ec2.delete_snapshot(snapshot_id)\n sleep 0.2\n rescue Fog::Compute::AWS::NotFound\n log \"Failed to delete snapshot: #{snapshot_id}; setting { 'protected' => true }\"\n ec2.tags.create({resource_id: snapshot_id, key: 'protected', value: 'true'})\n rescue Fog::Compute::AWS::Error\n log \"API Error\"\n end\n\n end", "def delete_snapshot(snapshot_id)\n end", "def restore_db\n\n begin\n self.rds.restore_db_instance_from_db_snapshot(new_snap.id,\n backup_server_id,\n {\"DBSubnetGroupName\" => @opts['db_subnet_group_name'],\n \"DBInstanceClass\" => @opts['db_instance_type'] } )\n rescue Exception => e\n raise MyRDSException.new(\"Error in #{self.class}:restore_db: #{e.class}: #{e}\")\n end\n\n end", "def restore(*args)\n call_engines_method(:restore, *args)\n end", "def restore_backup(backup_uuid)\n response = post \"storage/#{backup_uuid}/restore\"\n\n response\n end", "def revert_page(page, sha1, sha2 = nil, commit = {})\n return false unless page\n left, right, options = parse_revert_options(sha1, sha2, commit)\n commit_and_update_paths(@repo.git.revert_path(page.path, left, right), [page.path], options)\n end", "def restore\n RESTORE\n end", "def revert_to!(version)\n revert_to(version) ? save_without_revision : false\n end", "def delete_snapshot(snapshot_id)\n with_thread_name(\"delete_snapshot(#{snapshot_id})\") do\n snapshot = @ec2_resource.snapshot(snapshot_id)\n snapshot.delete\n logger.info(\"snapshot '#{snapshot_id}' deleted\")\n end\n end", "def restore\n authorize @page\n @version = @page.versions.find(params['version_id'])\n @page = @version.reify\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to page_versions_path(@page), notice: 'Page version was successfully restored.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :versions }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete_snapshot(snapshot_id)\n with_thread_name(\"delete_snapshot(#{snapshot_id})\") do\n snapshot = @ec2_resource.snapshot(snapshot_id)\n begin\n snapshot.delete\n rescue Aws::EC2::Errors::InvalidSnapshotNotFound => e\n logger.info(\"snapshot '#{snapshot_id}' not found\")\n end\n logger.info(\"snapshot '#{snapshot_id}' deleted\")\n end\n end", "def revert_to!(version)\n revert version, :hard\n self\n end", "def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def delete_snapshot(snapshot_id)\n raise Bosh::Clouds::NotSupported.new(false),\n 'delete_snapshot is not supported.'\n end", "def delete_snapshot(snapshot_id)\n link = generate_request(\"DeleteSnapshot\",\n \"SnapshotId\" => snapshot_id.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def restore\n end", "def delete(params = {})\n response = client.delete \"/_snapshot/{repository}/{snapshot}\", update_params(params, action: \"snapshot.delete\", rest_api: \"snapshot.delete\")\n response.body\n end", "def restore( page )\n load page, take_snapshot: false\n end", "def revert!\n @shell.call \"rm -rf #{self.checkout_path}\"\n\n last_deploy = previous_deploy_name(true)\n\n if last_deploy && !last_deploy.empty?\n @shell.symlink \"#{self.deploys_path}/#{last_deploy}\", self.current_path\n\n Sunshine.logger.info @shell.host, \"Reverted to #{last_deploy}\"\n\n else\n @crontab.delete!\n\n Sunshine.logger.info @shell.host, \"No previous deploy to revert to.\"\n end\n end", "def create_snapshot(vmId, description=\"New Snapshot\")\n @logger.warn 'DEPRECATION WARNING: use [create,revert]_vapp_snapshot instead.'\n create_snapshot_action(vmId, description, :vapp)\n end", "def check_snapshot(vmname, node)\n if node.name =~ /^prekernel/\n compare_time = Time.now - CLEAN_AFTER_DAYS * 24 * 60 * 60\n if compare_time > node.createTime\n puts 'Deleting snapshot for ' + vmname + ' | ' + node.name + ' | ' + node.createTime.iso8601\n\n snapshot_task = node.snapshot.RemoveSnapshot_Task(removeChildren: false)\n snapshot_task = snapshot_task.wait_for_completion\n end\n end\n\n unless node.childSnapshotList.empty?\n node.childSnapshotList.each { |item| check_snapshot(vmname, item) }\n end\nend", "def create_snapshot(snapshot, description = nil)\n ensure_uri && ensure_client\n if snapshot.is_a?(OneviewSDK::Resource) || snapshot.is_a?(Hash)\n name = snapshot[:name] || snapshot['name']\n description ||= snapshot[:description] || snapshot['description']\n else\n name = snapshot\n end\n data = generate_snapshot_data(name, description)\n response = @client.rest_post(\"#{@data['uri']}/snapshots\", { 'body' => data }, @api_version)\n @client.response_handler(response)\n true\n end", "def restart(vmname, action = 'restart')\n uri = @uri + \"/#{vmname}/#{action}?api-version=#{api_version}\"\n uri\n end", "def restore_volume(id, restore_point, opts = {})\n data, _status_code, _headers = restore_volume_with_http_info(id, restore_point, opts)\n data\n end", "def off\n attachment = hpg_resolve(shift_argument)\n return unless confirm_command(attachment.config_var, 'Deactiving will destroy all backups')\n action(\"Dectivating #{attachment.config_var} (#{attachment.resource_name})\") do\n RestClient.delete( authed_pgsnapshot_url(\"/client/resource/#{attachment.resource_name}\"))\n end\n end", "def restore(*args); end", "def redact_workflow(user, namespace, name, snapshot)\n full_name = [namespace, name, snapshot].join('/')\n begin\n logger.info \"Redacting workflow #{full_name}\"\n user_fire_cloud_client(user).delete_method(namespace, name, snapshot.to_i)\n logger.info \"Redaction complete for #{full_name}\"\n rescue => e\n logger.error \"Unable to redact #{full_name} due to error: #{e.message}\"\n end\n end", "def restore!(date, filename)\n\n object_name = \"#{date.strftime('%Y-%m-%d')}_#{filename}\"\n unless container.object_exists?(object_name)\n raise \"Object #{object_name} not found in container.\"\n end\n if File.exists?(filename)\n raise \"File #{filename} already exists locally, not overwriting.\"\n end\n\n object = container.object(object_name)\n object.save_to_filename(filename)\n\n puts \" -> Restored #{object_name} as #{filename} to the current directory\"\n\n end", "def reset_version(version = nil)\n if version.nil?\n @last_version = nil\n @reverted_from = nil\n else\n @reverted_from = version\n end\n @version = version\n end", "def apply_snapshot(snapshot)\n raise \"apply_snapshot not implemented in #{self}\"\n end", "def rmlease(name)\n call_rpc_for_target(VN_METHODS[:rmlease], name)\n end", "def restore(path, rev, opts = {})\n input_json = {\n path: path,\n rev: rev,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/restore\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def restore(cart_name)\n raise NotImplementedError(\"restore\")\n end", "def restore(location, revision)\n @client.restore(location, revision)\n rescue\n puts $! if @@verbose\n nil\n end", "def restore(path, rev)\n params = {\n 'rev' => rev.to_s\n }\n\n response = @session.do_post build_url(\"/restore/#{@root}#{format_path(path)}\", params)\n parse_response(response)\n end", "def vm_rename\n requires :instance_uuid, :name\n service.vm_rename('instance_uuid' => instance_uuid, 'name' => name)\n end", "def update_virtualization_vmware_virtual_machine_snapshot(moid, virtualization_vmware_virtual_machine_snapshot, opts = {})\n data, _status_code, _headers = update_virtualization_vmware_virtual_machine_snapshot_with_http_info(moid, virtualization_vmware_virtual_machine_snapshot, opts)\n data\n end", "def revert_to(version_number)\n snapshot = version(version_number)\n self.props.each_pair{|k,v| self[k] = nil if !snapshot.props.has_key?(k)}\n snapshot.props.each_pair{|k,v| self[k] = v if self.props[k].nil? && k != '_neo_id'}\n Neo4j::Transaction.run do\n restore_relationships(snapshot)\n save\n end\n end", "def snapshot()\n\t\tif(@wait != -1 && @count < @wait)\n\t\t\t@count += 1\n\t\t\treturn\n\t\tend\n\t\t\n\t\tif (! @quiet)\n\t\t\tputs \"Snapshot ##{@count}\"\n\t\tend\n\t\t\n\t\tnewName = File.basename(@file.path, \".svg\") + \"#{@count}\"\n\t\t@count += 1\n\t\t\n\t\t## Save a new SVG file\n\t\tsave(newName + \".svg\")\n\t\t\n\t\t## Convert to EPS\n\t\tif (@eps)\n\t\t\tsystem(\"#{@inkscape} -E=#{newName}.eps #{newName}.svg -z -d=90 -C --export-ignore-filters 2>/dev/null\")\n\t\tend\n\t\t\n\t\t## Delete the SVG file\n\t\tif (@cleanup)\n\t\t\tFile.delete(newName + \".svg\")\n\t\tend\n\tend" ]
[ "0.8358712", "0.83442545", "0.7905424", "0.7835717", "0.73976845", "0.6691044", "0.6623359", "0.6483487", "0.63131666", "0.6285355", "0.61799955", "0.61680114", "0.6142899", "0.61428314", "0.6123987", "0.6114518", "0.6073976", "0.59369624", "0.5795219", "0.5753843", "0.5634199", "0.5553863", "0.53716815", "0.5354266", "0.5341677", "0.5341609", "0.5320984", "0.5308694", "0.52775925", "0.52658075", "0.52452546", "0.5218913", "0.5214633", "0.5207093", "0.5178629", "0.5171787", "0.51358795", "0.5122434", "0.51063806", "0.5080536", "0.50794923", "0.5027489", "0.50108427", "0.5010673", "0.50006884", "0.49991912", "0.4996277", "0.49855852", "0.49503785", "0.49478465", "0.4946347", "0.49228594", "0.49184775", "0.49061912", "0.49030486", "0.48999462", "0.48951417", "0.48837093", "0.48826072", "0.48803928", "0.48783183", "0.48675406", "0.48673698", "0.48415", "0.4821735", "0.48121804", "0.48119706", "0.4802246", "0.47986302", "0.47917584", "0.4784054", "0.47831258", "0.47794336", "0.47694626", "0.4764539", "0.47606522", "0.47514558", "0.474062", "0.4738531", "0.47261757", "0.47258177", "0.4725514", "0.47239682", "0.4705865", "0.47012725", "0.4700087", "0.46980706", "0.46837002", "0.4679591", "0.46789438", "0.46781462", "0.4670651", "0.467024", "0.46361515", "0.46265584", "0.46243256", "0.462029", "0.4610742", "0.45919222", "0.45876798" ]
0.84456444
0
Public: List the snapshots for a VM. Examples
def snapshots unless exists? return Response.new :code => 1, :message => 'VM does not exist' end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? command = "#{vmrun_cmd} listSnapshots " command << "#{conf_file_response.data} 2>&1" output = `#{command}` response = Response.new :code => $?.exitstatus if response.successful? snaps = output.split("\n").select { |s| !s.include? 'Total snapshots:' } response.data = snaps.map { |s| s.strip } else response.message = output end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snapshots\n raise Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n command = \"#{vmrun_cmd} listSnapshots #{vmx_path.shellescape} 2>&1\"\n output = `#{command}`\n\n raise \"There was an error listing the snapshots of #{@name} :\\n #{output}\" unless $?.exitstatus==0\n\n snaps_unfiltered = output.split(\"\\n\").select { |s| !s.include? 'Total snapshots:' }\n snaps=snaps_unfiltered.map { |s| s.strip }\n return snaps\n end", "def snapshots\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n conf_file_response = @vm.conf_file\n return conf_file_response unless conf_file_response.successful?\n\n command = \"#{vmrun_cmd} listSnapshots \"\n command << \"'#{conf_file_response.data}' 2>&1\"\n\n command_exec = Fission::Action::ShellExecutor.new command\n result = command_exec.execute\n\n response = Response.new :code => result['process_status'].exitstatus\n\n if response.successful?\n response.data = parse_snapshot_names_from_output result['output']\n else\n response.message = result['output']\n end\n\n response\n end", "def list_snapshots\n snaps = execute(:list_snapshots, VmID: vm_id)\n snaps.map { |s| s['Name'] }\n end", "def list_snapshots(**options)\n Terminal.list_snapshots(@user_token, @access_token, **options)\n end", "def list_fusion_vm_snapshots(options)\n snapshot_list = get_fusion_vm_snapshots(options)\n handle_output(snapshot_list)\n return\nend", "def get_virtualization_vmware_virtual_machine_snapshot_list(opts = {})\n data, _status_code, _headers = get_virtualization_vmware_virtual_machine_snapshot_list_with_http_info(opts)\n data\n end", "def list_snapshot(regex = '.*')\n @admin.listSnapshots(Pattern.compile(regex)).to_a\n end", "def enumerate_snapshots(vm)\n snapshot_info = vm.snapshot\n\n if snapshot_info.nil?\n snapshot_root = []\n else\n snapshot_root = snapshot_info.rootSnapshotList\n end\n\n recursor = lambda do |snapshot_list|\n Enumerator.new do |yielder|\n snapshot_list.each do |s|\n # Yield the current VirtualMachineSnapshotTree object\n yielder.yield s\n\n # Recurse into child VirtualMachineSnapshotTree objects\n children = recursor.call(s.childSnapshotList)\n loop do\n yielder.yield children.next\n end\n end\n end\n end\n\n recursor.call(snapshot_root)\n end", "def available_snapshots\n snapshot_info = `#{config[:path]} --json snapshots`\n JSON.parse(snapshot_info, { symbolize_names: true })\n end", "def snapshots\n with_admin { |admin| admin.listSnapshots }.map { |sd|\n props = sd.getAllFields.map { |k, v|\n [k.name.to_sym, v.respond_to?(:name) ? v.name : v]\n }\n Hash[props]\n }\n end", "def snapshots\n Fission::Action::Snapshot::Lister.new(self).snapshots\n end", "def get_snapshots\n ensure_uri && ensure_client\n uri = \"#{@data['uri']}/snapshots\"\n self.class.find_with_pagination(@client, uri)\n end", "def getSnapshots()\n\t\tsnaps = JSON.parse(RestClient.get(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/snapshots/\"))\t\n\t\tret = []\n\n\t\tfor snap in snaps\n\t\t\tret.push(Snapshot.new(snap[\"hash\"], @testId))\n\n\t\tend\n\t\treturn ret\n\tend", "def list_instance_snapshots(rds_resource)\n instance_snapshots = []\n rds_resource.db_snapshots.each do |s|\n instance_snapshots.append({\n \"id\": s.snapshot_id,\n \"status\": s.status\n })\n end\n instance_snapshots\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't list instance snapshots:\\n #{e.message}\"\nend", "def list_snapshots options = {}\n paged_enum = subscriber.list_snapshots project: project_path(options),\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end", "def get_virtualization_vmware_virtual_machine_snapshot_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_vmware_virtual_machine_snapshot_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/VmwareVirtualMachineSnapshots'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VirtualizationVmwareVirtualMachineSnapshotResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_vmware_virtual_machine_snapshot_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VirtualizationApi#get_virtualization_vmware_virtual_machine_snapshot_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_snapshots\n @s3.buckets[@snapshot_bucket].objects.with_prefix(@prefix).to_a\n end", "def snapshots\n client = Aws::EC2::Client.new\n client.describe_snapshots({\n filters: [{\n name: \"tag:type\",\n values: [\"auto\"]\n }]\n }).snapshots\nend", "def list_all_fusion_vm_snapshots(options)\n vm_list = get_available_fusion_vms(options)\n vm_list.each do |vmx_file|\n options['name'] = File.basename(vmx_file,\".vmx\")\n list_fusion_vm_snapshots(options)\n end\n return\nend", "def snap(cmd, snap)\n nodes = getnodes.map{|x| x.name}\n out = `vagrant snapshot list`\n snaps = out.include?(\"No snapshots\") ? [] : out.split.uniq.sort\n curr_snap = snaps.last\n next_snap = curr_snap ? curr_snap[0..-2] + (curr_snap[-1].to_i + 1).to_s : \"snap1\"\n\n if cmd == \"save\"\n puts(\":: Creating snapshot for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n snap ||= next_snap\n Sys.exec(\"vagrant snapshot save #{snap}\")\n elsif cmd == \"restore\"\n puts(\":: Restoring previous snapshot for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n snap ||= curr_snap\n Sys.exec(\"vagrant snapshot restore #{snap}\")\n elsif cmd == \"delete\"\n puts(\":: Deleting previous snapshot for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n snap ||= curr_snap\n Sys.exec(\"vagrant snapshot delete #{snap}\")\n elsif cmd == \"list\"\n puts(\":: Listing snapshots for VMs [#{nodes * ','}]...\".colorize(:light_yellow))\n puts(snaps)\n end\n end", "def get_fusion_vm_snapshots(options)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n message = \"Information:\\tGetting a list of snapshots for #{options['vmapp']} VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion listSnapshots '#{fusion_vmx_file}'\"\n output = execute_command(options,message,command)\n return output\nend", "def volume_snapshots(volume_id)\n ec2.snapshots.select { |snapshot| snapshot.volume_id == volume_id }\n end", "def all_snapshots\n all.map(&:snapshots).flatten\n end", "def list_snapshots request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_snapshots_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::NetApp::V1::ListSnapshotsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def fetch_snapshots\n @snapshots = ::Refinery::Snapshots::Snapshot.all\n end", "def tags\n # Strangely, this only lists the first snapshot. If you remove '-o name', it lists them all\n #command = \"zfs list -H -r -t snapshot -o name #{@dataset}/share\"\n command = \"ls -1 #{@mountpoint}/share/.zfs/snapshot\"\n logger.debug \"running: #{command}\"\n `#{command}`.chomp.split(/\\n/).map { |x| x.sub(/.*@/, '') }\n end", "def find_snapshots\n unless @lineage\n s = @servers.first\n kind_params = s.transform_parameters(s.parameters)\n @lineage = kind_params['DB_LINEAGE_NAME'].gsub(/text:/, \"\")\n end\n snapshots = Ec2EbsSnapshot.find_by_cloud_id(@servers.first.cloud_id).select { |n| n.nickname =~ /#{@lineage}.*$/ }\n end", "def get(params = {})\n # Set snapshot name or we'll get the repository instead\n snapshot = name || \"_all\"\n response = client.get \"/_snapshot/{repository}/{snapshot}\", update_params(params, snapshot: snapshot, action: \"snapshot.get\", rest_api: \"snapshot.get\")\n response.body\n end", "def enrollment_snapshots(params = {})\n snapshot_id = params.delete :snapshot_id\n\n response =\n default_scope.get(\"enrollment/snapshot\" + (snapshot_id ? \"/#{snapshot_id}\" : '')) do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end", "def create_snapshots(isCopy)\n ec2 = AWS::EC2.new.client\n\n #get all volumes tagged as \"backup\"\n volumes = ec2.describe_volumes(:filters => [:name => 'tag-key', :values => ['backup']])\n snapshots = []\n\n #loop thru and create snapshots for all these volumes\n if volumes \n volumes.data[:volume_set].each do |v|\n name = get_tagvalue(v, \"Name\")\n snap = ec2.create_snapshot(:volume_id => v[:volume_id], :description => \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n if snap\n snapshots << snap.data\n #add name tag\n ec2.create_tags(:resources => [snap.data[:snapshot_id]], :tags => [{:key => \"Name\", :value => name + \" backup\"}])\n\n #now copy snapshots to another region\n if isCopy\n copy_snapshot(snap.data[:snapshot_id], AWSCONFIG[:default_region], AWSCONFIG[:backup_region], \n name + \" backup\", \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n end\n end\n end\n end\n\n return snapshots\n end", "def snapshots\n return @snapshots if @snapshots\n\n @snapshots = []\n @files.each do |f|\n io = File.open(f)\n\n begin\n @parser.read(io)\n @snapshots << @parser.snapshot\n rescue EOFError => e\n puts \"#{e.inspect}\\n#{f}\"\n end\n end\n\n return @snapshots\n end", "def snapshots\n return @snapshots if @snapshots\n\n @snapshots = []\n @files.each do |f|\n io = File.open(f)\n @parser.read(io)\n @snapshots << @parser.snapshot\n end\n\n return @snapshots\n end", "def list_table_snapshots(tableNameRegex, snapshotNameRegex = '.*')\n @admin.listTableSnapshots(Pattern.compile(tableNameRegex),\n Pattern.compile(snapshotNameRegex)).to_a\n end", "def list_cluster_snapshots(rds_resource)\n cluster_snapshots = []\n rds_resource.db_clusters.each do |c|\n c.snapshots.each do |s|\n cluster_snapshots.append({\n \"cluster\": c.id,\n \"snapshot_id\": s.snapshot_id,\n \"snapshot_status\": s.status\n })\n end\n end\n cluster_snapshots\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't list cluster snapshots:\\n #{e.message}\"\nend", "def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def list_private_virtual_machine_images\n request_path = '/services/vmimages'\n request = ManagementHttpRequest.new(:get, request_path, nil)\n response = request.call\n Serialization.virtual_machine_vmimages_from_xml(response)\n end", "def find_rds_snapshots(options = {}, snapshot_type = 'manual')\n days_old = options[:days_old]\n found_snap_shots = []\n\n snapshots_info = @rds.describe_db_snapshots(snapshot_type: snapshot_type)[:db_snapshots]\n\n snapshots_info.each do |snapshot_info|\n next if snapshot_info[:status] != 'available'\n if !days_old.nil?\n snapshot_days_old = (Time.now.to_i - snapshot_info[:snapshot_create_time].to_i) / Cucloud::SECONDS_IN_A_DAY\n if snapshot_days_old > days_old\n found_snap_shots.push(snapshot_info[:db_snapshot_identifier])\n end\n else\n found_snap_shots.push(snapshot_info[:db_snapshot_identifier])\n end\n end\n found_snap_shots\n end", "def index\n @snapshots = current_account.snapshots.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @snapshots }\n end\n end", "def index\n @inventory_snapshot_contents = InventorySnapshotContent.all\n end", "def list_public_virtual_machine_images\n request_path = '/services/images'\n request = ManagementHttpRequest.new(:get, request_path, nil)\n response = request.call\n Serialization.virtual_machine_images_from_xml(response)\n end", "def snapshots\n @dir.entries.map do |entry|\n next if entry[0] == '.' || entry == 'current'\n snapshot_path = File.expand_path(@dir.path + '/' + entry)\n next unless File.directory?(snapshot_path)\n begin\n Snapshot.new(self, snapshot_path)\n rescue ArgumentError => ae\n # directory name must represent a parseable Time\n nil\n end\n end.compact\n end", "def describe_db_snapshots( options = {} )\n raise ArgumentError, \"No :db_instance_identifier provided\" if options.does_not_have?(:db_instance_identifier)\n\n params = {}\n params['DBInstanceIdentifier'] = options[:db_instance_identifier]\n\n params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier] if options.has?(:db_snapshot_identifier)\n params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records)\n params['Marker'] = options[:marker] if options.has?(:marker)\n\n return response_generator(:action => \"DescribeDBSnapshots\", :params => params)\n end", "def wait_for_snapshots\n timeout=1500\n step=10\n while timeout > 0\n puts \"Checking for snapshot completed\"\n snapshots = behavior(:find_snapshots)\n status= snapshots.map { |x| x.aws_status } \n break unless status.include?(\"pending\")\n sleep step\n timeout -= step\n end\n raise \"FATAL: timed out waiting for all snapshots in lineage #{@lineage} to complete\" if timeout == 0\n end", "def list_snapshots_post_with_http_info(list_snapshots_param, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SnapshotApi.list_snapshots_post ...\"\n end\n # verify the required parameter 'list_snapshots_param' is set\n if @api_client.config.client_side_validation && list_snapshots_param.nil?\n fail ArgumentError, \"Missing the required parameter 'list_snapshots_param' when calling SnapshotApi.list_snapshots_post\"\n end\n # resource path\n local_var_path = \"/listSnapshots\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(list_snapshots_param)\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<String>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SnapshotApi#list_snapshots_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def snapshot_devices(devices, prefix, limit = 0, name = \"#{instance_id}\")\n log \"Snapshot limit set to #{limit} (0 means never purge)\"\n ts = DateTime.now.strftime(\"%Y-%m-%d-%H-%M\").to_s\n name = \"#{prefix} \" + name\n volumes = {}\n devices.each do |device|\n volumes[device] = find_volume_for_device(device)\n end\n sn = []\n volumes.each do |device, volume|\n log \"Creating volume snapshot for #{device} on instance #{instance_id}\"\n snapshot = volume.snapshots.new\n snapshot.description = name+\": #{device}\"\n snapshot.save\n sn << snapshot\n snapshot.reload\n\n @compute.tags.create(:resource_id => snapshot.id, :key =>\"device\", :value => device)\n @compute.tags.create(:resource_id => snapshot.id, :key =>\"instance_id\", :value =>instance_id)\n @compute.tags.create(:resource_id => snapshot.id, :key =>\"date\", :value => ts)\n end\n\n # DO NOT need to wait for creating EBS snapshot\n #log \"Waiting for snapshots to complete.\"\n #sn.each do |s|\n # begin\n # sleep(3)\n # s.reload\n # end while s.state == 'nil' || s.state == 'pending'\n #end\n\n if limit != 0\n # populate data structure with updated information\n snapshots = list_snapshots(devices)\n nsnaps = snapshots.keys.length\n if nsnaps-limit > 0\n dates = snapshots.keys.sort\n puts dates.inspect\n extra_snapshots = dates[0..-(limit+1)]\n remaining_snapshots = dates[-limit..-1]\n extra_snapshots.each do |date|\n snapshots[date].each do |snap|\n log \"Destroying #{snap.description} #{snap.id}\"\n snap.destroy\n end\n end\n end\n end\n end", "def get_vmi\n puts \"please wait...\"\n vm_image_management = Azure.vm_image_management\n vm_image_management.list_virtual_machine_images.each do |image|\n puts \"#{image.os_type}\"\n puts \" locations: #{image.locations}\"\n puts \" name : #{image.name}\"\n puts\n end\nend", "def images\n do_client.images.all.select do |image|\n image.public == false && image.type.casecmp('snapshot').zero?\n end.sort_by(&:id).reverse\n rescue DropletKit::Error => e\n e\n end", "def status(params = {})\n response = client.get \"/_snapshot{/repository}{/snapshot}/_status\", update_params(params, action: \"snapshot.status\", rest_api: \"snapshot.status\")\n response.body\n end", "def index\n @snaps = Snap.order(created_at: :desc).limit(20).all\n end", "def take_snapshots\n snapped_volumes = []\n logger.debug \"Issuing sync command\"\n system 'sync'\n\n logger.debug \"Walking attached volumes\"\n attached_volumes.each do |vol|\n dir = device_to_directory device_name vol\n logger.debug \"Found #{vol.id} mounted on #{dir}\"\n unless should_snap vol\n logger.debug \"Skipping #{vol.id}\"\n next\n end\n\n fs_freeze dir if options[:fs_freeze]\n take_snapshot vol\n snapped_volumes.push vol\n fs_unfreeze dir if options[:fs_freeze]\n end\n snapped_volumes\n end", "def pending_snapshots(rds_instance)\n snaps = rds_instance.snapshots\n snaps.select do |snap|\n snap.status == 'creating'\n end\n end", "def vm_create_evm_snapshot(vm, options = {})\n require \"OpenStackExtract/MiqOpenStackVm/MiqOpenStackInstance\"\n\n log_prefix = \"vm=[#{vm.name}]\"\n\n miq_openstack_instance = MiqOpenStackInstance.new(vm.ems_ref, openstack_handle)\n miq_snapshot = miq_openstack_instance.create_evm_snapshot(options)\n\n # Add new snapshot image to the vms table. Type is TemplateOpenstack.\n miq_templates.create!(\n :type => \"ManageIQ::Providers::Openstack::CloudManager::Template\",\n :vendor => \"openstack\",\n :name => miq_snapshot.name,\n :uid_ems => miq_snapshot.id,\n :ems_ref => miq_snapshot.id,\n :template => true,\n :location => \"unknown\"\n )\n\n # Add new snapshot to the snapshots table.\n vm.snapshots.create!(\n :name => miq_snapshot.name,\n :description => options[:desc],\n :uid => miq_snapshot.id,\n :uid_ems => miq_snapshot.id,\n :ems_ref => miq_snapshot.id\n )\n return miq_snapshot.id\n rescue => err\n _log.error \"#{log_prefix}, error: #{err}\"\n _log.debug { err.backtrace.join(\"\\n\") }\n raise\n end", "def getVMs\n @vms = VirtualMachine.all(@ip_address)\n end", "def enumerate_snapshots_to_be_pruned\n backed_up_snapshots = self.snapshots\n backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n prunees = []\n before = Date.today - ( Config.accounts[account.name][:backup][:days] || VfSnapshots::DEFAULT_BACKUP_DAYS )\n backed_up_snapshots.each do |snapshot|\n old_desc = snapshot.description.sub(\"#{account.name} \",'')\n account_name = snapshot.description.split(VfSnapshots::DESC_REGEX).first.chop\n if account_name == account.name\n if /^(\\d{14})/.match(old_desc)\n ts = Time.parse($1).to_date\n prunees << snapshot if (VfSnapshots::DESC_REGEX =~ old_desc) && ts < before\n end\n end\n end\n prunees\n end", "def create_snapshot(vm, name)\n task = vm.CreateSnapshot_Task(\n name: name,\n memory: false,\n quiesce: false)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end", "def copy_snapshots! snaps\n # account_snapshots = account.snapshots\n # backed_up_snapshots = self.snapshots\n # backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n if snaps.count > 0\n VfSnapshots.verbose \"\\n#{snaps.count} to copy, here we go.\"\n else\n VfSnapshots.verbose \"\\nNothing to copy.\"\n end\n begin\n tags = { tags: [\n {\n key: \"Account\",\n value: account.name,\n },\n ]\n }\n\n snaps.each_with_index do |snapshot,idx|\n VfSnapshots.verbose \"\\n[#{idx+1} of #{snaps.length}] Copying #{account.name} #{snapshot.description}\"\n\n # modify the source snapshot to share with the backup account\n snapshot.modify_attribute(attribute:'createVolumePermission', operation_type: 'add', user_ids: [ account.account_id ], create_volume_permission: { add: [{ user_id: account_id }] } )\n # get it in the backup account\n shared_snapshot = ec2.snapshot(snapshot.id)\n region = 'us-east-1'\n new_desc = \"#{account.name} #{snapshot.description}\"\n copy_response = shared_snapshot.copy(\n description: new_desc,\n source_region: region,\n destination_region: region,\n )\n ec2.snapshot(copy_response.snapshot_id).create_tags tags\n # puts \"Sleeping...\"\n # sleep 1\n # puts \"Woke!\"\n end\n rescue Aws::EC2::Errors::ResourceLimitExceeded\n VfSnapshots.verbose \"\\nThrottled!\"\n exit\n end\n end", "def volumes\n client = Aws::EC2::Client.new\n client.describe_volumes({\n filters: [{\n name: \"tag:backup\",\n values: [\"true\"]\n }]\n }).volumes\nend", "def list_volumes\n response = @connection.req(\"GET\", \"/#{@volume_path}\")\n volumes_hash = JSON.parse(response.body)[\"volumes\"]\n volumes_hash.inject([]){|res, current| res << OpenStack::Volume::Volume.new(current); res}\n end", "def sorted_snapshot_list()\n snapshot_list().sort{|a,b| b.time <=> a.time }\n end", "def get_options_snapshots(opts = {})\n data, _status_code, _headers = get_options_snapshots_with_http_info(opts)\n return data\n end", "def new\n @snapshot = current_account.snapshots.new\n @volumes = current_account.volumes\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snapshot }\n end\n end", "def snapshot()\n puts \"TODO\"\n end", "def delete_all_snapshot(regex)\n @admin.deleteSnapshots(Pattern.compile(regex)).to_a\n end", "def current_snapshot\n `zfs list -r -H -t snapshot -o name -S creation #{@dataset}/share | head -1`.chomp\n end", "def volumes_list(state = \"active\", limit = \"1000\")\n case state\n when \"active\"\n api_call = {\n :method => \"ListActiveVolumes\",\n :params => {\n :startVolumeID => 0,\n :limit => limit\n }\n }\n when \"deleted\"\n api_call = {\n :method => \"ListDeletedVolumes\",\n :params => {}\n }\n end\n answer = query_sf(api_call)\n return answer[\"volumes\"]\n end", "def list_all_aos_version_boxes(args = {}) \n get(\"/aosversions.json/aosversionbox\", args)\nend", "def create_snapshot(name)\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = running?\n return running_response unless running_response.successful?\n\n unless running_response.data\n message = 'The VM must be running in order to take a snapshot.'\n return Response.new :code => 1, :message => message\n end\n\n conf_file_response = conf_file\n return conf_file_response unless conf_file_response.successful?\n\n snapshots_response = snapshots\n return snapshots_response unless snapshots_response.successful?\n\n if snapshots_response.data.include? name\n message = \"There is already a snapshot named '#{name}'.\"\n return Response.new :code => 1, :message => message\n end\n\n command = \"#{vmrun_cmd} snapshot \"\n command << \"#{conf_file_response.data} \\\"#{name}\\\" 2>&1\"\n\n Response.from_command(`#{command}`)\n end", "def inspect\n snapshot.inspect\n end", "def list_kvms\n info = Hash[\n *Dir.glob(File.join(KVM_HOME, 'storage', '*.qcow2')).map{|dir|\n key = File.basename(dir).sub('.qcow2', '')\n [key, {:address => kvm_ip(key), :type => kvm_type(key)}]\n }.sort{|a,b|\n a.first <=> b.first\n }.flatten\n ]\n info.each do |name, info|\n puts \"#{name}\"\n puts \" Type: #{info[:type]}\"\n puts \" Address: #{info[:address]}\"\n end\nend", "def snapshot\n ls_tree(tree).map do |path|\n { \n path: path,\n status: deltas_to_hash[path] ? \n deltas_to_hash[path][:status] :\n :context\n }\n end\n end", "def retrieve_volumes\n dbg { \"retrieving #{pool_info}, #{hv_info}\" }\n\n volumes = pool.list_all_volumes\n dbg { \"list_all_volumes #{pool_info}, #{hv_info}\" }\n\n storage_volumes = volumes.map.with_index do |vol, index|\n id = \"#{uuid}--#{index}\"\n StorageVolume.new(vol, pool: self, id: id)\n end\n\n dbg { \"retrieved size=#{storage_volumes.size}, #{pool_info}, #{hv_info}\" }\n storage_volumes\n end", "def list_ai_vbox_vms()\n search_string = \"sol.11\"\n list_vbox_vms(search_string)\n return\nend", "def list_sql_history_snapshots\n update_area = params[:update_area]\n @instance = prepare_param_instance\n @dbid = prepare_param_dbid\n @sql_id = params[:sql_id]\n @parsing_schema_name = params[:parsing_schema_name]\n @time_selection_start = params[:time_selection_start]\n @time_selection_end = params[:time_selection_end]\n\n params[:groupby] = \"snap\" unless params[:groupby] # Default\n case params[:groupby].to_s\n when \"day\" then\n @begin_interval_sql = \"TRUNC(snap.Begin_Interval_Time)\"\n @end_interval_sql = \"TRUNC(snap.Begin_Interval_Time) + INTERVAL '1' DAY\"\n when \"snap\" then\n @begin_interval_sql = \"snap.Begin_Interval_Time\"\n @end_interval_sql = \"snap.End_Interval_Time\"\n else\n raise \"Unsupported value for parameter :groupby (#{params[:groupby]})\"\n end\n\n if @time_selection_start == nil || @time_selection_end == nil\n alter =sql_select_first_row [\"SELECT TO_CHAR(MIN(Begin_Interval_Time), '#{sql_datetime_minute_mask}') Time_Selection_Start,\n TO_CHAR(MAX(End_Interval_Time), '#{sql_datetime_minute_mask}') Time_Selection_End\n FROM DBA_Hist_Snapshot\n WHERE DBID = ?\n AND Instance_Number = ?\n \", @dbid, @instance]\n @time_selection_start =alter.time_selection_start\n @time_selection_end =alter.time_selection_end\n end\n\n @hist = sql_select_all([\"\\\n SELECT /* Panorama-Tool Ramm */\n #{@begin_interval_sql} Begin_Interval_Time,\n #{@end_interval_sql} End_Interval_Time,\n MIN(snap.Begin_Interval_Time) First_Occurrence,\n MAX(snap.End_Interval_Time) Last_Occurrence,\n COUNT(DISTINCT s.Plan_Hash_Value) Execution_Plans,\n MIN(Plan_Hash_Value) First_Plan_Hash_Value,\n MIN(Optimizer_Env_Hash_Value) First_Opt_Env_Hash_Value,\n SUM(Executions_Delta) Executions,\n SUM(Fetches_Delta) Fetches,\n SUM(Parse_Calls_Delta) Parse_Calls,\n SUM(Sorts_Delta) Sorts,\n SUM(Loads_Delta) Loads,\n SUM(Elapsed_Time_Delta)/1000000 Elapsed_Time_Secs,\n SUM(ELAPSED_TIME_Delta/1000000) / DECODE(SUM(EXECUTIONS_Delta), 0, 1, SUM(EXECUTIONS_Delta)) ELAPSED_TIME_SECS_PER_EXECUTE,\n SUM(Disk_Reads_Delta) Disk_Reads,\n SUM(DISK_READS_delta) / DECODE(SUM(EXECUTIONS_Delta), 0, 1, SUM(EXECUTIONS_Delta)) DISK_READS_PER_EXECUTE,\n SUM(Executions_Delta) / DECODE(SUM(Disk_Reads_Delta), 0, 1, SUM(Disk_Reads_Delta)) Execs_Per_Disk,\n SUM(Buffer_Gets_Delta) Buffer_Gets,\n SUM(BUFFER_GETS_delta) / DECODE(SUM(EXECUTIONS_Delta), 0, 1, SUM(EXECUTIONS_delta)) BUFFER_GETS_PER_Exec,\n SUM(BUFFER_GETS_delta) / DECODE(SUM(Rows_Processed_Delta), 0, 1, SUM(Rows_Processed_Delta)) BUFFER_GETS_PER_Row,\n SUM(Rows_Processed_Delta) Rows_Processed,\n SUM(Rows_Processed_Delta) / DECODE(SUM(EXECUTIONS_Delta), 0, 1, SUM(EXECUTIONS_Delta)) Rows_Processed_PER_EXECUTE,\n SUM(CPU_Time_Delta)/1000000 CPU_Time_Secs,\n SUM(ClWait_Delta) /1000000 Cluster_Wait_Time_Secs,\n SUM(ApWait_Delta) /1000000 Application_Wait_Time_secs,\n SUM(CCWait_Delta) /1000000 Concurrency_Wait_Time_secs,\n SUM(IOWait_Delta) /1000000 User_IO_Wait_Time_secs,\n SUM(PLSExec_Time_Delta)/1000000 PLSQL_Exec_Time_secs,\n 100 * (SUM(s.Buffer_Gets_Delta) - SUM(s.Disk_Reads_Delta)) / GREATEST(SUM(s.Buffer_Gets_Delta), 1) Hit_Ratio,\n MIN(s.Snap_ID) Min_Snap_ID,\n MAX(s.Snap_ID) Max_Snap_ID\n FROM DBA_Hist_SQLStat s\n JOIN dba_hist_snapshot snap ON snap.DBID = s.DBID AND snap.Instance_Number= s.instance_number AND snap.Snap_ID = s.Snap_ID\n WHERE s.DBID = ?\n AND s.Instance_Number = ?\n AND s.SQL_ID = ?\n AND snap.End_Interval_time > TO_TIMESTAMP(?, '#{sql_datetime_minute_mask}')\n AND snap.Begin_Interval_time < TO_TIMESTAMP(?, '#{sql_datetime_minute_mask}')\n #{@parsing_schema_name ? \"AND s.Parsing_Schema_Name = ?\" : \"\" }\n GROUP BY #{@begin_interval_sql}, #{@end_interval_sql}\n ORDER BY #{@begin_interval_sql}\n \", @dbid, @instance, @sql_id, @time_selection_start, @time_selection_end].concat(@parsing_schema_name ? [@parsing_schema_name] : []) )\n\n respond_to do |format|\n format.js {render :js => \"$('##{update_area}').html('#{j render_to_string :partial=>\"list_sql_history_snapshots\" }');\"}\n end\n end", "def list_instances token: nil\n execute do\n instances.list_instances(\n project_path,\n page_token: token\n )\n end\n end", "def current_node_snapshots\n nodes = {}\n snapshots = Hash.new { |h, k| h[k] = NodeSnapshot.new(k) }\n fetch_node_manager_states.each do |node_manager, states|\n available, unavailable = states.values_at(:available, :unavailable)\n available.each do |node_string, latency|\n node = nodes[node_string] ||= node_from(node_string)\n snapshots[node].viewable_by(node_manager, latency)\n end\n unavailable.each do |node_string|\n node = nodes[node_string] ||= node_from(node_string)\n snapshots[node].unviewable_by(node_manager)\n end\n end\n\n snapshots\n end", "def list_ks_vbox_vms()\n search_string = \"rhel|centos|ubuntu\"\n list_vbox_vms(search_string)\n return\nend", "def list_instances token: nil\n instances.list_instances parent: project_path, page_token: token\n end", "def parse_snapshot_names_from_output(cmd_output)\n header_text = 'Total snapshots:'\n snaps = cmd_output.split(\"\\n\").select { |s| !s.include? header_text }\n snaps.map { |s| s.strip }\n end", "def read_vms\n args = %w[list --all --no-header --json -o name,uuid]\n vms_arr = json { execute_prlctl(*args) }\n templates_arr = json { execute_prlctl(*args, '--template') }\n\n vms = vms_arr | templates_arr\n Hash[vms.map { |i| [i.fetch('name'), i.fetch('uuid')] }]\n end", "def index\n\n @virtualmachines = Virtualmachine.all\n\n end", "def vboxmanage_list_vms\n vms = Mash.new\n if vbox_host?\n so_cmd = \"VBoxManage list --sorted vms\"\n logger.trace(so_cmd)\n so = shell_out(so_cmd)\n\n if so.exitstatus == 0\n # parse the output\n so.stdout.lines.each do |line|\n case line\n when /^\"(\\S*)\" \\{(\\S*)\\}$/\n name = Regexp.last_match(1)\n uuid = Regexp.last_match(2)\n vms[name] = vboxmanage_vminfo(uuid)\n end\n end\n end\n end\n vms\n rescue Ohai::Exceptions::Exec\n logger.trace(\"Plugin VboxHost: Could not run 'VBoxManage list --sorted vms'. Skipping data\")\n end", "def vms\n vms = `VBoxManage list vms`.split(\"\\n\")\nend", "def list_snapshots_post(list_snapshots_param, opts = {})\n data, _status_code, _headers = list_snapshots_post_with_http_info(list_snapshots_param, opts)\n return data\n end", "def createEBSSnapshot(client=nil,description='',volume_id=nil)\n return false if volume_id.nil? || client.nil?\n # Fetch the Volume Name. This will be used in the description of the snapshot\n resp = client.describe_volumes({dry_run: false, volume_ids: [volume_id] })\n resp.volumes[0].tags.each do |t|\n if t.key=='Name'\n description = t.value unless t.value.empty?\n break\n end\n end\n # puts \"Taking snapshot of volume #{volume_id}...\"\n return client.create_snapshot({\n dry_run: false,\n volume_id: volume_id,\n description: description\n })\nend", "def delete_fusion_vm_snapshot(options)\n clone_list = []\n if options['clone'].to_s.match(/\\*/) or options['clone'].to_s.match(/all/)\n clone_list = get_fusion_vm_snapshots(options)\n clone_list = clone_list.split(\"\\n\")[1..-1]\n else\n clone_list[0] = options['clone']\n end\n clone_list.each do |clone|\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n message = \"Information:\\tDeleting snapshot \"+clone+\" for #{options['vmapp']} VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion deleteSnapshot '#{fusion_vmx_file}' '#{clone}'\"\n execute_command(options,message,command)\n end\n return\nend", "def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end", "def vm_instances\n @conn.vminstances\n end", "def snapshot(snapshot_id)\n snapshots(snapshot_id)[0]\n end", "def purgeOldSnapshots(profile,region)\n json = `aws --profile #{profile} --region #{region} ec2 describe-snapshots --owner-ids self`\n parsed = JSON.parse(json)\n parsed[\"Snapshots\"].each do |snapshot|\n desc = snapshot[\"Description\"]\n snapid = snapshot[\"SnapshotId\"]\n if desc.to_s.match('deleteafter')\n deletedate = desc.to_s.split('-deleteafter').last\n vol = desc.to_s.split('-deleteafter').first\n if Date.strptime(deletedate, \"%Y-%m-%d\") < Date.today\n puts \"Deleting #{snapid} for volume #{vol}- Due date: #{deletedate}\"\n `aws --profile #{profile} --region #{region} ec2 delete-snapshot --snapshot-id #{snapid}`\n end\n end\n end\nend", "def vms\n Vm.where(commit_id: @id)\n end", "def snapshot esurl, snapurl, options\n elastic esurl\n set_opts(options)\n set_repository snapurl, options\n initiate_snapshot snapurl\n end", "def show_list\n process_show_list(:conditions => [\"agent_type<>?\", \"VMDB\"])\n end", "def get_options_snapshots_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OptionsApi.get_options_snapshots ...\"\n end\n if @api_client.config.client_side_validation && opts[:'source'] && !['realtime', 'delayed'].include?(opts[:'source'])\n fail ArgumentError, 'invalid value for \"source\", must be one of realtime, delayed'\n end\n # resource path\n local_var_path = \"/options/snapshots\"\n\n # query parameters\n query_params = {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n query_params[:'at_datetime'] = opts[:'at_datetime'] if !opts[:'at_datetime'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ApiKeyAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OptionSnapshotsResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OptionsApi#get_options_snapshots\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def snapshot_diff(left:, right:)\n r = aptly_request('GET', \"api/snapshots/#{left}/diff/#{right}\")\n r.body\n end", "def enrollment_snapshot_data(params = {})\n scope 'default'\n get(\"enrollment/snapshot/#{params[:snapshot_id]}/data\")\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def versions(sku, offer, location = @location, publisher = @publisher)\n raise ArgumentError, \"No location specified\" unless location\n raise ArgumentError, \"No publisher specified\" unless publisher\n\n url = build_url(\n location, 'publishers', publisher, 'artifacttypes', 'vmimage',\n 'offers', offer, 'skus', sku, 'versions'\n )\n\n JSON.parse(rest_get(url)).map{ |element| element['name'] }\n end", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def get_volumes\n volumes = get(\"cloud-instances/#{guid}/volumes\")[\"volumes\"] || []\n\n volumes.map do |volume|\n get_volume(volume[\"volumeID\"])\n end\n end", "def snapshotInfo(_refresh = false)\n sni = nil\n @cacheLock.synchronize(:SH) do\n sni = @invObj.dupObj(snapshotInfo_locked)\n end\n (sni)\n end" ]
[ "0.8300678", "0.8081066", "0.80803514", "0.7840411", "0.7684221", "0.74065936", "0.7338083", "0.7323141", "0.7128714", "0.71278566", "0.7087461", "0.7066364", "0.7021482", "0.7017439", "0.7007793", "0.6985959", "0.67653114", "0.6729876", "0.67017585", "0.6624287", "0.6563861", "0.65006006", "0.6458754", "0.6448413", "0.64465046", "0.6406913", "0.6405337", "0.63883406", "0.63301635", "0.62805676", "0.6228139", "0.61884725", "0.6113403", "0.6108798", "0.60791034", "0.6045337", "0.5979892", "0.5978605", "0.59682804", "0.59388155", "0.5900715", "0.5847711", "0.5783967", "0.57480216", "0.57409066", "0.5739183", "0.57147497", "0.56887406", "0.5635378", "0.56136537", "0.561187", "0.5600888", "0.55973774", "0.5588255", "0.556661", "0.55440915", "0.55246335", "0.55127716", "0.5510142", "0.55085754", "0.5491713", "0.5485962", "0.5425254", "0.5410912", "0.54086816", "0.5407105", "0.5389393", "0.5386315", "0.5383381", "0.5364916", "0.5361215", "0.53467464", "0.53380424", "0.53370637", "0.5328516", "0.53259265", "0.5318399", "0.5313103", "0.5302692", "0.52862304", "0.528549", "0.5266934", "0.52668935", "0.52550596", "0.5250619", "0.5247684", "0.52410334", "0.5236917", "0.5225224", "0.52189344", "0.5216795", "0.5214758", "0.52102774", "0.5206672", "0.5203755", "0.51927596", "0.51838446", "0.51823866", "0.51801974", "0.5179028" ]
0.7795029
4
Public: Starts a VM. The VM must not be running in order to start it. options Hash of options: :headless Boolean which specifies to start the VM without a GUI console. The Fusion GUI must not be running in order to start the VM headless. (default: false) Examples
def start(options={}) unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? if running_response.data return Response.new :code => 1, :message => 'VM is already running' end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? unless options[:headless].blank? if Fusion.running? message = 'It looks like the Fusion GUI is currently running. ' message << 'A VM cannot be started in headless mode when the Fusion GUI is running. ' message << 'Exit the Fusion GUI and try again.' return Response.new :code => 1, :message => message end end command = "#{vmrun_cmd} start " command << "#{conf_file_response.data} " command << (options[:headless].blank? ? 'gui ' : 'nogui ') command << '2>&1' Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(options={})\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = @vm.running?\n return running_response unless running_response.successful?\n\n if running_response.data\n return Response.new :code => 1, :message => 'VM is already running'\n end\n\n conf_file_response = @vm.conf_file\n return conf_file_response unless conf_file_response.successful?\n\n unless options[:headless].blank?\n if Fusion.running?\n message = 'It looks like the Fusion GUI is currently running. '\n message << 'A VM cannot be started in headless mode when the Fusion GUI is running. '\n message << 'Exit the Fusion GUI and try again.'\n return Response.new :code => 1, :message => message\n end\n end\n\n command = \"#{vmrun_cmd} start \"\n command << \"'#{conf_file_response.data}' \"\n\n command << (options[:headless].blank? ? 'gui ' : 'nogui ')\n command << '2>&1'\n\n command_exec = Fission::Action::ShellExecutor.new command\n Response.from_shell_executor command_exec.execute\n end", "def start\n register unless registered?\n \n VirtualBox.run_command! ['VBoxManage', '--nologo', 'startvm', uid,\n '--type', gui ? 'gui' : 'headless']\n self\n end", "def start(options={})\n Fission::Action::VM::Starter.new(self).start(options)\n end", "def boot_fusion_vm(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Starting:\\tVM \"+options['name']\n if options['text'] == true or options['headless'] == true or options['serial'] == true\n command = \"\\\"#{options['vmrun']}\\\" -T fusion start \\\"#{fusion_vmx_file}\\\" nogui &\"\n else\n command = \"\\\"#{options['vmrun']}\\\" -T fusion start \\\"#{fusion_vmx_file}\\\" &\"\n end\n execute_command(options,message,command)\n if options['serial'] == true\n if options['verbose'] == true\n handle_output(options,\"Information:\\tConnecting to serial port of #{options['name']}\")\n end\n begin\n socket = UNIXSocket.open(\"/tmp/#{options['name']}\")\n socket.each_line do |line|\n handle_output(line)\n end\n rescue\n handle_output(options,\"Warning:\\tCannot open socket\")\n quit(options)\n end\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n end\n return\nend", "def start(quiet=false)\n if powered_off?\n log_stdout \"starting ...\", quiet\n\n if(@headless)\n type = 'headless'\n else\n type = 'gui'\n end\n `VBoxManage startvm \"#{@vbox_name}\" --type #{type}`\n wait_for_guestcontrol\n else\n log_stdout \"Already started ...\", quiet\n end\n end", "def start(mode)\n execute(\"startvm\", @uuid, \"--type\", mode.to_s)\n end", "def start_vm\n unless File.exists?(@image_file) and File.owned?(@image_file)\n @log.error \"Image file #{@image_file} doesn't exist or is not owned by you!\"\n exit 255\n end\n @log.info \"VM Will use SSH Port #{@vm_ssh_port} and VNC Port #{@vm_vnc_port}\"\n @log.info \"Starting vmm now...\"\n @log.debug \"vmm command line is: \" + vmm_command_line()\n @vmm_r, @vmm_w, @vmm_pid = PTY.spawn vmm_command_line()\n @vmm_r.expect(@vmm_prompt,@vmm_timeout) do |line|\n true\n end\n @vm_running = true\n @log.debug \"vmm instance pid is #{@vmm_pid}\"\n end", "def start options=nil\n options ||= {}\n\n if running?\n return unless options[:force]\n stop\n end\n\n # Permissions are handled by the script, use: :sudo => false\n run_script :start, :sudo => false\n end", "def start_virtual_machine(vm_name, cloud_service_name)\n vm = get_virtual_machine(vm_name, cloud_service_name)\n if vm\n if vm.status == 'ReadyRole'\n Loggerx.error \"Cannot perform the start operation on started virtual machine.\"\n else\n path = \"/services/hostedservices/#{vm.cloud_service_name}/deployments/#{vm.deployment_name}/roleinstances/#{vm.vm_name}/Operations\"\n body = Serialization.start_virtual_machine_to_xml\n Loggerx.info \"Starting virtual machine \\\"#{vm.vm_name}\\\" ...\"\n request = ManagementHttpRequest.new(:post, path, body)\n request.call\n end\n else\n Loggerx.error \"Cannot find virtual machine \\\"#{vm_name}\\\" under cloud service \\\"#{cloud_service_name}\\\".\"\n end\n end", "def start(obj_vm)\n\t\trun_hyperv_cmd(\"{#@BASE_CMD} -T ws start \\'#{obj_vm.location}\\' nogui\")\n\tend", "def configure_vs_fusion_vm(options)\n options['os-type'] = get_vs_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def start(options = {})\n setup options\n run!\n end", "def start!(options = {})\n trait[:started] = false\n startup(options)\n end", "def start_virtual_machine(vm_name, cloud_service_name)\n vm = get_virtual_machine(vm_name, cloud_service_name)\n if vm\n if vm.status == 'ReadyRole'\n Azure::Loggerx.error 'Cannot perform the start operation on started virtual machine.'\n else\n path = \"/services/hostedservices/#{vm.cloud_service_name}/deployments/#{vm.deployment_name}/roleinstances/#{vm.vm_name}/Operations\"\n body = Serialization.start_virtual_machine_to_xml\n Azure::Loggerx.info \"Starting virtual machine \\\"#{vm.vm_name}\\\" ...\"\n request = client.management_request(:post, path, body: body)\n request.call\n end\n else\n Azure::Loggerx.error \"Cannot find virtual machine \\\"#{vm_name}\\\" under cloud service \\\"#{cloud_service_name}\\\".\"\n end\n end", "def create_vm(opts = {})\n opts = opts.with_indifferent_access.reverse_merge(\n VSphereConfig.create_vm_defaults.symbolize_keys || {}\n )\n\n opts[:template_path] = compute.image if compute.image\n\n VSphere.with_connection do |vs|\n dest_folder = opts[:dest_folder]\n vm_name = opts[:name] || \"#{compute.image}-\"\\\n \"#{SecureRandom.hex(4)}-#{Time.new.strftime(\"%Y%m%d\")}\"\n exception_cb = lambda do |_p1|\n LabManager.logger.warn(\n \"Failed attempt to create virtual machine: template_name: #{opts[:template_path]}\"\\\n \", vm_name: #{vm_name}\"\n )\n end\n\n Retryable.retryable(\n tries: VSphereConfig.create_vm_defaults[:vm_clone_retry_count],\n on: [RbVmomi::Fault, CreateVMError, Fog::Compute::Vsphere::NotFound],\n exception_cb: exception_cb,\n sleep: ->(n) { Random.rand(n*3..n*3+10.0) }\n ) do\n LabManager.logger.info \"creating machine with name: #{vm_name} options: #{opts.inspect}\"\n machine = vs.vm_clone(\n 'datacenter' => opts[:datacenter],\n 'datastore' => opts[:datastore],\n 'template_path' => opts[:template_path],\n 'name' => vm_name,\n 'cluster' => opts[:cluster],\n 'linked_clone' => opts[:linked_clone],\n 'dest_folder' => dest_folder,\n 'power_on' => opts[:power_on],\n 'wait' => true\n )\n\n setup_network_interfaces({\n uuid: machine['new_vm']['uuid'],\n connection: vs,\n network_name: VSphereConfig.create_vm_defaults[:network_interface_name]\n })\n\n fail CreateVMError, \"Creation of (#{vm_name}) machine failed, retrying\" unless machine || machine['vm_ref']\n set_provider_data(machine['new_vm'], vs: vs)\n end\n\n add_machine_to_drs_rule(\n vs,\n group: opts[:add_to_drs_group],\n machine: \"#{dest_folder}/#{vm_name}\",\n datacenter: opts[:datacenter]\n ) if opts[:add_to_drs_group]\n end\n poweron_vm unless compute.provider_data['power_state'] == 'poweredOn'\n rescue\n # Try to free unsuccessfully started/configured/... VM\n begin\n terminate_vm\n rescue\n nil\n end if instance_uuid\n raise\n end", "def start! options=nil\n options ||= {}\n\n if running?\n return unless options[:force]\n stop!\n end\n\n # Permissions are handled by the script, use: :sudo => false\n run_script! :start, :sudo => false\n end", "def run_install(options={})\n run_command(\"curl -s get.gvmtool.net | bash\", options)\n fn = command\n # create gvm2 executable to wrap gvm shell command\n cmd = \"if [ ! -s #{fn} ]; then mkdir -p $HOME/bin; echo -e '#!/usr/bin/env bash\\n. type gvm &> /dev/null || source $HOME/.gvm/bin/gvm-init.sh || exit 1\\ngvm $@' >> #{fn}; chmod +x #{fn}; fi;\"\n options[:shellescape] = false\n run_command(cmd, options)\n end", "def start\n @virtual_machine_state = 'NOSTATE'\n Profitbricks.request :start_server, server_id: self.id\n return true\n end", "def configure_parallels_vm(options)\n check_parallels_is_installed(options)\n if options['vmnet'].to_s.match(/hostonly/)\n nic_name = check_parallels_hostonly_network(options)\n end\n disk_name = get_parallels_disk(options)\n socket_name = \"/tmp/#{options['name']}\"\n check_parallels_vm_doesnt_exist(options)\n register_parallels_vm(options['name'],options['os-type'])\n add_serial_to_parallels_vm(options)\n change_parallels_vm_mem(options['name'],options['memory'])\n change_parallels_vm_cpu(options['name'],options['vcpus'])\n if options['file'].to_s.match(/[0-9]|[a-z]/)\n attach_file_to_parallels_vm(options['name'],options['file'])\n end\n if options['mac'].to_s.match(/[0-9]/)\n change_parallels_vm_mac(options['name'],options['mac'])\n else\n options['mac'] = get_parallels_vm_mac(options)\n end\n handle_output(options,\"Created Parallels VM #{options['name']} with MAC address #{options['mac']}\")\n return\nend", "def configure_vs_parallels_vm(options)\n options['os-type'] = \"other\"\n configure_parallels_vm(options)\n return\nend", "def make_virtualbox_vm(options)\n @colour.notify \"Ensuring following commands run from directory '#{options[:project_dir]}/Vagrantfile'\"\n @colour.notify 'Executing vagrant up (this may take a while)'\n\n system \"cd '#{options[:project_dir]}' && vagrant up #{'--debug' if options[:debug]} #{'--no-color' if options[:disable_colour]}\"\n\n return options\nend", "def configure_ks_fusion_vm(options)\n options['os-type'] = get_ks_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def configure_ps_fusion_vm(options)\n options['os-type'] = get_ps_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def configure_nb_fusion_vm(options)\n options['os-type'] = get_nb_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def halt_fusion_vm(options)\n stop_fusion_vm(options)\nend", "def configure_pe_fusion_vm(options)\n options['os-type'] = get_pe_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def start\n if options.master?\n start_master(options)\n elsif options.slave?\n start_slave(options)\n else\n invoke :help, [:start]\n end\n end", "def create_vm(cpu, ram, capacity, name, cluster)\n return nil if cluster.networks.empty?\n\n vm_config = creation_config(cpu, ram, capacity, add_prefix(name), cluster.networks.first)\n vm = @folder.CreateVM_Task(config: vm_config, pool: cluster.resource_pool).wait_for_completion\n VSphere::VirtualMachine.new vm, folder: self\n end", "def configure_ai_fusion_vm(options)\n options['os-type'] = get_ai_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def start_kvm(name)\n unless(system(\"virsh start #{name}\"))\n raise \"Failed to start node: #{name}\"\n end\nend", "def start_server(options = {})\n @is_owner_process = true\n\n method = extract_deploy_method(options)\n if method == :InProc\n @is_in_proc_server = true\n start_local_server(options)\n else #method == :StandAlone\n @is_in_proc_server = false\n start_remote_server(options)\n end\n end", "def import(options)\n execute(:import_vm, options)\n end", "def create_kvm_instance(name, opts={})\n cmd = \"virt-install -n #{name} --ram #{opts[:memory]} --disk \" <<\n \"path=#{File.join(KVM_HOME, 'storage', \"#{name}.qcow2\")},device=disk,bus=virtio,format=qcow2 \" <<\n \"-v --import --noautoconsole --vcpus=#{opts[:vcpus]},maxvcpus=#{opts[:maxvcpus]}\" \n unless(system(cmd))\n raise \"Failed to create KVM instance!\"\n end \nend", "def configure_js_fusion_vm(options)\n options['os-type'] = get_js_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def configure_fusion_vm(options)\n (fusion_vm_dir,fusion_vmx_file,fusion_disk_file) = check_fusion_vm_doesnt_exist(options)\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking Fusion VM configuration directory\")\n end\n check_dir_exists(options,fusion_vm_dir)\n uid = options['uid']\n check_dir_owner(options,fusion_vm_dir,uid)\n if not options['mac'].to_s.match(/[0-9]/)\n options['vm'] = \"fusion\"\n options['mac'] = generate_mac_address(options['vm'])\n end\n options = create_fusion_vm_vmx_file(options,fusion_vmx_file)\n if not options['file'].to_s.match(/ova$/)\n create_fusion_vm_disk(options,fusion_vm_dir,fusion_disk_file)\n check_file_owner(options,fusion_disk_file,options['uid'])\n end\n handle_output(options,\"\")\n handle_output(options,\"Information:\\tClient: #{options['name']} created with MAC address #{options['mac']}\")\n handle_output(options,\"\")\n return options\nend", "def configure_ob_fusion_vm(options)\n options['os-type'] = get_ob_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def init(options)\n Thread.main[:name] = \"Main thread\"\n # We don't dump PATH info because at this point it's\n # unlikely to be changed.\n dump_ruby_environment\n check_rvm_using_wrapper_script(options)\n return sanitize_spawn_options(options)\n end", "def add_fusion_vm_network(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if !vm_list.to_s.match(/#{options['name']}/)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n message = \"Information:\\tAdding network interface to \"+options['name']\n command = \"'#{options['vmrun']}' addNetworkAdapter '#{fusion_vmx_file}' #{options['vmnetwork']}\"\n execute_command(options,message,command)\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def start_pvm_instance(instance_id)\n post(\n \"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action\",\n {\"action\" => \"start\"}.to_json\n )\n end", "def boot_vm\n start_vm()\n @log.debug \"Loading initial vm...\"\n vmm_command(eb(@config['vmm']['loadinit']))\n end", "def start\n log_debug \"[ #{@node}/#{@environment} ] - Start Proxmox LXC Container ...\"\n with_proxmox do |proxmox|\n run_proxmox_task(proxmox, :post, @lxc_details[:pve_node], \"lxc/#{@lxc_details[:vm_id]}/status/start\")\n end\n end", "def create_vm(vm, params, namespace)\n vm = param_substitution!(vm, params)\n os_labels = labels || {}\n vm = deep_merge!(vm,\n :spec => {\n :running => false\n },\n :metadata => {\n :namespace => namespace\n }\n )\n\n vm = deep_merge!(vm,\n :metadata => {\n :labels => {\n OS_LABEL => os_labels[OS_LABEL_SYMBOL]\n }\n }\n ) if os_labels[OS_LABEL_SYMBOL]\n\n # Send the request to create the virtual machine:\n vm = service.create_vm(vm)\n end", "def suspend_fusion_vm(options)\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Stopping:\\tVirtual Box VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion suspend '#{fusion_vmx_file}'\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} not running\")\n end\n end\n return\nend", "def create_fusion_vm_disk(options,fusion_vm_dir,fusion_disk_file)\n if File.exist?(fusion_disk_file)\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM disk '#{fusion_disk_file}' already exists for #{options['name']}\")\n quit(options)\n end\n check_dir_exists(options,fusion_vm_dir)\n if options['host-os-name'].to_s.match(/Darwin/)\n vdisk_bin = \"/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager\"\n else\n vdisk_bin = \"/usr/bin/vmware-vdiskmanager\"\n end\n message = \"Creating \\t#{options['vmapp']} disk '\"+fusion_disk_file+\"' for \"+options['name']\n command = \"cd \\\"#{fusion_vm_dir}\\\" ; \\\"#{vdisk_bin}\\\" -c -s \\\"#{options['size']}\\\" -a LsiLogic -t 0 \\\"#{fusion_disk_file}\\\"\"\n execute_command(options,message,command)\n return\nend", "def check_fusion_vm_is_running(options)\n list_vms = get_running_fusion_vms(options)\n if list_vms.to_s.match(/#{options['name']}.vmx/)\n running = \"yes\"\n else\n running = \"no\"\n end\n return running\nend", "def list_vs_fusion_vms(options)\n options['search'] = \"vmware\"\n list_fusion_vms(search_string)\n return\nend", "def clone(options = {})\n requires :name, :datacenter, :path\n\n # Convert symbols to strings\n req_options = options.each_with_object({}) { |(k, v), hsh| hsh[k.to_s] = v; }\n\n # Give our path to the request\n req_options['template_path'] = \"#{relative_path}/#{name}\"\n req_options['template_datacenter'] = datacenter.to_s\n req_options['datacenter'] ||= datacenter.to_s\n\n # Perform the actual clone\n clone_results = service.vm_clone(req_options)\n\n # We need to assign the service, otherwise we can't reload the model\n # Create the new VM model. TODO This only works when \"wait=true\"\n new_vm = self.class.new(clone_results['new_vm'].merge(service: service))\n\n # We need to assign the collection otherwise we\n # cannot reload the model.\n new_vm.collection = collection\n\n # Return the new VM model.\n new_vm\n end", "def make_proxmox_vm(vm)\n # * Disk: Use a SSD if possible. Preallocated might provide faster access.\n hd_file=@disk_folder+\"/#{vm}-HD.vdi\"\n\n # NOTE! Lots of code also available for inspiration in\n # /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/driver/version_4_3.rb\n\n\n unless(File.file?(@install_iso))\n raise \"ERROR - you need to download the ISO file at #{@install_iso} from https://www.proxmox.com/downloads\"\n end\n\n ide_storage_name=\"IDE Controller for #{vm}\"\n description = \"Proxmox-in-Virtualbox generated by https://github.com/mrjcleaver/proxmox-setup \\n\" + \\\n \"Generated \"+Time.now.to_s+ \" using \"+@install_iso\n\n # http://nakkaya.com/2012/08/30/create-manage-virtualBox-vms-from-the-command-line/\n # https://www.virtualbox.org/manual/ch08.html\n run_shell_cmd(\"VBoxManage createvm --name '#{vm}' --register\")\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --description '#{description}'\")\n # Note: Enabling the I/O APIC is required for 64-bit guest operating systems (page 48, manual)\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --memory '#{@ram_mb}' --acpi on --ioapic on --boot1 dvd --vram 12\")\n\n run_shell_cmd(\"VBoxManage modifyvm '#{vm}' --ostype Debian --audio none\")\n\n run_shell_cmd(\"VBoxManage createhd --filename '#{hd_file}' --size '#{@hd_size_mb}' --variant Fixed\")\n run_shell_cmd(\"VBoxManage storagectl '#{vm}' --name '#{ide_storage_name}' --add ide\")\n\n run_shell_cmd(\"VBoxManage storageattach '#{vm}' --storagectl '#{ide_storage_name}' --port 0 --device 0 --type hdd --medium '#{hd_file}' --nonrotational=#{@hd_on_ssd}\")\n\n run_shell_cmd(\"VBoxManage storageattach '#{vm}' --storagectl '#{ide_storage_name}' --port 1 --device 0 --type dvddrive --medium '#{@install_iso}'\")\n\n run_shell_cmd(\"VBoxManage setextradata '#{vm}' GUI/MouseCapturePolicy Default\")\nend", "def check_fusion_vm_exists(options)\n set_vmrun_bin(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n if not File.exist?(fusion_vmx_file)\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n end\n exists = false\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} exists\")\n end\n exists = true\n end\n return exists\nend", "def ssh(args, options)\n perform_action(args[0], options, 'SSH') do |vm|\n rc = vm.info\n\n if OpenNebula.is_error?(rc)\n STDERR.puts rc.message\n exit(-1)\n end\n\n if vm.lcm_state_str != 'RUNNING'\n STDERR.puts 'VM is not RUNNING, cannot SSH to it'\n exit(-1)\n end\n\n # Get user to login\n username = vm.retrieve_xmlelements('//TEMPLATE/CONTEXT/USERNAME')[0]\n\n if !username.nil?\n login = username.text\n elsif !args[1].nil?\n login = args[1]\n else\n login = 'root'\n end\n\n # Get CMD to run\n options[:cmd].nil? ? cmd = '' : cmd = options[:cmd]\n\n # Get NIC to connect\n if options[:nic_id]\n nic = vm.retrieve_xmlelements(\n \"//TEMPLATE/NIC[NIC_ID=\\\"#{options[:nic_id]}\\\"]\"\n )[0]\n else\n nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH=\"YES\"]')[0]\n end\n\n nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0] if nic.nil?\n\n if nic.nil?\n STDERR.puts 'No NIC found'\n exit(-1)\n end\n\n # If there is node port\n if nic['EXTERNAL_PORT_RANGE']\n ip = vm.to_hash['VM']['HISTORY_RECORDS']['HISTORY']\n ip = [ip].flatten[-1]['HOSTNAME']\n port = Integer(nic['EXTERNAL_PORT_RANGE'].split(':')[0]) + 21\n else\n ip = nic['IP']\n port = 22\n end\n\n options[:ssh_opts].nil? ? opts = '' : opts = options[:ssh_opts]\n\n if opts.empty?\n exec('ssh', \"#{login}@#{ip}\", '-p', port.to_s, cmd.to_s)\n else\n exec('ssh', *opts.split, \"#{login}@#{ip}\", '-p', port.to_s, cmd.to_s)\n end\n end\n\n # rubocop:disable Style/SpecialGlobalVars\n $?.exitstatus\n # rubocop:enable Style/SpecialGlobalVars\n end", "def start(vmname, action = 'start')\n uri = @uri + \"/#{vmname}/#{action}?api-version=#{api_version}\"\n uri\n end", "def show_fusion_vm_network(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n message = \"Information:\\tGetting network interface list for \"+options['name']\n command = \"'#{options['vmrun']}' listNetworkAdapters '#{fusion_vmx_file}'\"\n output = execute_command(options,message,command)\n handle_output(options,output)\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def execute\n log.info 'Creating the Basic VM'\n placement_spec = VMPlacementHelper.get_placementspec_vm(service_manager.vapi_config, datacenter_name, folder_name, datastore_name)\n standard_network = NetworkHelper.get_standard_network_mapping(service_manager.vapi_config, @datacenter_name, standard_portgroup_name)\n boot_disk = VCENTER_HARDWARE_DISK_CLASS::CreateSpec.new('type' => VCENTER_HARDWARE_DISK_CLASS::HostBusAdapterType::SCSI,\n 'scsi' => VCENTER_HARDWARE_MODULE::ScsiAddressSpec.new('bus'=>0,'unit'=>0),\n 'new_vmdk' => VCENTER_HARDWARE_DISK_CLASS::VmdkCreateSpec.new() )\n data_disk = VCENTER_HARDWARE_DISK_CLASS::CreateSpec.new('new_vmdk' => VCENTER_HARDWARE_DISK_CLASS::VmdkCreateSpec.new())\n ethernet_nic_0 = VCENTER_HARDWARE_ETHERNET_CLASS::CreateSpec.new('start_connected' => true,\n 'backing' => VCENTER_HARDWARE_ETHERNET_CLASS::BackingSpec.new(\n 'type' => VCENTER_HARDWARE_ETHERNET_CLASS::BackingType::STANDARD_PORTGROUP,\n 'network' => standard_network))\n boot_device_order = [VCENTER_HARDWARE_BOOT_DEVICE_CLASS::EntryCreateSpec.new('type' => VCENTER_HARDWARE_BOOT_DEVICE_CLASS::Type::ETHERNET),\n VCENTER_HARDWARE_BOOT_DEVICE_CLASS::EntryCreateSpec.new('type' => VCENTER_HARDWARE_BOOT_DEVICE_CLASS::Type::DISK)]\n vm_create_spec = VCENTER_VM_CLASS::CreateSpec.new('name' => vm_name,\n 'guest_OS' => VCENTER_VM_GUESTOS_CLASS::WINDOWS_8_64,\n 'placement' => placement_spec,\n 'disks' => [boot_disk, data_disk],\n 'nics' => [ethernet_nic_0],\n 'boot_devices' => boot_device_order)\n log.info 'The CreateVM Spec is '\n #Pretty print the create spec of the VM.\n pp vm_create_spec\n vm_id = vm_svc.create(vm_create_spec)\n log.info \"Created vm #{vm_name} with the VM Identifier #{vm_id}\"\n end", "def config_vnc(options = {})\n requires :instance_uuid\n service.vm_config_vnc(options.merge('instance_uuid' => instance_uuid))\n end", "def start!\n message \"Launching minimum_instances\"\n launch_minimum_instances\n message \"Waiting for master to boot up\" \n \n wait_for_all_instances_to_boot\n \n setup_cloud\n end", "def bootstrap(options = {})\n unless @vm\n warn 'No VM assigned to bootstrap chef-client'\n return false\n end\n debug 'Bootstrapping...'\n i = 30\n while i && !port_open?(ip, '22')\n i -= 1\n sleep(15)\n end\n result = system(\"#{bootstrap_command(options)}\")\n error 'Some error during bootstrapping' unless result\n result\n end", "def prepare\n if requires_snapshot?\n info \"Preparing vm #{name} ...\"\n restart { immutate }\n wait_for_boot\n pause\n snapshot\n end\n true\n end", "def register_parallels_vm(options)\n message = \"Registering Parallels VM \"+options['name']\n command = \"prlctl create \\\"#{options['name']}\\\" --ostype \\\"#{options['os-type']}\\\"\"\n execute_command(options,message,command)\n return\nend", "def show_fusion_vm_config(options)\n fusion_vmx_file = \"\"\n exists = check_fusion_vm_exists(options)\n if exists == true\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if File.exist?(fusion_vmx_file)\n print_contents_of_file(options,\"#{options['vmapp']} configuration\",fusion_vmx_file)\n end\n end\n return\nend", "def configure_other_fusion_vm(options)\n options['os-type'] = get_other_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def configure_ay_fusion_vm(options)\n options['os-type'] = get_ay_fusion_guest_os(options)\n options = configure_fusion_vm(options)\n return\nend", "def set_fusion_vm_dir(options)\n if options['host-os-name'].to_s.match(/Linux/)\n options['fusiondir'] = options['home']+\"/vmware\"\n end\n if options['host-os-name'].to_s.match(/Linux|Win/)\n options['vmapp'] = \"VMware Workstation\"\n else\n options['vmapp'] = \"VMware Fusion\"\n end\n return\nend", "def configure_nb_parallels_vm(options)\n options['os-type'] = \"freebsd-4\"\n configure_parallels_vm(options)\n return\nend", "def get_fusion_vm_screen(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n screencap_file = options['tmpdir']+\"/\"+options['name']+\".png\"\n message = \"Information:\\tCapturing screen of \"+options['name']+\" to \"+screencap_file\n command = \"'#{options['vmrun']}' captureScreen '#{fusion_vmx_file}' '#{screencap_file}''\"\n execute_command(options,message,command)\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Not Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def run(options)\n configure_logging\n\n case options[:action]\n when :attach\n # resolve cloud name.\n cloud_file = RightScale::AgentConfig.cloud_file_path\n cloud_name = options[:cloud]\n if cloud_name.nil? && File.file?(cloud_file)\n cloud_name = File.read(cloud_file).strip\n end\n cloud_name = 'none' if cloud_name.to_s.empty?\n\n cloud_dir = File.dirname(cloud_file)\n output_file = File.join(RightScale::Platform.filesystem.spool_dir, 'rightscale', 'user-data.txt')\n output_dir = File.dirname(output_file)\n\n if File.exist?(InstanceState::STATE_FILE) && !options[:force]\n puts \"It appears this system is already managed by RightScale; cannot continue\"\n puts\n puts \"To override this decision, use the --force option. Please make sure you\"\n puts \"know what you are doing! Connecting this system to a server when it is\"\n puts \"already connected to another server could cause unexpected behavior in\"\n puts \"the RightScale dashboard, and in certain cases, data loss!\"\n exit(-1)\n end\n\n puts \"Fetching launch settings from RightScale\"\n url = options[:url]\n data = http_get(url, false)\n\n unless data =~ /RS_rn_id/i\n Log.error(\"Malformed launch settings: #{data}\")\n raise MalformedResponse, \"Launch settings do not look well-formed; did you specify the right URL?\"\n end\n\n puts \"Creating cloud-family hint file (#{cloud_file})\"\n FileUtils.mkdir_p(cloud_dir)\n File.open(cloud_file, 'w') do |f|\n f.puts cloud_name\n end\n\n puts \"Writing launch settings to file\"\n FileUtils.mkdir_p(output_dir)\n File.open(output_file, 'w') do |f|\n f.puts data\n end\n\n puts \"Done connecting server to RightScale. Will now attempt to start the RightLink services.\"\n puts \"If starting of services fails, you can attempt to start them by rebooting.\"\n if RightScale::Platform.windows?\n puts `net start rightscale`\n exit $?.exitstatus unless $?.success?\n elsif RightScale::Platform.linux? || RightScale::Platform.darwin?\n puts `/etc/init.d/rightscale start && /etc/init.d/rightlink start`\n exit $?.exitstatus unless $?.success?\n else\n raise UnsupportedPlatform, \"Starting services is not supported for this platform.\"\n end\n exit\n else\n puts Usage.scan(__FILE__)\n exit\n end\n rescue SystemExit => e\n raise e\n rescue Exception => e\n fail(e)\n end", "def configure_ps_parallels_vm(options)\n options['os-type'] = \"ubuntu\"\n configure_parallels_vm(options)\n return\nend", "def stop(options={})\n Fission::Action::VM::Stopper.new(self).stop(options)\n end", "def start()\n data = JSON.generate(:resume => nil)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end", "def vm_management(options = {})\n Azure::VirtualMachineManagement::VirtualMachineManagementService.new(default_client(options))\n end", "def start_command\n can_start_instance? or return nil\n\n kvm = SysConf.value_for('kvm_bin')\n basedir = SysConf.value_for(:pid_dir)\n\n inst_num = maint_mode? ? 0 : laboratory.next_instance_to_start\n inst_name = laboratory.instance_name(inst_num)\n mac = laboratory.mac_for_instance(inst_num)\n disks = disk_devs.map {|d| d.dev_string }.join(' ')\n\n pidfile = File.join(basedir,\"#{inst_name}.pid\")\n socket = File.join(basedir, \"#{inst_name}.socket\")\n\n [ \"#{kvm} -name #{inst_name} -m #{ram} -localtime -pidfile #{pidfile}\",\n \"-usb -usbdevice tablet\",\n \"-net nic,macaddr=#{mac},model=#{net_iface.name}\",\n \"-net tap,ifname=tap_#{inst_name},script=/etc/kvm/kvm-ifup\",\n \"-boot c #{disks}\",\n \"-daemonize -vnc none\",\n \"-monitor unix:#{socket},server,nowait\"\n ].join(' ')\n end", "def create_virtual_machine(vm)\n kubevirt_client.create_virtual_machine(vm)\n end", "def start_monit_service(service_name, options = {})\n options = options.clone\n host = options.delete(:host) || 'localhost',\n port = options.delete(:port)\n timeout_sec = options.delete(:timeout_sec) || DEFAULT_MONIT_SERVICE_HOST_PORT_TIMEOUT_SEC\n raise \"Invalid options: #{options}\" unless options.empty?\n\n # Wait for the service status to stabilize to avoid the\n # \"Other action already in progress -- please try again later\" error.\n\n get_stable_monit_service_status(service_name)\n\n shell_out!(\"monit start #{service_name}\")\n\n # Wait for service status to stabilize once again.\n get_stable_monit_service_status(service_name)\n\n if host && port\n require 'waitutil' # Only require this when necessary, so that the gem is installed.\n Chef::Log.info(\n \"Waiting for service #{service_name} to become available on host #{host}, port #{port}\")\n WaitUtil.wait_for_service(service_name, host, port, delay_sec: 1,\n timeout_sec: timeout_sec)\n end\n end", "def console\n create_private_disk\n @results['test_start'] = Time.now()\n passed = []\n boot_vm() if @options[:vmm_enabled]\n prep\n freeze_vm() if @options[:vmm_enabled]\n # Print out ssh & vnc port, and freeze name.\n @log.info \"Handing off VM to you.. Type #{@config['vmm']['quitvmm']} to end session.\"\n @log.info \"Ports - SSH: #{@vm_ssh_port} VNC: #{@vm_vnc_port}\"\n\n # hand off console.\n print @config['vmm']['prompt']\n begin\n system('stty raw -echo')\n Thread.new{ loop { @vmm_w.print $stdin.getc.chr } }\n loop { $stdout.print @vmm_r.readpartial(512); STDOUT.flush }\n rescue\n nil # User probably caused the VMM to exit.\n ensure\n system \"stty -raw echo\"\n end\n # Done via the user?\n # stop_vm()\n cleanup_private_disk\n return\n end", "def start_vm(vmname)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show vm name=#{vmname}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"start vm name=#{vmname}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end", "def stdopt(\n config, hostname:, cpus: 1, memory_mb: 1024, box: \"ubuntu/focal64\"\n)\n config.vm.box = box\n config.vm.hostname = hostname\n\n config.ssh.forward_agent = true\n\n config.vm.synced_folder \".\", \"/host_share\"\n\n config.vm.provider \"virtualbox\" do |vbox|\n vbox.linked_clone = true\n vbox.cpus = cpus\n vbox.memory = memory_mb\n # Force allocation of all specified VM memory at start. Change the 1 below\n # to 0 to allow for \"as needed allocation\".\n vbox.customize [\"setextradata\", :id, \"VBoxInternal/RamPreAlloc\", 1]\n end\nend", "def create_kvm(kvm_name, template, options)\n ensure_name_availability!(kvm_name)\n clone_kvm(kvm_name, template)\n device = mount_kvm_volume(kvm_name)\n address = update_kvm_ip(kvm_name)\n update_hostname(kvm_name)\n make_console_accessible(kvm_name)\n unmount_kvm_volume(kvm_name, device)\n create_kvm_instance(kvm_name, options)\n puts \"KVM Node #{kvm_name} available at: #{address}\"\nend", "def start_cloud(resource, vm_ips, vm_ip_roles)\n\n puts \"Starting the cloud\"\n \n # ...\n\n end", "def start!(mode = nil)\n\t\traise \"Server must be stopped\" unless status == :stopped\n\n\t\tgenerate_config! unless slave?\n\n\t\tDatabass.pg_ctl(path, :start, '-w', '-o', \"-c port=#{port}\")\n\tend", "def reboot_fusion_vm(options)\n reset_fusion_vm(options)\nend", "def get_fusion_vm_status(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Not Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def create_vm(agent_id, stemcell_id, resource_pool, network_spec = nil,\n existing_disk = nil, environment = nil)\n with_thread_name(\"create_vm(#{agent_id}\") do\n begin\n validate_vm_resource_pool(resource_pool)\n # Check whether ephemeral disk is specified\n ephemeral_disk = (!resource_pool['disk'].nil? &&\n resource_pool['disk'].to_i > 0)\n # Create agent settings for the VM\n agent_env = initial_agent_settings(agent_id, agent_id, network_spec,\n ephemeral_disk, [],\n environment, @options['blobstore'],\n @options['agent']['mbus'])\n iso_uuid = create_and_upload_env_iso(agent_id, agent_env)\n # Get the disk id of the newly created image.\n iso_disk_id = @image_manager.get_image(iso_uuid)['vm_disk_id']\n # Get disk id of the uploaded stemcell image\n stemcell_disk_id = @image_manager\n .get_image(stemcell_id)['vm_disk_id']\n network = create_vm_nic_config(network_spec)\n ephemeral_disk_size = ephemeral_disk ? resource_pool['disk'] : nil\n vm_create_specs = create_vm_specs(agent_id, resource_pool['cpu'],\n resource_pool['ram'], agent_env,\n iso_disk_id, stemcell_disk_id,\n network, ephemeral_disk_size)\n @logger.debug(\"VM Specs: #{vm_create_specs}\")\n @vm_manager.create_virtual_machine(vm_create_specs)\n @logger.info(\"Virtual machine [#{agent_id}] created.\")\n unless existing_disk.nil?\n existing_disk.each do |disk_id|\n attach_disk(agent_id, disk_id)\n end\n end\n @vm_manager.set_power_state(agent_id, 'on')\n @logger.info('Virtual machine powered on.')\n # Delete the uploaded iso as it is not required\n @image_manager.delete_image(iso_uuid)\n @logger.info('Deleted the uploaded ENV ISO.')\n agent_id\n rescue => e\n delete_vm(agent_id) if has_vm?(agent_id)\n cloud_error(e.message)\n end\n end\n end", "def serve(options)\n @logger = Logger.new STDERR\n @logger.level = options[:logging] ? Logger::DEBUG : Logger::FATAL\n\n serving_transport = Smartcard::Iso.auto_transport\n unless serving_transport\n @logger.error \"ISO7816 smart-card transport auto-configuration failed\"\n return\n end\n @logger.info \"Proxying to #{serving_transport.inspect}\\n\"\n @logger.info \"Serving with #{options.inspect}\\n\"\n serving_logic = ServingLogic.new serving_transport, options[:logging]\n Smartcard::Iso::JcopRemoteServer.new(options, serving_logic).run\nend", "def setup\n java.lang.System.setProperty(\"vbox.home\", Travis::Worker.config.vms.vbox_home)\n\n require 'vboxjxpcom.jar'\n\n java_import 'org.virtualbox_4_1.VirtualBoxManager'\n java_import 'org.virtualbox_4_1.VBoxEventType'\n java_import 'org.virtualbox_4_1.LockType'\n java_import 'org.virtualbox_4_1.MachineState'\n java_import 'org.virtualbox_4_1.IMachineStateChangedEvent'\n java_import 'org.virtualbox_4_1.DeviceType'\n java_import 'org.virtualbox_4_1.AccessMode'\n java_import 'org.virtualbox_4_1.MediumType'\n java_import 'org.virtualbox_4_1.SessionState'\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 boot(opts)\n opts[:flavor] ||= 'standard.xsmall'\n opts[:image] ||= /Ubuntu Precise/\n opts[:sec_groups] ||= ['default']\n opts[:key_name] ||= 'default'\n opts[:region] ||= 'az-2.region-a.geo-1'\n\n raise 'no name provided' if !opts[:name] or opts[:name].empty?\n\n cleanup opts[:name]\n private_key = new_key opts[:name]\n write_key(private_key, File.expand_path('~/.ssh/hpcloud-keys/' + opts[:region] + '/'))\n\n server = @os.create_server(\n :imageRef => image_id(opts[:image]),\n :flavorRef => flavor_id(opts[:flavor]),\n :key_name => private_key[:name],\n :security_groups => opts[:sec_groups],\n :name => opts[:name])\n\n wait(300) do\n server = @os.server(server.id)\n raise 'error booting vm' if server.status == 'ERROR'\n server.status == 'ACTIVE'\n end\n sleep 60\n\n {\n :ip => public_ip(server),\n :user => 'ubuntu',\n :key => private_key[:private_key]\n }\n end", "def configure_vm(vm, **opts)\n\n vm.box = opts.fetch(:box, \"bento/ubuntu-16.04\")\n vm.network :private_network, ip: opts[:private_ip]\n\n vm.provider \"virtualbox\" do |vb|\n vb.memory = 4096\n vb.cpus = 2\n end\n \n # Disable default share, because we dont use it\n vm.synced_folder \".\", \"/vagrant\", disabled: true\nend", "def configure_ob_parallels_vm(options)\n options['os-type'] = \"freebsd-4\"\n configure_parallels_vm(options)\n return\nend", "def configure_ay_parallels_vm(options)\n options['os-type'] = \"opensuse\"\n configure_parallels_vm(options)\n return\nend", "def start_server(options = {})\n\n # Backward compatibility\n if options.is_a? String\n url = options\n port = nil\n logfile = nil\n else\n url = options[:url]\n port = options[:port]\n logfile = options[:logfile]\n end\n\n url = ENV['TALKSHOW_REMOTE_URL'] if ENV['TALKSHOW_REMOTE_URL']\n port = ENV['TALKSHOW_PORT'] if ENV['TALKSHOW_PORT']\n logfile = ENV['TALKSHOW_LOG'] if ENV['TALKSHOW_LOG']\n\n Talkshow::Server.set_port port if port\n Talkshow::Server.set_logfile logfile if logfile\n \n if !url\n @type = :thread\n @question_queue = ::Queue.new\n @answer_queue = ::Queue.new\n @thread = Thread.new do\n Talkshow::Server.question_queue(@question_queue)\n Talkshow::Server.answer_queue(@answer_queue)\n Talkshow::Server.run!\n end\n else\n @type = :remote\n @question_queue = Talkshow::Queue.new(url)\n @answer_queue = Talkshow::Queue.new(url)\n end\n \n end", "def create_virtual_machine(params, options={})\n options[:os_type] = get_os_type(params[:image])\n options[:image_type] = get_image_type(params[:image])\n validate_deployment_params(params, options)\n options[:cloud_service_name] = generate_cloud_service_name(params[:vm_name]) unless options[:cloud_service_name]\n options[:storage_account_name] = generate_storage_account_name(params[:vm_name]) unless options[:storage_account_name] \n optionals = {}\n if options[:virtual_network_name]\n virtual_network_service = Azure::VirtualNetworkManagementService.new\n virtual_networks = virtual_network_service.list_virtual_networks.select{|x| x.name == options[:virtual_network_name]}\n if virtual_networks.empty?\n Loggerx.error_with_exit \"Virtual network #{options[:virtual_network_name]} doesn't exists\"\n else\n optionals[:affinity_group_name] = virtual_networks.first.affinity_group\n end\n elsif options[:affinity_group_name]\n optionals[:affinity_group_name] = options[:affinity_group_name]\n else\n optionals[:location] = params[:location]\n end \n cloud_service = Azure::CloudServiceManagementService.new\n cloud_service.create_cloud_service(options[:cloud_service_name], optionals)\n cloud_service.upload_certificate(options[:cloud_service_name],params[:certificate]) unless params[:certificate].empty?\n Azure::StorageManagementService.new.create_storage_account(options[:storage_account_name], optionals)\n\n body = Serialization.deployment_to_xml(params,options)\n path = \"/services/hostedservices/#{options[:cloud_service_name]}/deployments\"\n Loggerx.info \"Deployment in progress...\"\n request = ManagementHttpRequest.new(:post, path, body)\n request.call\n get_virtual_machine(params[:vm_name],options[:cloud_service_name])\n rescue Exception => e\n e.message\n end", "def start_vm\n respond_to do |format|\n logger.debug \"\\n start? \\n \"\n result = @vm.start_vm\n \n is_notice= (result[:notice] && result[:notice]!='')\n is_alert = (result[:alert] && result[:alert]!='')\n\n flash[:notice] = result[:notice].html_safe if is_notice\n flash[:alert] = result[:alert].html_safe if is_alert\n \n format.html {\n redirect_back fallback_location: my_labs_path+(@vm.lab_vmt.lab ? \"/#{@vm.lab_vmt.lab.id}\" : '')+(@vm.lab_vmt.lab && params[:username] ? \"/#{params[:username]}\" : '')\n }\n format.json { render :json => {:success=>is_notice, :message=> is_notice ? 'Machine started' : 'Machine start failed'} }\n end\n end", "def create_vm(vms, vm_type, config)\n vms.each do | vm |\n hostname = vm.get_hostname\n \n # cpu & memory\n cpu = vm.get_cpu\n memory = vm.get_memory\n \n # nat port\n ssh_nat_port = vm.get_ssh_nat_port\n http_nat_port = vm.get_http_nat_port\n novnc_nat_port = vm.get_novnc_nat_port \n \n # list of interfaces\n interfaces = vm.get_interfaces\n bridged_interface = vm.get_bridged_interface\n \n # box info\n box_name = vm.box.name\n box_user = vm.box.user\n box_pass = vm.box.pass\n \n switch_type = vm.switch_type\n switch_ver = vm.switch_ver \n \n # IMPORTANT: use your own link_prefix to avoid duplication error with other vagrant instances\n link_prefix=File.basename(Dir.getwd)\n \n interface_count = interfaces.length\n if bridged_interface != \"\"\n interface_count += 1\n end\n \n config.vm.define \"#{hostname}\" do |cfg|\n cfg.vm.box = box_name\n cfg.vm.boot_timeout = 90\n \n cfg.ssh.username = box_user\n cfg.ssh.password = box_pass\n \n for i in interfaces\n cfg.vm.network \"private_network\", auto_config: false, virtualbox__intnet: \"#{link_prefix}_switch_interface_#{i}\" \n end\n \n # bridged interface to have external network connectivity\n if bridged_interface != \"\"\n cfg.vm.network \"public_network\", auto_config: false, bridge: \"#{bridged_interface}\"\n end\n \n #if switch_type != \"\"\n # cfg.vm.provision :shell, :path => \"../common/install_#{switch_type}_#{switch_ver}.sh\"\n #end\n \n if File.exist?(\"init_node_#{hostname}.sh\")\n cfg.vm.provision :shell, :path => \"init_node_#{hostname}.sh\"\n end\n \n cfg.vm.provider \"virtualbox\" do |v|\n v.cpus = cpu\n v.memory = memory\n v.customize [\"modifyvm\", :id, \"--hpet\", \"on\"]\n \n # 스위칭에 이용하는 인터페이스에 대해서 promiscuous mode를 allow vms로 설정해줌\n for i in 2..(interface_count + 1)\n v.customize [\"modifyvm\", :id, \"--nicpromisc#{i}\", \"allow-all\"] \n end\n v.gui = true\n end\n \n if ssh_nat_port != -1\n cfg.vm.network :forwarded_port, guest: 22, host: \"#{ssh_nat_port}\", id: \"ssh\"\n end\n \n if http_nat_port != -1\n cfg.vm.network :forwarded_port, guest: 80, host: \"#{http_nat_port}\", id: \"http\" \n end\n \n if novnc_nat_port != -1\n cfg.vm.network :forwarded_port, guest: 6080, host: \"#{novnc_nat_port}\", id: \"novnc\" \n end\n \n cfg.vm.synced_folder \"../common\", \"/root/common\", disabled: false\n end\n end\nend", "def start\n return if @vim_started\n return unless @gtk_socket\n @vim_started = true\n listen\n fork do\n #exec %Q[#{Executable} --servername #{@vim_server_name} --socketid #{@gtk_socket.id} -nb:localhost:#{port}:#{Password} -S #{extras_source_path}]\n exec %Q[#{Executable} --servername #{@vim_server_name} --socketid #{@gtk_socket.id} -S #{extras_source_path}]\n end\n self\n end", "def initialize_vm\n\n begin\n #connect to TCPServer to execute the programm\n puts \"Connecting to vm on #{VM_HOST}:#{VM_PORT}.\"\n vm = TCPSocket.open(VM_HOST, VM_PORT)\n rescue\n $stderr.puts 'Could not connect to TCPSocket. Start ruby vm/vm/vm.rb development'\n exit_simulation!('Ein interner Fehler ist aufgetreten.')\n @packet.send_packet\n else\n command = @preprocessor.commands_for_vm\n\n vm.puts proof_commands(command)\n\n vm\n end\nend", "def set_resources(vm, options)\n vm.provider :virtualbox do |v|\n v.cpus = options[:cpu]\n v.memory = options[:ram]\n end\nend", "def clone_vm args\n args = parse_args args\n path_replace = %r{/Datacenters/#{datacenter}/vm(/|)}\n\n interfaces = client.list_vm_interfaces(args[:image_id])\n interface = interfaces.detect{|i| i[:name] == \"Network adapter 1\" }\n network_adapter_device_key = interface[:key]\n\n opts = {\n \"datacenter\" => datacenter,\n \"template_path\" => args[:image_id],\n \"dest_folder\" => args[:path].gsub(path_replace, ''),\n \"power_on\" => false,\n \"start\" => args[:start],\n \"name\" => args[:name],\n \"numCPUs\" => args[:cpus],\n \"memoryMB\" => args[:memory_mb],\n \"datastore\" => args[:volumes].first[:datastore],\n \"network_label\" => args[:interfaces].first[:network],\n \"network_adapter_device_key\" => network_adapter_device_key\n }\n client.servers.get(client.vm_clone(opts)['new_vm']['id'])\n end", "def create_vm(config, node_name)\n config.vm.define node_name do |vm|\n vm.vm.host_name = node_name\n vm.vm.network \"private_network\", type: \"dhcp\"\n vm.vm.box = \"ubuntu/xenial64\"\n end\nend", "def start\n puts \"Starting #{@resource[:name]}\"\n return if running?\n cmd = [command(:instance_manager)]\n cmd += [\"start\"]\n cmd += [@resource[:name]]\n run(cmd)\n end", "def setup_headless()\r\n xvfbRunPath = parse([BUILD_PROPERTIES, LOCAL_PROPERTIES])[\"config_xvfbRunPath\"]\r\n if !isWindows and (xvfbRunPath and xvfbRunPath.length > 0)\r\n require 'headless'\r\n puts \"Running tests in headless mode.\"\r\n headless = Headless.new(display: 200, destroy_at_exit: false, reuse: true)\r\n headless.start\r\n return headless\r\n else\r\n return nil\r\n end\r\nend", "def start\n server.synchronize do\n fail 'server is already running' if started?\n fail 'provide server address' if cfg.address.nil?\n\n FileUtils.mkdir_p(server.runsv_dir)\n run = File.join(server.runsv_dir, 'run')\n\n ErbTemplate.render_to('runsv', {\n name: server.name,\n address: cfg.address,\n netif: cfg.netif,\n }, run)\n\n File.chmod(0755, run)\n File.symlink(server.runsv_dir, service_link)\n end\n end" ]
[ "0.8063125", "0.7371226", "0.72947097", "0.6703487", "0.66851383", "0.6637769", "0.63795877", "0.6048234", "0.6026887", "0.60018075", "0.59982306", "0.5958771", "0.59550554", "0.5914051", "0.58915216", "0.5859023", "0.58584094", "0.5856711", "0.5852507", "0.5768819", "0.57680285", "0.5696778", "0.5691365", "0.56842554", "0.56332034", "0.5619705", "0.55716115", "0.5558851", "0.5538092", "0.55341923", "0.54846674", "0.547513", "0.54699576", "0.5467891", "0.54378957", "0.5421516", "0.53996915", "0.5386426", "0.5356888", "0.53442615", "0.53316736", "0.53311354", "0.5323671", "0.5291748", "0.52822876", "0.5259232", "0.5255721", "0.52468735", "0.523121", "0.52081025", "0.51806617", "0.5171704", "0.5165217", "0.5156194", "0.515073", "0.51296544", "0.5116355", "0.51070696", "0.50934756", "0.5089818", "0.50896204", "0.5085115", "0.5072413", "0.50656056", "0.5052693", "0.50383884", "0.5036407", "0.5031895", "0.5030887", "0.50297284", "0.5019288", "0.50166094", "0.50154597", "0.50090015", "0.49985492", "0.49892926", "0.49882975", "0.4985733", "0.49770972", "0.49741966", "0.49681202", "0.49626967", "0.4960917", "0.4944199", "0.49247327", "0.49242476", "0.49229598", "0.4911681", "0.49002868", "0.48948902", "0.4891097", "0.48898098", "0.48752984", "0.48750913", "0.4872765", "0.48676988", "0.48632655", "0.48574403", "0.48564133", "0.4847999" ]
0.80328715
1
Public: Stops a VM. The VM must be running in order to stop it. options Hash of options: :hard Boolean which specifies to power off the VM (instead of attempting to initiate a graceful shutdown). This is the equivalent of passing 'hard' to the vmrun stop command. (default: false) Examples
def stop(options={}) unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? unless running_response.data return Response.new :code => 1, :message => 'VM is not running' end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? command = "#{vmrun_cmd} stop " command << "#{conf_file_response.data} " command << 'hard ' unless options[:hard].blank? command << '2>&1' Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(options={})\n Fission::Action::VM::Stopper.new(self).stop(options)\n end", "def halt_fusion_vm(options)\n stop_fusion_vm(options)\nend", "def force_stop(options={})\n @state.value = State::STOPPED\n @cartridge_model.create_stop_lock\n @container_plugin.stop(options)\n end", "def stop(options = {})\n # set :stopping\n info \"stopping job\"\n unsubscribe\n kill if options[:force]\n end", "def suspend_fusion_vm(options)\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Stopping:\\tVirtual Box VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion suspend '#{fusion_vmx_file}'\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} not running\")\n end\n end\n return\nend", "def stop_pvm_instance(instance_id)\n post(\n \"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action\",\n {\"action\" => \"stop\"}.to_json\n )\n end", "def stop_vm\n exit_status = nil\n @vm_running = false\n begin\n exit_status = vmm_command(eb(@config['vmm']['quitvmm']))\n sleep 1\n # Check to see if it is still running.\n is_alive = (Process.kill(0, @vmm_pid) rescue 0)\n if is_alive != 0\n @log.warn \"Warning, vmm didn't die.. killing manually\"\n Process.kill(\"TERM\",@vmm_pid)\n sleep 2\n end\n rescue PTY::ChildExited\n true # expected\n end\n return exit_status\n end", "def halt\n execute(\"controlvm\", @uuid, \"poweroff\")\n end", "def unconfigure_parallels_vm(options)\n check_parallels_is_installed(options)\n exists = check_parallels_vm_exists(options)\n if exists == false\n handle_output(options,\"Parallels VM #{options['name']} does not exist\")\n quit(options)\n end\n stop_parallels_vm(options)\n sleep(5)\n message = \"Deleting Parallels VM \"+options['name']\n command = \"prlctl delete #{options['name']}\"\n execute_command(options,message,command)\n message = \"Unregistering Parallels VM \"+options['name']\n command = \"prlctl unregister #{options['name']}\"\n execute_command(options,message,command)\n return\nend", "def cmd_stop argv\n setup argv\n uuid = @hash['uuid']\n response = @api.stop(uuid)\n msg response\n return response\n end", "def stop\n @virtual_machine_state = 'SHUTOFF'\n Profitbricks.request :stop_server, server_id: self.id\n return true\n end", "def stop(vmname, action = 'stop')\n uri = @uri + \"/#{vmname}/#{action}?api-version=#{api_version}\"\n uri\n end", "def stop\n log_debug \"[ #{@node}/#{@environment} ] - Stop Proxmox LXC Container ...\"\n with_proxmox do |proxmox|\n run_proxmox_task(proxmox, :post, @lxc_details[:pve_node], \"lxc/#{@lxc_details[:vm_id]}/status/stop\")\n end\n end", "def stop(force = true)\n return if ! active_instance_dir_exists?\n return if ! running?\n puts \"Stopping #{@resource[:name]}\"\n cmd = [command(:instance_manager)]\n cmd += [\"stop\"]\n cmd += [@resource[:name]]\n cmd += [\"force\"] if force\n run(cmd)\n end", "def unconfigure_fusion_vm(options)\n stop_fusion_vm(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n stop_fusion_vm(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Deleting:\\t#{options['vmapp']} VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion deleteVM '#{fusion_vmx_file}'\"\n execute_command(options,message,command)\n vm_dir = options['name']+\".vmwarevm\"\n message = \"Removing:\\t#{options['vmapp']} VM \"+options['name']+\" directory\"\n command = \"cd \\\"#{options['fusiondir']}\\\" ; rm -rf \\\"#{vm_dir}\\\"\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n end\n end\n return\nend", "def stop_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n raise ArgumentError, \":force must be 'true' or 'false'\" unless options[:force].nil? || [true, false].include?(options[:force])\n params = {}\n params.merge!(pathlist(\"InstanceId\", options[:instance_id]))\n params[\"Force\"] = options[:force].to_s unless options[:force].nil?\n return response_generator(:action => \"StopInstances\", :params => params)\n end", "def shutdown_virtual_machine(vm_name, cloud_service_name)\n vm = get_virtual_machine(vm_name, cloud_service_name)\n if vm\n if ['StoppedVM','StoppedDeallocated'].include?(vm.status)\n Loggerx.error \"Cannot perform the shutdown operation on a stopped virtual machine.\"\n elsif vm.deployment_status == 'Running'\n path = \"/services/hostedservices/#{vm.cloud_service_name}/deployments/#{vm.deployment_name}/roleinstances/#{vm.vm_name}/Operations\"\n body = Serialization.shutdown_virtual_machine_to_xml\n Loggerx.info \"Shutting down virtual machine \\\"#{vm.vm_name}\\\" ...\"\n request = ManagementHttpRequest.new(:post, path, body)\n request.call\n else\n Loggerx.error \"Cannot perform the shutdown operation on a stopped deployment.\"\n end\n else\n Loggerx.error \"Cannot find virtual machine \\\"#{vm_name}\\\" under cloud service \\\"#{cloud_service_name}\\\". \"\n end\n end", "def stop(*args)\n self.exec(\"lxc-stop\", *args)\n self.state\n end", "def stop_kvm(name)\n unless(system(\"virsh destroy #{name}\"))\n raise \"Failed to stop node: #{name}\"\n end\nend", "def shutdown_virtual_machine(vm_name, cloud_service_name)\n vm = get_virtual_machine(vm_name, cloud_service_name)\n if vm\n if %w(StoppedVM StoppedDeallocated).include?(vm.status)\n Azure::Loggerx.error 'Cannot perform the shutdown operation on a stopped virtual machine.'\n elsif vm.deployment_status == 'Running'\n path = \"/services/hostedservices/#{vm.cloud_service_name}/deployments/#{vm.deployment_name}/roleinstances/#{vm.vm_name}/Operations\"\n body = Serialization.shutdown_virtual_machine_to_xml\n Azure::Loggerx.info \"Shutting down virtual machine \\\"#{vm.vm_name}\\\" ...\"\n request = client.management_request(:post, path, body)\n request.call\n else\n Azure::Loggerx.error 'Cannot perform the shutdown operation on a stopped deployment.'\n end\n else\n Azure::Loggerx.error \"Cannot find virtual machine \\\"#{vm_name}\\\" under cloud service \\\"#{cloud_service_name}\\\". \"\n end\n end", "def ct_stop(opts)\n ct = lxc_ct(opts[:id])\n\n if ct_shutdown(opts, ct)[:status]\n ok\n\n else\n ct_kill(opts, ct)\n end\n end", "def reboot_fusion_vm(options)\n reset_fusion_vm(options)\nend", "def stop\n begin\n run :stop, '--name', @name\n rescue LXC::Errors::ExecuteError => e\n if e.exitcode == 2\n @logger.debug \"Machine already stopped, lxc-stop returned 2\"\n else\n raise e\n end\n end\n end", "def stop\n debug \"Call 'stop' for Pacemaker service '#{name}' on node '#{hostname}'\"\n disable_basic_service_on_action :stop\n\n enable unless primitive_is_managed? name\n\n if pacemaker_options[:cleanup_on_stop]\n if not pacemaker_options[:cleanup_only_if_failures] or primitive_has_failures? name, hostname\n cleanup\n end\n end\n\n if primitive_is_multistate? name\n service_stop_mode pacemaker_options[:stop_mode_multistate]\n elsif primitive_is_clone? name\n service_stop_mode pacemaker_options[:stop_mode_clone]\n else\n service_stop_mode pacemaker_options[:stop_mode_simple]\n end\n debug cluster_debug_report \"#{@resource} stop\"\n end", "def stop\n Daemons.run(file_path, options.merge(ARGV: ['stop']))\n end", "def halt(force = false)\n args = ['stop', @uuid]\n args << '--kill' if force\n execute_prlctl(*args)\n end", "def destroy(state)\n return if state[:vm_name].nil?\n\n save_and_validate_parameters\n connect\n vm = get_vm(state[:vm_name])\n\n vm_obj = Com::Vmware::Vcenter::VM.new(vapi_config)\n\n # shut the machine down if it is running\n if vm.power_state.value == \"POWERED_ON\"\n power = Com::Vmware::Vcenter::Vm::Power.new(vapi_config)\n power.stop(vm.vm)\n end\n\n # delete the vm\n vm_obj.delete(vm.vm)\n end", "def stop_vm(vmname)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show vm name=#{vmname}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"stop vm name=#{vmname}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end", "def stop_node_instance(node_instance, options={})\n super(node_instance, options)\n node_instance.wait_for { status.downcase == 'down' }\n end", "def stop\n AwesomeSpawn.run(\"ansible-runner\", :params => [\"stop\", base_dir, :json, {:ident => \"result\"}])\n end", "def stop(*args)\n unless stopped?\n get '/invoke/wm.server.admin/shutdown?bounce=no&timeout=0&option=force'\n wait_until(\"Stopping\") do\n stopped?\n end\n end\n end", "def shutdown_vms()\n @vm_manager.shutdown_vms()\n end", "def stop force=nil\n if force\n conn.get 'StopInstances', :'instances.1' => id, :force => 1\n else\n conn.get 'StopInstances', :'instances.1' => id\n end\n promise(timeout:60){ wait_for :stopped }\n end", "def stop(options)\n options = Utils.symbolize_keys(options)\n if File.exist?(options[:pid])\n pid = File.read(options[:pid]).to_i\n puts \"=> Sending INT to process with pid #{pid}\"\n begin\n Process.kill(2, pid)\n rescue Errno::ESRCH, RangeError => error\n puts error.message\n exit\n rescue Errno::EPERM => error\n puts error.message\n abort\n end\n else\n puts \"=> #{options[:pid]} not found!\"\n abort\n end\n end", "def stop_machine(action_handler, machine_spec, machine_options)\n raise \"#{self.class} does not implement stop_machine\"\n end", "def stop\n if @resource[:stop] or stopcmd\n ucommand(:stop)\n else\n pid = getpid\n unless pid\n self.info \"#{self.name} is not running\"\n return false\n end\n begin\n output = kill pid\n rescue Puppet::ExecutionFailure => detail\n @resource.fail \"Could not kill #{self.name}, PID #{pid}: #{output}\"\n end\n return true\n end\n end", "def shutdown(options={})\n param = { :uniq_id => @uniq_id }.merge options\n param[:force] = param[:force] ? 1 : 0\n data = Storm::Base::SODServer.remote_call '/Server/shutdown', param\n data[:shutdown]\n end", "def reboot!(vm, options)\n if reboot? vm, options\n vm.action(:reload, options)\n end\n end", "def stop(labels = [])\n call_container_method(:stop, labels)\n end", "def stop\n Cocaine::CommandLine.new(\n @opt.fetch(:command, 'bin/delayed_job'),\n 'stop'\n ).run\n end", "def leader_stop(cloud_type, stop_function)\n\n # Stop cron jobs on all machines\n stop_cron_jobs(cloud_type)\n \n # Stop the cloud with the provided method\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(@resource)\n stop_function.call(@resource, vm_ip_roles)\n \n # Shutdown and undefine all virtual machines explicitly created for\n # this cloud\n @vm_manager.shutdown_vms()\n \n # Delete cloud related files\n delete_files()\n \n # Note: As all the files deleted so far are located in the /tmp directory\n # only the machines that are still alive need to delete these files.\n # If the machine was shut down, these files will not be there the next\n # time it is started, so there is no need to delete them.\n \n puts \"===================\"\n puts \"== Cloud stopped ==\"\n puts \"===================\"\n\n end", "def stop_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_stop_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def stop_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_stop_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def stop(force: false)\n create('stop', force: force)\n end", "def stop!\n @state = :stopped\n end", "def stop\n rpc(:stop).key?(:success)\n end", "def stop\n $stdout.puts \"Stopping the pow server...\"\n %x{launchctl unload \"$HOME/Library/LaunchAgents/cx.pow.powd.plist\" 2>/dev/null}\n %x{sudo launchctl unload \"/Library/LaunchDaemons/cx.pow.firewall.plist\" 2>/dev/null}\n $stdout.puts \"Done!\"\n end", "def stop\n tempfile = ARGV.first\n system(\"#{MOCK_EXECUTABLE} #{tempfile} --stop --example -y\")\n end", "def stop\n puts \"\\n\\n project:\"\n puts ' command: stop'\n puts \" name: #{File.basename(root_dir)}\"\n unless vm_running?\n puts \"\\n docker-machine:\"\n puts \" name: #{project_config['docker-machine']['name']}\"\n puts ' status: ALREADY stopped'\n puts \"\\n\\n docker-machine not even running - thus nothing to do\\n\\n\"\n else\n puts \"\\n docker-compose:\"\n puts \" service: #{project_config['docker-compose']['service']}\"\n unless service_running?\n puts ' status: ALREADY stopped'\n puts \"\\n\\n service not even running - thus nothing to do\\n\\n\"\n else\n print \" status: stopping...\\r\"\n `#{setup_docker_env_vars_str} docker-compose stop > /dev/null 2>&1`\n puts ' status: stopped '\n puts \"\\n watchman:\"\n if watchman_trigger_installed?\n print \" trigger: removing...\\r\"\n remove_watchman_trigger\n end\n puts \" trigger: #{watchman_trigger_installed? ? 'still installed' : 'removed'} \"\n if running_container_count == 0\n puts \"\\n docker-machine: (no containers running)\"\n puts \" name: #{project_config['docker-machine']['name']}\"\n print \" status: stopping...\\r\"\n `#{setup_docker_env_vars_str} docker-machine stop #{project_config['docker-machine']['name']}`\n puts \" status: stopped \\n\\n\"\n end\n end\n end\nend", "def stop(*args)\n logger.info('Stopping load generation and monitoring on targets...')\n wait = args.include?('wait')\n options = (args.include?('suspend') ? { suspend: true } : nil)\n current_project.stop(wait, options)\n\n show_load_agents\n show_target_hosts\n end", "def delete_virtual_machine(vm_name, cloud_service_name, options={})\n virtual_machines = list_virtual_machines(cloud_service_name)\n vm = virtual_machines.select { |x| x.vm_name == vm_name }.first\n if vm\n if virtual_machines.size == 1\n cloud_service = client.cloud_service_management\n cloud_service.delete_cloud_service_deployment(cloud_service_name)\n cloud_service.delete_cloud_service(cloud_service_name)\n else\n path = \"/services/hostedservices/#{vm.cloud_service_name}/deployments/#{vm.deployment_name}/roles/#{vm.vm_name}\"\n Azure::Loggerx.info \"Deleting virtual machine #{vm_name}. \\n\"\n request = client.management_request(:delete, path)\n request.call\n end\n Azure::Loggerx.info \"Waiting for disk to be released.\\n\"\n disk_name = vm.disk_name\n disk_management_service = client.vm_disk_management\n # Wait for 180s for disk to be released.\n disk = nil\n 18.times do\n Azure::Loggerx.info '# '\n disk = disk_management_service.get_virtual_machine_disk(disk_name)\n unless disk.attached\n Azure::Loggerx.info \"Disk released.\\n\"\n break\n end\n sleep 10\n end\n if disk.attached\n Azure::Loggerx.error \"\\nCannot delete disk #{disk_name}.\"\n else\n disk_management_service.delete_virtual_machine_disk(disk_name, options)\n end\n else\n Azure::Loggerx.error \"Cannot find virtual machine #{vm_name} under cloud service #{cloud_service_name}\"\n end\n rescue\n end", "def stop(params)\n services = services_from_params(params)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would stop #{agent.host} (#{agent.type})\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::StopCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Stopped #{agent.host} (#{agent.type})',\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end", "def stop\n control :kill\n self\n end", "def stop!\n # Permissions are handled by the script, use: :sudo => false\n run_script! :stop, :sudo => false\n end", "def service_stop_mode(mode = :global)\n if mode == :master\n debug \"Choose master stop for Pacemaker service '#{name}'\"\n ban_primitive name, hostname\n wait_for_stop(name, hostname) do\n ban_primitive name, hostname\n end\n elsif mode == :local\n debug \"Choose local stop for Pacemaker service '#{name}' on node '#{hostname}'\"\n ban_primitive name, hostname\n wait_for_stop(name, hostname) do\n ban_primitive name, hostname\n end\n elsif mode == :global\n debug \"Choose global stop for Pacemaker service '#{name}'\"\n stop_primitive name\n wait_for_stop(name) do\n stop_primitive name\n end\n else\n fail \"Unknown service stop mode '#{mode}'\"\n end\n end", "def stop\n # Permissions are handled by the script, use: :sudo => false\n run_script :stop, :sudo => false\n end", "def stop(inode)\n logger.info(\"machine.stop\")\n raise Exceptions::NotImplemented\n end", "def stop\n log_debug \"[ #{@node}/#{@environment} ] - Stop Podman Container #{@container} ...\"\n @cmd_runner.run_cmd \"#{podman_cmd} container stop #{@container}\"\n end", "def stop\n return if not running?\n @running = false\n @server.shutdown\n end", "def stop\n MU.log \"Stopping #{@cloud_id}\"\n MU::Cloud::Google.compute(credentials: @config['credentials']).stop_instance(\n @project_id,\n @config['availability_zone'],\n @cloud_id\n )\n begin\n sleep 5\n end while cloud_desc(use_cache: false).status != \"TERMINATED\" # means STOPPED\n end", "def stop()\n self.destroy()\n\n # Stop the EC2 instance\n $ec2.terminate_instances([self.id])\n end", "def cleanup\n vm_id = VMHelper.get_vm(service_manager.vapi_config, vm_name)\n status = vm_power_svc.get(vm_id)\n if status.state == VM_POWER_CLASS::State::POWERED_ON ||\n status.state == VM_POWER_CLASS::State::SUSPENDED\n log.info \"The VM #{vm_name} would be powered OFF\"\n vm_power_svc.stop(vm_id)\n end\n log.info \"Cleanup :: Deleting the VM #{vm_name}\"\n vm_svc.delete(vm_id)\n end", "def stop\n action('stop')\n end", "def stop()\n data = JSON.generate(:suspend => nil)\n puts data\n pp \"About to post ACTION\"\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end", "def shutdown(options = {})\n record_api_supportability_metric(:shutdown)\n agent&.shutdown\n end", "def shutdown(opt=:kill)\n @rufus.shutdown(opt) if @rufus\n end", "def stop_gear(options={})\n buffer = ''\n if proxy_cartridge = @cartridge_model.web_proxy\n unless options[:hot_deploy] == true or options[:init]\n result = update_proxy_status(cartridge: proxy_cartridge,\n action: :disable,\n gear_uuid: self.uuid,\n persist: false)\n result[:proxy_results].each do |proxy_gear_uuid, result|\n buffer << result[:messages].join(\"\\n\")\n end\n end\n end\n\n begin\n buffer << @cartridge_model.stop_gear(options)\n rescue ::OpenShift::Runtime::Utils::ShellExecutionException => e\n raise e if options[:user_initiated] == true || options[:force] == false\n\n logger.warn(\"stop_gear for #{self.uuid} failed with #{e.message}\\n#{e.stdout}\\n#{e.stderr}\")\n end\n\n unless buffer.empty?\n buffer.chomp!\n buffer << \"\\n\"\n end\n\n if options[:force]\n kill_procs(options)\n end\n\n buffer << stopped_status_attr\n buffer\n end", "def stopcmd\n end", "def stop_vm\n respond_to do |format|\n logger.debug \"\\n resume? \\n \"\n result = @vm.stop_vm\n # TODO! check if really stopped\n format.html {\n flash[:notice] = result[:message].html_safe \n redirect_back fallback_location: my_labs_path+(@vm.lab_vmt.lab ? \"/#{@vm.lab_vmt.lab.id}\" : '')+(@vm.lab_vmt.lab && params[:username] ? \"/#{params[:username]}\" : '')\n }\n format.json { render :json => {:success=>result[:success], :message=> result[:message] } }\n end\n end", "def stop\n\t\t# puts \"Stopping #{@ip} ...\"\n\t\tsystem ipmi_command + \" chassis power soft\"\n\tend", "def destroy_vm(_pool_name, _vm_name)\n\n machine = virtual_box.find_machine(:nameOrId => _vm_name)\n return true if machine.nil?\n \n sess = @web_session_mgr.get_session_object\n begin\n machine.lock_machine(:session => sess, :lockType => 'VM')\n progress = sess.console.power_down()\n progress.wait_for_completion(:timeout => -1)\n rescue Exception => e\n $logger.log('s', \"[x] can't destroy vm: can't get lock [#{_pool_name}] '#{machine}'. #{e.message}\")\n return false\n end\n\n begin\n machine.unregister(:cleanupMode => 'Full')\n rescue Exception => e\n $logger.log('s', \"[x] can't unregister vm: can't get lock [#{_pool_name}] '#{machine}'. #{e.message}\")\n return false\n end\n\n return true\n\n end", "def destroy(state)\n return if state[:vm_name].nil?\n\n # Reset resource pool, as it's not needed for the destroy action but might be a remnant of earlier calls to \"connect\"\n # Temporary fix until setting cluster + resource_pool at the same time is implemented (lines #64/#187)\n config[:resource_pool] = nil\n\n save_and_validate_parameters\n connect\n\n vm = get_vm(state[:vm_name])\n unless vm.nil?\n vm_api = VSphereAutomation::VCenter::VMApi.new(api_client)\n raise_if_unauthenticated vm_api, \"connecting to VM API\"\n\n # shut the machine down if it is running\n if vm.power_state == \"POWERED_ON\"\n power = VSphereAutomation::VCenter::VmPowerApi.new(api_client)\n power.stop(vm.vm)\n end\n\n # delete the vm\n vm_api.delete(vm.vm)\n end\n end", "def stop(klass, *args)\n stop_service(hals[hardcore_alias(klass, *args)])\n end", "def stop(flags = {})\n raise BreakControllerException.new(flags)\n end", "def stop\n put :stop\n end", "def destroy_vm(_pool_name, _vm_name)\n raise(\"#{self.class.name} does not implement destroy_vm\")\n end", "def stop\n UI.info \"Shutting down Rack...\"\n ::Process.kill(\"TERM\", @pid)\n ::Process.wait(@pid)\n @pid = nil\n true\n end", "def delete_virtualization_virtual_machine(moid, opts = {})\n delete_virtualization_virtual_machine_with_http_info(moid, opts)\n nil\n end", "def destroy!(options={})\n info \"Destroying...\" if verbose?\n servers.each do |server|\n server.destroy\n end\n end", "def stop\n # self.stop_proxy\n # if machine_status and (machine_status == STATUS_AVAILABLE or machine_status == STATUS_OCCUPIED)\n # self.cleanup_after_stop\n # end\n\n self.delete_machine\n self.status = STATUS_ERROR\n self.student_id = 0\n self.save\n end", "def stop\n\t\treturn nil unless self.running?\n\t\tbegin\n\t\t\tProcess.kill 'TERM', @pid\n\t\t\tProcess.waitpid( @pid, 0 )\n\t\trescue SystemCallError => err\n\t\t\t$stderr.puts \"SystemCallError while stopping: #{err.message}\" if\n\t\t\t\t$DEBUG || $VERBOSE\n\t\tend\n\n\t\t@errlog = nil\n\t\t@custom_logs = {}\n\t\tObjectSpace.undefine_finalizer( self )\t\n\tend", "def kill(secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n @kill_sig_received = true\n \n if is_hybrid_cloud? \n Thread.new {\n Kernel.sleep(5)\n HelperFunctions.terminate_hybrid_vms(creds)\n }\n elsif is_cloud?\n Thread.new {\n Kernel.sleep(5)\n infrastructure = creds[\"infrastructure\"]\n keyname = creds[\"keyname\"]\n HelperFunctions.terminate_all_vms(infrastructure, keyname)\n }\n else\n # in xen/kvm deployments we actually want to keep the boxes\n # turned on since that was the state they started in\n\n if my_node.is_login?\n stop_ejabberd \n end\n\n if my_node.is_shadow? or my_node.is_appengine?\n ApiChecker.stop \n end\n\n maybe_stop_taskqueue_worker(\"apichecker\")\n maybe_stop_taskqueue_worker(AppDashboard::APP_NAME)\n\n jobs_to_run = my_node.jobs\n commands = {\n \"load_balancer\" => \"stop_app_dashboard\",\n \"appengine\" => \"stop_appengine\",\n \"db_master\" => \"stop_db_master\",\n \"db_slave\" => \"stop_db_slave\",\n \"zookeeper\" => \"stop_zookeeper\"\n }\n\n my_node.jobs.each { |job|\n if commands.include?(job)\n Djinn.log_info(\"About to run [#{commands[job]}]\")\n send(commands[job].to_sym)\n else\n Djinn.log_info(\"Unable to find command for job #{job}. Skipping it.\")\n end\n }\n\n if has_soap_server?(my_node)\n stop_soap_server\n stop_datastore_server\n end\n\n TaskQueue.stop if my_node.is_taskqueue_master?\n TaskQueue.stop if my_node.is_taskqueue_slave?\n TaskQueue.stop_flower if my_node.is_login?\n\n stop_app_manager_server\n stop_infrastructure_manager\n end\n\n MonitInterface.shutdown\n FileUtils.rm_rf(STATE_FILE)\n\n if @creds['alter_etc_resolv'].downcase == \"true\"\n HelperFunctions.restore_etc_resolv()\n end\n\n return \"OK\" \n end", "def stop(force = false)\n worker.send(force ? :shutdown! : :shutdown)\n true\n end", "def stop!\n @stop = true\n end", "def stop!\n @stop = true\n end", "def delete\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = @vm.running?\n return running_response unless running_response.successful?\n\n if running_response.data\n message = 'The VM must not be running in order to delete it.'\n return Response.new :code => 1, :message => message\n end\n\n FileUtils.rm_rf @vm.path\n Metadata.delete_vm_info @vm.path\n\n Response.new :code => 0\n end", "def teardown\n with_vsphere_connection do |dc|\n nodes.each do |k,v|\n storage = RSpec.configuration.rs_storage[:nodes][k]\n\n if storage.nil?\n log.info \"No entry for node #{k}, no teardown necessary\"\n next\n end\n\n ssh = storage[:ssh]\n unless ssh.nil? or ssh.closed?\n ssh.close\n end\n\n if destroy\n log.info \"Destroying instance #{k}\"\n vm_name = storage[:vm]\n if vm_name == nil\n log.error \"No vm object for #{k}\"\n next\n end\n\n # Traverse folders to find target folder for new vm's\n vm_folder = dc.vmFolder.traverse(vmconf[:dest_dir], RbVmomi::VIM::Folder)\n raise \"VirtualMachine folder #{vmconf[:dest_dir]} not found\" if vm_folder.nil?\n vm = vm_folder.find(vm_name, RbVmomi::VIM::VirtualMachine)\n raise \"VirtualMachine #{vm_name} not found in #{vmconf[:dest_dir]}\" if vm.nil?\n\n begin\n vm.PowerOffVM_Task.wait_for_completion\n rescue RbVmomi::Fault => e\n log.error \"Fault attempting to power off node #{k}, #{e.message}\"\n ensure\n begin\n vm.Destroy_Task.wait_for_completion\n rescue RbVmomi::Fault => e\n log.error \"Fault attempting to destroy node #{k}, #{e.message}\"\n end\n end\n else\n next\n end\n end\n end\n\n nil\n end", "def stop(kill_arg = T.unsafe(nil)); end", "def delete_kubernetes_virtual_machine_instance_type(moid, opts = {})\n delete_kubernetes_virtual_machine_instance_type_with_http_info(moid, opts)\n nil\n end", "def stop(timeout=nil)\n timeout ||= @timeout +1\n @shutting_down = true\n @thread.join timeout\n @running = false\n end", "def stop\n @server.shutdown if @server\n end", "def stop\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n error(\"Usage: heroku ps:stop DYNO\\nMust specify DYNO to stop.\")\n when /.+\\..+/\n ps = args.first\n [\"Stopping #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Stopping #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_stop(app, options)\n end\n end", "def destroy!(options = {}, &block)\n options.merge!(force: true)\n\n destroy_remote(options, &block)\n end", "def stop\n if working\n @stop = true\n else\n exit\n end\n end", "def stop\n ck_valid\n Process.kill 15, @pid if running?\n\n invalidate\n end", "def force_stop(inode)\n logger.info(\"machine.force_stop\")\n raise Exceptions::NotImplemented\n end", "def stop!\n @stopped = true\n end", "def stop\n service.pool_action uuid, :destroy\n end", "def stop_instance instance\n begin\n instance.terminate\n rescue\n end \n end", "def shutdown\n Bj.submit \"#{XEN_CMD_RUNNER} shutdown_instance #{name} true\", :tag => \"#{name}.shutdown_instance\"\n end" ]
[ "0.7952278", "0.71565455", "0.6723032", "0.6444872", "0.6229081", "0.62088543", "0.6152392", "0.61098343", "0.60134584", "0.5987258", "0.595926", "0.5947789", "0.58820486", "0.5866406", "0.586381", "0.58149314", "0.5808411", "0.5782733", "0.5781018", "0.577224", "0.57667756", "0.57598156", "0.5758003", "0.57135266", "0.5707745", "0.56532085", "0.5651515", "0.55947775", "0.5594447", "0.5591314", "0.5577243", "0.5575075", "0.5555305", "0.5550123", "0.5548257", "0.54789704", "0.5466017", "0.54333687", "0.5406355", "0.5392752", "0.53770596", "0.53761566", "0.53761566", "0.5368255", "0.5333834", "0.53333974", "0.5327821", "0.5317273", "0.53037953", "0.5295821", "0.5295277", "0.52872324", "0.5284985", "0.5281823", "0.52807343", "0.5274725", "0.52745616", "0.5273177", "0.52693653", "0.5264392", "0.52593714", "0.5252097", "0.52319187", "0.5230311", "0.52250975", "0.52148414", "0.5197146", "0.519607", "0.51907516", "0.5187655", "0.5179909", "0.5179858", "0.51699704", "0.5169452", "0.51560926", "0.5154747", "0.51449937", "0.5143839", "0.5141966", "0.51104105", "0.509332", "0.5092062", "0.5088247", "0.5083996", "0.5083996", "0.5067872", "0.5066072", "0.50615513", "0.5061184", "0.50606847", "0.50566447", "0.5049224", "0.5031311", "0.50300825", "0.50261974", "0.5023804", "0.501541", "0.5005008", "0.4997794", "0.4995603" ]
0.81308055
0
Public: Suspends a VM. The VM must be running in order to suspend it. Examples
def suspend unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? unless running_response.data return Response.new :code => 1, :message => 'VM is not running' end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? command = "#{vmrun_cmd} suspend " command << "#{conf_file_response.data} 2>&1" Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suspend\n execute(\"controlvm\", @uuid, \"savestate\")\n end", "def suspend\n Fission::Action::VM::Suspender.new(self).suspend\n end", "def suspend\n execute_prlctl('suspend', @uuid)\n end", "def suspend\n requires :id\n begin\n response = service.post_suspend_vapp(id)\n rescue Fog::VcloudDirector::Compute::BadRequest => ex\n Fog::Logger.debug(ex.message)\n return false\n end\n service.process_task(response.body)\n end", "def suspend\n action('suspend')\n end", "def suspend\n end", "def suspend!\n return if suspended?\n self.status = \"suspended\"\n self.stop = Time.now.to_s\n end", "def suspend\n raise Suspended\n end", "def suspend_fusion_vm(options)\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Stopping:\\tVirtual Box VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion suspend '#{fusion_vmx_file}'\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} not running\")\n end\n end\n return\nend", "def halt\n execute(\"controlvm\", @uuid, \"poweroff\")\n end", "def suspend\n @suspended = true\n end", "def suspend\n\t\t@state = STATE_SUSPENDED\n\tend", "def asg_suspend_termination\n @asg_suspend_termination = true\n end", "def suspend\n FFI::Libvirt.virDomainSuspend(self) == 0\n end", "def suspend\n FFI::Libvirt.virDomainSuspend(self) == 0\n end", "def suspend\n _suspend(false) do\n system(\"tput cup 26 0\")\n system(\"tput ed\")\n system(\"echo Enter C-d to return to application\")\n system (ENV['PS1']='\\s-\\v\\$ ') if ENV['SHELL']== '/bin/bash'\n system(ENV['SHELL']);\n end\n end", "def suspend(vid)\n perform_request(action: 'vserver-suspend', vserverid: vid)\n end", "def suspend_new!\n @suspend_new = true\n end", "def suspend\n data = JSON.generate(:suspend => nil)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end", "def freeze_vm()\n @log.debug \"Freezing vm for test series\"\n vmm_command(eb(@config['vmm']['saveteststate']))\n end", "def resume\n @vm.resume\n end", "def power_down\n send_to_vm('system_powerdown')\n end", "def suspend_vm(vmname)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show vm name=#{vmname}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"suspend vm name=#{vmname}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end", "def suspend_vapp(vAppId)\n power_action(vAppId, 'suspend')\n end", "def suspend\n param 'state' => Patriot::JobStore::JobState::SUSPEND\n end", "def suspend(view)\n end", "def shutdown_vms()\n @vm_manager.shutdown_vms()\n end", "def suspend(node)\n Result.new(call(CMD_SUSPEND % node))\n end", "def suspend!\n self.update_attribute(:status, SUSPENDED)\n self.registration.update_attribute(:status, SUSPENDED) if self.registration\n end", "def pause!\n @paused = true\n raise(Paused)\n end", "def suspend()\n #This is a stub, used for indexing\n end", "def TrialController(params, vmid, _host = nil)\n LOG \"VM #{vmid} suspend action scheduled\", 'TrialController'\n action_time = Time.now.to_i + (params['trial-suspend-delay'].nil? ?\n IONe::Settings['TRIAL_SUSPEND_DELAY'] :\n params['trial-suspend-delay'])\n onblock(:vm, vmid).wait_for_state\n if !onblock(:vm, vmid).schedule('suspend', action_time).nil? then\n LOG_ERROR 'Scheduler process error', 'TrialController'\n end\n end", "def _suspend\n\t\t# Ask the user if they would like to background the session\n\t\tif (prompt_yesno(\"Background session #{name}?\") == true)\n\t\t\tself.interacting = false\n\t\tend\n\tend", "def resume\n execute(:resume_vm, VmId: vm_id)\n end", "def pause\n @actor << 'PAUSE'\n @actor.wait\n end", "def suspend\n @active = false\n while creeps.any?{|creep| creep.busy? }\n sleep 1\n end\n while @colony_processor_busy\n sleep 1\n end\n end", "def suspend_todo\n cli.die \"That task is already suspended!\" if @todo.suspended?\n @todo.suspend!\n puts \"#{@todo.label}: '#{@todo.todo}' marked as suspended at #{@todo.stop}\"\n end", "def suspend_all; threads.each {|x| suspend(x)}; end", "def shutdown_virtual_machine(vm_name, cloud_service_name)\n vm = get_virtual_machine(vm_name, cloud_service_name)\n if vm\n if ['StoppedVM','StoppedDeallocated'].include?(vm.status)\n Loggerx.error \"Cannot perform the shutdown operation on a stopped virtual machine.\"\n elsif vm.deployment_status == 'Running'\n path = \"/services/hostedservices/#{vm.cloud_service_name}/deployments/#{vm.deployment_name}/roleinstances/#{vm.vm_name}/Operations\"\n body = Serialization.shutdown_virtual_machine_to_xml\n Loggerx.info \"Shutting down virtual machine \\\"#{vm.vm_name}\\\" ...\"\n request = ManagementHttpRequest.new(:post, path, body)\n request.call\n else\n Loggerx.error \"Cannot perform the shutdown operation on a stopped deployment.\"\n end\n else\n Loggerx.error \"Cannot find virtual machine \\\"#{vm_name}\\\" under cloud service \\\"#{cloud_service_name}\\\". \"\n end\n end", "def pause\n return unless running?\n return if paused?\n info \"PAUSE!\"\n send_command :pause\n @paused = true\n callback! :pause, true\n end", "def cmd_suspend(*args)\n # give'em help if they want it, or seem confused\n if args.length == 0 or (args.include? \"-h\")\n cmd_suspend_help\n return true\n end\n\n continue = args.delete(\"-c\") || false\n resume = args.delete(\"-r\") || false\n\n # validate all the proposed pids first so we can bail if one is bogus\n valid_pids = validate_pids(args)\n args.uniq!\n diff = args - valid_pids.map {|e| e.to_s}\n if not diff.empty? # then we had an invalid pid\n print_error(\"The following pids are not valid:\t#{diff.join(\", \").to_s}.\")\n if continue\n print_status(\"Continuing. Invalid args have been removed from the list.\")\n else\n print_error(\"Quitting.\tUse -c to continue using only the valid pids.\")\n return false\n end\n end\n\n targetprocess = nil\n if resume\n print_status(\"Resuming: #{valid_pids.join(\", \").to_s}\")\n else\n print_status(\"Suspending: #{valid_pids.join(\", \").to_s}\")\n end\n begin\n valid_pids.each do |pid|\n print_status(\"Targeting process with PID #{pid}...\")\n targetprocess = client.sys.process.open(pid, PROCESS_ALL_ACCESS)\n targetprocess.thread.each_thread do |x|\n if resume\n targetprocess.thread.open(x).resume\n else\n targetprocess.thread.open(x).suspend\n end\n end\n end\n rescue ::Rex::Post::Meterpreter::RequestError => e\n print_error \"Error acting on the process: #{e.to_s}.\"\n print_error \"Try migrating to a process with the same owner as the target process.\"\n print_error \"Also consider running the win_privs post module and confirm SeDebug priv.\"\n return false unless continue\n ensure\n targetprocess.close if targetprocess\n end\n return true\n end", "def run(vm)\n while step(vm); end\n end", "def suspend &block\n if block_given? then\n @mutex.synchronize {\n begin\n @suspended = true\n block.call(self)\n ensure\n @suspended = false\n end\n }\n end\n end", "def update_vm_properties(vm)\n begin\n start_time = Time.now.to_i\n vm_promise = @compute_client.virtual_machines.create_or_update(@rg_name, @instance_name, vm)\n my_vm = vm_promise.value!\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"Storage Disk detached #{duration} seconds\")\n OOLog.info(\"VM: #{my_vm.body.name} UPDATED!!!\")\n return true\n rescue MsRestAzure::AzureOperationError =>e\n OOLog.fatal(e.body)\n rescue Exception => ex\n OOLog.fatal(ex.message)\n end\n end", "def stop_vm\n exit_status = nil\n @vm_running = false\n begin\n exit_status = vmm_command(eb(@config['vmm']['quitvmm']))\n sleep 1\n # Check to see if it is still running.\n is_alive = (Process.kill(0, @vmm_pid) rescue 0)\n if is_alive != 0\n @log.warn \"Warning, vmm didn't die.. killing manually\"\n Process.kill(\"TERM\",@vmm_pid)\n sleep 2\n end\n rescue PTY::ChildExited\n true # expected\n end\n return exit_status\n end", "def suspended!\n self.update_attribute(:status, SUSPEND)\n end", "def suspend(tid); Ragweed::Wrap32::open_thread(tid) {|x| Ragweed::Wrap32::suspend_thread(x)}; end", "def shutdown_virtual_machine(vm_name, cloud_service_name)\n vm = get_virtual_machine(vm_name, cloud_service_name)\n if vm\n if %w(StoppedVM StoppedDeallocated).include?(vm.status)\n Azure::Loggerx.error 'Cannot perform the shutdown operation on a stopped virtual machine.'\n elsif vm.deployment_status == 'Running'\n path = \"/services/hostedservices/#{vm.cloud_service_name}/deployments/#{vm.deployment_name}/roleinstances/#{vm.vm_name}/Operations\"\n body = Serialization.shutdown_virtual_machine_to_xml\n Azure::Loggerx.info \"Shutting down virtual machine \\\"#{vm.vm_name}\\\" ...\"\n request = client.management_request(:post, path, body)\n request.call\n else\n Azure::Loggerx.error 'Cannot perform the shutdown operation on a stopped deployment.'\n end\n else\n Azure::Loggerx.error \"Cannot find virtual machine \\\"#{vm_name}\\\" under cloud service \\\"#{cloud_service_name}\\\". \"\n end\n end", "def pause\n @pause_queue << :paused\n end", "def pause\n data = JSON.generate(:pause => nil)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end", "def cmd_suspend_help\n print_line(\"Usage: suspend [options] pid1 pid2 pid3 ...\")\n print_line(\"Suspend one or more processes.\")\n print @@suspend_opts.usage\n end", "def suspend_agent\r\n Admin.suspend params[:id]\r\n redirect_to :action => 'show_agents' \r\n end", "def resume\n @suspended = false\n end", "def suspend_all_processes\n suspend_processes\n end", "def cleanup\n vm_id = VMHelper.get_vm(service_manager.vapi_config, vm_name)\n status = vm_power_svc.get(vm_id)\n if status.state == VM_POWER_CLASS::State::POWERED_ON ||\n status.state == VM_POWER_CLASS::State::SUSPENDED\n log.info \"The VM #{vm_name} would be powered OFF\"\n vm_power_svc.stop(vm_id)\n end\n log.info \"Cleanup :: Deleting the VM #{vm_name}\"\n vm_svc.delete(vm_id)\n end", "def suspend(options={})\n # either monitorIds or tag is required\n # if options is a hash, then treat it as options\n # otherwise, treat it as a monitor id or an array of them\n if options.class == Hash\n result = post('suspendExternalMonitor', options)\n elsif options.class == Array\n result = post('suspendExternalMonitor', monitorIds: options.join(','))\n else\n result = post('suspendExternalMonitor', monitorIds: options)\n end\n result\n end", "def suspend\n process_status = status\n if process_status != 'terminated' && process_status != 'stopped'\n return status if Process.kill('STOP', @proc_attrs[:pid].to_i)\n end\n process_status\n rescue Errno::EPERM\n return 'non-privilaged operation'\n end", "def cmd_pause argv\n setup argv\n uuid = @hash['uuid']\n response = @api.pause(uuid)\n msg response\n return response\n end", "def pause\n super\n each_slave{ |instance, iter| instance.framework.pause{ iter.next } }\n true\n end", "def delete_virtualbox_vm(vm_name)\n @colour.notify \"Deleting VirtualBox VM #{vm_name}\"\n @colour.notify \"VirtualBox VM #{vm_name} deleted\" if system \"VBoxManage unregistervm #{vm_name} --delete\"\nend", "def reset_vm()\n @log.debug \"Reseting vm for next test\"\n vmm_command(eb(@config['vmm']['loadteststate']))\n # Give it a half a tic to reset...\n sleep 0.5\n end", "def modifyvm(parameter, value)\n begin\n vboxmanage('modifyvm', resource[:name], \"--#{parameter}\", value)\n # If I could find a better exception here would be great,\n # something that is a bit more specific\n rescue Puppet::ExecutionFailure => e\n #throw e.message.to_s\n if e.message.to_s =~ /already locked for a session/\n throw \"VM is running, changes will not be made until it is stopped\"\n else \n throw e\n end\n end\n end", "def suspend(view)\n puts(\"suspend\")\n Sketchup.active_model.select_tool(nil)\n end", "def task_suspend(task)\n r = CALLS[\"libc!task_suspend:I=I\"].call(task).first\n raise KernelCallError.new(:task_suspend, r) if r != 0\n end", "def pause\n \tsleeper(25)\n end", "def pause\n \tsleeper(25)\n end", "def check_pending_vm(vm, pool, timeout, vsphere)\n Thread.new do\n _check_pending_vm(vm, pool, timeout, vsphere)\n end\n end", "def suspend_vapp(vAppId)\n params = {\n 'method' => :post,\n 'command' => \"/vApp/vapp-#{vAppId}/power/action/suspend\"\n }\n\n response, headers = send_request(params)\n task_id = headers[:location].gsub(\"#{@api_url}/task/\", \"\")\n task_id\n end", "def resume(vid)\n perform_request(action: 'vserver-unsuspend', vserverid: vid)\n end", "def pause()\r\n # nothing here\r\n end", "def poweroff(s)\n s.puts \"PU;\"\n sleep 0.1\nend", "def create_vm(name, &block)\n raise('This function need to be executed after ALL_VM_GROUPS_UP event') unless self.has_topic\n raise(\"The Virtual machine #{name} is not defined in this group\") unless vm(name)\n @topic.create(:virtual_machine, {:label => name}) do |vm|\n vm_topic = vm.resource\n if vm_topic.error?\n error app.inspect\n else\n vm_topic.on_subscribed do\n block.call(vm_topic) if block\n end\n end\n end\n end", "def task_suspend(task)\n r = CALLC[\"libc!task_suspend:I=I\"].call(task).first\n raise KernelCallError.new(r) if r != 0\n end", "def run_provisioner(env, p)\n env[:ui].info(I18n.t(\"vagrant.actions.vm.provision.beginning\",\n :provisioner => p.class))\n\n p.provision\n end", "def pause wait_time\r\n command 'pause', wait_time\r\n end", "def immediate_shutdown_pvm_instance(instance_id)\n post(\n \"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action\",\n {\"action\" => \"immediate-shutdown\"}.to_json\n )\n end", "def pause\n\n end", "def pause(device: T.unsafe(nil), duration: T.unsafe(nil)); end", "def power_off\n requires :id\n begin\n response = service.post_power_off_vapp(id)\n rescue Fog::VcloudDirector::Compute::BadRequest => ex\n Fog::Logger.debug(ex.message)\n return false\n end\n service.process_task(response.body)\n end", "def reset!\n @suspend_new = false\n stop_all!\n end", "def pause; end", "def check_pending_vm(vm, pool, timeout)\n Thread.new do\n _check_pending_vm(vm, pool, timeout)\n end\n end", "def halt_fusion_vm(options)\n stop_fusion_vm(options)\nend", "def suspend(job = ALL_JOBS)\n DRMAA.control(job, DRMAA::ACTION_SUSPEND)\n end", "def pause\n @paused = true\n end", "def pause\n @paused = true\n end", "def suspend_partner\n wait_until { change_status_link.visible? }\n change_status_link.click\n # wait for edit view\n wait_until { change_status_select.visible? }\n change_status_select.select('Suspended')\n submit_change_status_btn.click\n wait_until{ change_status_link.visible? }\n end", "def unpause\n data = JSON.generate(:unpause => nil)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end", "def suspend\n self.suspended = true\n save(:validate => false)\n end", "def unconfigure_vbox_vm(client_name)\n check_vbox_is_installed()\n exists = check_vbox_vm_exists(client_name)\n if exists == \"no\"\n puts \"VirtualBox VM \"+client_name+\" does not exist\"\n exit\n end\n stop_vbox_vm(client_name)\n sleep(5)\n message = \"Deleting:\\tVirtualBox VM \"+client_name\n command = \"VBoxManage unregistervm #{client_name} --delete\"\n execute_command(message,command)\n return\nend", "def pause(p)\n \tsleep p\n \tputs\nend", "def suspend(job = ALL_JOBS)\n DRMAA.control(job, DRMAA::ACTION_SUSPEND)\n end", "def wakeup\n ::Kernel.raise ThreadError, \"dead em_thread\" unless status\n wake_resume()\n self\n end", "def pause_after_run\n sleep @sleep_seconds\n end", "def pause_vm\n respond_to do |format|\n logger.debug \"\\n resume? \\n \"\n result = @vm.pause_vm\n # TODO! check if really paused\n format.html {\n flash[:notice] = result[:message].html_safe \n redirect_back fallback_location: my_labs_path+(@vm.lab_vmt.lab ? \"/#{@vm.lab_vmt.lab.id}\" : '')+(@vm.lab_vmt.lab && params[:username] ? \"/#{params[:username]}\" : '')\n }\n format.json { render :json => {:success=>result[:success], :message=> result[:message] } }\n end\n end", "def after_suspend(user, transition)\n UserMailer.deliver_suspension_notice(user)\n end", "def pause\n puts \"Pausing Microwave...\"\n send_request(:command => :pause)\n end", "def raw_suspend\n raise NotImplementedError, _(\"must be implemented in a subclass\")\n end", "def destroy_vm(_pool_name, _vm_name)\n\n machine = virtual_box.find_machine(:nameOrId => _vm_name)\n return true if machine.nil?\n \n sess = @web_session_mgr.get_session_object\n begin\n machine.lock_machine(:session => sess, :lockType => 'VM')\n progress = sess.console.power_down()\n progress.wait_for_completion(:timeout => -1)\n rescue Exception => e\n $logger.log('s', \"[x] can't destroy vm: can't get lock [#{_pool_name}] '#{machine}'. #{e.message}\")\n return false\n end\n\n begin\n machine.unregister(:cleanupMode => 'Full')\n rescue Exception => e\n $logger.log('s', \"[x] can't unregister vm: can't get lock [#{_pool_name}] '#{machine}'. #{e.message}\")\n return false\n end\n\n return true\n\n end", "def pause\n end" ]
[ "0.72526103", "0.674012", "0.655616", "0.63345", "0.6240721", "0.62070835", "0.6192826", "0.6139993", "0.6128174", "0.6116592", "0.597085", "0.57992333", "0.57641864", "0.57539874", "0.57539874", "0.5694305", "0.5680789", "0.56572825", "0.5650772", "0.55372185", "0.5509754", "0.55024755", "0.5486071", "0.5393564", "0.5380638", "0.536884", "0.53646064", "0.535944", "0.53212404", "0.5316167", "0.5306784", "0.5304888", "0.53043914", "0.528975", "0.5267091", "0.52469176", "0.52460885", "0.52433354", "0.52349645", "0.5226308", "0.52187836", "0.52113223", "0.51908815", "0.5185273", "0.5180758", "0.51782197", "0.51605153", "0.5144289", "0.5137328", "0.5137096", "0.51276755", "0.50780916", "0.5067857", "0.5067123", "0.50602055", "0.505027", "0.5026022", "0.5023186", "0.5020367", "0.50168645", "0.50090075", "0.49997267", "0.49970978", "0.49868938", "0.4983217", "0.4983217", "0.49804968", "0.49688202", "0.4958339", "0.49457148", "0.49339762", "0.4925179", "0.492432", "0.49161407", "0.49135977", "0.49134055", "0.49010977", "0.48930436", "0.4891136", "0.4890285", "0.48851413", "0.48665845", "0.48592424", "0.4854542", "0.48537076", "0.48537076", "0.48518512", "0.48448235", "0.4839915", "0.48396486", "0.48319152", "0.48235375", "0.48186564", "0.48144135", "0.4810643", "0.48092237", "0.48023373", "0.4801641", "0.479567", "0.47930512" ]
0.6477853
3
Public: Provides the MAC addresses for a VM. Examples:
def mac_addresses network_response = network_info return network_response unless network_response.successful? response = Response.new :code => 0 response.data = network_response.data.values.collect { |n| n['mac_address'] } response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_mac_addresses\n read_vm_option('mac').strip.gsub(':', '').split(' ')\n end", "def read_mac_address\n execute(:get_network_mac, VmId: vm_id)\n end", "def mac_address\n mac = nil\n\n ovf.xpath(\"//*[local-name()='Machine']/*[local-name()='Hardware']/*[local-name()='Network']/*[local-name()='Adapter']\").each do |net|\n if net.attribute(\"enabled\").value == \"true\"\n mac = net.attribute(\"MACAddress\").value\n break\n end\n end\n\n if mac\n return mac\n else\n fail Errors::BoxAttributeError, error_message: 'Could not determine mac address'\n end\n end", "def get_fusion_vm_mac(options)\n options['mac'] = \"\"\n options['search'] = \"ethernet0.address\"\n options['mac'] = get_fusion_vm_vmx_file_value(options)\n if not options['mac']\n options['search'] = \"ethernet0.generatedAddress\"\n options['mac'] = get_fusion_vm_vmx_file_value(options)\n end\n return options['mac']\nend", "def mac_address\n mac = nil\n\n ovf.elements.each(\"//vbox:Machine/Hardware//Adapter\") do |ele|\n if ele.attributes['enabled'] == 'true'\n mac = ele.attributes['MACAddress']\n break\n end\n end\n\n if mac\n return mac\n else\n raise Errors::BoxAttributeError, :error_message => 'Could not determine mac address'\n end\n end", "def mac_eth0\n eth0.mac_address\n end", "def dell_mac_addresses\n macs = []\n result = run_command([\"delloem\", \"mac\"])\n result.each_line do |line|\n data = line.split(' ')\n if data[0].to_i.to_s == data[0].to_s\n macs << mac = {:index => data[0], :address => data[1]}\n unless data[2].blank?\n mac[:enabled] = data[2] == 'Enabled'\n else\n mac[:enabled] = true\n end\n end\n end\n macs\n end", "def get_vbox_vm_mac(client_name)\n message = \"Getting:\\tMAC address for \"+client_name\n command = \"VBoxManage showvminfo #{client_name} |grep MAC |awk '{print $4}'\"\n vbox_vm_mac = execute_command(message,command)\n vbox_vm_mac = vbox_vm_mac.chomp\n vbox_vm_mac = vbox_vm_mac.gsub(/\\,/,\"\")\n return vbox_vm_mac\nend", "def read_mac_address\n execute(\"showvminfo\", @uuid, \"--machinereadable\").split(\"\\n\").each do |line|\n return $1.to_s if line =~ /^macaddress1=\"(.+?)\"$/\n end\n\n nil\n end", "def mac\n File.open(\"/sys/class/net/#{@name}/address\") do |f|\n f.read.chomp\n end\n end", "def mac_addr\n if (mac_addr = @host.at('tag[name=mac-addr]'))\n mac_addr.inner_text\n end\n end", "def get_parallels_vm_mac(options)\n message = \"Information:\\tGetting MAC address for \"+options['name']\n command = \"prlctl list --info #{options['name']} |grep net0 |grep mac |awk '{print $4}' |cut -f2 -d=\"\n vm_mac = execute_command(options,message,command)\n vm_mac = vm_mac.chomp\n vm_mac = vm_mac.gsub(/\\,/,\"\")\n return vm_mac\nend", "def get_macaddr\n currentEth = currentAddr = nil; macaddrs = {}\n `ifconfig`.split(\"\\n\").map! do |line|\n maybeEth = line.match(/([a-z]+[0-9]+): .*/)\n currentEth = maybeEth[1].strip if !maybeEth.nil?\n maybeAddr = line.match(/ether ([0-9 A-Ea-e \\:]+)/)\n currentAddr = maybeAddr[1].strip if !maybeAddr.nil?\n if currentEth != nil && currentAddr != nil\n macaddrs[currentEth] = currentAddr\n currentEth = currentAddr = nil\n end\n end\n macaddrs\nend", "def mac_address\n raise ::Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n line=File.new(vmx_path).grep(/^ethernet0.generatedAddress =/)\n if line.nil?\n #Fission.ui.output \"Hmm, the vmx file #{vmx_path} does not contain a generated mac address \"\n return nil\n end\n address=line.first.split(\"=\")[1].strip.split(/\\\"/)[1]\n return address\n end", "def get_gdom_mac(options)\n message = \"Information:\\tGetting guest domain \"+options['name']+\" MAC address\"\n command = \"ldm list-bindings #{options['name']} |grep '#{options['vmnic']}' |awk '{print $5}'\"\n output = execute_command(options,message,command)\n options['mac'] = output.chomp\n return options['mac']\nend", "def mac_address\n if NicView.empty_mac?(self[\"CurrentMACAddress\"])\n self[\"PermanentMACAddress\"]\n elsif self[\"PermanentMACAddress\"]\n self[\"CurrentMACAddress\"]\n end\n end", "def change_fusion_vm_mac(options)\n (fusion_vm_dir,fusion_vmx_file,fusion_disk_file) = check_fusion_vm_doesnt_exist(options)\n if not File.exist?(fusion_vmx_file)\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} does not exist \")\n quit(options)\n end\n copy=[]\n file=IO.readlines(fusion_vmx_file)\n file.each do |line|\n if line.match(/generatedAddress/)\n copy.push(\"ethernet0.address = \\\"\"+options['mac']+\"\\\"\\n\")\n else\n if line.match(/ethernet0\\.address/)\n copy.push(\"ethernet0.address = \\\"\"+options['mac']+\"\\\"\\n\")\n else\n copy.push(line)\n end\n end\n end\n File.open(fusion_vmx_file,\"w\") {|file_data| file_data.puts copy}\n return\nend", "def node_mac(name)\n %x{grep 'mac address' /etc/libvirt/qemu/#{name}.xml 2>/dev/null}.match(/((..:){5}..)/).to_s\nend", "def read_mac_address\n end", "def check_fusion_vm_mac(options)\n if options['mac'].gsub(/:/,\"\").match(/^08/)\n handle_output(options,\"Warning:\\tInvalid MAC address: #{options['mac']}\")\n options['vm'] = \"fusion\"\n options['mac'] = generate_mac_address(options['vm'])\n handle_output(options,\"Information:\\tGenerated new MAC address: #{options['mac']}\")\n end\n return options['mac']\nend", "def tap_mac\n\t\[email protected]_address.to_sockaddr[-6,6]\n\tend", "def tap_mac\n\t\[email protected]_address.to_sockaddr[-6,6]\n\tend", "def arp_src_mac= i; typecast \"arp_src_mac\", i; end", "def macify\n split(\":\").map {|a| a[0].chr == \"0\" ? a[1].chr : a}.join(\":\")\n end", "def mac\n @attributes.fetch('mac', nil)\n end", "def pretty\n\t\tmacocts = []\n\t\tmac_addr.each_byte { |o| macocts << o }\n\t\tmacocts += [0] * (6 - macocts.size) if macocts.size < 6\n\t\treturn sprintf(\n\t\t\t\t\"#{mac_name}\\n\" +\n\t\t\t\t\"Hardware MAC: %02x:%02x:%02x:%02x:%02x:%02x\\n\" +\n\t\t\t\t\"IP Address : %s\\n\" +\n\t\t\t\t\"Netmask : %s\\n\" +\n\t\t\t\t\"\\n\", \n\t\t\t\tmacocts[0], macocts[1], macocts[2], macocts[3], \n\t\t\t\tmacocts[4], macocts[5], ip, netmask)\n\tend", "def get_mac_address(addresses)\n detected_addresses = addresses.detect { |address, keypair| keypair == { \"family\" => \"lladdr\" } }\n if detected_addresses\n detected_addresses.first\n else\n \"\"\n end\n end", "def tap_mac\n @sock.local_address.to_sockaddr[-6, 6]\n end", "def mac\n @mac || REXML::XPath.first(@definition, \"//domain/devices/interface/mac/@address\").value\n end", "def get_mac_for_interface(interfaces, interface)\n interfaces[interface][:addresses].find { |k, v| v[\"family\"] == \"lladdr\" }.first unless interfaces[interface][:addresses].nil? || interfaces[interface][:flags].include?(\"NOARP\")\n end", "def getMAC(interface)\n cmd = `ifconfig #{interface}`\n mac = cmd.match(/(([A-F0-9]{2}:){5}[A-F0-9]{2})/i).captures\n @log.debug \"MAC of interface '#{interface}' is: #{mac.first}\"\n return mac.first\n end", "def change_vbox_vm_mac(client_name,client_mac)\n message = \"Setting:\\tVirtualBox VM \"+client_name+\" MAC address to \"+client_mac\n if client_mac.match(/:/)\n client_mac = client_mac.gsub(/:/,\"\")\n end\n command = \"VBoxManage modifyvm #{client_name} --macaddress1 #{client_mac}\"\n execute_command(message,command)\n return\nend", "def generate_mac\n if locate_config_value(:macaddress).nil?\n ('%02x' % (rand(64) * 4 | 2)) + (0..4).reduce('') { |s, _x|s + ':%02x' % rand(256) }\n else\n locate_config_value(:macaddress)\n end\n end", "def ip_by_mac(mac)\n %x{arp -a | grep #{mac}}.split(' ')[1].to_s.sub('(', '').sub(')', '')\nend", "def address\n return @mac_address if defined? @mac_address and @mac_address\n re = %r/[^:\\-](?:[0-9A-F][0-9A-F][:\\-]){5}[0-9A-F][0-9A-F][^:\\-]/io\n cmds = '/sbin/ifconfig', '/bin/ifconfig', 'ifconfig', 'ipconfig /all', 'cat /sys/class/net/*/address'\n\n null = test(?e, '/dev/null') ? '/dev/null' : 'NUL'\n\n output = nil\n cmds.each do |cmd|\n begin\n r, w = IO.pipe\n ::Process.waitpid(spawn(cmd, :out => w))\n w.close\n stdout = r.read\n next unless stdout and stdout.size > 0\n output = stdout and break\n rescue\n # go to next command!\n end\n end\n raise \"all of #{ cmds.join ' ' } failed\" unless output\n\n @mac_address = parse(output)\n end", "def mac\n options[:mac]\n end", "def mac_address\n @mac_address ||= raw_data[22..27].join(':')\n end", "def read_mac_address\n hw_info = read_settings.fetch('Hardware', {})\n shared_ifaces = hw_info.select do |name, params|\n name.start_with?('net') && params['type'] == 'shared'\n end\n\n raise Errors::SharedInterfaceNotFound if shared_ifaces.empty?\n\n shared_ifaces.values.first.fetch('mac', nil)\n end", "def getMAC\n tmpmac = \"\"\n if Stage.initial\n tmpmac = Convert.to_string(SCR.Read(path(\".etc.install_inf.HWAddr\")))\n end\n cleanmac = Builtins.deletechars(tmpmac != nil ? tmpmac : \"\", \":\")\n cleanmac\n end", "def arp_dest_mac= i; typecast \"arp_dest_mac\", i; end", "def generate_mac\n crc32 = Zlib.crc32(self.id.to_s)\n offset = crc32.modulo(255)\n\n digits = [ %w(0),\n %w(0),\n %w(0),\n %w(0),\n %w(5),\n %w(e),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(5 6 7 8 9 a b c d e f),\n %w(3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f),\n %w(0 1 2 3 4 5 6 7 8 9 a b c d e f) ]\n mac = \"\"\n for x in 1..12 do\n mac += digits[x-1][offset.modulo(digits[x-1].count)]\n mac += \":\" if (x.modulo(2) == 0) && (x != 12)\n end\n mac\n end", "def get_mac_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /HWaddr ([A-Z0-9:]+)/)\n end\n end\n return nil\nend", "def mac_address\n unless @mac\n octets = 3.times.map { rand(255).to_s(16) }\n @mac = \"525400#{octets[0]}#{octets[1]}#{octets[2]}\"\n end\n @mac\n end", "def mac\n config[\"mac\"]\n end", "def generate_mac \n (\"%02x\"%(rand(64)*4|2))+(0..4).inject(\"\"){|s,x|s+\":%02x\"%rand(256)}\n end", "def get_mac_address_of_nic_on_requested_vlan\n args = {\n :value_of_vlan_option => get_option(:vlan),\n :dest_cluster => dest_cluster,\n :destination => destination\n }\n source.ext_management_system.ovirt_services.get_mac_address_of_nic_on_requested_vlan(args)\n end", "def empirical_mac(entry)\n ping = Mixlib::ShellOut.new('ping', entry[:ip_address], '-c', '1')\n ping.run_command\n unless ping.status.success?\n puts \"Ping to #{entry[:hostname]} (#{entry[:ip_address]}) failed, \" \\\n 'checking ARP anyway.'\n end\n\n arp = Mixlib::ShellOut.new('arp', '-an')\n arp.run_command\n arp_entry = arp.stdout.split(\"\\n\")\n .map(&:chomp)\n .select { |l| l.include?(entry[:ip_address]) }\n .first\n match_data =\n /(\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w) .ether./.match(arp_entry.to_s)\n if !match_data.nil? && match_data.captures.count == 1\n mac = match_data[1]\n puts \"Found #{mac} for #{entry[:hostname]} (#{entry[:ip_address]})\"\n mac\n else\n raise 'Could not find ARP entry for ' \\\n \"#{entry[:hostname]} (#{entry[:ip_address]})!\"\n end\n end", "def arp_src_mac; self[:arp_src_mac].to_s; end", "def multicast_mac(options=nil)\n known_args = [:Objectify]\n objectify = false\n\n if (options)\n if (!options.kind_of? Hash)\n raise ArgumentError, \"Expected Hash, but #{options.class} provided.\"\n end\n NetAddr.validate_args(options.keys,known_args)\n\n if (options.has_key?(:Objectify) && options[:Objectify] == true)\n objectify = true\n end\n end\n\n if (@version == 4)\n if (@ip & 0xf0000000 == 0xe0000000)\n # map low order 23-bits of ip to 01:00:5e:00:00:00\n mac = @ip & 0x007fffff | 0x01005e000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv4 multicast \" +\n \"addresses should be in the range 224.0.0.0/4.\"\n end\n else\n if (@ip & (0xff << 120) == 0xff << 120)\n # map low order 32-bits of ip to 33:33:00:00:00:00\n mac = @ip & (2**32-1) | 0x333300000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv6 multicast \" +\n \"addresses should be in the range ff00::/8.\"\n end\n end\n\n eui = NetAddr::EUI48.new(mac)\n eui = eui.address if (!objectify)\n\n return(eui)\n end", "def mac_address\n super\n end", "def list_macs\n db_cached_connect\n\n retvalue = []\n\n sql = \"SELECT S.descr switch_descr,\n SP.descr switchport_descr,\n M.mac mac,\n M.descr mac_descr\n FROM mac_history MH,\n switch S,\n switchport SP,\n mac M\n WHERE MH.mac_id = M.mac_id\n AND MH.switchport_id = SP.switchport_id\n AND SP.switch_id = S.switch_id\n AND NOW() BETWEEN MH.start_dt AND MH.end_dt\n AND SP.uplink = false\n ORDER BY S.descr, SP.descr, M.mac, M.descr;\"\n\n @dbh.prepare(sql) do |sth|\n sth.execute\n sth.fetch_hash do |hash|\n retvalue.push(hash)\n end\n end\n\n return retvalue\n end", "def true_mac_address\n super\n end", "def true_mac_address\n super\n end", "def arp_dest_mac; self[:arp_dest_mac].to_s; end", "def mac_to_txt(mac)\n mac.map {|s| s.to_s(16)}.join \":\"\nend", "def dev_addr(mac, family='lladdr')\n interface_node = node['network']['interfaces']\n addr = mac.downcase\n interface_node.select do |dev, data|\n data['addresses'].select do |id, prop|\n\treturn dev if id.downcase == addr && prop['family'] == family\n end\n end\n return nil\n end", "def change_parallels_vm_mac(options)\n message = \"Information:\\tSetting Parallels VM \"+options['name']+\" MAC address to \"+options['mac']\n if options['mac'].to_s.match(/:/)\n options['mac'] = options['mac'].gsub(/:/,\"\")\n end\n command = \"prlctl set #{options['name']} --device-set net0 #{options['mac']}\"\n execute_command(options,message,command)\n return\nend", "def set_mac_address(mac)\n execute(\"modifyvm\", @uuid, \"--macaddress1\", mac)\n end", "def mac_masquerade_address\n super\n end", "def mac_masquerade_address\n super\n end", "def all_ips_for(vm)\n vm.guest.net.map(&:ipAddress).flatten\n end", "def random_mac_addr(provider)\n symbol = provider.to_sym\n case symbol\n when :virtualbox\n PROVIDER_MAC_PREFIXES[:virtualbox] + 3.times.map { '%02x' % rand(0..255) }.join\n when :libvirt\n PROVIDER_MAC_PREFIXES[:libvirt] + 3.times.map { '%02x' % rand(0..255) }.join\n when :vmware_fusion\n PROVIDER_MAC_PREFIXES[:vmware] + 3.times.map { '%02x' % rand(0..255) }.join\n when :vmware\n PROVIDER_MAC_PREFIXES[:vmware] + 3.times.map { '%02x' % rand(0..255) }.join\n when :parallels\n PROVIDER_MAC_PREFIXES[:parallels] + 3.times.map { '%02x' % rand(0..255) }.join\n when :hyper_v\n PROVIDER_MAC_PREFIXES[:hyper_v] + 3.times.map { '%02x' % rand(0..255) }.join\n else\n raise \"Unsupported provider #{provider}\"\n end\nend", "def resolve_to_mac(input)\n if valid_mac?(input)\n return input\n end\n lookup_in_ethers(input)\n end", "def base_mac_address\n super\n end", "def index\n @machines = Machine.all.order(mac: :asc)\n end", "def mac_for_instance(num=nil)\n num = next_instance_to_start if num.nil?\n num = num.to_i if num.is_a?(String) and num =~ /^\\d+$/\n if !num.is_a? Fixnum or num < 0 or num > 255 \n raise TypeError, _('Argument must be an integer between 0 and 255')\n end\n offset = sprintf('%02x', num)\n mac = mac_base_addr.gsub(/00$/, offset)\n\n mac\n end", "def default_ip_command\n %q( awk \"/$mac/ {print \\$1}\" /proc/net/arp )\n end", "def get_mac_to_i_ps_with_http_info(vmnet, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HostNetworksManagementApi.get_mac_to_i_ps ...'\n end\n # verify the required parameter 'vmnet' is set\n if @api_client.config.client_side_validation && vmnet.nil?\n fail ArgumentError, \"Missing the required parameter 'vmnet' when calling HostNetworksManagementApi.get_mac_to_i_ps\"\n end\n # resource path\n local_var_path = '/vmnet/{vmnet}/mactoip'.sub('{' + 'vmnet' + '}', vmnet.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.vmware.vmw.rest-v1+json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/vnd.vmware.vmw.rest-v1+json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'MACToIPs')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: HostNetworksManagementApi#get_mac_to_i_ps\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def format_mac_address\n self.mac_address = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')\n end", "def address\n @mac_address ||= addresses.first\n end", "def get_mac_address(pool, num)\n end_num = num.to_s(16)\n # mac_address = pool.starting_mac_address\n mac_address = '002440'\n mac_address = mac_address.ljust(12, \"0\")\n mac_address[mac_address.size - end_num.size, mac_address.size]= end_num\n mac_address = mac_address[0,2] + ':' + mac_address[2, 2] + ':' + mac_address[4,2] + ':' + mac_address[6,2] + ':' + mac_address[8,2] + ':' + mac_address[10,2]\n return mac_address\n end", "def calc_mac(post)\n string = '';\n post.sort_by {|sym| sym.to_s}.map do |key,value|\n if key != 'MAC'\n if string.length > 0\n string += '&'\n end\n string += \"#{key}=#{value}\"\n end\n end\n post[:MAC] = OpenSSL::HMAC.hexdigest('sha256', hexto_sring(@options[:password]), string)\n end", "def private_networks(vm, host)\n if host.has_key?('private_networks')\n private_networks = host['private_networks']\n private_networks.each do |private_network|\n options = {}\n if private_network.key?('ip') && private_network['ip'] != 'dhcp'\n options[:ip] = private_network['ip']\n options[:netmask] = private_network['netmask'] ||= '255.255.255.0'\n else\n options[:type] = 'dhcp'\n end\n options[:mac] = private_network['mac'].gsub(/[-:]/, '') if private_network.key?('mac')\n options[:auto_config] = private_network['auto_config'] if private_network.key?('auto_config')\n options[:virtualbox__intnet] = private_network['intnet'] if private_network.key?('intnet')\n vm.network :private_network, options\n end\n end\nend", "def get_ipmi_mac_address(channel)\n mac = get_ipmi_field(channel, 'MAC Address')\n mac or raise Puppet::Error.new(\"Unable to get IPMI MAC address\")\n end", "def calc_mac(base_mac, i = 1)\n mac_array = base_mac.split(/:/)\n\n mac_array[-1] = sprintf(\"%02x\", mac_array.last.hex + i).upcase\n mac_array.join(\":\")\nend", "def reset_mac_addresses!\n delegate(provider, :reset_mac_addresses!)\n end", "def net_set_mac(mac_addr)\n execute(:set_network_mac, VmId: vm_id, Mac: mac_addr)\n end", "def ip_address\n raise ::Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n unless mac_address.nil?\n lease=LeasesFile.new(\"/var/db/vmware/vmnet-dhcpd-vmnet8.leases\").find_lease_by_mac(mac_address)\n if lease.nil?\n return nil\n else\n return lease.ip\n end\n else\n # No mac address was found for this machine so we can't calculate the ip-address\n return nil\n end\n end", "def get_system_mac(device_id=nil)\n sysarray = []\n if device_id == 0x3543\n puts \"S5C variant\"\n for i in 0..3 do\n f=IO.popen(\"ipmitool -H #{@host} -U #{@username} -P #{@password} raw 0x30 4 0x49 0x4d 0x41 0 0 #{i}\")\n mac = parse_s5c_sys_mac(f.read.strip)\n f.close\n sysarray << mac if mac.length > 0\n end\n else\n for i in 0..15 do\n f=IO.popen(\"ipmitool -H #{@host} -U #{@username} -P #{@password} raw 0x30 0x19 #{i} 0\")\n if (mac = parse_ipmi_raw_mac_resp(f.readlines.join.strip)) != nil\n sysarray << mac if mac.length > 0\n end\n f.close\n end\n end\n return sysarray\n end", "def libvirt_vm_ip(name)\n mac = `sudo virsh domiflist #{name} | tail -n +3 | tr -s \" \" | cut -f 5 -d \" \"`.strip\n address = `arp | grep -i #{mac} | cut -f1 -d \" \"`.chomp\n { address: address, port: SSH_PORT }\n end", "def random_mac(oui=nil)\n mac_parts = [oui||DEFAULT_OUI]\n [0x7f, 0xff, 0xff].each do |limit|\n mac_parts << \"%02x\" % rand(limit + 1)\n end\n mac_parts.join('-')\nend", "def has_rackspace_mac? \n network[:interfaces].values.each do |iface|\n unless iface[:arp].nil?\n return true if iface[:arp].value?(\"00:00:0c:07:ac:01\")\n end\n end\n false\nend", "def reg_binary_to_mac(mac_v)\n\t\tbssid = mac_v.data.to_s.unpack(\"H*\")[0]\n\t\tbssid.insert(2,\":\")\n\t\tbssid.insert(5,\":\")\n\t\tbssid.insert(8,\":\")\n\t\tbssid.insert(11,\":\")\n\t\tbssid.insert(14,\":\")\n\t\treturn bssid\n\tend", "def mac?\n @mac\n end", "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "def set_mac_address(mac)\n end", "def arp_saddr_mac\n\t\tEthHeader.str2mac(self[:arp_src_mac].to_s)\n\tend", "def active_macs\n db_cached_connect\n\n retvalue = []\n\n sql = \"SELECT M.mac\n FROM mac M,\n mac_history MH\n WHERE M.mac_id = MH.mac_id\n AND NOW() BETWEEN MH.start_dt AND MH.end_dt\"\n\n @dbh.prepare(sql) do |sth|\n sth.execute(switch_id, name, descr, portindex, bridgeport, uplink, active)\n sth.fetch_hash do |hash|\n retvalue.push(hash['mac'])\n end\n end\n\n return retvalue\n end", "def format_mac_address\n\t\tself.mac_address = self.mac_address.to_s().upcase().gsub( /[^A-F0-9]/, '' )\n\tend", "def detect_ip\n mac = vm_info['VM']['TEMPLATE']['NIC']['MAC']\n 20.times do\n debug 'Trying to get IP...'\n out = `echo '#{config[:local_sudo_pass]}' | sudo -S nmap -sP -n 153.15.248.0/21`\n out = out.lines\n index = out.find_index { |s| s =~ /.*#{mac}.*/i }\n if index\n return out.to_a[index - 2].scan(/[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+/)[0]\n end\n end\n warn \"Can't locate VM ip\"\n nil\n end", "def mac_address(prefix: T.unsafe(nil)); end", "def set_ips\n array = []\n @machines.each do |machine|\n name = machine['name']\n ip = machine['ip']\n array.push(\"#{ip}\\t#{name}\")\n end\n array\n end", "def get_host_xml(mac)\n xml = \"\"\n hosts.each do |host|\n if host[:mac] == mac\n return \"<host mac='#{host[:mac]}' name='#{host[:name]}' ip='#{host[:ip]}' />\"\n end\n end\n xml\n end", "def getMacAddrByType(x, y, type = 1, domain = \"grid\")\n # This method should be considered deprecated because it exposes\n # device_id numbers to higher levels of abstraction. device_id\n # numbers are not a \"type\", but rather a means of associating rows\n # in two tables in the database. It is probably a better idea to\n # only expose PCI ID numbers. See getMacAddrByOUI().\n p \"Warning - getMacAddrByType() probably isn't what you want. See getMacAddrByOUI().\"\n MObject.warn \"Inventory - getMacAddrByType() is deprecated.\"\n cards = [] \n # First, find out the Motherboard ID of the requested node\n moid = getMotherboardID(x, y, domain)\n # Second, find out the MAC address of the interfaces with the required type on that Motherboard\n qs = \"SELECT interfaces.mac interfaces.device_id \" \\\n \"FROM interfaces \" \\\n \"LEFT JOIN motherboards ON interfaces.motherboard_id = motherboards.id \" \\\n\t \"WHERE motherboards.id= #{moid} \" \\\n\t \"AND device_id = #{type} \"\n begin\n [email protected](qs)\n if results.each() { |mac, did| \n p \" Got for [\"+x.to_s+\",\"+y.to_s+\"] type=\"+type+\" mac=[\"+mac+\"]\"\n cards |= mac \n MObject.debug \" Inventory - T:#{domain} - X:#{x} - Y:#{y} - MAC:#{mac} - TYPE:#{did}\" \n }\n end\n rescue MysqlError => e\n p \"Inventory - Could not get MAC for T:#{domain} - X:#{x} - Y:#{y} - TYPE:#{type}\"\n MObject.debug \"Inventory - Could not get MAC for T:#{domain} - X:#{x} - Y:#{y} - TYPE:#{type}\"\n end\n cards\n end", "def show\n @hosts_to_mac_addresses = HostsToMacAddresses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hosts_to_mac_addresses }\n end\n end", "def getVMs\n @vms = VirtualMachine.all(@ip_address)\n end", "def get_mac_addresses(mac_set_id, opts = {})\n data, _status_code, _headers = get_mac_addresses_with_http_info(mac_set_id, opts)\n return data\n end", "def ceph_chef_mon_addresses\n mon_ips = ceph_chef_mon_nodes_ip(ceph_chef_mon_nodes)\n mon_ips.reject(&:nil?).uniq\nend" ]
[ "0.7692694", "0.74545956", "0.7099549", "0.70928115", "0.70827186", "0.7019374", "0.6979955", "0.68134606", "0.68021387", "0.67451507", "0.67300785", "0.6715417", "0.6691889", "0.65320915", "0.65040594", "0.65022993", "0.63408506", "0.63189", "0.6315108", "0.63004774", "0.62775683", "0.62775683", "0.6256764", "0.6246136", "0.62444353", "0.6202888", "0.6195359", "0.61860216", "0.6183616", "0.61718875", "0.61701477", "0.6166083", "0.616264", "0.61600786", "0.6156732", "0.6144191", "0.61376363", "0.6103769", "0.6099119", "0.6082258", "0.6072508", "0.6071473", "0.6055747", "0.603759", "0.6027226", "0.5989046", "0.5957788", "0.59297675", "0.59221196", "0.5902979", "0.5879261", "0.5876628", "0.5876628", "0.586215", "0.5839826", "0.5808867", "0.579496", "0.57663906", "0.5756907", "0.5756907", "0.5744674", "0.5734634", "0.5700776", "0.5691398", "0.567821", "0.5675732", "0.5674782", "0.5659157", "0.56574184", "0.56354016", "0.5624753", "0.5618807", "0.55908275", "0.5548677", "0.5544041", "0.55437446", "0.55380124", "0.54748", "0.5460815", "0.5459051", "0.5457644", "0.54407865", "0.5434131", "0.54239607", "0.5384299", "0.5384299", "0.53695863", "0.5365753", "0.53599495", "0.5355626", "0.53389275", "0.5302645", "0.52973586", "0.52940345", "0.52886623", "0.5280679", "0.52764386", "0.5257663", "0.5240133" ]
0.72958803
3
Public: Provides the state of the VM. Examples
def state running_response = running? return running_response unless running_response.successful? response = Response.new :code => 0, :data => 'not running' if running_response.data response.data = 'running' else suspended_response = suspended? return suspended_response unless suspended_response.successful? response.data = 'suspended' if suspended_response.data end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(vm_name)\n `VBoxManage showvminfo #{vm_name}` =~ /^State:\\s+(.*)$/ ? $1 : 'unknown'\n end", "def read_state\n read_vm_option('status').strip.to_sym\n end", "def get_current_state\n execute(:get_vm_status, VmId: vm_id)\n end", "def read_state\n output = execute(\"showvminfo\", @uuid, \"--machinereadable\")\n if output =~ /^name=\"<inaccessible>\"$/\n return :inaccessible\n elsif output =~ /^VMState=\"(.+?)\"$/\n return $1.to_sym\n end\n\n nil\n end", "def info\n return 'STATE=d' if @state == 'd'\n\n if @vm.vm_info\n guest_ip = @vm.vm_info['guest.ipAddress']\n else\n guest_ip = @vm['guest.ipAddress']\n end\n\n used_cpu = @monitor[:used_cpu]\n used_memory = @monitor[:used_memory]\n netrx = @monitor[:netrx]\n nettx = @monitor[:nettx]\n diskrdbytes = @monitor[:diskrdbytes]\n diskwrbytes = @monitor[:diskwrbytes]\n diskrdiops = @monitor[:diskrdiops]\n diskwriops = @monitor[:diskwriops]\n\n if @vm.vm_info\n esx_host = @vm.vm_info[:esx_host_name].to_s\n else\n esx_host = @vm['runtime.host.name'].to_s\n end\n\n if @vm.vm_info\n guest_state = @vm.vm_info['guest.guestState'].to_s\n else\n guest_state = @vm['guest.guestState'].to_s\n end\n\n if @vm.vm_info\n vmware_tools = @vm.vm_info['guest.toolsRunningStatus'].to_s\n else\n vmware_tools = @vm['guest.toolsRunningStatus'].to_s\n end\n\n if @vm.vm_info\n vm_name = @vm.vm_info['name'].to_s\n else\n vm_name = @vm['name'].to_s\n end\n\n if @vm.vm_info\n vmtools_ver = @vm.vm_info['guest.toolsVersion'].to_s\n else\n vmtools_ver = @vm['guest.toolsVersion'].to_s\n end\n\n if @vm.vm_info\n vmtools_verst = @vm.vm_info['guest.toolsVersionStatus2'].to_s\n else\n vmtools_verst = @vm['guest.toolsVersionStatus2'].to_s\n end\n\n if @vm.vm_info\n rp_name = @vm.vm_info[:rp_list]\n .select do |item|\n item[:ref] == @vm.vm_info['resourcePool']._ref\n end\n .first[:name] rescue ''\n\n rp_name = 'Resources' if rp_name.empty?\n else\n rp_name = @vm['resourcePool'].name\n end\n\n str_info = ''\n\n str_info = 'GUEST_IP=' << guest_ip.to_s << ' ' if guest_ip\n\n if @guest_ip_addresses && !@guest_ip_addresses.empty?\n str_info << 'GUEST_IP_ADDRESSES=\"' << @guest_ip_addresses.to_s \\\n << '\" '\n end\n\n str_info << \"#{POLL_ATTRIBUTE[:state]}=\" << @state << ' '\n str_info << \"#{POLL_ATTRIBUTE[:cpu]}=\" << used_cpu.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:memory]}=\" << used_memory.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:netrx]}=\" << netrx.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:nettx]}=\" << nettx.to_s << ' '\n\n str_info << 'DISKRDBYTES=' << diskrdbytes.to_s << ' '\n str_info << 'DISKWRBYTES=' << diskwrbytes.to_s << ' '\n str_info << 'DISKRDIOPS=' << diskrdiops.to_s << ' '\n str_info << 'DISKWRIOPS=' << diskwriops.to_s << ' '\n\n str_info << 'VCENTER_ESX_HOST=\"' << esx_host << '\" '\n str_info << 'VCENTER_GUEST_STATE=' << guest_state << ' '\n str_info << 'VCENTER_VM_NAME=\"' << vm_name << '\" '\n str_info << 'VCENTER_VMWARETOOLS_RUNNING_STATUS=' << vmware_tools << ' '\n str_info << 'VCENTER_VMWARETOOLS_VERSION=' << vmtools_ver << ' '\n str_info << 'VCENTER_VMWARETOOLS_VERSION_STATUS=' \\\n << vmtools_verst << ' '\n str_info << 'VCENTER_RP_NAME=\"' << rp_name << '\" '\n\n # @vm.info_disks.each do |disk|\n # str_info << \"DISK_#{disk[0]}_ACTUAL_PATH=\\\"[\" <<\n # disk[1].ds.name << '] ' << disk[1].path << '\" '\n # end\n\n str_info\n end", "def show_state\n puts \"#{@name} a #{@life_points} de PV\"\n end", "def state\n running_vms = vboxmanage('list', 'runningvms')\n state = 'poweroff'\n if running_vms.kind_of?(Array)\n running_vms.each do |vm|\n if vm.include? resource[:name]\n state = 'running'\n end\n end\n else\n \tif running_vms.include? resource[:name]\n \t state = 'running'\n \tend\n end\n state\n end", "def state\n # Determine the ID of the state here.\n state_id = nil\n state_id = :not_created if [email protected]\n state_id = @driver.read_state if !state_id\n state_id = :unknown if !state_id\n\n # Translate into short/long descriptions\n short = state_id.to_s.gsub('_', ' ')\n long = I18n.t(\"vagrant_parallels.commands.status.#{state_id}\")\n\n # If machine is not created, then specify the special ID flag\n if state_id == :not_created\n state_id = Vagrant::MachineState::NOT_CREATED_ID\n end\n\n # Return the state\n Vagrant::MachineState.new(state_id, short, long)\n end", "def state\n @state\n end", "def show_state\n puts \"#{self.name} a #{self.life_points} points de vie.\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie.\"\n end", "def state\n @state\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie\"\n end", "def print_state(machine)\n puts \"[#{machine[:stack]}, #{machine[:register]}]\"\nend", "def show_state\n puts \"#{@name} a #{@life_points} de vie\"\n end", "def state\n end", "def info()\n super(VM_METHODS[:info], 'VM')\n end", "def get_state\n @client.get_state\n end", "def vcenter_vms_state\n vc_uuid = @vic.vim.serviceContent.about.instanceUuid\n\n view = @vic.vim\n .serviceContent\n .viewManager\n .CreateContainerView(\n {\n :container => @cluster.item,\n :type => ['VirtualMachine'],\n :recursive => true\n }\n )\n\n pc = @vic.vim.serviceContent.propertyCollector\n\n result = pc.RetrieveProperties(\n :specSet => [\n RbVmomi::VIM.PropertyFilterSpec(\n :objectSet => [\n :obj => view,\n :skip => true,\n :selectSet => [\n RbVmomi::VIM.TraversalSpec(\n :name => 'traverseEntities',\n :type => 'ContainerView',\n :path => 'view',\n :skip => false\n )\n ]\n ],\n :propSet => [\n {\n :type => 'VirtualMachine',\n :pathSet => VM_STATE_PROPERTIES\n }\n ]\n )\n ]\n )\n\n vms_hash = {}\n\n result.each do |r|\n next unless r.obj.is_a?(RbVmomi::VIM::VirtualMachine)\n\n vms_hash[r.obj._ref + '_' + vc_uuid] = r.to_hash\n end\n\n view.DestroyView\n\n vmpool = OpenNebula::VirtualMachinePool.new(@onec)\n rc = vmpool.info(-2)\n\n return {} if OpenNebula.is_error?(rc)\n\n vms = {}\n vms_hash.each do |vm_ref, info|\n one_id = -1\n\n # Add OR to retrieve VMs that are using old deploy ID\n ids = vmpool.retrieve_xmlelements(\n \"/VM_POOL/VM[(DEPLOY_ID = '#{vm_ref}')\" \\\n ' or ' \\\n \"(DEPLOY_ID = '#{vm_ref.split('_')[0]}')]\"\n )\n\n ids.select do |vm|\n hid = vm['HISTORY_RECORDS/HISTORY/HID']\n\n if hid\n hid.to_i == @host_id\n else\n false\n end\n end\n\n one_id = ids[0]['ID'] if ids[0]\n next if one_id.to_i == -1\n\n vms[vm_ref] = {\n :id => one_id,\n :name => \"#{info['name']} - #{@cluster.item.name}\",\n :deploy_id => vm_ref,\n :state => STATE_MAP[info['summary.runtime.powerState']] || 'UNKNOWN'\n }\n end\n\n vms\n end", "def state()\n info[:state]\n end", "def state_vm\n current_vm_states = vcenter_vms_state\n\n # Check if we need a full sync\n full_sync = false\n now = Time.now.to_i\n if @last_sync.nil? || ((now - @last_sync) > VM_SYNC_TIME)\n full_sync = true\n @last_sync = now\n end\n\n str_info = ''\n str_info << \"SYNC_STATE=yes\\nMISSING_STATE=#{VM_MISSING_STATE}\\n\" if full_sync\n\n current_vm_states.each do |_, vm|\n vm_ref = vm[:deploy_id]\n\n if full_sync || need_state_sync?(vm_ref, vm[:state])\n str_info << \"VM = [ ID=\\\"#{vm[:id]}\\\", \"\n str_info << \"DEPLOY_ID=\\\"#{vm[:deploy_id]}\\\", STATE=\\\"#{vm[:state]}\\\" ]\\n\"\n end\n end\n\n @previous_vm_states = current_vm_states\n\n str_info\n end", "def show_state\n\t\tputs \"#{@name} a #{@life_points} points de vie.\"\n\tend", "def show_state\n puts \"#{name} a #{life_points} points de vie !!\"\n end", "def show_state \n puts \"#{@name} a #{@life_points} points de vie.\"\n end", "def show_state\n \tputs \"#{@name} a #{life_points} points de vie\"\n end", "def get_vm_info()\n promise = @compute_client.virtual_machines.get(@rg_name, @instance_name)\n result = promise.value!\n OOLog.info(\"vm info :\"+result.body.inspect)\n return result.body\n end", "def show_state\n puts \"#{name} a #{life_points} points de vie!\"\n end", "def state\n if @lxc_details.nil?\n :missing\n else\n status = nil\n with_proxmox do |proxmox|\n vm_id_str = @lxc_details[:vm_id].to_s\n status =\n if proxmox_get(proxmox, \"nodes/#{@lxc_details[:pve_node]}/lxc\").any? { |data_info| data_info['vmid'] == vm_id_str }\n status_info = proxmox_get(proxmox, \"nodes/#{@lxc_details[:pve_node]}/lxc/#{@lxc_details[:vm_id]}/status/current\")\n # Careful that it is possible that somebody destroyed the VM and so its status is missing\n status = status_info.key?('status') ? status_info['status'].to_sym : :missing\n status = :exited if status == :stopped\n status\n else\n :missing\n end\n end\n status\n end\n end", "def state\n @state\n end", "def state\n self.instance_variables.map { |variable| self.instance_variable_get variable }\n end", "def state\n self.instance_variables.map { |variable| self.instance_variable_get variable }\n end", "def state\n self.instance_variables.map { |variable| self.instance_variable_get variable }\n end", "def show_state\n puts \"#{@name} has #{@life_points} life points\"\n end", "def show_state\r\n puts \"#{@name} à #{@life_points} points de vie\"\r\n end", "def show_state\n puts \"#{names} a #{life_points} points de vie\"\n end", "def state\n @current_state\n end", "def show_state\n puts \"#{@name} à #{@life_points} points de vie\"\n end", "def state\n @state ||= getStateData()\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def read_vm_state vmname\n full_name = \"#{File.basename __dir__}_#{vmname}\"\n cmd = VMSTATE_CMD_TEMPLATE % [full_name]\n output = `#{cmd}`\n\n if output =~ /^name=\"<inaccessible>\"$/\n return :inaccessible\n elsif output =~ /^VMState=\"(.+?)\"$/\n return $1.to_sym\n end\n\n nil\nend", "def state\n info[:state]\n end", "def inspect\n \"#{name}=#{state.inspect} #{location}\"\n end", "def show_state \n puts \"#{@name} à #{@life_points} points de vie\"\n end", "def running\n\t @vm_running = Virtualmachine.isrunning\n end", "def read_state(hyp, machine)\n output = hyp.exec(\"vmadm get #{machine.id}\")\n\n if output.exit_code != 0 || output.stderr.chomp =~ /No such zone configured/ || output.stdout == \"\"\n nil\n else\n JSON.load(output.stdout)\n end\n end", "def state\n State.instance\n end", "def show_state\n puts \"#{name} à #{life_points} points de vie\"\n end", "def state\n @obj_env\n end", "def state\n data.state\n end", "def state\n data.state\n end", "def states; end", "def read_state\n end", "def vm_state(state)\n case state\n when 'poweredOn'\n 'RUNNING'\n when 'suspended'\n 'POWEROFF'\n when 'poweredOff'\n 'POWEROFF'\n else\n 'UNKNOWN'\n end\n end", "def tb_state; @tb_state; end", "def state\n data[:state]\n end", "def state\n @__state\n end", "def monitor\n @summary = @vm.summary\n @state = state_to_c(@summary.runtime.powerState)\n\n if @state != 'a'\n @used_cpu = 0\n @used_memory = 0\n\n @net_rx = 0\n @net_tx = 0\n\n return\n end\n\n @used_memory = @summary.quickStats.hostMemoryUsage * 1024\n\n host = VIDriver::host\n cpuMhz = host.cpuMhz.to_f\n @used_cpu =\n ((@summary.quickStats.overallCpuUsage.to_f / cpuMhz) * 100).to_s\n @used_cpu = sprintf('%.2f',@used_cpu).to_s\n\n vm_stats = VIDriver::retrieve_stats([@vm],\n [\"net.packetsRx\",\"net.packetsTx\"])\n @net_rx = 0\n @net_tx = 0\n\n if vm_stats[@vm] && vm_stats[@vm][:metrics]\n if vm_stats[@vm][:metrics][\"net.packetsRx\"]\n @net_rx = vm_stats[@vm][:metrics][\"net.packetsRx\"].first\n end\n\n if vm_stats[@vm][:metrics][\"net.packetsTx\"]\n @net_tx = vm_stats[@vm][:metrics][\"net.packetsTx\"].first\n end\n end\n\n # Check for negative values\n @used_memory = 0 if @used_memory.to_i < 0\n @used_cpu = 0 if @used_cpu.to_i < 0\n @net_rx = 0 if @net_rx.to_i < 0\n @net_tx = 0 if @net_tx.to_i < 0\n end", "def state\n object.state_code\n end", "def state\n if (interpreter = @interpreter)\n @interpreter.state\n else\n nil\n end\n end", "def show_state\n return \"#{@name} a #{@life_points} points de vie\"\n end", "def live\r\n @state=1\r\n end", "def instructions\n @state.instructions\n end", "def instructions\n @state.instructions\n end", "def vm\n env.vm\n end", "def show_state\n puts \"#{self.name} a #{self.life_points} points de vie et son arme est de niveau #{self.weapon_level}.\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end", "def state_str\n VM_STATE[state]\n end", "def state_str\n VM_STATE[state]\n end", "def description\n @state.description\n end", "def vm_state(state)\n STATE_MAP[state] || 'UNKNOWN'\n end", "def show_state\n\t\treturn \"#{self.name} a #{self.life_points} points de vie.\"\n\tend", "def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end", "def enter_state\n puts \"Entering #{self.class}\"\n execution_state = EXECUTION_STATE[:active]\n end", "def state\n self[:ST]\n end", "def get_state\n send_request(FUNCTION_GET_STATE, [], '', 2, '? ?')\n end", "def get_state\n \"Treasury state: #{@resources}\"\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def __state_internal\n @state\n end", "def show_state\n puts \"#{@names} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end", "def state\n %w{ OFF ON }[params.valve.cmd]\n end", "def inspect\n state_provider = \"[#{box_state} (#{provider})]\"\n \"#{name.ljust(max_length)} #{state_provider.ljust(max_length)} [VM OS <-- #{guest_os}]\"\n end", "def state_machine_details\n erb(:state_machines) if state_machines\nend", "def current_state\n Display.hangman(@lives)\n puts @hints.join('.')\n Display.errors(@incorrect)\n end", "def show_state\n\t\tputs \"#{self.name} a #{self.life_points} points de vie et une arme de niveau #{self.weapon_level}.\"\n\tend", "def state\r\n\t\t\t`#{BITS::BITSADMIN} /getstate {#{@id}}`\r\n\t\tend" ]
[ "0.66668713", "0.66076", "0.6602058", "0.6538977", "0.6533354", "0.64973766", "0.64890385", "0.64790255", "0.64336526", "0.6419743", "0.63984644", "0.63975495", "0.6395126", "0.6390423", "0.6379748", "0.6374456", "0.6364532", "0.6360513", "0.6352875", "0.63508016", "0.6344633", "0.6344167", "0.63354975", "0.6320848", "0.6300579", "0.62839884", "0.6275022", "0.6254324", "0.6214283", "0.621323", "0.621323", "0.621323", "0.6211425", "0.62112135", "0.62054324", "0.61956054", "0.618953", "0.6178133", "0.61761314", "0.61761314", "0.61761314", "0.61761314", "0.61761314", "0.61761314", "0.61761314", "0.61761314", "0.6165773", "0.61592734", "0.614497", "0.61386824", "0.61242604", "0.6112223", "0.6105188", "0.6103577", "0.6095407", "0.6084165", "0.6084165", "0.60754603", "0.60230213", "0.6022828", "0.6022168", "0.6011886", "0.6004706", "0.59943306", "0.59935343", "0.59929806", "0.5927056", "0.59248596", "0.59245145", "0.59245145", "0.591284", "0.58996344", "0.5899409", "0.5894817", "0.5894817", "0.58912253", "0.58903277", "0.5881715", "0.5881699", "0.58749926", "0.58668274", "0.5860488", "0.5859507", "0.5845277", "0.5845277", "0.5845277", "0.5845277", "0.5845277", "0.5845277", "0.5845277", "0.5845277", "0.5845277", "0.5845277", "0.5833738", "0.58287835", "0.58077925", "0.57940626", "0.5790093", "0.57843626", "0.57812345", "0.5779583" ]
0.0
-1
Public: Determines if the VM exists or not. This method looks for the VM's conf file ('.vmx') to determine if the VM exists or not. Examples
def exists? conf_file.successful? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n File.exists? vmx_path\n end", "def check_fusion_vm_exists(options)\n set_vmrun_bin(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n if not File.exist?(fusion_vmx_file)\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n end\n exists = false\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} exists\")\n end\n exists = true\n end\n return exists\nend", "def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end", "def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end", "def check_vbox_vm_config_exists(client_name)\n exists = \"no\"\n vbox_vm_dir = get_vbox_vm_dir(client_name)\n config_file = vbox_vm_dir+\"/\"+client_name+\".vbox\"\n if File.exist?(config_file)\n exists = \"yes\"\n else\n exists = \"no\"\n end\n return exists\nend", "def vm_exists?(uuid)\n end", "def is_vm?\n cmd = \"VBoxManage showvminfo \\\"#{@vbox_name}\\\"\"\n _, stderr, _ = Open3.capture3(cmd)\n if stderr.include? 'Could not find a registered machine named'\n raise \"Virtual Machine #{@vbox_name} does not exist\"\n end\n end", "def check_parallels_vm_exists(options)\n set_vmrun_bin(options)\n exists = false\n vm_list = get_all_parallels_vms(options)\n vm_list.each do |vm_name|\n if vm_name.match(/^#{options['name']}$/)\n exists = true\n return exists\n end\n end\n return exists\nend", "def created?(vm_name, provider='virtualbox')\n\tFile.exist?(\".vagrant/machines/#{vm_name}/#{provider}/id\")\nend", "def vm_exists_silent\n return false unless @state.key?(:id) && !@state[:id].nil?\n\n existing_vm = run_ps ensure_vm_running_ps\n return false if existing_vm.nil? || existing_vm[\"Id\"].nil?\n\n true\n end", "def kvm_exists?(kvm_name)\n begin\n virt.lookup_domain_by_name(kvm_name)\n true\n rescue Libvirt::RetrieveError\n false\n end\nend", "def exists?\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\tend", "def check_fusion_vm_doesnt_exist(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n fusion_disk_file = fusion_vm_dir+\"/\"+options['name']+\".vmdk\"\n if File.exist?(fusion_vmx_file)\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} already exists\")\n quit(options)\n end\n return fusion_vm_dir,fusion_vmx_file,fusion_disk_file\nend", "def exists?\n\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\n\tend", "def provisioned?(vm_name='default', provider='virtualbox')\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\nend", "def provisioned?(vm_name=\"default\", provider=\"virtualbox\")\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\nend", "def vm_exists?(uuid)\n 5.times do\n result = raw(@prlctl_path, 'list', uuid)\n return true if result.exit_code == 0\n\n # Sometimes this happens. In this case, retry.\n # If we don't see this text, the VM really doesn't exist.\n return false unless result.stderr.include?('Login failed:')\n\n # Sleep a bit though to give Parallels Desktop time to fix itself\n sleep 2\n end\n\n # If we reach this point, it means that we consistently got the\n # failure, do a standard prlctl now. This will raise an\n # exception if it fails again.\n execute_prlctl('list', uuid)\n true\n end", "def check_multipass_vm_exists(options)\n exists = false\n if options['name'] == options['empty']\n handle_output(options,\"Warning:\\tNo client name specified\")\n quit(options)\n end\n vm_name = options['name'].to_s\n message = \"Information:\\tChecking if VM #{vm_name} exists\"\n command = \"multipass list |grep #{vm_name}\"\n output = execute_command(options,message,command)\n if output.match(/#{vm_name}/)\n exists = true\n end\n return exists\nend", "def check_parallels_vm_doesnt_exist(options)\n exists = check_parallels_vm_exists(options)\n if exists == true\n handle_output(options,\"Parallels VM #{options['name']} already exists\")\n quit(options)\n end\n return\nend", "def check_docker_vm_exists(options)\n exists = false\n message = \"Information:\\tChecking docker instances for #{options['name']}\"\n command = \"docker-machine ls\"\n output = execute_command(options,message,command)\n output = output.split(/\\n/)\n output.each do |line|\n line = line.chomp\n items = line.split(/\\s+/)\n host = items[0]\n if host.match(/^#{options['name']}$/)\n exists = true\n return exists\n end\n end\n return exists\nend", "def has_vm?(vm_id)\n with_thread_name(\"has_vm?(#{vm_id})\") do\n begin\n @logger.info(\"Checking if VM with id = #{vm_id} exists...\")\n vm = @vm_manager.get_virtual_machine(vm_id)\n !vm.nil? ? true : false\n rescue => e\n @logger.error(e)\n false\n end\n end\n end", "def vip_installed?\n ssh.directory_exists?(vip_path)\n end", "def provisioned?(vm_name='default', provider='virtualbox')\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\n end", "def check_vbox_vm_exists(client_name)\n message = \"Checking:\\tVM \"+client_name+\" exists\"\n command = \"VBoxManage list vms |grep -v 'inaccessible'\"\n host_list = execute_command(message,command)\n if !host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM \"+client_name+\" does not exist\"\n exists = \"no\"\n else\n exists = \"yes\"\n end\n return exists\nend", "def has_vm?(vm_cid)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"has_vm?(#{vm_cid})\") do\n @telemetry_manager.monitor('has_vm?', id: vm_cid) do\n vm = @vm_manager.find(InstanceId.parse(vm_cid, _azure_config.resource_group_name))\n !vm.nil? && vm[:provisioning_state] != 'Deleting'\n end\n end\n end", "def check_fusion_vm_is_running(options)\n list_vms = get_running_fusion_vms(options)\n if list_vms.to_s.match(/#{options['name']}.vmx/)\n running = \"yes\"\n else\n running = \"no\"\n end\n return running\nend", "def looks_like_orionvm_v2?\n File.exists?('/etc/orion_base')\n end", "def user_template_exists?\n !options['puppet_config_template'].nil? &&\n File.exist?(options['puppet_config_template'])\nend", "def check_vbox_vm_doesnt_exist(client_name)\n message = \"Checking:\\tVM \"+client_name+\" doesn't exist\"\n command = \"VBoxManage list vms\"\n host_list = execute_command(message,command)\n if host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM #{client_name} already exists\"\n exit\n end\n return\nend", "def vagrant?\n @vagrant ||= `id vagrant 2>&1`.index 'uid'\n end", "def exists?\n @lxc.exists?(self.name)\n end", "def vbox_host?\n host = false\n if !virtualization.nil? && (virtualization[\"system\"] == \"vbox\" || virtualization[\"systems\"][\"vbox\"] == \"host\")\n host = true if which(\"VBoxManage\")\n end\n host\n end", "def instance_exists(path)\n result = $evm.instance_exists?(path)\n if result\n $evm.log('info',\"Instance:<#{path}> exists. Result:<#{result.inspect}>\") if @debug\n else\n $evm.log('info',\"Instance:<#{path}> does not exist. Result:<#{result.inspect}>\") if @debug\n end\n return result\n end", "def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end", "def exists?(vid)\n perform_request(:action => 'vserver-checkexists', :vserverid => vid)\n !statusmsg.match(/Virtual server exists/i).nil?\n end", "def has_vm?(server_id)\n with_thread_name(\"has_vm?(#{server_id})\") do\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n !server.nil? && !%i[terminated deleted].include?(server.state.downcase.to_sym)\n end\n end", "def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end", "def show_fusion_vm_config(options)\n fusion_vmx_file = \"\"\n exists = check_fusion_vm_exists(options)\n if exists == true\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if File.exist?(fusion_vmx_file)\n print_contents_of_file(options,\"#{options['vmapp']} configuration\",fusion_vmx_file)\n end\n end\n return\nend", "def conf_file\n vmx_path = File.join path, \"*.vmx\"\n conf_files = Dir.glob vmx_path\n\n response = Response.new\n\n case conf_files.count\n when 0\n response.code = 1\n response.message = \"Unable to find a config file for VM '#{@name}' (in '#{vmx_path}')\"\n when 1\n response.code = 0\n response.data = conf_files.first\n else\n if conf_files.include?(File.join(File.dirname(vmx_path), \"#{@name}.vmx\"))\n response.code = 0\n response.data = File.join(File.dirname(vmx_path), \"#{@name}.vmx\")\n else\n response.code = 1\n output = \"Multiple config files found for VM '#{@name}' (\"\n output << conf_files.sort.map { |f| \"'#{File.basename(f)}'\" }.join(', ')\n output << \" in '#{File.dirname(vmx_path)}')\"\n response.message = output\n end\n end\n\n response\n end", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def exists?(vid)\n perform_request(action: 'vserver-checkexists', vserverid: vid)\n !!statusmsg.match(/Virtual server exists/i)\n end", "def rvm?\n\t\t\tFile.exists?(RvmPow::RVM_BINARY)\n\t\tend", "def exists?\n vnic\n end", "def can_be_configured?(vagrant_config, file_config)\n true\n end", "def mmkv_file_exists(file)\n is_exist = false\n if File.methods.include?(:exists?)\n is_exist = File.exists? file\n else\n is_exist = File.exist? file\n end\n return is_exist\nend", "def conf_file\n vmx_path = File.join path, \"*.vmx\"\n conf_files = Dir.glob vmx_path\n\n response = Response.new\n\n case conf_files.count\n when 0\n response.code = 1\n response.message = \"Unable to find a config file for VM '#{@name}' (in '#{vmx_path}')\"\n when 1\n response.code = 0\n response.data = conf_files.first\n else\n if conf_files.include?(File.join(File.dirname(vmx_path), \"#{@name}.vmx\"))\n response.code = 0\n response.data = File.join(File.dirname(vmx_path), \"#{@name}.vmx\")\n else\n response.code = 1\n output = \"Multiple config files found for VM '#{@name}' (\"\n output << conf_files.sort.map { |f| \"'#{File.basename(f)}'\" }.join(', ')\n output << \" in '#{File.dirname(vmx_path)}')\"\n response.message = output\n end\n end\n\n response.data.gsub! ' ', '\\ ' if response.successful?\n\n response\n end", "def get_fusion_vm_status(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Not Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def vboxchk(session)\n vm = false\n vboxprocs = [\n \"vboxservice.exe\",\n \"vboxtray.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vboxprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\DSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\FADT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\RSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n key_path = 'HKLM\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0'\n if registry_getvaldata(key_path,'Identifier') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System','SystemBiosVersion') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"VBoxMouse\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxGuest\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxService\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxSF\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualBox\" },\n :update => :unique_data\n )\n print_good(\"This is a Sun VirtualBox Virtual Machine\")\n return \"VirtualBox\"\n end\n end", "def should_install_vagrant?\n vagrant_v_output = run_command('vagrant -v')[:output]\n installed_version = vagrant_v_output.match(/^Vagrant ([0-9.]+)\\s*$/)[1]\n SemVersion.new(VAGRANT_VERSION) > SemVersion.new(installed_version)\n rescue Errno::ENOENT\n true\n end", "def only_vmware?(server)\n return false if server['general']['alive'].to_i == 1\n return false unless server['netdb'].empty?\n return true unless server['vmware'].empty?\n\n false\n end", "def vmwarechk(session)\n vm = false\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"vmdebug\")\n vm = true\n elsif srvvals and srvvals.include?(\"vmmouse\")\n vm = true\n elsif srvvals and srvvals.include?(\"VMTools\")\n vm = true\n elsif srvvals and srvvals.include?(\"VMMEMCTL\")\n vm = true\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System\\BIOS','SystemManufacturer') =~ /vmware/i\n vm = true\n end\n end\n if not vm\n key_path = 'HKLM\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0'\n if registry_getvaldata(key_path,'Identifier') =~ /vmware/i\n vm = true\n end\n end\n if not vm\n vmwareprocs = [\n \"vmwareuser.exe\",\n \"vmwaretray.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vmwareprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n end\n\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VMware\" },\n :update => :unique_data\n )\n print_good(\"This is a VMware Virtual Machine\")\n return \"VMWare\"\n end\n end", "def has_checkpoint?(vm_name, checkpoint_name) \n\n if !ENV['UPLF_NO_VAGRANT_CHECKPOINTS'].nil?\n _log.info(\"#{vm_name}: [-] provision checkpoint: #{checkpoint_name} (UPLF_NO_VAGRANT_CHECKPOINTS is set)\")\n \n return false \n end\n \n file_name = \".vagrant/machines/#{vm_name}/virtualbox/.uplift/.checkpoint-#{checkpoint_name}\"\n exists = File.exist?(file_name)\n \n if exists == true \n _log.info_light(\"#{vm_name}: [+] provision checkpoint: #{checkpoint_name}\")\n else \n _log.info(\"#{vm_name}: [-] provision checkpoint: #{checkpoint_name}\")\n end\n \n return exists\n end", "def vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end", "def vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end", "def exists?\n #notice(\"DEBUG + \" + resource[:content])\n configs = Hash.new\n qmgmt(['volume', 'config', 'list']).each_line { |l|\n configs[l.chomp()] = true\n }\n\n # diff config is volume config exists\n if ( configs[resource[:name]] )\n diff_config\n else\n return false\n end\n end", "def is_vmware(machine)\n machine.provider_name.to_s().start_with?('vmware')\n end", "def active_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + @resource[:name] )\n end", "def raise_if_no_exists_in_vcenter\n raise 'vCenter device does not exist at the moment' unless exists?\n end", "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end", "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end", "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end", "def agent_template_exists?(agent)\n if target_guestshell?(agent)\n opts = { acceptable_exit_codes: [0, 2], pty: true }\n else\n opts = { acceptable_exit_codes: [0, 2] }\n end\n result = on agent, \"#{pp(agent)} ls #{get_puppet_config(agent)}\", opts\n result.exit_code == 0\nend", "def find_or_create_vm(bootstrap_options, machine_spec, action_handler)\n vm = vsphere_helper.find_vm(\n bootstrap_options[:vm_folder],\n machine_spec.name\n )\n if vm\n Chef::Log.info machine_msg(\n machine_spec.name,\n vm.config.instanceUuid,\n 'already created'\n )\n else\n\t if bootstrap_options[:create_new_vm]\n\t vm = clone_vm(\n action_handler,\n bootstrap_options,\n machine_spec.name)\n\t\t else\n raise \"#{machine_spec.name}is not present in the vCenter. Aborting the node creation\"\n end\n end\n vm\n end", "def get_machine_id()\n machine_id_filepath = \".vagrant/machines/default/virtualbox/id\"\n\n if not File.exists? machine_id_filepath\n # VM hasn't been created yet.\n return false\n end\n\n # This is probably not a great way to do this: shell out to the cat command.\n # It seems likely that ruby has a get-file-contents function somewhere,\n # but I'm definitely not a ruby dev right now.\n machine_id = `cat #{machine_id_filepath}`\nend", "def valid?(home_path)\n return false if !vagrantfile_path\n return false if !vagrantfile_path.directory?\n\n # Create an environment so we can determine the active\n # machines...\n found = false\n env = vagrant_env(home_path)\n env.active_machines.each do |name, provider|\n if name.to_s == self.name.to_s &&\n provider.to_s == self.provider.to_s\n found = true\n break\n end\n end\n\n # If an active machine of the same name/provider was not\n # found, it is already false.\n return false if !found\n\n # Get the machine\n machine = nil\n begin\n machine = env.machine(self.name.to_sym, self.provider.to_sym)\n rescue Errors::MachineNotFound\n return false\n end\n\n # Refresh the machine state\n return false if machine.state.id == MachineState::NOT_CREATED_ID\n\n true\n end", "def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend", "def virtual_host_exists?(host)\n if File.exists?(host)\n separator\n puts \"Sorry, but a virtual host in the same name already exist!\"\n puts \"Please try with a diffrent name.\"\n puts \"[Hint: speedy new_name.local ]\"\n separator\n exit!\n end\n end", "def file_exists?(name)\n\n #if file exists return true\n Chef::Log.debug \"DEBUG: Checking to see if the curent file: '#{ name }.conf' exists in pool directory #{ node[\"php_fpm\"][\"pools_path\"] }\"\n ::File.file?(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ name }.conf\")\n\nend", "def get_fusion_vm_vmx_file_value(options)\n vm_value = \"\"\n vmx_file = get_fusion_vm_vmx_file(options)\n if File.exist?(vmx_file)\n if File.readable?(vmx_file)\n vm_config = ParseConfig.new(vmx_file)\n vm_value = vm_config[options['search']]\n else\n vm_value = \"File Not Readable\"\n end\n else\n if options['verbose'] == true\n handle_output(options,\"Warning:\\tWMware configuration file \\\"#{vmx_file}\\\" not found for client\")\n end\n end\n return vm_value\nend", "def hypervchk(session)\n vm = false\n sfmsvals = registry_enumkeys('HKLM\\SOFTWARE\\Microsoft')\n if sfmsvals and sfmsvals.include?(\"Hyper-V\")\n vm = true\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System','SystemBiosVersion') =~ /vrtual/i\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\FADT')\n if srvvals and srvvals.include?(\"VRTUAL\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\RSDT')\n if srvvals and srvvals.include?(\"VRTUAL\")\n vm = true\n end\n end\n\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.hypervisor',\n :data => { :hypervisor => \"MS Hyper-V\" },\n :update => :unique_data\n )\n print_good(\"This is a Hyper-V Virtual Machine\")\n return \"MS Hyper-V\"\n end\n end", "def verify_puppet_exists\n MakeMakefile::Logging.instance_variable_set(:@logfile, File::NULL)\n find_executable0('puppet')\n end", "def exists?\n Puppet.debug(self.class.to_s.split('::').last + ': Calling exists method : ')\n @property_hash[:ensure] == :present\n end", "def config_template_exist?\n Chef::Log.debug(\"config_template_exist?: Checking for config file template #{new_resource.config_file}\")\n config_resource = !find_resource!(:template, ::File.join(new_resource.config_file)).nil?\n\n Chef::Log.debug(\"config_template_exist?: #{config_resource}\")\n config_resource\n rescue Chef::Exceptions::ResourceNotFound\n Chef::Log.debug(\"config_template_exist?: Config file template #{new_resource.config_file} ResourceNotFound\")\n false\n end", "def check_vbox_is_installed()\n app_dir = \"/Applications/VirtualBox.app\"\n if !File.directory?(app_dir)\n puts \"Warning:\\tVirtualbox not installed\"\n exit\n end\nend", "def vagrant_provision\n if @env\n puts \"Running vagrant provision.\"\n @env.cli(\"provision\") && FileUtils.touch('.vagrant_last_provisioned')\n else\n puts \"Setting up vagrant environment.\"\n setup_vagrant && FileUtils.touch('.vagrant_last_provisioned')\n end\nend", "def vm_guest_ip?(vm)\n vm.guest.guestState == 'running' && vm.guest.toolsRunningStatus == 'guestToolsRunning' && !vm.guest.ipAddress.nil? && IPAddr.new(vm.guest.ipAddress).ipv4?\n end", "def multivm?\n vms.length > 1\n end", "def exists?\n name_exists? ? exact_deployment? : false\n end", "def controller_exists(name, controller_name)\n return false if name.nil?\n\n out, err = Open3.capture2e(\"VBoxManage showvminfo #{name}\")\n raise out unless err.exitstatus === 0\n\n out.split(/\\n/)\n .select { |x| x.start_with? 'Storage Controller Name' }\n .map { |x| x.split(':')[1].strip }\n .any? { |x| x == controller_name }\nend", "def exists?\n get_lxd_config_value(resource[:config]) != nil\n end", "def vm_ready?(_pool_name, _vm_name)\n raise(\"#{self.class.name} does not implement vm_ready?\")\n end", "def vm_ready?(_pool_name, _vm_name)\n raise(\"#{self.class.name} does not implement vm_ready?\")\n end", "def first_run?\n not File.exists? '/boot/config/.boxcar'\n end", "def exists?\n\t\t# Look for volume\n\t\t@vol_id = DSMAPIVolume.find_volume(@resource[:name], @resource[:storagecenter])\n\t\tif @vol_id == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "def apparently_configured?\n return false unless File.exist?(user_vimrc_path)\n\n FileUtils.compare_file(user_vimrc_path, template_vimrc_path)\n end", "def config_exists?(path)\n File.exist?(path)\n end", "def exists?(name)\r\n \t!template_paths(name).empty?\r\n end", "def inactive_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name] )\n end", "def exists?\n # Puppet.notice(\"cert - exists - resource = #{resource.inspect}\")\n # Puppet.notice(\"cert - exists - resource = #{@resource.inspect}\")\n cert = certificate\n priv_key = private_key\n # Check for the certificate existing at all\n # Check if the given private key matches the given cert\n # Check if the certificate exists in Vault\n # Check if the certificate is expired or not\n # Check if the cert is revoked or not\n (cert && priv_key && cert.check_private_key(priv_key) &&\n check_cert_exists && !check_cert_expiring && !check_cert_revoked)\n end", "def exists?\n prepare_environment\n load_template(@data['serverProfileTemplateUri'], 'new_profile')\n return @resource_type.find_by(@client, @data).any? if resource['ensure'].to_sym == :absent\n super([nil, :found, :get_available_targets, :get_available_networks, :get_available_servers, :get_compliance_preview,\n :get_messages, :get_profile_ports, :get_transformation, :absent])\n end", "def controller_exists(name, controller_name)\n out, err = Open3.capture2e(\"VBoxManage showvminfo #{name}\")\n\n return false if err.exitstatus != 0\n\n out.split(/\\n/)\n .select { |x| x.start_with? 'Storage Controller Name' }\n .map { |x| x.split(':')[1].strip }\n .any? { |x| x == controller_name }\nend", "def controller_exists(name, controller_name)\n out, err = Open3.capture2e(\"VBoxManage showvminfo #{name}\")\n\n return false if err.exitstatus != 0\n\n out.split(/\\n/)\n .select { |x| x.start_with? 'Storage Controller Name' }\n .map { |x| x.split(':')[1].strip }\n .any? { |x| x == controller_name }\nend", "def centos?\n File.exist?('/etc/centos-release')\nend", "def computer_exists?(fwip)\n system(\"ping -c1 -w1 #{fwip}\")\nend", "def check_vbox_hostonly_network()\n message = \"Checking:\\tVirtualBox hostonly network exists\"\n command = \"VBoxManage list hostonlyifs |grep '^Name' |awk '{print $2}' |head -1\"\n if_name = execute_command(message,command)\n if_name = if_name.chomp\n if !if_name.match(/vboxnet/)\n message = \"Plumbing:\\tVirtualBox hostonly network\"\n command = \"VBoxManage hostonlyif create\"\n execute_command(message,command)\n message = \"Finding:\\tVirtualBox hostonly network name\"\n command = \"VBoxManage list hostonlyifs |grep '^Name' |awk '{print $2}' |head -1\"\n if_name = execute_command(message,command)\n if_name = if_name.chomp\n if_name = if_name.gsub(/'/,\"\")\n message = \"Disabling:\\tDHCP on \"+if_name\n command = \"VBoxManage dhcpserver remove --ifname #{if_name}\"\n execute_command(message,command)\n end\n message = \"Checking:\\tVirtualBox hostonly network \"+if_name+\" has address \"+$default_hostonly_ip\n command = \"VBoxManage list hostonlyifs |grep 'IPAddress' |awk '{print $2}' |head -1\"\n host_ip = execute_command(message,command)\n host_ip = host_ip.chomp\n if !host_ip.match(/#{$default_hostonly_ip}/)\n message = \"Configuring:\\tVirtualBox hostonly network \"+if_name+\" with IP \"+$default_hostonly_ip\n command = \"VBoxManage hostonlyif ipconfig #{if_name} --ip #{$default_hostonly_ip} --netmask #{$default_netmask}\"\n execute_command(message,command)\n end\n gw_if_name = get_osx_gw_if_name()\n check_osx_nat(gw_if_name,if_name)\n return if_name\nend", "def exists?\n @aws_instance.exists? && @aws_instance.state.name != 'terminated'\n end", "def exists?\n zk.exists?(path)\n end", "def checkFileExists()\n if(File.exist?(@fileName_vars))\n return\n else\n abort(\"Error: could not find the config file. Please make sure it is in the root of the application folder.\")\n end\n end" ]
[ "0.7622194", "0.754773", "0.7458194", "0.7458194", "0.72291404", "0.71238846", "0.7053148", "0.69420063", "0.6885644", "0.6843978", "0.68160194", "0.68004954", "0.6784", "0.67590314", "0.6726877", "0.6713914", "0.6643735", "0.66268003", "0.65253115", "0.6507069", "0.64989924", "0.64126563", "0.64092386", "0.64028245", "0.63713723", "0.62955374", "0.6277653", "0.6156936", "0.60958904", "0.6033109", "0.60249454", "0.6021568", "0.5981733", "0.5970859", "0.59292", "0.58930904", "0.58738047", "0.5873051", "0.5847041", "0.5841146", "0.5841146", "0.5821627", "0.5814084", "0.57964104", "0.5773551", "0.5758059", "0.5718108", "0.570965", "0.5707357", "0.57050616", "0.57035035", "0.569838", "0.5665839", "0.5661506", "0.5661506", "0.56606936", "0.56564575", "0.5641744", "0.56353986", "0.5626639", "0.5626639", "0.5626639", "0.5619923", "0.56073624", "0.55953074", "0.5576798", "0.5576044", "0.5563672", "0.55414474", "0.55245733", "0.55184805", "0.551343", "0.5506248", "0.5491483", "0.5465176", "0.5453937", "0.54403067", "0.5427152", "0.5424652", "0.5420268", "0.54172486", "0.5409959", "0.5409959", "0.54052496", "0.54006785", "0.53967637", "0.53864086", "0.5386372", "0.53811646", "0.5375952", "0.5371709", "0.53708977", "0.53692836", "0.53597814", "0.5353105", "0.5343634", "0.53428864", "0.5338691", "0.5334823" ]
0.58102995
43
Public: Determines if a VM is suspended. Examples
def suspended? running_response = running? return running_response unless running_response.successful? response = Response.new :code => 0, :data => false response.data = suspend_file_exists? unless running_response.data response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suspended?\n status.suspended?\n end", "def suspended?\n (status == SUSPENDED)\n end", "def suspended?\n !active?\n end", "def suspended?()\n #This is a stub, used for indexing\n end", "def suspended?\n (status == SUSPEND)\n end", "def is_suspended?\n current_teacher && current_teacher.suspended == true\n end", "def state\n running_vms = vboxmanage('list', 'runningvms')\n state = 'poweroff'\n if running_vms.kind_of?(Array)\n running_vms.each do |vm|\n if vm.include? resource[:name]\n state = 'running'\n end\n end\n else\n \tif running_vms.include? resource[:name]\n \t state = 'running'\n \tend\n end\n state\n end", "def teacher_is_suspended?( teacher)\n teacher.suspended\n end", "def suspended\n return @suspended\n end", "def powered_off?\n cmd = \"VBoxManage showvminfo \\\"#{@vbox_name}\\\" | grep \\\"State:\\\"\"\n print cmd if @verbose\n out = `#{cmd}`\n print out if @verbose\n if out.include?('powered off') || out.include?('aborted')\n return true\n end\n end", "def paused?\n !running?\n end", "def paused?\n paused\n end", "def suspend\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = running?\n return running_response unless running_response.successful?\n\n unless running_response.data\n return Response.new :code => 1, :message => 'VM is not running'\n end\n\n conf_file_response = conf_file\n return conf_file_response unless conf_file_response.successful?\n\n command = \"#{vmrun_cmd} suspend \"\n command << \"#{conf_file_response.data} 2>&1\"\n\n Response.from_command(`#{command}`)\n end", "def suspended?(pod_id)\n query_podcast_with_id(pod_id).get(:suspended)\n end", "def suspended=(value)\n @suspended = value\n end", "def paused?\n @state == :paused\n end", "def is_suspended\n if is_suspended?\n flash[:danger] = \"Your account has been suspended.\"\n redirect_to root_path\n end\n end", "def suspend\n FFI::Libvirt.virDomainSuspend(self) == 0\n end", "def suspend\n FFI::Libvirt.virDomainSuspend(self) == 0\n end", "def running\n\t @vm_running = Virtualmachine.isrunning\n end", "def suspend!\n return if suspended?\n self.status = \"suspended\"\n self.stop = Time.now.to_s\n end", "def paused?\n return true if @paused > 0\n return false\n end", "def present_and_stopped?\n return inactive_instance_dir_exists?\n end", "def suspend\n execute(\"controlvm\", @uuid, \"savestate\")\n end", "def paused?\n @server.make_json_request('show', tvdbid: @tvdbid)['data']['paused'] == 1\n end", "def enabled?\n !suspended\n end", "def paused?\n\n get_expression_pool.is_paused?(self)\n end", "def paused?\n @paused > 0\n end", "def is_msg_handler_suspended?\n return @srv_msg_handler_susp\n end", "def paused?\n @paused == true\n end", "def paused?\n @paused == true\n end", "def paused?\n @paused == true\n end", "def suspended!\n self.update_attribute(:status, SUSPEND)\n end", "def check_fusion_vm_is_running(options)\n list_vms = get_running_fusion_vms(options)\n if list_vms.to_s.match(/#{options['name']}.vmx/)\n running = \"yes\"\n else\n running = \"no\"\n end\n return running\nend", "def paused?\r\n\t\treturn @pause\r\n\tend", "def suspend\n requires :id\n begin\n response = service.post_suspend_vapp(id)\n rescue Fog::VcloudDirector::Compute::BadRequest => ex\n Fog::Logger.debug(ex.message)\n return false\n end\n service.process_task(response.body)\n end", "def suspend\n process_status = status\n if process_status != 'terminated' && process_status != 'stopped'\n return status if Process.kill('STOP', @proc_attrs[:pid].to_i)\n end\n process_status\n rescue Errno::EPERM\n return 'non-privilaged operation'\n end", "def suspend\n\t\t@state = STATE_SUSPENDED\n\tend", "def resume\n return true if active?\n FFI::Libvirt.virDomainResume(self) == 0\n end", "def resume\n return true if active?\n FFI::Libvirt.virDomainResume(self) == 0\n end", "def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end", "def suspended?\n next_payment_at \\\n && (next_payment_at + UserSystem.account_grace_period).to_date < Date.today\n end", "def stopped?\n status == \"TERMINATED\"\n end", "def suspend\n @suspended = true\n end", "def inactive?\n (status == INACTIVE)\n end", "def paused?\n @paused || paused.present?\n end", "def paused?\n @paused || paused.present?\n end", "def vm_exists_silent\n return false unless @state.key?(:id) && !@state[:id].nil?\n\n existing_vm = run_ps ensure_vm_running_ps\n return false if existing_vm.nil? || existing_vm[\"Id\"].nil?\n\n true\n end", "def stopped?\n @state == :stopped\n end", "def esta_suspendida?\n\n if self.estatus_id == 10029\n return true\n else\n return false\n end\n # solicitud_causa_renuncia = SolicitudCausaRenuncia.find_by_solicitud_id self.id\n\n #if solicitud_causa_renuncia.nil?\n # return false\n #else\n # return true\n #end\n end", "def true(argvs)\n return nil unless argvs\n return nil unless argvs.is_a? Sisimai::Data\n return nil unless argvs.deliverystatus.size > 0\n\n return true if argvs.reason == 'suspend'\n return true if match(argvs.diagnosticcode)\n return false\n end", "def resumed\n !!@hash_object[:resumed]\n end", "def suspend\n Fission::Action::VM::Suspender.new(self).suspend\n end", "def pause?\n\t\t\treturn account_life_cycle_status == PAUSE \n\t\tend", "def running?\n self.reload\n self.virtual_machine_state == \"RUNNING\"\n end", "def is_inactive?\n return (self.status == HostResult::STATUS_INACTIVE)\n end", "def is_vm?\n cmd = \"VBoxManage showvminfo \\\"#{@vbox_name}\\\"\"\n _, stderr, _ = Open3.capture3(cmd)\n if stderr.include? 'Could not find a registered machine named'\n raise \"Virtual Machine #{@vbox_name} does not exist\"\n end\n end", "def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end", "def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end", "def suspend_vm(vmname)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show vm name=#{vmname}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"suspend vm name=#{vmname}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end", "def paused?\n with_queue_control do |control|\n control.is_paused\n end\n end", "def stopped?\n\t\treturn ! self.running?\n\tend", "def vm_state(state)\n case state\n when 'poweredOn'\n 'RUNNING'\n when 'suspended'\n 'POWEROFF'\n when 'poweredOff'\n 'POWEROFF'\n else\n 'UNKNOWN'\n end\n end", "def paused?\n !!adapter && adapter.paused?\n end", "def is_running?\n # TODO: cache this maybe?\n fetch_is_running?\n end", "def paused?(topic, partition)\n pause = pause_for(topic, partition)\n pause.paused? && !pause.expired?\n end", "def sim_is_running?\n not sim_pid.nil?\n end", "def suspend\n execute_prlctl('suspend', @uuid)\n end", "def _suspend\n\t\t# Ask the user if they would like to background the session\n\t\tif (prompt_yesno(\"Background session #{name}?\") == true)\n\t\t\tself.interacting = false\n\t\tend\n\tend", "def running?\n !(status =~ /running/).nil?\n end", "def running?\n !(status =~ /running/).nil?\n end", "def running?\n !(status =~ /running/).nil?\n end", "def suspend\n raise Suspended\n end", "def not_started?\n if self.status == self.statuses[\"Not started\"]\n return true\n end\n return false\n end", "def state\n return \"not created\" unless self.exists?\n\n return \"suspend\" if self.suspended?\n\n return \"running\" if self.running?\n\n return \"not running\"\n end", "def running?\n !pid.nil? && status == 'running'\n end", "def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend", "def invm?\n @is_invm\n end", "def is_running?\n @running\n end", "def running?\n status == 'running'\n end", "def unscheduled?\n state == :unscheduled\n end", "def running?\n status == :running\n end", "def state(vm_name)\n `VBoxManage showvminfo #{vm_name}` =~ /^State:\\s+(.*)$/ ? $1 : 'unknown'\n end", "def running?\n @state == :running\n end", "def suspend\n data = JSON.generate(:suspend => nil)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end", "def started?\n status['Running']\n end", "def waiting_for_breakpoint?\n @breakpoint_listener.status == 'sleep'\n end", "def running?\n @is_running\n end", "def vboxchk(session)\n vm = false\n vboxprocs = [\n \"vboxservice.exe\",\n \"vboxtray.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vboxprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\DSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\FADT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\RSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n key_path = 'HKLM\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0'\n if registry_getvaldata(key_path,'Identifier') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System','SystemBiosVersion') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"VBoxMouse\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxGuest\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxService\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxSF\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualBox\" },\n :update => :unique_data\n )\n print_good(\"This is a Sun VirtualBox Virtual Machine\")\n return \"VirtualBox\"\n end\n end", "def terminated?\n INACTIVE_STATUS_CHOICES.include?(self.status)\n end", "def is_game_time_paused()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Timer_is_game_time_paused(@handle.ptr)\n result\n end", "def resume\n @suspended = false\n end", "def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def vmwarechk(session)\n vm = false\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"vmdebug\")\n vm = true\n elsif srvvals and srvvals.include?(\"vmmouse\")\n vm = true\n elsif srvvals and srvvals.include?(\"VMTools\")\n vm = true\n elsif srvvals and srvvals.include?(\"VMMEMCTL\")\n vm = true\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System\\BIOS','SystemManufacturer') =~ /vmware/i\n vm = true\n end\n end\n if not vm\n key_path = 'HKLM\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0'\n if registry_getvaldata(key_path,'Identifier') =~ /vmware/i\n vm = true\n end\n end\n if not vm\n vmwareprocs = [\n \"vmwareuser.exe\",\n \"vmwaretray.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vmwareprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n end\n\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VMware\" },\n :update => :unique_data\n )\n print_good(\"This is a VMware Virtual Machine\")\n return \"VMWare\"\n end\n end", "def check_for_pause\n ControllableThread.check_for_pause\n end", "def running?\n status.running? && !starting?\n end", "def checkvrtlpc(session)\n vm = false\n vpcprocs = [\n \"vmusrvc.exe\",\n \"vmsrvc.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vpcprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"vpc-s3\")\n vm = true\n elsif srvvals and srvvals.include?(\"vpcuhub\")\n vm = true\n elsif srvvals and srvvals.include?(\"msvmmouf\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualPC\" },\n :update => :unique_data\n )\n print_good(\"This is a VirtualPC Virtual Machine\")\n return \"VirtualPC\"\n end\n end" ]
[ "0.7707653", "0.7624279", "0.7370699", "0.7369654", "0.73558897", "0.68175644", "0.6817079", "0.6506195", "0.64723384", "0.64467597", "0.63937956", "0.6337369", "0.63169354", "0.63122475", "0.62116605", "0.6162644", "0.615737", "0.6099624", "0.6099624", "0.60401946", "0.60336035", "0.6025065", "0.60034055", "0.59811527", "0.596706", "0.59569806", "0.59425807", "0.58873266", "0.58423257", "0.5818429", "0.5818429", "0.5818429", "0.57962996", "0.57884383", "0.5787966", "0.5772525", "0.57586396", "0.5756085", "0.5754521", "0.5754521", "0.5753909", "0.572411", "0.5721258", "0.56966925", "0.5670765", "0.56703216", "0.56703216", "0.56670994", "0.56499624", "0.56339115", "0.5625913", "0.56253177", "0.56179625", "0.5597685", "0.5593042", "0.55876076", "0.558088", "0.5579831", "0.5579831", "0.55673265", "0.5544416", "0.552911", "0.5519306", "0.55139786", "0.55133754", "0.5508308", "0.5503324", "0.5500698", "0.5498576", "0.54911816", "0.54911816", "0.54911816", "0.54727346", "0.5469521", "0.54632443", "0.5456621", "0.5438781", "0.54379624", "0.54345167", "0.54284734", "0.542422", "0.5417776", "0.540388", "0.54022354", "0.5386436", "0.5367742", "0.5336191", "0.53291494", "0.53185743", "0.5310914", "0.52994573", "0.5290698", "0.52884114", "0.52842885", "0.52842885", "0.52842623", "0.5282125", "0.52781004", "0.5276585" ]
0.630387
14
Public: Determines if a VM has a suspend file ('.vmem') in it's directory. This only looks for a suspend file which matches the name of the VM. Examples
def suspend_file_exists? File.file? File.join(path, "#{@name}.vmem") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suspend\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = running?\n return running_response unless running_response.successful?\n\n unless running_response.data\n return Response.new :code => 1, :message => 'VM is not running'\n end\n\n conf_file_response = conf_file\n return conf_file_response unless conf_file_response.successful?\n\n command = \"#{vmrun_cmd} suspend \"\n command << \"#{conf_file_response.data} 2>&1\"\n\n Response.from_command(`#{command}`)\n end", "def check_parallels_vm_exists(options)\n set_vmrun_bin(options)\n exists = false\n vm_list = get_all_parallels_vms(options)\n vm_list.each do |vm_name|\n if vm_name.match(/^#{options['name']}$/)\n exists = true\n return exists\n end\n end\n return exists\nend", "def provisioned?(vm_name='default', provider='virtualbox')\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\nend", "def exists?\n File.exists? vmx_path\n end", "def provisioned?(vm_name=\"default\", provider=\"virtualbox\")\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\nend", "def mmkv_file_exists(file)\n is_exist = false\n if File.methods.include?(:exists?)\n is_exist = File.exists? file\n else\n is_exist = File.exist? file\n end\n return is_exist\nend", "def provisioned?(vm_name='default', provider='virtualbox')\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\n end", "def created?(vm_name, provider='virtualbox')\n\tFile.exist?(\".vagrant/machines/#{vm_name}/#{provider}/id\")\nend", "def check_fusion_vm_exists(options)\n set_vmrun_bin(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n if not File.exist?(fusion_vmx_file)\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n end\n exists = false\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} exists\")\n end\n exists = true\n end\n return exists\nend", "def is_vm?\n cmd = \"VBoxManage showvminfo \\\"#{@vbox_name}\\\"\"\n _, stderr, _ = Open3.capture3(cmd)\n if stderr.include? 'Could not find a registered machine named'\n raise \"Virtual Machine #{@vbox_name} does not exist\"\n end\n end", "def suspended?\n running_response = running?\n return running_response unless running_response.successful?\n\n response = Response.new :code => 0, :data => false\n response.data = suspend_file_exists? unless running_response.data\n\n response\n end", "def suspended?\n running_response = running?\n return running_response unless running_response.successful?\n\n response = Response.new :code => 0, :data => false\n response.data = suspend_file_exists? unless running_response.data\n\n response\n end", "def vm_file_extensions\n ['.nvram', '.vmdk', '.vmem', '.vmsd', '.vmss', '.vmx', '.vmxf']\n end", "def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end", "def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end", "def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end", "def check_fusion_vm_is_running(options)\n list_vms = get_running_fusion_vms(options)\n if list_vms.to_s.match(/#{options['name']}.vmx/)\n running = \"yes\"\n else\n running = \"no\"\n end\n return running\nend", "def rvm?\n\t\t\tFile.exists?(RvmPow::RVM_BINARY)\n\t\tend", "def has_checkpoint?(vm_name, checkpoint_name) \n\n if !ENV['UPLF_NO_VAGRANT_CHECKPOINTS'].nil?\n _log.info(\"#{vm_name}: [-] provision checkpoint: #{checkpoint_name} (UPLF_NO_VAGRANT_CHECKPOINTS is set)\")\n \n return false \n end\n \n file_name = \".vagrant/machines/#{vm_name}/virtualbox/.uplift/.checkpoint-#{checkpoint_name}\"\n exists = File.exist?(file_name)\n \n if exists == true \n _log.info_light(\"#{vm_name}: [+] provision checkpoint: #{checkpoint_name}\")\n else \n _log.info(\"#{vm_name}: [-] provision checkpoint: #{checkpoint_name}\")\n end\n \n return exists\n end", "def suspend_fusion_vm(options)\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Stopping:\\tVirtual Box VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion suspend '#{fusion_vmx_file}'\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} not running\")\n end\n end\n return\nend", "def check_vbox_is_installed()\n app_dir = \"/Applications/VirtualBox.app\"\n if !File.directory?(app_dir)\n puts \"Warning:\\tVirtualbox not installed\"\n exit\n end\nend", "def check_vbox_vm_config_exists(client_name)\n exists = \"no\"\n vbox_vm_dir = get_vbox_vm_dir(client_name)\n config_file = vbox_vm_dir+\"/\"+client_name+\".vbox\"\n if File.exist?(config_file)\n exists = \"yes\"\n else\n exists = \"no\"\n end\n return exists\nend", "def vboxchk(session)\n vm = false\n vboxprocs = [\n \"vboxservice.exe\",\n \"vboxtray.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vboxprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\DSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\FADT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\RSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n key_path = 'HKLM\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0'\n if registry_getvaldata(key_path,'Identifier') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System','SystemBiosVersion') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"VBoxMouse\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxGuest\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxService\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxSF\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualBox\" },\n :update => :unique_data\n )\n print_good(\"This is a Sun VirtualBox Virtual Machine\")\n return \"VirtualBox\"\n end\n end", "def virtual_file?(name); end", "def find_vm(rp,vm_name)\n mob_vm = nil\n rp.each do |vm|\n break if ! mob_vm.nil?\n mob_vm = vm if vm.name == vm_name\n end\n if mob_vm.nil?\n fail \"Could not find virtual machine: #{vm_name}\"\n end\n mob_vm\n end", "def virtual_file?(name)\n [\"(irb)\", \"-e\", \"(byebug)\", \"(eval)\"].include?(name)\n end", "def check_fusion_vm_doesnt_exist(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n fusion_disk_file = fusion_vm_dir+\"/\"+options['name']+\".vmdk\"\n if File.exist?(fusion_vmx_file)\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} already exists\")\n quit(options)\n end\n return fusion_vm_dir,fusion_vmx_file,fusion_disk_file\nend", "def looks_like_orionvm_v2?\n File.exists?('/etc/orion_base')\n end", "def check_multipass_vm_exists(options)\n exists = false\n if options['name'] == options['empty']\n handle_output(options,\"Warning:\\tNo client name specified\")\n quit(options)\n end\n vm_name = options['name'].to_s\n message = \"Information:\\tChecking if VM #{vm_name} exists\"\n command = \"multipass list |grep #{vm_name}\"\n output = execute_command(options,message,command)\n if output.match(/#{vm_name}/)\n exists = true\n end\n return exists\nend", "def existing_kvms\n Dir.glob(File.join(KVM_HOME, 'storage', '*.qcow2')).map do |file|\n File.basename(file).sub('.qcow2', '')\n end\nend", "def vm_exists_silent\n return false unless @state.key?(:id) && !@state[:id].nil?\n\n existing_vm = run_ps ensure_vm_running_ps\n return false if existing_vm.nil? || existing_vm[\"Id\"].nil?\n\n true\n end", "def find_vm(name, recursive: true)\n vms(recursive: recursive).find { |each| each.name == name }\n end", "def looks_like_orionvm_v3?\n File.exists?('/etc/udev/rules.d/70-contextdrive.rules')\n end", "def find_vm(name, recursive: true)\n vms(recursive: recursive).find { |each| each.name == name }\n end", "def vm(name)\n @vms.find {|v| v.name == name}\n end", "def vm_exists?(uuid)\n end", "def find(name)\n list.select do |vm|\n vm.name.to_s.index(name.to_s) && vm.running?\n end.first\n end", "def check_parallels_vm_doesnt_exist(options)\n exists = check_parallels_vm_exists(options)\n if exists == true\n handle_output(options,\"Parallels VM #{options['name']} already exists\")\n quit(options)\n end\n return\nend", "def state\n running_vms = vboxmanage('list', 'runningvms')\n state = 'poweroff'\n if running_vms.kind_of?(Array)\n running_vms.each do |vm|\n if vm.include? resource[:name]\n state = 'running'\n end\n end\n else\n \tif running_vms.include? resource[:name]\n \t state = 'running'\n \tend\n end\n state\n end", "def vmwarechk(session)\n vm = false\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"vmdebug\")\n vm = true\n elsif srvvals and srvvals.include?(\"vmmouse\")\n vm = true\n elsif srvvals and srvvals.include?(\"VMTools\")\n vm = true\n elsif srvvals and srvvals.include?(\"VMMEMCTL\")\n vm = true\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System\\BIOS','SystemManufacturer') =~ /vmware/i\n vm = true\n end\n end\n if not vm\n key_path = 'HKLM\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0'\n if registry_getvaldata(key_path,'Identifier') =~ /vmware/i\n vm = true\n end\n end\n if not vm\n vmwareprocs = [\n \"vmwareuser.exe\",\n \"vmwaretray.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vmwareprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n end\n\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VMware\" },\n :update => :unique_data\n )\n print_good(\"This is a VMware Virtual Machine\")\n return \"VMWare\"\n end\n end", "def createVMLoadFile()\n if File.exists?($TMPVMLOADFILE) \n lastMtime = File.mtime($TMPVMLOADFILE)\n else\n lastMtime = Time.now - 60\n end\n diff = Time.now - lastMtime\n if diff > 60.0\n tmpfile = File.new($TMPVMLOADFILE + \".new\" ,File::CREAT|File::TRUNC|File::RDWR, 0644)\n IO.popen(\"onecmd -a onevm list\") { |f|\n loop do\n v = f.readline\n tmpfile.write(v) \n if f.eof \n tmpfile.close()\n break\n end\n end\n }\n File.rename($TMPVMLOADFILE + \".new\", $TMPVMLOADFILE)\n end\n end", "def lvm_enabled?(root)\n puts \"Checking if volume group is available for: #{root}\"\n %x{lvscan | grep #{root}}.split(' ').first == 'ACTIVE'\nend", "def read_vm_state vmname\n full_name = \"#{File.basename __dir__}_#{vmname}\"\n cmd = VMSTATE_CMD_TEMPLATE % [full_name]\n output = `#{cmd}`\n\n if output =~ /^name=\"<inaccessible>\"$/\n return :inaccessible\n elsif output =~ /^VMState=\"(.+?)\"$/\n return $1.to_sym\n end\n\n nil\nend", "def check_for_rmvx( notify = false )\n if process_running?( \"rpgvx.exe\" )\n if notify\n\t puts \"RPG Maker VX is already running! Please close it and try again. :)\"\n puts \"Exiting...\"\n pause_prompt\n\t end\n\t return true\n else\n return false\n end\nend", "def vm_exists?(uuid)\n 5.times do\n result = raw(@prlctl_path, 'list', uuid)\n return true if result.exit_code == 0\n\n # Sometimes this happens. In this case, retry.\n # If we don't see this text, the VM really doesn't exist.\n return false unless result.stderr.include?('Login failed:')\n\n # Sleep a bit though to give Parallels Desktop time to fix itself\n sleep 2\n end\n\n # If we reach this point, it means that we consistently got the\n # failure, do a standard prlctl now. This will raise an\n # exception if it fails again.\n execute_prlctl('list', uuid)\n true\n end", "def suspend_vm(vmname)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show vm name=#{vmname}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"suspend vm name=#{vmname}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end", "def present?\n ['/dev/ipmi0', '/dev/ipmi/0', '/dev/ipmidev/0'].find { |dev| File.exist? dev }\n end", "def has_vm?(vm_id)\n with_thread_name(\"has_vm?(#{vm_id})\") do\n begin\n @logger.info(\"Checking if VM with id = #{vm_id} exists...\")\n vm = @vm_manager.get_virtual_machine(vm_id)\n !vm.nil? ? true : false\n rescue => e\n @logger.error(e)\n false\n end\n end\n end", "def checkvrtlpc(session)\n vm = false\n vpcprocs = [\n \"vmusrvc.exe\",\n \"vmsrvc.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vpcprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"vpc-s3\")\n vm = true\n elsif srvvals and srvvals.include?(\"vpcuhub\")\n vm = true\n elsif srvvals and srvvals.include?(\"msvmmouf\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualPC\" },\n :update => :unique_data\n )\n print_good(\"This is a VirtualPC Virtual Machine\")\n return \"VirtualPC\"\n end\n end", "def vip_installed?\n ssh.directory_exists?(vip_path)\n end", "def check_vbox_vm_exists(client_name)\n message = \"Checking:\\tVM \"+client_name+\" exists\"\n command = \"VBoxManage list vms |grep -v 'inaccessible'\"\n host_list = execute_command(message,command)\n if !host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM \"+client_name+\" does not exist\"\n exists = \"no\"\n else\n exists = \"yes\"\n end\n return exists\nend", "def present_and_stopped?\n return inactive_instance_dir_exists?\n end", "def _pid_file_exists?\n File.exist?(_pid_filename) \n end", "def marshalized_text_file_exist?(filename)\n if PSDK_CONFIG.release?\n vdfilename = VD_TEXT_FILENAME\n ::Kernel::Loaded[vdfilename] = Yuki::VD.new(vdfilename, :read) unless ::Kernel::Loaded.key?(vdfilename)\n return ::Kernel::Loaded[vdfilename].exists?(File.basename(filename))\n end\n return File.exist?(filename)\n end", "def search_session name\n if File.extname(name) != @@session_extname\n name = name + @@session_extname\n end\n\n status = {:exist => File.exist?(name), :name => name}\n if !status[:exist] && Pathname.new(name).relative?\n session_name = File.join(Dir.pwd, name)\n status = {:exist => File.exist?(session_name), :name => session_name}\n unless status[:exist]\n session_name = File.join(@@session_dir, name)\n status = {:exist => File.exist?(session_name), :name => session_name}\n end\n end\n status\n end", "def check_and_print_video_file_name()\n is_success = true\n video_file_name = @options.video_file_name()\n if !!video_file_name then\n @renderer.print(\"Video: #{video_file_name}\")\n if FileTest.exist?(video_file_name) then\n @renderer.print(\"\\n\")\n else\n @renderer.print(\": does not exist.\\n\")\n is_success = false\n end\n end\n return is_success\n end", "def multivm?\n vms.length > 1\n end", "def powered_off?\n cmd = \"VBoxManage showvminfo \\\"#{@vbox_name}\\\" | grep \\\"State:\\\"\"\n print cmd if @verbose\n out = `#{cmd}`\n print out if @verbose\n if out.include?('powered off') || out.include?('aborted')\n return true\n end\n end", "def boot_complete?\n out = `VBoxManage showvminfo \"#{@vbox_name}\" | grep 'Additions run level:'`\n print out if @verbose\n if out[-2..-2].to_i == 3\n return true\n end\n end", "def pid_file?\n return true if File.exist?(pid_path)\n false\n end", "def exists?\n volumes = Hash.new\n qmgmt(['volume', 'list']).each_line { |l|\n if ( l.match(/^Name/) )\n next\n end\n line = l.split(/\\s{2,}/)\n volumes[line.shift()] = true\n }\n\n if ( volumes[resource[:name]] )\n return true\n else\n return false\n end\n end", "def path\n File.join Fission.config['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def path\n File.join Fission.config['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def check_vbox_vm_doesnt_exist(client_name)\n message = \"Checking:\\tVM \"+client_name+\" doesn't exist\"\n command = \"VBoxManage list vms\"\n host_list = execute_command(message,command)\n if host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM #{client_name} already exists\"\n exit\n end\n return\nend", "def virtualbox_nonrunning_vm_guids\n running_vms_guids = []\n `vboxmanage list runningvms`.scan(/{(.*)}/) { running_vms_guids << Regexp.last_match(1) }\n vm_guids = []\n `vboxmanage list vms`.scan(/{(.*)}/) { vm_guids << Regexp.last_match(1) unless running_vms_guids.include?(Regexp.last_match(1)) }\n\n vm_guids\nend", "def check_for_rmvxa( notify = false )\n if process_running?( \"rpgvxace.exe\" )\n if notify\n\t puts \"RPG Maker VXA is already running! Please close it and try again. :)\"\n puts \"Exiting...\"\n pause_prompt\n\t end\n\t return true\n else\n return false\n end\nend", "def get_machine_id()\n machine_id_filepath = \".vagrant/machines/default/virtualbox/id\"\n\n if not File.exists? machine_id_filepath\n # VM hasn't been created yet.\n return false\n end\n\n # This is probably not a great way to do this: shell out to the cat command.\n # It seems likely that ruby has a get-file-contents function somewhere,\n # but I'm definitely not a ruby dev right now.\n machine_id = `cat #{machine_id_filepath}`\nend", "def find_vagrantfile(search_path)\n @vagrantfile_name.each do |vagrantfile|\n current_path = search_path.join(vagrantfile)\n return current_path if current_path.exist?\n end\n\n nil\n end", "def suspend\n execute(\"controlvm\", @uuid, \"savestate\")\n end", "def check_fusion_vm_promisc_mode(options)\n\tif options['host-os-name'].to_s.match(/Darwin/)\n\t promisc_file=\"/Library/Preferences/VMware Fusion/promiscAuthorized\"\n if !File.exist?(promisc_file)\n\t %x[sudo sh -c 'touch \"/Library/Preferences/VMware Fusion/promiscAuthorized\"']\n\t end\n\tend\n return\nend", "def get_fusion_vm_status(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Not Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def zombie\n\t\t\t\tlist.select { |x|\n\t\t\t\t\tbegin\n\t\t\t\t\t\tIO.read(File.join('/proc', x.to_s, 'stat')).split[2] == ?Z\n\t\t\t\t\trescue Exception\n\t\t\t\t\t\tnil\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend", "def vm_by_name(name)\n vms = get('VM', :by_name_label, name)\n if vms.any?\n UltraVM::VM.new(self, vms.first)\n else\n false\n end\n end", "def vm_names\n machines = manager.vbox.machines.find_all do |machine|\n machine.name =~ /#{Travis::Worker.config.vms.name_prefix}/\n end\n machines ? machines.map { |machine| machine.name } : []\n end", "def procfs?\n return File.exist?('/proc')\n end", "def is_manifest_exists?\n abort \"ERROR : No ssh session found\" if @ssh.nil?\n r = @ssh.do_ssh_cmd(\"ls #{@puppetfolder}/manifests/site.pp\")\n r[:exit_code].eql? 0\n end", "def has_vuln?(name)\n ::ApplicationRecord.connection_pool.with_connection {\n Mdm::Vuln.find_by_name(name)\n }\n end", "def blocked_wmi_name?(name)\n [\n \"creation_class_name\", # this is just the wmi name\n \"cs_creation_class_name\", # this is just the wmi name\n \"oem_logo_bitmap\", # this is the entire OEM bitmap file\n \"total_swap_space_size\", # already in memory plugin\n \"total_virtual_memory_size\", # already in memory plugin\n \"total_virtual_memory_size\", # already in memory plugin\n \"free_physical_memory\", # already in memory plugin\n \"free_space_in_paging_files\", # already in memory plugin\n \"free_virtual_memory\", # already in memory plugin\n ].include?(name)\n end", "def is_unmanaged_attached_volume?(mapping)\n case mapping[:volume_status]\n when 'attached', 'attaching'\n mapping[:management_status].nil?\n else\n false\n end\n end", "def sandbox_active?\n if File.exists? SANDBOX_FILE\n @sandbox = File.readlines(SANDBOX_FILE)\n @sandbox.each { |line| return true if line.match sb_regex(@name) } \n end\n false\n end", "def path\n File.join Fission.config.attributes['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def profile_exists?(project_root, profile_path)\n Dir.exists?( File.join(\"#{project_root}/puppet/profiles\", \"#{profile_path}\") )\n end", "def vmx_path\n return File.join(path, \"#{@name}.vmx\")\n end", "def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end", "def has_vm?(vm_cid)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"has_vm?(#{vm_cid})\") do\n @telemetry_manager.monitor('has_vm?', id: vm_cid) do\n vm = @vm_manager.find(InstanceId.parse(vm_cid, _azure_config.resource_group_name))\n !vm.nil? && vm[:provisioning_state] != 'Deleting'\n end\n end\n end", "def is_up?\n\t\tFile.exists?(@file)\n\tend", "def lvm_partition(dev)\n part = %x{sfdisk -l /dev/nbd0 2>/dev/null | grep 8e | cut -d ' ' -f 1}.strip\n part.empty? ? raise(\"Failed to locate LVM partition\") : part\nend", "def get_fusion_vm_vmdk_file(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n if File.directory?(fusion_vm_dir)\n fusion_vmdk_file = Dir.entries(fusion_vm_dir).grep(/vmdk$/)[0].chomp\n else\n fusion_vmdk_file = \"\"\n end\n fusion_vmdk_file = fusion_vm_dir+\"/\"+fusion_vmdk_file\n return fusion_vmdk_file\nend", "def suspended?\n status.suspended?\n end", "def probe_vm_monitor\n one_vms = ''\n vms = @db.select_one\n vms.each do |vm|\n one_vms << Base64.decode64(vm)\n end\n one_vms\n end", "def is_managed_attached_unassigned_volume?(mapping)\n return 'attached' == mapping[:volume_status] && 'attached' == mapping[:management_status]\n end", "def has_vm?(server_id)\n with_thread_name(\"has_vm?(#{server_id})\") do\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n !server.nil? && !%i[terminated deleted].include?(server.state.downcase.to_sym)\n end\n end", "def dump_mem(pid,name, toggle)\n\thost,port = @client.tunnel_peer.split(':')\n\t# Create Filename info to be appended to created files\n\tfilenameinfo = \"_#{name}_#{pid}_\" + ::Time.now.strftime(\"%Y%m%d.%M%S\")\n\t# Create a directory for the logs\n\tlogs = ::File.join(Msf::Config.log_directory, 'scripts', 'proc_memdump')\n\t# Create the log directory\n\t::FileUtils.mkdir_p(logs)\n\t#Dump file name\n\tdumpfile = logs + ::File::Separator + host + filenameinfo + \".dmp\"\n\tprint_status(\"\\tDumping Memory of #{name} with PID: #{pid.to_s}\")\n\tbegin\n\t\tdump_process = @client.sys.process.open(pid.to_i, PROCESS_READ)\n\trescue\n\t\tprint_error(\"Could not open process for reading memory!\")\n\t\traise Rex::Script::Completed\n\tend\n\t# MaximumApplicationAddress for 32bit or close enough\n\tmaximumapplicationaddress = 2147418111\n\tbase_size = 0\n\twhile base_size < maximumapplicationaddress\n\t\tmbi = dump_process.memory.query(base_size)\n\t\t# Check if Allocated\n\t\tif mbi[\"Available\"].to_s == \"false\"\n\t\t\tfile_local_write(dumpfile,mbi.inspect) if toggle\n\t\t\tfile_local_write(dumpfile,dump_process.memory.read(mbi[\"BaseAddress\"],mbi[\"RegionSize\"]))\n\t\t\tprint_status(\"\\tbase size = #{base_size/1024}\")\n\t\tend\n\t\tbase_size += mbi[\"RegionSize\"]\n\tend\n\tprint_status(\"Saving Dumped Memory to #{dumpfile}\")\n\nend", "def inactive_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name] )\n end", "def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend", "def check_env_files(role_manifest, dev_env)\n vars = role_manifest['configuration']['variables']\n dev_env.each_pair do |name, (env_file, value)|\n next if Common.special_env(name)\n i = vars.find_index{ |x| x['name'] == name }\n next unless i.nil?\n STDOUT.puts \"dev env var #{name.red} defined in #{env_file.red} does not exist in role manifest\"\n @has_errors += 1\n end\nend", "def get_fusion_vm_vmx_file(options)\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}\\.vmx/)\n fusion_vmx_file = vm_list.grep(/#{options['name']}\\.vmx/)[0].chomp\n else\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n if File.directory?(fusion_vm_dir)\n fusion_vmx_file = Dir.entries(fusion_vm_dir).grep(/vmx$/)[0].chomp\n else\n fusion_vmx_file = \"\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+fusion_vmx_file\n end\n return fusion_vmx_file\nend", "def update_vm_properties(vm)\n begin\n start_time = Time.now.to_i\n vm_promise = @compute_client.virtual_machines.create_or_update(@rg_name, @instance_name, vm)\n my_vm = vm_promise.value!\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"Storage Disk detached #{duration} seconds\")\n OOLog.info(\"VM: #{my_vm.body.name} UPDATED!!!\")\n return true\n rescue MsRestAzure::AzureOperationError =>e\n OOLog.fatal(e.body)\n rescue Exception => ex\n OOLog.fatal(ex.message)\n end\n end", "def local_software_file_check(srv, file_names)\n srv.trigger.before [:up, :reload, :provision] do |trigger|\n trigger.ruby do |env, machine|\n files_found = true\n file_names.each do |file_name|\n file_path = \"#{VAGRANT_ROOT}/modules/software/files/#{file_name}\"\n unless File.exist?(file_path) # returns true for directories\n files_found = false\n env.ui.error \"Missing software file: #{file_name}\"\n end\n end\n if not files_found\n env.ui.error \"Please add missing file(s) to the: ./modules/software/files/ directory.\"\n raise FilesNotFoundError\n end\n end\n end\nend" ]
[ "0.5882661", "0.5777305", "0.576586", "0.57584304", "0.5748528", "0.5652615", "0.54903674", "0.54500395", "0.54241735", "0.54192775", "0.5355263", "0.5355263", "0.5311403", "0.5243774", "0.5243667", "0.5243667", "0.52360857", "0.52010655", "0.5191226", "0.5185978", "0.5177669", "0.51686454", "0.5133243", "0.50986844", "0.50945973", "0.50547874", "0.5053599", "0.5032199", "0.50309956", "0.50255126", "0.5015621", "0.50069886", "0.5006897", "0.5005604", "0.4992893", "0.49909523", "0.49853998", "0.4968763", "0.49646044", "0.49621904", "0.4932209", "0.49018437", "0.49005443", "0.4898143", "0.48970488", "0.4875701", "0.48665634", "0.4858681", "0.4854801", "0.4851141", "0.48463282", "0.48447087", "0.47892013", "0.4786949", "0.4762018", "0.47596344", "0.47472808", "0.47059697", "0.47055945", "0.46731135", "0.46727833", "0.46726272", "0.46726272", "0.46698093", "0.4662843", "0.46582747", "0.46561614", "0.46521878", "0.46483225", "0.46461746", "0.46455026", "0.4644468", "0.46433565", "0.46303633", "0.46188918", "0.46164304", "0.46149483", "0.4609609", "0.46092755", "0.46088228", "0.46045896", "0.46008626", "0.45888293", "0.45795107", "0.45638403", "0.4563592", "0.4554722", "0.45518404", "0.45502502", "0.45423347", "0.45349777", "0.4523612", "0.45235208", "0.4516352", "0.45107728", "0.45052743", "0.44964102", "0.44959238", "0.44884634" ]
0.7517683
1
Public: Determines if a VM is running. Examples
def running? all_running_response = self.class.all_running return all_running_response unless all_running_response.successful? response = Response.new :code => 0, :data => false if all_running_response.data.collect { |v| v.name }.include? @name response.data = true end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running\n\t @vm_running = Virtualmachine.isrunning\n end", "def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend", "def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end", "def check_fusion_vm_is_running(options)\n list_vms = get_running_fusion_vms(options)\n if list_vms.to_s.match(/#{options['name']}.vmx/)\n running = \"yes\"\n else\n running = \"no\"\n end\n return running\nend", "def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end", "def running?\n self.reload\n self.virtual_machine_state == \"RUNNING\"\n end", "def running?\n execpipe(\"#{command(:instance_manager)} status\") do |out|\n out.each_line do |line|\n if line =~ /^#{@resource[:name]}\\s+\\d+/\n return true\n end\n end\n end\n return false\n end", "def is_vm?\n cmd = \"VBoxManage showvminfo \\\"#{@vbox_name}\\\"\"\n _, stderr, _ = Open3.capture3(cmd)\n if stderr.include? 'Could not find a registered machine named'\n raise \"Virtual Machine #{@vbox_name} does not exist\"\n end\n end", "def running?\n status == 'running'\n end", "def is_running?\n # TODO: cache this maybe?\n fetch_is_running?\n end", "def running?\n status == :running\n end", "def running?\n !pid.nil? && status == 'running'\n end", "def running?\n self.status == STATUS_RUNNING\n end", "def running?\n status.running? && !starting?\n end", "def running?\n !(status =~ /running/).nil?\n end", "def running?\n !(status =~ /running/).nil?\n end", "def running?\n !(status =~ /running/).nil?\n end", "def running?\n begin\n ping\n rescue Errno::EBADF, Errno::ECONNREFUSED => e\n return false\n end\n return true\n end", "def running?\n @is_running\n end", "def running?\n res = shell_out('ps -A -c -o command | grep ^Fantastical\\ 2$ || true')\n res.stdout.strip.empty? ? false : true\n end", "def isRunning\n return running?\n end", "def running?\n @running.true?\n end", "def running?(_under = nil)\n return false if info.nil?\n info[:running]\n end", "def is_running?\n @running\n end", "def running?\n\t\t\t@status == :running\n\t\tend", "def running?\n return false if state.nil?\n \"running\".casecmp(state).zero?\n end", "def is_running?\n return @running\n end", "def running?\n !!@pid\n end", "def present_and_running?\n return active_instance_dir_exists? && running?\n end", "def is_running?\n return @running\n end", "def started?\n status['Running']\n end", "def running?\n 'Running' == self.status\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n result = true\n SERVICES.each do |_, check|\n result &&= check.call\n end\n result\n end", "def running?\n spawned? and !@status and alive?\n end", "def running?\n (state == :running)\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def running?\n @container.nil? ? false : self.stats['State']['Running']\n end", "def running?\n @running\n end", "def running?\n @running\n end", "def has_vm?(vm_id)\n with_thread_name(\"has_vm?(#{vm_id})\") do\n begin\n @logger.info(\"Checking if VM with id = #{vm_id} exists...\")\n vm = @vm_manager.get_virtual_machine(vm_id)\n !vm.nil? ? true : false\n rescue => e\n @logger.error(e)\n false\n end\n end\n end", "def running?\n return @running\n end", "def is_running?\n result = \"\"\n result = `ps -p #{pid} -o cmd=`.gsub(\"\\n\", \"\") unless pid.empty?\n\n running = result.split.first == \"redis-server\" ? true : false\n\n running\n end", "def instance_running? instance\n\t\t\tunless instance.host == host\n\t\t\t\traise ArgumentError, \"Cannot check instances on remote hosts!\"\n\t\t\tend\n\t\t\t# This seems like a reasonable way to check without `ps ...`.\n\t\t\tFile.directory?(\"/proc/#{instance.pid}\")\n\t\tend", "def instance_by_name_running?(instance_name)\n return false unless configured?\n\n instance_running?(get_aws_instance_id_by_node_name(instance_name))\n end", "def running?\n pid = `ps x -o pid,command|grep [K]EWatcher|awk '{print $1}'`.to_i\n pid == 0 ? false : pid\n end", "def running?\n @pid.exist? and Pid.running? @pid.pid\n end", "def instance_running?(instance_id)\n return false if instance_id.nil? || !configured?\n\n response = @client.describe_instance_status(instance_ids: [instance_id])\n response.instance_statuses.any? do |status|\n status.instance_id == instance_id &&\n %w[pending running].include?(status.instance_state.name)\n end\n end", "def primitive_is_running?(primitive, node = nil)\n return unless primitive_exists? primitive\n status = primitive_status primitive, node\n return status unless status\n %w(start master).include? status\n end", "def running?\n @state == :running\n end", "def running?(arguments={})\n Cluster.new(arguments).running?\n end", "def running?\n runtime_state?(peek_current_state)\n end", "def running?\n pidfile.running?\n end", "def service_running?\n response = `#{setup_docker_env_vars_str} docker-compose ps #{project_config['docker-compose']['service']}`\n return false if response =~ /No such service/i\n\tservice_state = response.split(\"\\n\")[2].split(/\\s{2,}/)[2]\n\tservice_state =~ /up/i ? true : false\nend", "def sim_is_running?\n not sim_pid.nil?\n end", "def vm_guest_ip?(vm)\n vm.guest.guestState == 'running' && vm.guest.toolsRunningStatus == 'guestToolsRunning' && !vm.guest.ipAddress.nil? && IPAddr.new(vm.guest.ipAddress).ipv4?\n end", "def running?\n !running.empty?\n end", "def vm_exists_silent\n return false unless @state.key?(:id) && !@state[:id].nil?\n\n existing_vm = run_ps ensure_vm_running_ps\n return false if existing_vm.nil? || existing_vm[\"Id\"].nil?\n\n true\n end", "def running?\n if cluster_health = Timeout::timeout(0.25) { __get_cluster_health } rescue nil\n return cluster_health['cluster_name'] == arguments[:cluster_name] && \\\n cluster_health['number_of_nodes'] == arguments[:number_of_nodes]\n end\n return false\n end", "def running?\n @run\n end", "def running?\n @server && !(@server.stopped?)\n end", "def running?\n @state == :started\n end", "def running?\n started? && !dead?\n end", "def running?\n @running && !@stopping\n end", "def running?\n @applications.each { |a| return true if a.running? }\n return false\n end", "def invm?\n @is_invm\n end", "def is_running?\n result = \"\"\n result = `ps -p #{pid} -o cmd=`.gsub(\"\\n\", \"\") unless pid.empty?\n\n result.split.first == \"unicorn\" ? true : false\n end", "def is_running?\n omnibus_helper = OmnibusHelper.new(node)\n omnibus_helper.service_up?(service_name) || (delegated? && omnibus_helper.service_up?(delegate_service_name) && is_ready?)\n end", "def running?\n is_running = false\n \n if container.nil?\n begin\n self.container = ::Docker::Container.get(name)\n rescue \n self.container = nil\n end\n end\n \n unless container.nil?\n is_running = container.is_running?\n end\n \n is_running\n end", "def has_vm?(server_id)\n with_thread_name(\"has_vm?(#{server_id})\") do\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n !server.nil? && !%i[terminated deleted].include?(server.state.downcase.to_sym)\n end\n end", "def state\n running_vms = vboxmanage('list', 'runningvms')\n state = 'poweroff'\n if running_vms.kind_of?(Array)\n running_vms.each do |vm|\n if vm.include? resource[:name]\n state = 'running'\n end\n end\n else\n \tif running_vms.include? resource[:name]\n \t state = 'running'\n \tend\n end\n state\n end", "def running?(pid)\n !(pid.nil? || Sys::ProcTable.ps(pid.to_i).nil?)\n end", "def fetch_is_running?\n server = BigbluebuttonRails.configuration.select_server.call(self, :is_meeting_running)\n server.api.is_meeting_running?(self.meetingid)\n end", "def alive?\n nodes.map(&:state).all?{ |state| state == :running }\n end", "def running?\n # First check if we have a pid file and if it exists\n return false if @pid_file.nil? || !File.exists?(@pid_file)\n\n # Then make sure we have a pid\n return false if pid.nil?\n\n # If we can get the process id then we assume it is running\n begin\n Process.getpgid(pid)\n true\n rescue Errno::ESRCH\n false\n end\n end", "def running?\n @thread and @thread.alive?\n end", "def can_start_instance?\n if maint_mode?\n return false unless Instance.running_for_profile(self).empty? or\n Instance.running_maint_for_laboratory?(laboratory)\n else\n return false if !active? or \n laboratory.max_instances <= laboratory.active_instances.size\n end\n true\n end", "def is_process_running?(image_name)\n puts \"Looking for instances of #{image_name}\"\n command = 'tasklist /FI \"IMAGENAME eq ' + \"#{image_name}\"\"\"\n command_output = `#{command}`\n command_output.each_line do |line|\n if line =~ /^#{image_name}/\n return true\n end\n end\n return false\n end", "def jenkins_running?(opts)\n\tbegin\n\t\tid = jenkins_id(opts)\n\t\trunning = id and id.length > 0 ? run_in_shell( \"docker inspect -f {{.State.Running}} #{id}\", true ) : false\n\t\treturn running\n\trescue => e\n\t\t#puts e\n\t\treturn false\n\tend\nend", "def check_parallels_vm_exists(options)\n set_vmrun_bin(options)\n exists = false\n vm_list = get_all_parallels_vms(options)\n vm_list.each do |vm_name|\n if vm_name.match(/^#{options['name']}$/)\n exists = true\n return exists\n end\n end\n return exists\nend", "def running?\n !@manager_thread.nil? &&\n ['sleep', 'run'].include?(@manager_thread.status)\n end", "def running? ; @running end", "def running?\n @server_thread && @server_thread.alive?\n end", "def running?\n\t\treturn false if @pid.nil?\n\n\t\tif (Process.kill 0, @pid) == 1\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\t\tend\n\trescue Errno::ESRCH\n\t\treturn false\n\tend", "def started?\n begin\n ping\n return true\n rescue => ex\n return false\n end\n end", "def has_vm?(vm_cid)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"has_vm?(#{vm_cid})\") do\n @telemetry_manager.monitor('has_vm?', id: vm_cid) do\n vm = @vm_manager.find(InstanceId.parse(vm_cid, _azure_config.resource_group_name))\n !vm.nil? && vm[:provisioning_state] != 'Deleting'\n end\n end\n end", "def running?\n started? && !finished?\n end", "def present_and_stopped?\n return inactive_instance_dir_exists?\n end", "def get_fusion_vm_status(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Not Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def one_running?\n system = OpenNebula::System.new(OpenNebula::Client.new)\n config = system.get_configuration\n\n OpenNebula.is_error?(config)\n end", "def status\n return true unless managed?\n\n out = exec('status', output: true).read\n out =~ /running on port #{port}/\n end", "def running?\n ! (shuttingdown? || shutdown?)\n end" ]
[ "0.8204294", "0.77401966", "0.7664043", "0.7388182", "0.73449606", "0.7291203", "0.7264888", "0.713769", "0.7125689", "0.712245", "0.70647603", "0.70549226", "0.7054564", "0.69614667", "0.6945672", "0.6945672", "0.6945672", "0.69407046", "0.6922534", "0.6914648", "0.6912643", "0.6911676", "0.68928397", "0.6875651", "0.6868265", "0.6843543", "0.6829262", "0.68274105", "0.68163025", "0.68142444", "0.68080384", "0.67936665", "0.6791498", "0.6791498", "0.6791498", "0.6791498", "0.6791498", "0.6791498", "0.6791498", "0.67474616", "0.6741596", "0.67291695", "0.67259383", "0.67259383", "0.67259383", "0.67259383", "0.6720231", "0.6708378", "0.6708378", "0.669947", "0.66582876", "0.6655869", "0.6639382", "0.66301537", "0.662279", "0.6620762", "0.6613547", "0.6611106", "0.65953714", "0.65798014", "0.6575821", "0.6573797", "0.6559499", "0.6544506", "0.65433675", "0.65422004", "0.6540712", "0.6540112", "0.65400445", "0.6539977", "0.65312344", "0.65177226", "0.6514579", "0.6506536", "0.6506498", "0.65014005", "0.64991105", "0.64478356", "0.6441177", "0.64327437", "0.6392015", "0.63776815", "0.63683975", "0.6336623", "0.63312167", "0.6324876", "0.63248664", "0.63214785", "0.6312632", "0.63084143", "0.6297991", "0.6286693", "0.62838274", "0.62642866", "0.62572795", "0.62403446", "0.6210033", "0.62077975", "0.61323416", "0.6128205", "0.60947555" ]
0.0
-1
Public: Determines the path to the VM's config file ('.vmx'). Examples
def conf_file vmx_path = File.join path, "*.vmx" conf_files = Dir.glob vmx_path response = Response.new case conf_files.count when 0 response.code = 1 response.message = "Unable to find a config file for VM '#{@name}' (in '#{vmx_path}')" when 1 response.code = 0 response.data = conf_files.first else if conf_files.include?(File.join(File.dirname(vmx_path), "#{@name}.vmx")) response.code = 0 response.data = File.join(File.dirname(vmx_path), "#{@name}.vmx") else response.code = 1 output = "Multiple config files found for VM '#{@name}' (" output << conf_files.sort.map { |f| "'#{File.basename(f)}'" }.join(', ') output << " in '#{File.dirname(vmx_path)}')" response.message = output end end response.data.gsub! ' ', '\ ' if response.successful? response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vmx_path\n return File.join(path, \"#{@name}.vmx\")\n end", "def path\n File.join Fission.config.attributes['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def path\n File.join Fission.config['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def path\n File.join Fission.config['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def conf_file\n vmx_path = File.join path, \"*.vmx\"\n conf_files = Dir.glob vmx_path\n\n response = Response.new\n\n case conf_files.count\n when 0\n response.code = 1\n response.message = \"Unable to find a config file for VM '#{@name}' (in '#{vmx_path}')\"\n when 1\n response.code = 0\n response.data = conf_files.first\n else\n if conf_files.include?(File.join(File.dirname(vmx_path), \"#{@name}.vmx\"))\n response.code = 0\n response.data = File.join(File.dirname(vmx_path), \"#{@name}.vmx\")\n else\n response.code = 1\n output = \"Multiple config files found for VM '#{@name}' (\"\n output << conf_files.sort.map { |f| \"'#{File.basename(f)}'\" }.join(', ')\n output << \" in '#{File.dirname(vmx_path)}')\"\n response.message = output\n end\n end\n\n response\n end", "def dotfile_path\n return nil if !root_path\n root_path.join(config.global.vagrant.dotfile_name)\n end", "def get_uplift_config_file \n config_dir_path = get_uplift_config_folder\n file_name = \".vagrant-network.yaml\"\n\n return File.join(config_dir_path, file_name) \n end", "def global_config_dir\n '/etc/vgh'\n end", "def config_path\n @config_path ||= local_config_path\n end", "def config_path\n if result = chef_api_config_path\n Pathname(result).expand_path\n else\n Pathname(\"\")\n end\n end", "def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end", "def config_directory\n \"C:\\\\chef\"\n end", "def config_path\n Gym.cache[:config_path] ||= \"#{Tempfile.new('gym_config').path}.plist\"\n return Gym.cache[:config_path]\n end", "def get_fusion_vm_vmx_file_value(options)\n vm_value = \"\"\n vmx_file = get_fusion_vm_vmx_file(options)\n if File.exist?(vmx_file)\n if File.readable?(vmx_file)\n vm_config = ParseConfig.new(vmx_file)\n vm_value = vm_config[options['search']]\n else\n vm_value = \"File Not Readable\"\n end\n else\n if options['verbose'] == true\n handle_output(options,\"Warning:\\tWMware configuration file \\\"#{vmx_file}\\\" not found for client\")\n end\n end\n return vm_value\nend", "def configuration_file_path; end", "def config_path(svc_name)\n # strip st2 prefix\n noprefix_name = svc_name.sub(/^st2/, '')\n config_name = ['logging', noprefix_name, 'conf'].compact.join('.')\n File.join([spec[:conf_dir], config_name])\n end", "def app_config_path\n Pathname.new('.').join('config')\n end", "def path\n @path || File.expand_path(ENV['NEXUS_CONFIG'] || DEFAULT_FILE)\n end", "def path\n @path ||= File.dirname @config_file\n end", "def config_file\n CONFIG_FILE\n end", "def config_path\n Gym.cache[:config_path] ||= \"/tmp/gym_config_#{Time.now.to_i}.plist\"\n return Gym.cache[:config_path]\n end", "def config_file\n send_command(:getinfo, 'config-file')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n Pathname(reply)\n end", "def filename( )\n @configFileDNE\n end", "def config_file_name\n @config_file_name || Pdm.config_file\n end", "def get_fusion_vm_vmx_file(options)\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}\\.vmx/)\n fusion_vmx_file = vm_list.grep(/#{options['name']}\\.vmx/)[0].chomp\n else\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n if File.directory?(fusion_vm_dir)\n fusion_vmx_file = Dir.entries(fusion_vm_dir).grep(/vmx$/)[0].chomp\n else\n fusion_vmx_file = \"\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+fusion_vmx_file\n end\n return fusion_vmx_file\nend", "def conf_file_data\n VMConfiguration.new(self).config_data\n end", "def current_texte_path\n config = File.open('./.config.msh','rb'){|f|Marshal.load(f)}\n config[:last_file_path]\n end", "def config_path\n @config_path ||= 'config/spinach.yml'\n end", "def config_file\n FilePath.new(@directory, 'tc-config.xml')\n end", "def chef_config_path\n Berkshelf.root.join(\"spec/config/knife.rb\").to_s\n end", "def configdir\n\t\tetc/\"cpu-sentinel\"\n\tend", "def config_file\n @config_file\n end", "def cfg_dir\n File.join(@full_path, CONFIG_DIR)\n end", "def getConfigPath\n if @conf[:config_name].index('/')\n return @conf[:config_name] if File.file?(@conf[:config_name])\n else \n @conf[:config_dirs].each {|i|\n r = Pathname.new(i) + @conf[:config_name]\n return r if File.file?(r)\n }\n end\n\n CliUtils.warnx \"no config file '#{@conf[:config_name]}' found\" if @conf[:verbose] >= 2\n return nil\n end", "def config_path\n ::Rails.root.to_s + \"/config/#{self.name.split('::').last.underscore.pluralize}.yml\"\n end", "def config_path\n etc+\"php/\"\n end", "def config_filename\n return @config_filename if @config_filename\n\n @config_filename = File.join(config_directory, \"config\")\n end", "def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end", "def config_file\n File.join AppRoot, ConfigFile\n end", "def base_config_path\n BASE_CONFIG_PATH\n end", "def chef_config_path\n if Chef::Config['config_file']\n ::File.dirname(Chef::Config['config_file'])\n else\n raise(\"No chef config file defined. Are you running \\\nchef-solo? If so you will need to define a path for the ohai_plugin as the \\\npath cannot be determined\")\n end\n end", "def template_path(name)\n File.join(__dir__, 'config', \"#{name}.yml.erb\")\n end", "def config_dir\n Wonkavision::Sample::CONFIG_DIR\n end", "def config_path(arg = nil)\n set_or_return(:config_path,\n arg,\n kind_of: String,\n default: '/etc/hipache.json')\n end", "def config_path\n NginxStage.pun_config_path(user: user)\n end", "def configru_path\n @configru_path ||= if ::File.directory?(new_resource.path)\n ::File.join(new_resource.path, 'config.ru')\n else\n new_resource.path\n end\n end", "def show_fusion_vm_config(options)\n fusion_vmx_file = \"\"\n exists = check_fusion_vm_exists(options)\n if exists == true\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if File.exist?(fusion_vmx_file)\n print_contents_of_file(options,\"#{options['vmapp']} configuration\",fusion_vmx_file)\n end\n end\n return\nend", "def global_config_path\n linux_cfg = '/etc/openshift/' + conf_name\n File.exists?(linux_cfg) ? linux_cfg : File.join(File.expand_path(File.dirname(__FILE__) + \"/../../conf\"), conf_name)\n end", "def vagrantfile(*args)\n path = args.shift.join(\"Vagrantfile\") if Pathname === args.first\n path ||= vagrant_app(\"Vagrantfile\")\n str = args.shift || \"\"\n File.open(path.to_s, \"w\") do |f|\n f.puts \"Vagrant::Config.run do |config|\"\n f.puts \"config.vagrant.log_output = nil\"\n f.puts \"config.vagrant.home = '#{home_path}'\"\n f.puts str\n f.puts \"end\"\n end\n\n path.parent\n end", "def config_file\n File.join(@path, %w[ application config application.php ])\n end", "def config_path\n test? ? \"config-test.yml\" : \"config.yml\"\n end", "def plugin_config_file\n File.join(@dir, Config::FILE_NAME)\n end", "def user_config_dir\n File.expand_path('~/.vgh')\n end", "def selected_yaml_file\n p = current_impressbox_provisioner\n if p.nil? || p.config.nil? || p.config.file.nil? ||\n !(p.config.file.is_a?(String) && p.config.file.chop.length > 0)\n return 'config.yaml'\n end\n p.config.file\n end", "def config_file\n env_config['config_file'] || raise('environment problem:environment information not loaded')\n end", "def config_file\n \"#{confdir}/config.yml\"\n end", "def example_config_filename\n return @example_config_filename unless @example_config_filename.nil?\n filename = self.config_filename\n target_ext = File.extname(filename)\n return \"#{filename[0, filename.size-target_ext.size]}.example#{target_ext}\" if '' != target_ext\n nil\n end", "def template_dir\n File.dirname(__FILE__) + '/../cfg'\n end", "def config_path\n File.join(solr_home, 'conf')\n end", "def default_concierge_variables_path\n Hanami.root.join(\"config\", \"environment_variables.yml\").to_s\n end", "def empty_config_file_path\n ::File.expand_path '../../../support/empty_resolv.conf', __FILE__\n end", "def chef_api_config_path\n ENV[\"CHEF_API_CONFIG\"] || if ENV.key?(\"HOME\")\n \"~/.chef-api\"\n else\n nil\n end\n end", "def vpath\n vdir_for_set(image_set_id) + filename\n end", "def config_filepath(name)\n File.expand_path(\"../fixtures/configs/#{name}.yaml\", __dir__)\nend", "def get_fusion_vm_vmdk_file(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n if File.directory?(fusion_vm_dir)\n fusion_vmdk_file = Dir.entries(fusion_vm_dir).grep(/vmdk$/)[0].chomp\n else\n fusion_vmdk_file = \"\"\n end\n fusion_vmdk_file = fusion_vm_dir+\"/\"+fusion_vmdk_file\n return fusion_vmdk_file\nend", "def config_file\n File.join(root, 'config.yml')\n end", "def template_filepath(filename)\n raise ProjectHanlon::Error::Slice::InternalError, \"must provide xenserver version.\" unless @osversion\n filepath = File.join(File.dirname(__FILE__), \"xenserver/#{@osversion}/#{filename}.erb\")\n end", "def get_config_file_for(name)\n if File.exists?(\"#{user_dir}/config/#{name}\")\n \"#{user_dir}/config/#{name}\"\n else\n \"#{root_dir}/config/#{name}\"\n end\n end", "def generate_vagrant_config\n template = Souffle::Template.new('Vagrantfile.erb')\n temp_binding = OpenStruct.new\n temp_binding.version = Souffle::VERSION\n \n template.render(temp_binding)\n end", "def configuration_file_for(target_dir)\n find_project_dotfile(target_dir) || find_user_dotfile ||\n find_user_xdg_config || DEFAULT_FILE\n end", "def get_file_path(filename)\n # dir = File.realdirpath(File.join(File.dirname(__FILE__), '..', 'config'))\n File.join(@dir, filename)\n end", "def template_config\n File.read(options['puppet_config_template'])\nend", "def config_dir\n runtime_config.generated_files_dir\n end", "def get_config_file\n\t\tconfig_paths =\n\t\t\t[\n\t\t\t\t\"C:\\\\ProgramData\\\\Dyn\\\\Updater\\\\\", #Vista\n\t\t\t\t\"C:\\\\Documents and Settings\\\\All Users\\\\Application Data\\\\Dyn\\\\Updater\\\\\" #XP and else\n\t\t\t]\n\n\t\t# Give me the first match\n\t\tconfig_file = nil\n\t\tconfig_paths.each do |p|\n\t\t\ttmp_path = p + \"config.dyndns\"\n\t\t\tbegin\n\t\t\t\tf = session.fs.file.stat(tmp_path)\n\t\t\t\tconfig_file = tmp_path\n\t\t\t\tbreak #We've found a valid one, break!\n\t\t\trescue\n\t\t\tend\n\t\tend\n\n\t\treturn config_file\n\tend", "def configuration_file\n @config_file_name ||= MyRhouse.confpath( \"#{config_file_name}.yml\" )\n end", "def config_dir\n \"#{gem_dir}/config\"\n end", "def config_dir\n \"#{gem_dir}/config\"\n end", "def file_path\n PATH_USER_DEFAULTS\n end", "def config_path=(value)\n @config_path = value\n end", "def template_path\n path = File.expand_path File.join(@template_options[CONFIG_PATH], @template_options[TEMPLATE_NAME])\n # TODO fix and throw some sort of cool exception\n if !File.exists? path\n path = nil\n end\n return path\n end", "def get_config_file_name(config, stage)\n path = File.dirname(config)\n extension = File.extname(config)\n filename = File.basename(config, extension)\n extension.sub!(/^\\./, '')\n local_file = [filename, stage].join('.')\n local_file = [local_file, extension].join('.') unless extension.empty?\n local_path = File.join(path, local_file)\n end", "def config_dev_path\n File.join test_app_path, 'config', 'deploy', 'dev.rb'\n end", "def default_path\n Pathname.pwd.join(*base_config_path, self.class.config_folder)\n end", "def get_config_path()\n return ENV['DOCS_CONFIG_PATH'] || CONFIG_PATH_DEFAULT\n end", "def kitchen_driver_file\n { virtualbox: File.join(@opts[:path], '.kitchen.yml'),\n docker: File.join(@opts[:path], '.kitchen.local.yml'),\n solusvm: File.join(@opts[:path], '.kitchen.local.yml')\n }\n end", "def conf\n @c ||= JSON.load(File.read('/etc/knife-kvm/config.json'))\nend", "def custom_config_path\n argv.each_with_index do |arg, index|\n if arg == \"--config-path\" || arg == \"-c\"\n next_arg = argv[index + 1]\n raise ConfigPathNotProvided.new if next_arg.nil?\n raise ConfigPathInvalid.new(next_arg) unless File.file?(next_arg) && File.readable?(next_arg)\n\n return next_arg\n end\n end\n nil\n end", "def full_configuration_path\n @full_config_path ||= File.join(self.class.config_base_path, self.class.config_path)\n end", "def config_dir\n dir = options[:config] ? File.dirname(options[:config]) : './config'\n File.expand_path(dir)\n end", "def app_config_file(filename)\n File.read(File.dirname(__FILE__)+\"/../../app/config/\" + filename).split(\"\\n\")\nend", "def configuration_file\n gitpusshuten_root + '/config.rb'\n end", "def config_file(filename)\n if filename =~ /^\\//\n @@config_file = filename\n else\n @@config_file = File.join(File.expand_path('~'),filename)\n end\n commands[:initconfig] = InitConfig.new(@@config_file)\n @@config_file\n end", "def find_config_file\n\n root_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))\n app_config = File.join(root_directory, CONFIG_FILE_NAME)\n global_config = File.join('/etc', CONFIG_FILE_NAME)\n\n [app_config, global_config].each do |config_file|\n return config_file if File.exists?(config_file)\n end\n\n nil\n\n end", "def john_pot_file\n ::File.join(::Msf::Config.config_directory, \"john.pot\")\n end", "def john_config_file\n ::File.join(::Msf::Config.data_directory, \"jtr\", \"john.conf\")\n end", "def get_vagrant_appdir(node, appname)\n if ::EasyBib.is_aws(node)\n Chef::Log.warn('get_vagrant_appdir called from AWS env. There is something broken.')\n # trying to return a somewhat sane default\n return node['deploy'][appname]['deploy_to']\n end\n\n has_docroot_location = !node.fetch('vagrant', {}).fetch('applications', {}).fetch(appname, {})['doc_root_location'].nil?\n has_approot_location = !node.fetch('vagrant', {}).fetch('applications', {}).fetch(appname, {})['app_root_location'].nil?\n\n if has_approot_location\n return node['vagrant']['applications'][appname]['app_root_location']\n elsif !has_docroot_location\n Chef::Log.info('neither app_root_location nor doc_root_location set. Locations set to vagrant default')\n return '/vagrant_data/'\n end\n\n Chef::Log.info('app_root_location is not set in web_dna.json, trying to guess')\n path = node['vagrant']['applications'][appname]['doc_root_location']\n '/' + path.split('/')[1..-2].join('/') + '/'\n end", "def package_config\n File.join @proj_path_base, 'packages.config'\n end", "def getCfg(snap = nil)\n mor = snap ? getSnapMor(snap) : @vmMor\n cfgProps = @invObj.getMoProp(mor, \"config\")\n raise MiqException::MiqVimError, \"Failed to retrieve configuration information for VM\" if cfgProps.nil?\n cfgProps = cfgProps[\"config\"]\n\n cfgHash = {\n 'displayname' => cfgProps['name'],\n 'guestos' => cfgProps['guestId'].downcase.chomp(\"guest\"),\n 'uuid.bios' => cfgProps['uuid'],\n 'uuid.location' => cfgProps['locationId'],\n 'memsize' => cfgProps['hardware']['memoryMB'],\n 'cpu_cores_per_socket' => cfgProps['hardware']['numCoresPerSocket'],\n 'numvcpu' => cfgProps['hardware']['numCPU'],\n 'config.version' => cfgProps['version'],\n }\n\n controllerKeyHash = {}\n\n 1.upto(2) do |_i|\n cfgProps['hardware']['device'].each do |dev|\n case dev.xsiType\n when 'VirtualIDEController'\n tag = \"ide#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n\n when 'VirtualLsiLogicController', 'VirtualLsiLogicSASController', 'ParaVirtualSCSIController'\n tag = \"scsi#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.virtualdev\"] = \"lsilogic\"\n\n when 'VirtualBusLogicController'\n tag = \"scsi#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.virtualdev\"] = \"buslogic\"\n\n when 'VirtualDisk'\n controller_tag = controllerKeyHash.fetch_path(dev['controllerKey'], 'tag')\n next if controller_tag.nil?\n tag = \"#{controller_tag}:#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.devicetype\"] = \"disk\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n cfgHash[\"#{tag}.mode\"] = dev['backing']['diskMode']\n when \"VirtualCdrom\"\n controller_tag = controllerKeyHash.fetch_path(dev['controllerKey'], 'tag')\n next if controller_tag.nil?\n tag = \"#{controller_tag}:#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n if dev['backing']['fileName'].nil?\n cfgHash[\"#{tag}.devicetype\"] = \"cdrom-raw\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['deviceName']\n else\n cfgHash[\"#{tag}.devicetype\"] = \"cdrom-image\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n end\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n when \"VirtualFloppy\"\n tag = \"floppy#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n if dev['backing']['fileName'].nil?\n cfgHash[\"#{tag}.filename\"] = dev['backing']['deviceName']\n else\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n end\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n when \"VirtualPCNet32\", \"VirtualE1000\"\n tag = \"ethernet#{dev['unitNumber'].to_i - 1}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.networkname\"] = dev['backing']['deviceName']\n cfgHash[\"#{tag}.generatedaddress\"] = dev['macAddress']\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n cfgHash[\"#{tag}.type\"] = dev['deviceInfo']['label']\n end\n end\n end\n\n cfgHash\n end", "def get_vbox_vm_dir(client_name)\n message = \"Getting:\\tVirtualBox VM directory\"\n command = \"VBoxManage list systemproperties |grep 'Default machine folder' |cut -f2 -d':' |sed 's/^[ ]*//g'\"\n vbox_vm_base_dir = execute_command(message,command)\n vbox_vm_base_dir = vbox_vm_base_dir.chomp\n if !vbox_vm_base_dir.match(/[A-z]/)\n vbox_vm_base_dir=$home_dir+\"/VirtualBox VMs\"\n end\n vbox_vm_dir = \"#{vbox_vm_base_dir}/#{client_name}\"\n return vbox_vm_dir\nend", "def config(path)\n path = File.absolute_path(path)\n\n dir =\n if File.directory?(path)\n path\n else\n File.expand_path('..', path)\n end\n\n relative_to_home = dir.start_with?(HOME)\n\n if !relative_to_home\n dir = HOME\n end\n\n scan_for_dotconfig!(dir)\n\n @path2dotconfig[dir]\n end" ]
[ "0.7842283", "0.775856", "0.7737295", "0.7737295", "0.7139698", "0.70410436", "0.69512856", "0.66847956", "0.666324", "0.65464497", "0.65182424", "0.64154017", "0.63584983", "0.6341152", "0.63227695", "0.6321877", "0.6313751", "0.63087255", "0.62857175", "0.6284578", "0.6273854", "0.62682146", "0.6266549", "0.62300813", "0.62157935", "0.6199132", "0.6119553", "0.61162937", "0.6102832", "0.60994077", "0.60777235", "0.6076296", "0.60602546", "0.60525584", "0.6036664", "0.6031718", "0.60116565", "0.60107875", "0.6000031", "0.5999226", "0.5981781", "0.5977105", "0.597557", "0.5960321", "0.59551334", "0.59351873", "0.5911363", "0.59076774", "0.58949333", "0.58795476", "0.5878713", "0.5877511", "0.58635604", "0.5857794", "0.58564895", "0.5855781", "0.5853571", "0.58529615", "0.5824125", "0.5821416", "0.57820207", "0.5780887", "0.57776475", "0.5776", "0.57742083", "0.57552314", "0.57459337", "0.5736037", "0.57294345", "0.5728769", "0.5714042", "0.5704423", "0.5704151", "0.57036847", "0.57029426", "0.5701866", "0.5701866", "0.56996435", "0.5698768", "0.56873024", "0.568442", "0.5674601", "0.56734127", "0.566636", "0.5655638", "0.5650964", "0.56462854", "0.5639567", "0.56377006", "0.5626999", "0.56218475", "0.56217617", "0.5615747", "0.5611654", "0.5610582", "0.5606659", "0.5604996", "0.56040525", "0.56003064", "0.55998516" ]
0.7224048
4
Public: Provides the expected path to a VM's directory. This does not imply that the VM or path exists. name The name of the VM to provide the path for. Examples
def path File.join Fission.config['vm_dir'], "#{@name}.vmwarevm" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n File.join Fission.config.attributes['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def path(name=nil)\n if name\n return @dir + '/' + name\n else\n return @dir\n end\n end", "def vagrant_box(name)\n result = boxes_path.join(name)\n FileUtils.mkdir_p(result)\n result\n end", "def local_box_path name\n boxes_root = (self.local_field \"boxes_path\") || ENV['VAGRANT_BOXES'] || \"~/.boxes\"\n \"#{boxes_root}/#{name}\"\n end", "def output_dir(vm_name, build_type)\n unless build_type == 'base'\n File.join('./output/', \"#{vm_name}-virtualbox\")\n else\n File.join('./output/', \"#{vm_name}-base-virtualbox\")\n end\nend", "def get_vbox_vm_dir(client_name)\n message = \"Getting:\\tVirtualBox VM directory\"\n command = \"VBoxManage list systemproperties |grep 'Default machine folder' |cut -f2 -d':' |sed 's/^[ ]*//g'\"\n vbox_vm_base_dir = execute_command(message,command)\n vbox_vm_base_dir = vbox_vm_base_dir.chomp\n if !vbox_vm_base_dir.match(/[A-z]/)\n vbox_vm_base_dir=$home_dir+\"/VirtualBox VMs\"\n end\n vbox_vm_dir = \"#{vbox_vm_base_dir}/#{client_name}\"\n return vbox_vm_dir\nend", "def vmx_path\n return File.join(path, \"#{@name}.vmx\")\n end", "def path(name)\n File.join(@output_dir, name)\n end", "def define_machine_name(config, name)\n config.vm.provider \"virtualbox\" do |v|\n v.name = name\n end\nend", "def dir_name(name)\n name = name.dup\n name.gsub!(\":\", VAGRANT_COLON) if Util::Platform.windows?\n name.gsub!(\"/\", VAGRANT_SLASH)\n name\n end", "def get_parallels_disk(options)\n message = \"Information:\\tDetermining directory for Parallels VM \"+options['name']\n command = \"prlctl list #{options['name']} --info |grep image |awk '{print $4}' |cut -f2 -d=\"\n vm_dir = execute_command(options,message,command)\n vm_dir = vm_dir.chomp.gsub(/'/,\"\")\n return vm_dir\nend", "def dir(name)\n return CottaDir.new(factory, @path.join(name))\n end", "def vagrant_vm_name(name)\n return \"vagrant-#{name}-#{ENV['USER']}\"\nend", "def dir(name = :test)\n @dirs[name.to_sym] ||= Pathname.new(\n File.expand_path(\"#{Dir.tmpdir}/#{Time.now.to_i}#{rand(1000)}/\"))\n end", "def view_directory(name, _target_path = nil)\n directory name.to_s, _target_path || \"#{target_path}/#{name}\"\n end", "def view_directory(name, _target_path = nil)\n directory name.to_s, _target_path || \"#{target_path}/#{name}\"\n end", "def path(name)\n RubyAem::Resources::Path.new(@client, name)\n end", "def find_vm(name, recursive: true)\n vms(recursive: recursive).find { |each| each.name == name }\n end", "def find_vm(name, recursive: true)\n vms(recursive: recursive).find { |each| each.name == name }\n end", "def path(name)\n return @paths[''] if name.nil?\n normalized = name.split('/').inject([]) do |path, part|\n case part\n when '.', nil, ''\n path\n when '..'\n path[0...-1]\n else\n path << part\n end\n end.join('/')\n @paths[normalized] ||= Path.new(self, normalized)\n end", "def path(name)\n root.join(name)\n end", "def cache config, name, path\n require 'fileutils'\n require 'pathname'\n name = name.to_s\n local = File.join(File.expand_path('~/.vagrant.d/cache'), config.vm.box, name)\n FileUtils.mkdir_p local\n config.vm.synced_folder local, path\nend", "def cache config, name, path\n require 'fileutils'\n require 'pathname'\n name = name.to_s\n local = File.join(File.expand_path('~/.vagrant.d/cache'), config.vm.box, name)\n FileUtils.mkdir_p local\n config.vm.synced_folder local, path\nend", "def resolve_as_directory name\n [test_dir + name, context.root + name].detect { |dir|\n dir.directory? and handle? dir\n }\n end", "def path_existance_check(path_name_param, path_name, lang_choice)\n if Dir.exists?(path_name_param)\n haml_existance_check(path_name, lang_choice)\n return 0\n else\n $flag = 2\n if lang_choice == 1\n puts 'No such directory found'\n else\n puts \"Aucun répertoire de ce type n'a été trouvé\"\n end\n return -1\n end\n end", "def path\n @@path ||= File.join(RAILS_ROOT, 'tmp', 'cache', 'vm')\n end", "def template_path(name)\n name = name.to_s\n if name.include?('/') # Specific path like 'representers/somethingorother/foo.haml' given.\n name\n else\n File.join(self.class.representer_path, name)\n end\n end", "def created?(vm_name, provider='virtualbox')\n\tFile.exist?(\".vagrant/machines/#{vm_name}/#{provider}/id\")\nend", "def path\n \"#{Dir.tmpdir}/#{name}\"\n end", "def get_vagrant_appdir(node, appname)\n if ::EasyBib.is_aws(node)\n Chef::Log.warn('get_vagrant_appdir called from AWS env. There is something broken.')\n # trying to return a somewhat sane default\n return node['deploy'][appname]['deploy_to']\n end\n\n has_docroot_location = !node.fetch('vagrant', {}).fetch('applications', {}).fetch(appname, {})['doc_root_location'].nil?\n has_approot_location = !node.fetch('vagrant', {}).fetch('applications', {}).fetch(appname, {})['app_root_location'].nil?\n\n if has_approot_location\n return node['vagrant']['applications'][appname]['app_root_location']\n elsif !has_docroot_location\n Chef::Log.info('neither app_root_location nor doc_root_location set. Locations set to vagrant default')\n return '/vagrant_data/'\n end\n\n Chef::Log.info('app_root_location is not set in web_dna.json, trying to guess')\n path = node['vagrant']['applications'][appname]['doc_root_location']\n '/' + path.split('/')[1..-2].join('/') + '/'\n end", "def local_cache(box_name, cache_name)\r\n cache_dir = File.join(File.expand_path(\"~/.vagrant.d\"), \"cache\", cache_name, box_name)\r\n if cache_name == \"apt\"\r\n partial_dir = File.join(cache_dir, \"partial\")\r\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\r\n end\r\n cache_dir\r\nend", "def get_parallels_vm_dir(options)\n\treturn options['vmdir']\nend", "def path\n File.join(@base, @name)\n end", "def lsblk_path(p)\n return unless !p['path'] && p['name']\n\n if File.exist?(\"/dev/#{p['name']}\")\n p['path'] = \"/dev/#{p['name']}\"\n elsif File.exist?(\"/dev/mapper/#{p['name']}\")\n p['path'] = \"/dev/mapper/#{p['name']}\"\n end\n end", "def resolve_as_directory name\n [test_dir + name, context.root + name].detect { |dir| handle?(dir) }\n end", "def set_vbmanage_machinefolder(vm_name, vm_config, value = nil) \n value = value || ENV['UPLF_VBMANAGE_MACHINEFOLDER'] \n \n if !value.to_s.empty?\n log_info(\"#{vm_name}: vboxmanage machinefolder: #{value}\")\n system(\"vboxmanage setproperty machinefolder #{value}\")\n\n _track_ai_event(__method__, {\n 'vm_name': vm_name\n })\n end\n end", "def vm(name)\n logger.debug \"Retrieving VM '#{name}' from #{description}\"\n Derelict::VirtualMachine.new(self, name).validate!\n end", "def path_for(name, **options)\n lookup!(name, **options).fetch('file')\n end", "def path()\n return ::File.join(@root, @name)\n end", "def getFileDest(name)\n return nil if name.index(@templateRoot) != 0\n @projectRoot + '/' + name[@templateRoot.length + 1 .. -1]\n end", "def local_cache(basebox_name)\n cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)\n # Vagrant::Environment.new.home_path\n print cache_dir\n cache_dir.mkpath unless cache_dir.exist?\n partial_dir = cache_dir.join('partial')\n partial_dir.mkdir unless partial_dir.exist?\n cache_dir\nend", "def path(name,ext=nil)\n a,filename = File.split(ext.nil? ? super(name) : super(name,ext))\n a,b = File.split(a)\n File.join(a,'catalog_cm_guard',filename)\n end", "def path\n File.join(@base, @name)\n end", "def path\n name.split(\"::\").join(\"/\").downcase\n end", "def local_cache(box_name)\n cache_dir = File.join(File.expand_path(\"~/.vagrant.d\"),\n 'cache',\n 'apt',\n box_name)\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def vm(name)\n @vms.find {|v| v.name == name}\n end", "def dir(name, &blk)\n # Store the current steps and set a blank steps\n old, @steps = @steps, nil\n\n # Generate the block steps\n result = yield\n\n # Restore the old steps\n @steps = old\n\n # Put dir commands in the steps\n step \"(cd #{name} && (#{result.join('\\n')}))\"\n end", "def path\n folder.path + name\n end", "def setup_system_dir(name)\n system_dir = File.join(base_systems_dir, name)\n unless File.directory?(system_dir)\n say \"Creating new system #{name} directory\"\n mkdir_p(system_dir)\n end\n set_system(name)\n end", "def path\n @path ||= Pathname.new(dir) + filename\n end", "def get_fusion_vm_vmdk_file(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n if File.directory?(fusion_vm_dir)\n fusion_vmdk_file = Dir.entries(fusion_vm_dir).grep(/vmdk$/)[0].chomp\n else\n fusion_vmdk_file = \"\"\n end\n fusion_vmdk_file = fusion_vm_dir+\"/\"+fusion_vmdk_file\n return fusion_vmdk_file\nend", "def local_cache(box_name)\n cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),\n 'cache',\n 'apt',\n box_name)\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def template_path(name, template_engine:nil) #current_template_engine)\n template_engine ||= '*'\n #puts \"TEMPLATE_path searching with name: #{name}, template_engine: #{template_engine}\"\n ([Vue::Helpers.views_path].flatten.uniq.compact || Dir.getwd).each do |start_path|\n #puts \"TEMPLATE_path searching views-path: #{start_path}\"\n Dir.breadth_first(\"*\", base:start_path) do |path|\n #puts \"TEMPLATE_path inspecting file: #{path}\"\n return path if File.fnmatch(File.join('*', \"#{name}.vue.#{template_engine}\"), path)\n return path if File.fnmatch(File.join('*', \"#{name}.vue\"), path)\n return path if File.fnmatch(File.join('*', name.to_s), path)\n end\n end\n\n return nil\n end", "def get_vm(name)\n filter = Com::Vmware::Vcenter::VM::FilterSpec.new(names: Set.new([name]))\n vm_obj = Com::Vmware::Vcenter::VM.new(vapi_config)\n vm_obj.list(filter)[0]\n end", "def dir\n @dir ||= File.join Hoboku.data_dir, name\n end", "def dotfile_path\n return nil if !root_path\n root_path.join(config.global.vagrant.dotfile_name)\n end", "def find_vm(vmname)\n @datacenter.find_vm(vmname)\n end", "def mount_kvm_volume(name)\n dev = available_dev\n enable_netblockdev(name, dev)\n vol_grp = lvm_volume_group(\n lvm_partition(dev)\n )\n root = lvm_root(vol_grp)\n lvm_enable(vol_grp) unless lvm_enabled?(root)\n mount(name, root)\n dev\nend", "def file(name)\n if name.start_with?('/')\n File.new(name)\n elsif name.start_with?('~')\n File.new(name.gsub('~', \"#{ENV['HOME']}\"))\n else\n File.new(File.join(sandbox, name))\n end\n end", "def dotfile( name )\n File.join( build_dir, \".#{name}\" )\n end", "def vm(name)\n @conn.vms.get(name)\n end", "def generate_path file_name, scope = \"video\"\n generator = CONFIG[:\"#{scope}_path_generator\"]\n begin\n generator = instance_exec(file_name, &generator).to_s if generator.is_a? Proc\n rescue => e\n generator = nil\n raise ConfigError, \"Path generator error: (#{e})\"\n end\n\n storage = CONFIG[:\"#{scope}_storage\"].to_s\n storage += \"/\" unless storage.empty?\n storage += generator || \"\"\n\n path = (!storage || storage.empty? ? CONFIG[:PWD] : storage).to_s.strip.gsub(%r#/+#, '/').gsub(%r#/$#, '')\n\n # generate path\n begin\n FileUtils.mkdir_p path, :mode => 0755\n rescue => e\n raise FileError, \"Path generator error: #{e}\"\n end unless File.exists?(path)\n path\n end", "def view_directory(name, view_target_path = nil)\n directory \"#{name}/default\", view_target_path || \"#{target_path}/#{name}/#{plural_target || :default}\"\n end", "def ensure_local_drive_path(path, temp_dir_name)\n return path\n end", "def ensure_local_drive_path(path, temp_dir_name)\n return path\n end", "def guest_device(name, mount_point_obj)\n \"/dev/#{guest_vg_name(name, mount_point_obj)}/#{guest_lv_name(mount_point_obj)}\"\n end", "def path_name\n str = name.dup\n str << '/' if is_dir\n str = parent.path_name + str if parent\n str\n end", "def full_path\n File.join(@path, @name)\n end", "def run_name_path(num, run)\n se = Sequence_event.new(run)\n des = \"/stornext/snfs#{num}/next-gen/solid/results\"\n if !File.directory?(des)\n Helpers::log(\"snfs#{num} does not exist. exiting..\", 1)\n end\n\n des + \"/\" + @machine + \"/\" + se.year + \"/\" + se.month +\n \"/\" + se.rname\n end", "def safe_dir\n options[:root_dir] / name.to_s\n end", "def setUpProvisionLogging(vmName)\n\tif $vmProvisionLoggingEnabled\n\t\tcurrentTime = Time.now.strftime(\"%d-%m-%Y-%H-%M\")\n\n\t\tlogDirectoryGuest = \"/vagrant/generated/vagrant/provisioning/%s/\" % vmName\n\t\tlogDirectoryHost = \"generated/vagrant/provisioning/%s/\" % vmName\n\n\t\tlogFileGuest = \"%s%s.log\" % [logDirectoryGuest, currentTime]\n\t\tlogFileHost = \"%s%s.log\" % [logDirectoryHost, currentTime]\n\n\t\tFileUtils.mkdir_p(logDirectoryHost)\n\t\tFileUtils.touch(logFileHost)\n\n\t\treturn logFileGuest\n\telse\n\t\treturn \"/dev/null\"\n\tend\nend", "def path\n [name]\n end", "def locate(name)\n name = name[1..-1] if name.start_with?(':')\n name = name[0..-2] if name.end_with?(':')\n path = name.split(':')\n _locate(path)\n end", "def locate(name)\n name = name[1..-1] if name.start_with?(':')\n name = name[0..-2] if name.end_with?(':')\n path = name.split(':')\n _locate(path)\n end", "def machine\n @machine = begin\n machine = manager.vbox.machines.detect { |machine| machine.name == name }\n raise VmNotFound, \"#{name} VirtualBox VM could not be found\" unless machine\n machine\n end\n end", "def lookup_or_create(path, **kwargs)\n existing = @virtual_disk[self.class.cleanpath(path)]\n return existing if existing\n\n kwargs[:exist?] = false\n VirtualPathname.new(@virtual_disk, path, **kwargs)\n end", "def get_vm(name)\n vm_api = VSphereAutomation::VCenter::VMApi.new(api_client)\n raise_if_unauthenticated vm_api, \"checking for VM `#{name}`\"\n\n vms = vm_api.list({ filter_names: name }).value\n\n raise_if_missing vms, format(\"Unable to find VM `%s`\", name)\n raise_if_ambiguous vms, format(\"`%s` returned too many VMs\", name)\n\n vms.first\n end", "def mkdir(name=newname)\n dir = path(name)\n Dir.mkdir(dir)\n return dir\n end", "def path_to_template name\n \"#{JSPEC_ROOT}/templates/#{name}/.\"\n end", "def addNameToPath(name)\n @root = name if @currentPath.empty?\n @currentPath.addName(name)\n end", "def name\n @name || path_name\n end", "def _entry_path(cve_name)\n year = NvdFileSystem.year_from_name(cve_name)\n \"#{@root_path}/#{year}/#{cve_name}/\"\n end", "def virtual_machine(name)\n kubevirt_client.get_virtual_machine(name, @namespace)\n end", "def vm_name\n if !name || name.empty?\n \"#{user.id}-#{project.name.gsub('.','-')}-#{Time.zone.now.to_i.to_s.sub(/^../,'')}\".downcase\n else\n name\n end\n end", "def dir_alias= name\n #This is a stub, used for indexing\n end", "def dir\n Rails.root.join(ROOT, type, name).to_s\n end", "def stored_virtual_machine(name)\n kubevirt_client.get_stored_virtual_machine(name, @namespace)\n end", "def share_folder(location, name, box)\n if location\n box.vm.share_folder(name, name, location, :nfs => true)\n end\nend", "def path\n File.join(@base, @dir.sub(@dst_dir, @src_dir), @name)\n end", "def pwd(msg) # :yields: nil \n %[257 \"#{virtual_folder(Dir.pwd)}\" is the current directory]\n end", "def set_vbmanage_machinefolder_default()\n system(\"vboxmanage setproperty machinefolder default\")\n _track_ai_event(__method__, {\n 'vm_name': vm_name\n })\n end", "def find_file(name)\n if name =~ /^\\//\n @wiki.file(name[1..-1], @version)\n else\n path = @dir == '.' ? name : ::File.join(@dir, name)\n @wiki.file(path, @version)\n end\n end", "def directory(name = 'some-dir', &block)\n tmpdir = Dir.mktmpdir.tap do |path|\n Dir.chdir(path) do\n Dir.mkdir(name)\n Dir.chdir(name) do\n block.call if block_given?\n end\n end\n end\n\n File.join(tmpdir, name)\n end", "def directory(name = 'some-dir', &block)\n tmpdir = Dir.mktmpdir.tap do |path|\n Dir.chdir(path) do\n Dir.mkdir(name)\n Dir.chdir(name) do\n block.call if block_given?\n end\n end\n end\n\n File.join(tmpdir, name)\n end", "def virtual_machine_template(name)\n kubevirt_client.get_virtual_machine_template(name, @namespace)\n end", "def vpath\n vdir_for_set(image_set_id) + filename\n end", "def path\n \"repos/#{@user}/#{name}\"\n end", "def local_image_path(name)\n Rails.root.join('uploads', name).to_s\n end", "def pathForName(name)\n name = name.gsub(/Iowa::Application::ContentClasses::/,C_empty)\n return @pathNameCache[name] if @templateLTimes.has_key?(name) and (@templateLTimes[name] < Time.now)\n my_docroot = @docroot\n my_docroot << C_slash unless my_docroot[-1,1] == C_slash\n \n pfn_pre = my_docroot + name.gsub(/::/,C_slash)\n pfn = nil\n @@view_suffixes.each do |sfx|\n tmp_pfn = pfn_pre + sfx\n if FileTest.exist? tmp_pfn\n pfn = tmp_pfn\n @pathNameCache[name] = pfn\n @templateLTimes[name] = Time.now + path_query_interval\n break\n end\n end\n pfn\n end" ]
[ "0.6807978", "0.65036577", "0.6354682", "0.6059271", "0.60238516", "0.5988303", "0.5812387", "0.57191455", "0.5660093", "0.5637171", "0.55512977", "0.5549756", "0.55132025", "0.5470299", "0.5448806", "0.5448806", "0.5438736", "0.5437756", "0.5437428", "0.5419269", "0.53777117", "0.5348906", "0.5348906", "0.5334694", "0.5328467", "0.5315852", "0.5268876", "0.52511173", "0.5226964", "0.5219116", "0.52050453", "0.519866", "0.518954", "0.51737905", "0.51688874", "0.51598155", "0.5142867", "0.5102884", "0.5101855", "0.5101289", "0.5086734", "0.5076963", "0.5069679", "0.5067732", "0.5066152", "0.505407", "0.5045933", "0.5045362", "0.5021831", "0.5020209", "0.50084645", "0.49920142", "0.4988045", "0.49848887", "0.49753347", "0.49678484", "0.49651706", "0.4963425", "0.4951572", "0.4951519", "0.49513307", "0.49431014", "0.4942014", "0.4933612", "0.4933612", "0.49304453", "0.49285644", "0.49259907", "0.4924096", "0.4921882", "0.4917457", "0.49106532", "0.4906674", "0.4906674", "0.49063066", "0.49009693", "0.48996", "0.48992932", "0.48904824", "0.48888", "0.48844564", "0.48750967", "0.4872813", "0.4864014", "0.48605746", "0.485675", "0.4853291", "0.4846292", "0.48428148", "0.4839733", "0.48378146", "0.48364058", "0.4828804", "0.4828804", "0.48258033", "0.48230267", "0.4821887", "0.48186642", "0.4816593" ]
0.68357503
1
Public: Deletes a VM. The VM must not be running in order to delete it. As there are a number issues with the Fusion command line tool for deleting VMs, this is a best effort. The VM must not be running when this method is called. This essentially deletes the VM directory and attempts to remove the relevant entries from the Fusion plist file. It's highly recommended to delete VMs without the Fusion GUI running. If the Fusion GUI is running this method should succeed, but it's been observed that Fusion will recreate the plist data which is deleted. This leads to 'missing' VMs in the Fusion GUI. Examples
def delete unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? if running_response.data message = 'The VM must not be running in order to delete it.' return Response.new :code => 1, :message => message end FileUtils.rm_rf path Metadata.delete_vm_info path Response.new :code => 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = @vm.running?\n return running_response unless running_response.successful?\n\n if running_response.data\n message = 'The VM must not be running in order to delete it.'\n return Response.new :code => 1, :message => message\n end\n\n FileUtils.rm_rf @vm.path\n Metadata.delete_vm_info @vm.path\n\n Response.new :code => 0\n end", "def destroy\n vm.destroy\n FileUtils.rm_rf dir\n end", "def delete_vm\n osapi = Apiexternal::Osapi.new\n\n begin\n osapi.delete_vm(nova_id)\n rescue Exceptions::NextDeployException => me\n me.log\n end\n\n # delete hiera and vcl files\n clear_vmfiles\n generate_host_all\n end", "def delete\n execute(\"unregistervm\", @uuid, \"--delete\")\n end", "def vm_delete(vm)\n connection[vms_collection].find(_id: vm).delete_one\n end", "def delete_vm\n unless @vm\n info 'No VM assigned, nothing to delete'\n return false\n end\n system(\"knife node delete #{chef_name} -y\")\n # TODO: make changes here after switching to newer version of OpenNebula\n locate_vm(id).finalize\n @vm = nil\n @ip = nil\n true\n end", "def unconfigure_fusion_vm(options)\n stop_fusion_vm(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n stop_fusion_vm(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Deleting:\\t#{options['vmapp']} VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion deleteVM '#{fusion_vmx_file}'\"\n execute_command(options,message,command)\n vm_dir = options['name']+\".vmwarevm\"\n message = \"Removing:\\t#{options['vmapp']} VM \"+options['name']+\" directory\"\n command = \"cd \\\"#{options['fusiondir']}\\\" ; rm -rf \\\"#{vm_dir}\\\"\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n end\n end\n return\nend", "def delete_vm(vm_id)\n with_thread_name(\"delete_vm(#{vm_id}\") do\n begin\n # Skip if the VM does not exist\n return unless has_vm?(vm_id)\n vm = @vm_manager.get_virtual_machine(vm_id, true, true)\n unless vm['power_state'] == 'off'\n @logger.info('Switching off the VM...')\n @vm_manager.set_power_state(vm_id, 'off')\n end\n @logger.info('Detaching persistent disks attached to VM.')\n vm['vm_disk_info'].each do |disk|\n # If a volume is attached to the virtual machine\n # then detach it before deleting the virtual machine\n vol_group_uuid = disk['disk_address']['volume_group_uuid']\n unless vol_group_uuid.nil?\n @vol_group_manager.detach_from_vm(vol_group_uuid, vm_id)\n @logger.info(\"Detached volume group #{vol_group_uuid}.\")\n end\n end\n @vm_manager.delete_virtual_machine(vm_id)\n @logger.info('Deleted the virtual machine.')\n rescue => e\n @logger.error(e)\n cloud_error(e.message)\n end\n end\n end", "def delete_vm(instance_id)\n with_thread_name(\"delete_vm(#{instance_id}):v2\") do\n logger.info(\"Deleting instance '#{instance_id}'\")\n @cloud_core.delete_vm(instance_id) do |instance_id|\n @registry.delete_settings(instance_id) if @stemcell_api_version < 2\n end\n end\n end", "def delete_vm(instance_id)\n with_thread_name(\"delete_vm(#{instance_id})\") do\n logger.info(\"Deleting instance '#{instance_id}'\")\n\n @cloud_core.delete_vm(instance_id) do |instance_id|\n @registry.delete_settings(instance_id)\n end\n end\n end", "def delete_virtual_machine(vm_name, cloud_service_name, options={})\n virtual_machines = list_virtual_machines(cloud_service_name)\n vm = virtual_machines.select { |x| x.vm_name == vm_name }.first\n if vm\n if virtual_machines.size == 1\n cloud_service = client.cloud_service_management\n cloud_service.delete_cloud_service_deployment(cloud_service_name)\n cloud_service.delete_cloud_service(cloud_service_name)\n else\n path = \"/services/hostedservices/#{vm.cloud_service_name}/deployments/#{vm.deployment_name}/roles/#{vm.vm_name}\"\n Azure::Loggerx.info \"Deleting virtual machine #{vm_name}. \\n\"\n request = client.management_request(:delete, path)\n request.call\n end\n Azure::Loggerx.info \"Waiting for disk to be released.\\n\"\n disk_name = vm.disk_name\n disk_management_service = client.vm_disk_management\n # Wait for 180s for disk to be released.\n disk = nil\n 18.times do\n Azure::Loggerx.info '# '\n disk = disk_management_service.get_virtual_machine_disk(disk_name)\n unless disk.attached\n Azure::Loggerx.info \"Disk released.\\n\"\n break\n end\n sleep 10\n end\n if disk.attached\n Azure::Loggerx.error \"\\nCannot delete disk #{disk_name}.\"\n else\n disk_management_service.delete_virtual_machine_disk(disk_name, options)\n end\n else\n Azure::Loggerx.error \"Cannot find virtual machine #{vm_name} under cloud service #{cloud_service_name}\"\n end\n rescue\n end", "def delete_virtualbox_vm(vm_name)\n @colour.notify \"Deleting VirtualBox VM #{vm_name}\"\n @colour.notify \"VirtualBox VM #{vm_name} deleted\" if system \"VBoxManage unregistervm #{vm_name} --delete\"\nend", "def remove_from(vm)\n VirtualBox.run_command! ['VBoxManage', '--nologo', 'storagectl', vm.uuid,\n '--name', name, '--remove']\n self\n end", "def destroy\n requires_existing_vm\n domain.undefine\n set_domain(nil)\n end", "def destroy(state)\n return if state[:vm_name].nil?\n\n save_and_validate_parameters\n connect\n vm = get_vm(state[:vm_name])\n\n vm_obj = Com::Vmware::Vcenter::VM.new(vapi_config)\n\n # shut the machine down if it is running\n if vm.power_state.value == \"POWERED_ON\"\n power = Com::Vmware::Vcenter::Vm::Power.new(vapi_config)\n power.stop(vm.vm)\n end\n\n # delete the vm\n vm_obj.delete(vm.vm)\n end", "def delete_virtual_machine(vm_name, cloud_service_name)\n vm = get_virtual_machine(vm_name,cloud_service_name)\n if vm\n cloud_service = Azure::CloudServiceManagementService.new\n cloud_service.delete_cloud_service_deployment(cloud_service_name)\n cloud_service.delete_cloud_service(cloud_service_name)\n Loggerx.info \"Waiting for disk to be released.\\n\"\n sleep 60\n disk_management_service = VirtualMachineDiskManagementService.new\n disk_management_service.delete_virtual_machine_disk(vm.disk_name)\n else\n Loggerx.error \"Cannot find virtual machine #{vm_name} under cloud service #{cloud_service_name}\"\n end\n rescue \n end", "def unconfigure_vbox_vm(client_name)\n check_vbox_is_installed()\n exists = check_vbox_vm_exists(client_name)\n if exists == \"no\"\n puts \"VirtualBox VM \"+client_name+\" does not exist\"\n exit\n end\n stop_vbox_vm(client_name)\n sleep(5)\n message = \"Deleting:\\tVirtualBox VM \"+client_name\n command = \"VBoxManage unregistervm #{client_name} --delete\"\n execute_command(message,command)\n return\nend", "def delete_vm_instance(name, namespace)\n @conn.vminstances.destroy(name, namespace)\n end", "def delete\n Fission::Action::VM::Deleter.new(self).delete\n end", "def delete_pvm_instance(instance_id)\n delete(\"cloud-instances/#{guid}/pvm-instances/#{instance_id}\")\n end", "def delete_virtualization_virtual_machine(moid, opts = {})\n delete_virtualization_virtual_machine_with_http_info(moid, opts)\n nil\n end", "def destroy(state)\n return if state[:vm_name].nil?\n\n # Reset resource pool, as it's not needed for the destroy action but might be a remnant of earlier calls to \"connect\"\n # Temporary fix until setting cluster + resource_pool at the same time is implemented (lines #64/#187)\n config[:resource_pool] = nil\n\n save_and_validate_parameters\n connect\n\n vm = get_vm(state[:vm_name])\n unless vm.nil?\n vm_api = VSphereAutomation::VCenter::VMApi.new(api_client)\n raise_if_unauthenticated vm_api, \"connecting to VM API\"\n\n # shut the machine down if it is running\n if vm.power_state == \"POWERED_ON\"\n power = VSphereAutomation::VCenter::VmPowerApi.new(api_client)\n power.stop(vm.vm)\n end\n\n # delete the vm\n vm_api.delete(vm.vm)\n end\n end", "def delete_vm(instance_id)\n with_thread_name(\"delete_vm(#{instance_id})\") do\n logger.info(\"Deleting instance '#{instance_id}'\")\n @instance_manager.find(instance_id).terminate(fast_path_delete?)\n end\n end", "def delete_vm(instance_id)\n with_thread_name(\"delete_vm(#{instance_id})\") do\n logger.info(\"Deleting instance '#{instance_id}'\")\n @instance_manager.find(instance_id).terminate(fast_path_delete?)\n end\n end", "def cleanup\n vm_id = VMHelper.get_vm(service_manager.vapi_config, vm_name)\n status = vm_power_svc.get(vm_id)\n if status.state == VM_POWER_CLASS::State::POWERED_ON ||\n status.state == VM_POWER_CLASS::State::SUSPENDED\n log.info \"The VM #{vm_name} would be powered OFF\"\n vm_power_svc.stop(vm_id)\n end\n log.info \"Cleanup :: Deleting the VM #{vm_name}\"\n vm_svc.delete(vm_id)\n end", "def delete_vbox_vm_config(client_name)\n vbox_vm_dir = get_vbox_vm_dir(client_name)\n config_file = vbox_vm_dir+\"/\"+client_name+\".vbox\"\n if File.exist?(config_file)\n message = \"Removing:\\tVirtualbox configuration file \"+config_file\n command = \"rm \\\"#{config_file}\\\"\"\n execute_command(message,command)\n end\n return\nend", "def delete_vm(vm_cid)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"delete_vm(#{vm_cid})\") do\n @telemetry_manager.monitor('delete_vm', id: vm_cid) do\n @logger.info(\"Deleting instance '#{vm_cid}'\")\n @vm_manager.delete(InstanceId.parse(vm_cid, _azure_config.resource_group_name))\n end\n end\n end", "def destroy\n getnodes.each{|node|\n Sys.exec(\"vagrant destroy #{node.name} -f\")\n }\n end", "def unregister\n VirtualBox.run_command ['VBoxManage', 'unregistervm', uid, '--delete']\n self\n end", "def delete_vm(server_id)\n with_thread_name(\"delete_vm(#{server_id})\") do\n @logger.info(\"Deleting server `#{server_id}'...\")\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n if server\n server_tags = metadata_to_tags(server.metadata)\n @logger.debug(\"Server tags: `#{server_tags}' found for server #{server_id}\")\n destroy_server(server, server_tags)\n else\n @logger.info(\"Server `#{server_id}' not found. Skipping.\")\n end\n end\n end", "def unconfigure_parallels_vm(options)\n check_parallels_is_installed(options)\n exists = check_parallels_vm_exists(options)\n if exists == false\n handle_output(options,\"Parallels VM #{options['name']} does not exist\")\n quit(options)\n end\n stop_parallels_vm(options)\n sleep(5)\n message = \"Deleting Parallels VM \"+options['name']\n command = \"prlctl delete #{options['name']}\"\n execute_command(options,message,command)\n message = \"Unregistering Parallels VM \"+options['name']\n command = \"prlctl unregister #{options['name']}\"\n execute_command(options,message,command)\n return\nend", "def destroy_kvm(kvm_name)\n [\n \"virsh destroy #{kvm_name}\",\n \"virsh undefine #{kvm_name}\"\n ].each do |cmd|\n raise \"Failed to delete node: #{kvm_name}\" unless system(cmd)\n end\n File.delete(File.join(KVM_HOME, 'storage', \"#{kvm_name}.qcow2\"))\nend", "def destroy\n @vm.destroy\n respond_to do |format|\n format.html { redirect_to(vms_path+'?admin=1') }\n format.xml { head :ok }\n end\n end", "def cleanup(vm_ref)\n ui.warn \"Clenaing up work and exiting\"\n xapi.VM.destroy(vm_ref)\n exit 1 \n end", "def destroy_vm(_pool_name, _vm_name)\n raise(\"#{self.class.name} does not implement destroy_vm\")\n end", "def delete(session, id)\n write_task('rvpe.vmtype.delete', session, true) do\n type = VMType.find_by_id(id)[0]\n raise \"VMType[#{id}] does not exist.\" unless type\n\n type.delete\n [true, '']\n end\n end", "def destroy_vm(_pool_name, _vm_name)\n\n machine = virtual_box.find_machine(:nameOrId => _vm_name)\n return true if machine.nil?\n \n sess = @web_session_mgr.get_session_object\n begin\n machine.lock_machine(:session => sess, :lockType => 'VM')\n progress = sess.console.power_down()\n progress.wait_for_completion(:timeout => -1)\n rescue Exception => e\n $logger.log('s', \"[x] can't destroy vm: can't get lock [#{_pool_name}] '#{machine}'. #{e.message}\")\n return false\n end\n\n begin\n machine.unregister(:cleanupMode => 'Full')\n rescue Exception => e\n $logger.log('s', \"[x] can't unregister vm: can't get lock [#{_pool_name}] '#{machine}'. #{e.message}\")\n return false\n end\n\n return true\n\n end", "def destroy\n @vm.destroy\n respond_to do |format|\n format.html { redirect_to vms_url, notice: 'Vm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n deleteVm = Virtualmachine.new\n @response_del = deleteVm.deleteVMcall(@virtualmachine.RemoteID)\n @virtualmachine.destroy\n respond_to do |format|\n format.html { redirect_to virtualmachines_url,notice: 'Virtual server will be delete shortly.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @virtualmachines = Virtualmachine.find(params[:id])\n @virtualmachines.destroy\n\n respond_to do |format|\n format.html { redirect_to(virtualmachines_url) }\n format.xml { head :ok }\n end\n end", "def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end", "def delete_compute(request, params)\n # --- Get the VM ---\n vm = VirtualMachineOCCI.new(\n VirtualMachine.build_xml(params[:id]),\n @client)\n\n # --- Finalize the VM ---\n result = vm.finalize\n if OpenNebula.is_error?(result)\n return result, CloudServer::HTTP_ERROR_CODE[result.errno]\n end\n\n return \"\", 204\n end", "def remove\n remove_vagrant_box(self)\n remove_checkpoints\n remove_hiera_template\n remove_manifests_node\n end", "def delete_virtualization_virtual_disk(moid, opts = {})\n delete_virtualization_virtual_disk_with_http_info(moid, opts)\n nil\n end", "def cleanup(vm_ref)\n # shutdown and dest\n unless xapi.VM.get_power_state(vm_ref) == 'Halted'\n ui.msg 'Shutting down Guest'\n task = xapi.Async.VM.hard_shutdown(vm_ref)\n get_task_ref(task) unless task == 'Halted'\n end\n\n ui.msg 'Removing disks attached to Guest'\n Chef::Log.debug \"getting vbds attached to #{vm_ref}\"\n wait_tasks = []\n xapi.VM.get_VBDs(vm_ref).to_a.each do |vbd|\n next unless vbd\n\n Chef::Log.debug \"removing vbd: #{vbd}\"\n wait_tasks << xapi.Async.VDI.destroy(xapi.VBD.get_record(vbd)['VDI'])\n wait_tasks << xapi.Async.VBD.destroy(vbd)\n end\n\n # wait for disk cleanup to finish up\n unless wait_tasks.empty?\n ui.msg 'waiting for disks to cleanup'\n wait_tasks.each do |task|\n wait_on_task(task)\n end\n end\n\n ui.msg 'Destroying Guest'\n task = xapi.Async.VM.destroy(vm_ref)\n wait_on_task(task)\n end", "def destroy\n @vdm.destroy\n\n head :no_content\n end", "def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end", "def destroy(_)\n paths = [\n instance.provisioner[:root_path], instance.verifier[:root_path]\n ]\n paths.each do |p|\n FileUtils.rm_rf(p)\n logger.info(\"[Localhost] Deleted temp dir '#{p}'.\")\n end\n self.class.unlock!\n end", "def delete_fusion_vm_snapshot(options)\n clone_list = []\n if options['clone'].to_s.match(/\\*/) or options['clone'].to_s.match(/all/)\n clone_list = get_fusion_vm_snapshots(options)\n clone_list = clone_list.split(\"\\n\")[1..-1]\n else\n clone_list[0] = options['clone']\n end\n clone_list.each do |clone|\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n message = \"Information:\\tDeleting snapshot \"+clone+\" for #{options['vmapp']} VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion deleteSnapshot '#{fusion_vmx_file}' '#{clone}'\"\n execute_command(options,message,command)\n end\n return\nend", "def delete_virtualization_virtual_network(moid, opts = {})\n delete_virtualization_virtual_network_with_http_info(moid, opts)\n nil\n end", "def delete\n stop\n [ @resource['instances_dir'] + \"/\" + @resource[:name],\n @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name]\n ].each do |dir|\n FileUtils.rm_rf(dir) if File.directory?(dir)\n end\n end", "def delete_vapp(id)\n fog_service_interface.delete_vapp(id)\n end", "def delete\n results = submit_cmd('delete app instance',:db, \" -env #{self.belongs_to.env} -app_instance #{self.name}\")\n\n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \t raise \"update attribute failed\" \n\t else\n\t \t self.belongs_to.appTemplates.delete(self)\n\t end\n\n end", "def delete_kubernetes_virtual_machine_node_profile(moid, opts = {})\n delete_kubernetes_virtual_machine_node_profile_with_http_info(moid, opts)\n nil\n end", "def delete_vagrant_plugins\n `vagrant -v`\n rescue Errno::ENOENT\n @ui.info('Vagrant in not installed')\n else\n vagrant_plugin_list = run_command('vagrant plugin list')\n return if vagrant_plugin_list[:output] =~ /No plugins installed/\n\n plugin_regexp = /(\\S+) \\([0-9.]+.*\\)/\n plugins = vagrant_plugin_list[:output].split(\"\\n\").each_with_object([]) do |line, acc|\n acc.push(line.match(plugin_regexp)[1]) if line =~ plugin_regexp\n acc\n end\n run_command(\"vagrant plugin uninstall #{plugins.join(' ')}\") unless plugins.empty?\n end", "def destroy\n log_debug \"[ #{@node}/#{@environment} ] - Delete Proxmox LXC Container ...\"\n release_lxc_container(@lxc_details[:vm_id])\n end", "def delete\n if (exists?)\n list.each do |children|\n children.delete\n end\n factory.system.delete_dir(@path)\n end\n end", "def delete_fusion_vm_network(options,install_interface)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if !vm_list.to_s.match(/#{options['name']}/)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if install_interface == options['empty']\n message = \"Information:\\tGetting network interface list for \"+options['name']\n command = \"'#{options['vmrun']}' listNetworkAdapters '#{fusion_vmx_file}' |grep ^Total |cut -f2 -d:\"\n output = execute_command(options,message,command)\n last_id = output.chomp.gsub(/\\s+/,\"\")\n last_id = last_id.to_i\n if last_id == 0\n handle_output(options,\"Warning:\\tNo network interfaces found\")\n return\n else\n last_id = last_id-1\n install_interface = last_id.to_s\n end\n end\n message = \"Information:\\tDeleting network interface from \"+options['name']\n command = \"'#{options['vmrun']}' deleteNetworkAdapter '#{fusion_vmx_file}' #{install_interface}\"\n execute_command(options,message,command)\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend", "def delete_virtual_network(id, opts = {})\n data, _status_code, _headers = delete_virtual_network_with_http_info(id, opts)\n data\n end", "def delete_kubernetes_virtual_machine_instance_type(moid, opts = {})\n delete_kubernetes_virtual_machine_instance_type_with_http_info(moid, opts)\n nil\n end", "def delete\n FileUtils.remove_entry_secure(@directory)\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::ENOENT\n end", "def shutdown_vms()\n @vm_manager.shutdown_vms()\n end", "def delete_vcenter(vcenter_id=nil, auth=nil, cert=nil)\n check_vcenter(vcenter_id)\n payload = {\n }.to_json\n rest_post(payload, \"#{@base_url}/compute/vcenters/#{vcenter_id}/deactivate\", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)\n end", "def destroy!\n fail \"Can not destroy a running stone\" if running?\n rm_rf system_config_filename\n rm_rf extent_directory\n rm_rf log_directory\n rm_rf tranlog_directories\n end", "def suspend_fusion_vm(options)\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n message = \"Stopping:\\tVirtual Box VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion suspend '#{fusion_vmx_file}'\"\n execute_command(options,message,command)\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} not running\")\n end\n end\n return\nend", "def delete\n ensure_service!\n service.delete_instance path\n true\n end", "def delete\n execute_prlctl('delete', @uuid)\n end", "def destroy_directory!(directory)\n system(\"trash #{directory}\")\n end", "def deleteFW (path)\n choose = prompt(text: \"delete \" + path.to_s + \"?\\n press 1 to continue, 0 to exit: \").to_i\n if choose.to_i == 0 \n abort UI.user_error!(\"program was forced exit by user\")\nelse\n sh(\"rm -rf \" + path.to_s)\n end\nend", "def destroy\n @action_runner.run(:box_remove, { :box_name => @name, :box_directory => @directory })\n end", "def cleanup_storage vm\n vm.volumes.each do |vol|\n @logger.debug \"Deleting volume #{vol.name} for OpenStack host #{vm.name}\"\n vm.detach_volume(vol.id)\n vol.wait_for { ready? }\n vol.destroy\n end\n end", "def delete_libvirt_pool\n run_sequence([\n 'sudo virsh pool-destroy default',\n 'sudo virsh pool-delete default',\n 'sudo virsh pool-undefine default'\n ], until_first_error: false)\n end", "def destroy!\n # Delete the directory to delete the box.\n FileUtils.rm_r(@directory)\n\n # Just return true always\n true\n rescue Errno::ENOENT\n # This means the directory didn't exist. Not a problem.\n return true\n end", "def cleanup\n @logger.notify \"Cleaning up OpenStack\"\n @vms.each do |vm|\n cleanup_storage(vm)\n @logger.debug \"Release floating IPs for OpenStack host #{vm.name}\"\n floating_ips = vm.all_addresses # fetch and release its floating IPs\n floating_ips.each do |address|\n @compute_client.disassociate_address(vm.id, address['ip'])\n @compute_client.release_address(address['id'])\n end\n @logger.debug \"Destroying OpenStack host #{vm.name}\"\n vm.destroy\n if @options[:openstack_keyname].nil?\n @logger.debug \"Deleting random keypair\"\n @compute_client.delete_key_pair vm.name\n end\n end\n end", "def teardown\n with_vsphere_connection do |dc|\n nodes.each do |k,v|\n storage = RSpec.configuration.rs_storage[:nodes][k]\n\n if storage.nil?\n log.info \"No entry for node #{k}, no teardown necessary\"\n next\n end\n\n ssh = storage[:ssh]\n unless ssh.nil? or ssh.closed?\n ssh.close\n end\n\n if destroy\n log.info \"Destroying instance #{k}\"\n vm_name = storage[:vm]\n if vm_name == nil\n log.error \"No vm object for #{k}\"\n next\n end\n\n # Traverse folders to find target folder for new vm's\n vm_folder = dc.vmFolder.traverse(vmconf[:dest_dir], RbVmomi::VIM::Folder)\n raise \"VirtualMachine folder #{vmconf[:dest_dir]} not found\" if vm_folder.nil?\n vm = vm_folder.find(vm_name, RbVmomi::VIM::VirtualMachine)\n raise \"VirtualMachine #{vm_name} not found in #{vmconf[:dest_dir]}\" if vm.nil?\n\n begin\n vm.PowerOffVM_Task.wait_for_completion\n rescue RbVmomi::Fault => e\n log.error \"Fault attempting to power off node #{k}, #{e.message}\"\n ensure\n begin\n vm.Destroy_Task.wait_for_completion\n rescue RbVmomi::Fault => e\n log.error \"Fault attempting to destroy node #{k}, #{e.message}\"\n end\n end\n else\n next\n end\n end\n end\n\n nil\n end", "def delete\n if options.master?\n delete_master(options)\n elsif options.slave?\n delete_slave(options)\n else\n invoke :help, [:delete]\n end\n end", "def halt_fusion_vm(options)\n stop_fusion_vm(options)\nend", "def destroy\n FileUtils.rm_r(directory) if exist?\n end", "def destroy\n @vpn = current_user.vpn\n @vpn.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vip_service.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_services_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted a amx vip service: #{@vip_service.name}\")\n end", "def reboot_fusion_vm(options)\n reset_fusion_vm(options)\nend", "def destroy_backend\n Rails.logger.info \"Removing tenant #{self.name} with tenant id #{self.uuid}.\"\n\n Rails.logger.info \"Undeploying all instances for tenant #{self.name}...\"\n # Delete all instances\n if self.instances.count > 0\n success = self.instances.each {|i| i.undeploy }\n if success\n Rails.logger.info \"Removed all instances for tenant #{self.name}.\"\n else\n Rails.logger.error \"Could not remove instance during project deletion:\"\n Rails.logger.error \"Instance: #{i.name} #{i.id} #{i.uuid}\"\n return false\n end\n end\n\n compute_c = get_connection(\"compute\")\n network_c = get_connection(\"network\")\n identity_c = get_connection(\"identity\")\n\n # Unallocate floating ips\n floating_ips = compute_c.get_floating_ips\n floating_ips.each do |ip|\n Rails.logger.info \"Deleting floating ip #{ip.ip} with id #{ip.id}\"\n compute_c.delete_floating_ip(ip.id)\n end\n\n routers = network_c.list_routers.select {|router| router.tenant_id == self.uuid}\n subnets = network_c.list_subnets.select {|subnet| subnet.tenant_id == self.uuid}\n networks = network_c.list_networks.select {|network| network.tenant_id == self.uuid}\n\n # Clear all router gateways\n routers.each do |router|\n Rails.logger.info \"Clearing router gateway for #{router.name} with id #{router.id}.\"\n # Remove gateway from the router\n network_c.update_router(router.id, {\"external_gateway_info\" => {}})\n end\n\n # loop through each network\n # For each router, remove any subnet interfaces\n networks.each do |network|\n subnets.select {|subnet| subnet.network_id == network.id}.each do |subnet|\n routers.each do |router|\n begin\n Rails.logger.info \"Attempting to remove router interface for subnet #{subnet.name} with id #{subnet.id} from router #{router.name} with id #{router.id}.\"\n network_c.remove_router_interface(router.id, subnet.id)\n Rails.logger.info \"Successfully removed router interface for subnet #{subnet.name}.\"\n rescue => e\n Rails.logger.error \"Tried to remove router interface for subnet #{subnet.name} with id #{subnet.id} from router #{router.name} with id #{router.id}.\"\n end\n end\n end\n end\n\n # Delete all subnets\n subnets.each do |subnet|\n Rails.logger.info \"Deleting subnet #{subnet.name} with id #{subnet.id}\"\n network_c.delete_subnet(subnet.id)\n end\n\n # Delete all routers\n routers.each do |router|\n Rails.logger.info \"Deleting router #{router.name} with id #{router.id}\"\n network_c.delete_router(router.id)\n end\n\n # Delete all networks\n networks.each do |network|\n Rails.logger.info \"Deleting network #{network.name} with id #{network.id}\"\n network_c.delete_network(network.id)\n end\n\n # Finally, delete the tenant\n Rails.logger.info \"Deleting tenant #{self.name} with id #{self.uuid}\"\n identity_c.delete_tenant(self.uuid)\n\n Rails.logger.info \"Removal of tenant #{self.name} on the OpenStack backend succeeded.\"\n end", "def delete_token(filename)\n begin\n File.delete(File.join(@token_folder, filename))\n rescue => e\n @logger.error \"Error deleting token file for VM #{vm_id}\"\n @logger.error e.message\n end\n end", "def cleanup\n FileUtils.rm(autoinst_path, force: true)\n FileUtils.rm(definition_path, force: true)\n FileUtils.rm(libvirt_definition_path, force: true)\n if provider == :libvirt\n # Due a bug in vagrant-libvirt the images will not cleanuped correctly\n # in the /var/lib/libvirt directory. This has to be done manually\n # (including DB update)\n system \"sudo virsh vol-delete #{IMAGE_BOX_NAME} default\"\n end\n end", "def delete_machine(machine, pool)\n handle_action_exceptions(__method__) do\n cmd_line = [\"deletemachine '#{machine}' '#{pool}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def destroy\n FileUtils.rm_rf(@working_dir)\n end", "def delete\n profile = profile_by_name(args.first)\n\n if profile.blank?\n display \"Please supply the name of the profile you'd like to delete\"\n self.list\n return false\n end\n\n if args[1] == \"yes\"\n puts profile['strongspace_path'][12..-1]\n begin\n strongspace.rm(profile['strongspace_path'][12..-1])\n rescue\n end\n end\n\n delete_profile(profile)\n\n display \"#{args.first} has been deleted\"\n end", "def delete_token(filename)\n begin\n File.delete(File.join(@token_folder, filename))\n rescue StandardError => e\n @logger.error \"Error deleting token file for VM #{vm_id}\"\n @logger.error e.message\n end\n end", "def delete_gdom_dir(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n destroy_zfs_fs(gdom_dir)\n return\nend", "def destroy\n @vpn = Vpn.find(params[:id])\n checkaccountobject(\"vpns\",@vpn)\n @vpn.send_delete\n\n respond_to do |format|\n format.html { redirect_to vpns_url }\n format.json { head :ok }\n end\n end", "def delete!\n return true unless File.exist?(path)\n FileUtils.rm(path)\n end", "def remove\n unless name.nil?\n dhcp.remove self if dhcp\n VirtualBox.run_command ['VBoxManage', 'hostonlyif', 'remove', name]\n end\n self\n end", "def exec__delete(opts = {})\n task = Task.create_top_level(model_handle(:task), self, task_action: 'delete and destroy')\n ret = {\n assembly_instance_id: self.id,\n assembly_instance_name: self.display_name_print_form\n }\n opts.merge!(skip_running_check: true)\n \n if !opts[:recursive] && is_target_service_instance?\n staged_instances = get_children_instances(self)\n service_instances = []\n staged_instances.each do |v|\n service_instances << v[:display_name]\n end\n fail ErrorUsage, \"The context service cannot be deleted because there are service instances dependent on it (#{service_instances.join(', ')}). Please use flag '-r' to remove all.\" unless staged_instances.empty?\n end\n \n if opts[:recursive]\n fail ErrorUsage, \"You can use recursive delete with target service instances only!\" unless is_target_service_instance?\n delete_recursive(self, task, opts)\n end\n\n return nil unless self_subtask = delete_instance_task?(self, opts)\n\n if is_target_service_instance?\n task.add_subtask(self_subtask)\n else\n task = self_subtask\n end\n\n task = task.save_and_add_ids\n\n task.subtasks.each do |st|\n if st[:display_name].include?(\"ec2\")\n ret.merge!(has_ec2: true)\n end\n end\n \n Workflow.create(task).defer_execution\n \n ret.merge(task_id: task.id)\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def delete_vapp(vAppId)\n params = {\n 'method' => :delete,\n 'command' => \"/vApp/vapp-#{vAppId}\"\n }\n\n response, headers = send_request(params)\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end", "def teardown\n @executor.start_section \"Vundle\"\n @executor.execute \"Removing Vim Folder\", \"rm -r #{vim_folder}\" do |output|\n raise TaskSkipped.new(\"Folder not found\") if output.include? \"No such file or directory\"\n end\n end", "def destroy\n FileUtils.rm_rf(@root)\n true\n end", "def deletevolume\n if not checkRequirements([\"thezone\",\"thevolume\"])\n return false\n end\n checkToken(@thezone)\n submit = queryGCE(:path => '/compute/v1beta15/projects/#{@thezone.name}/zones/#{@thevolume.azone.name}/disks/#{@thevolume.serial}', :method => 'delete', :options => '', :access_token => @thezone.token )\n checkQuery(:type => 'zone', :token => @thezone.token, :projectname => @thezone.name, :zonename => @thevolume.azone.name, :operationname => submit[\"name\"])\n end", "def delete(p)\n puts \"Deleting page #{p}\"\n FileUtils.rm_rf \"#{p}\"\n end", "def delete(volume)\n dest_path = dest_path_resolver.path(volume)\n removed = fs.remove(dest_path)\n log(volume, removed ? \"removed\" : \"not present\")\n fs.rm_empty_tree(dest_path.parent)\n end" ]
[ "0.783307", "0.7668545", "0.7576776", "0.7350829", "0.71360725", "0.70495564", "0.6981492", "0.6955153", "0.6829678", "0.6660791", "0.6660105", "0.66413295", "0.66387916", "0.65960497", "0.65945834", "0.6533798", "0.64958787", "0.64371127", "0.63971364", "0.6387111", "0.6364367", "0.6344472", "0.6323933", "0.6323933", "0.6305142", "0.6262481", "0.6210073", "0.6181854", "0.61229515", "0.60793954", "0.6053143", "0.6044346", "0.60269576", "0.6025907", "0.59886944", "0.5976803", "0.59616035", "0.59572786", "0.5950645", "0.584588", "0.58338845", "0.5754864", "0.57468325", "0.57115453", "0.5672441", "0.56373036", "0.56229544", "0.55954504", "0.5547082", "0.5537388", "0.55058837", "0.5411572", "0.53447455", "0.5341418", "0.532482", "0.5321996", "0.53201765", "0.5304483", "0.5292754", "0.5286768", "0.5286626", "0.52774704", "0.52731055", "0.5268692", "0.52592134", "0.5257914", "0.5257336", "0.5234062", "0.52325535", "0.5221892", "0.52112395", "0.5209644", "0.5191636", "0.5180545", "0.51734847", "0.51676434", "0.51563144", "0.514595", "0.51370484", "0.5135579", "0.512867", "0.5127364", "0.5117376", "0.51138145", "0.5107762", "0.5102533", "0.50945264", "0.50892794", "0.50881195", "0.5085146", "0.508344", "0.5082469", "0.5080027", "0.50721633", "0.50689644", "0.50659215", "0.50588065", "0.50585735", "0.5058101", "0.50569195" ]
0.7764674
1
Internal: Helper for getting the configured vmrun_cmd value. Examples
def vmrun_cmd Fission.config['vmrun_cmd'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vmrun_cmd\n Fission.config['vmrun_cmd']\n end", "def vmrun_cmd\n Fission.config['vmrun_cmd']\n end", "def vmrun_cmd\n Fission.config['vmrun_cmd']\n end", "def vmrun_cmd\n Fission.config['vmrun_cmd']\n end", "def vmm_command_line\n return eb(@config['vmm']['cmdline'])\n end", "def vmcl\n return vmm_command_line\n end", "def rvm_run(cmd)\n run %{#{rvm_env} rvm #{cmd}}, :shell => \"bash\"\nend", "def command(cmd)\n if VNMNetwork::COMMANDS.keys.include?(cmd.to_sym)\n cmd_str = \"#{VNMNetwork::COMMANDS[cmd.to_sym]}\"\n else\n cmd_str = \"#{cmd}\"\n end\n\n return cmd_str\n end", "def cmd_test(test, rvm=false)\n cmd_if %{[ #{test} ]}, rvm\nend", "def value\n cmd = \"#{resource[:tunable]}\"\n case cmd\n when 'schedo'\n schedo('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'vmo'\n vmo('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'ioo'\n ioo('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'lvmo'\n lvmo('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'no'\n no('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n when 'nfso'\n nfso('-x', \"#{resource[:attribute]}\").split(',')[1].chomp\n end\n end", "def get_parallels_vm_uuid(options)\n message = \"Information:\\tDetermining UUID for Parallels VM \"+options['name']\n command = \"prlctl list --info \\\"#{options['name']}\\\" |grep '^ID' |cut -f2 -d:\"\n vm_uuid = vm_uuid.chomp.gsub(/^\\s+/,\"\")\n vm_uuid = execute_command(options,message,command)\n return vm_uuid\nend", "def cmdline\n if @cmdline.nil?\n cmdline = \"#{@cmd}\"\n @args.each do |arg|\n cmdline << (arg.to_s.index(\" \") ? \" \\\"#{arg}\\\"\" : \" #{arg}\")\n end if @args\n @cmdline = cmdline\n end\n @cmdline\n end", "def run_cmd\n @run_cmd ||= local_suite_files.empty? ? nil : \"#{sudo}#{jr_bin} test\"\n end", "def dummy_command\n return options['dummy_command'] if options.include?('dummy_command')\n return nil unless node['virtualization'] && %w{docker lxc}.include?(node['virtualization']['system'])\n node.value_for_platform_family(debian: '/usr/sbin/runsvdir-start', rhel: '/sbin/runsvdir -P -H /etc/service')\n end", "def config_value\n @config_value ||= `#{CONFIG_CMD}`\n end", "def config_value_for(key)\n cmd = executable_command config_value_str(key)\n value = `#{cmd}`.strip\n value = nil if value == ''\n value\n end", "def GetCmdLine\n ParseInstallationKernelCmdline() if !@cmdline_parsed\n @cmdLine\n end", "def kubelet_cmd\n [new_resource.kubelet_bin, kubelet_flags].join(' ').strip\nend", "def get_cmd(klass,task)\n cmd = case klass.to_s\n when \"Brocade::SAN::ZoneConfiguration\"\n \"cfg#{task}\"\n when \"Brocade::SAN::Zone\"\n \"zone#{task}\"\n when \"Brocade::SAN::Alias\"\n \"ali#{task}\"\n end \n end", "def run_vagrant_command(subcmd, instance_or_id = nil, args = \"\")\n # Parse instance_or_id\n instance = instance_or_id.kind_of?(String) ? Rubber.instances[instance_or_id] : instance_or_id\n id = instance ? instance.instance_id : instance_or_id\n vagrant_cwd = get_vagrant_cwd(instance)\n\n # Build command 'VAGRANT_CWD=<cwd> vagrant <subcmd> <id> <args>'\n cmd = ''\n cmd += \"VAGRANT_CWD=#{vagrant_cwd} \" if vagrant_cwd\n cmd += 'vagrant ' + subcmd\n cmd += ' ' + id if id\n cmd += ' ' + args unless args.empty?\n\n capistrano.logger.info(\"Running '#{cmd}'\")\n\n if block_given?\n yield `#{cmd}`\n else\n system(cmd)\n end\n end", "def run(cmd)\n ENV['LANG'] = 'C'\n log \"Run: #{cmd}\"\n if dry_run\n return ['', 0]\n end\n stdout = `#{cmd} 2>&1`\n return_code = $?.exitstatus\n puts stdout\n puts \"Return: #{return_code}\"\n [stdout, return_code]\n end", "def command_string\n\t\treturn datastore['CMD'] || ''\n\tend", "def command\n [env, *rvm_context_prefix, 'ruby', path, '--use-color=true'] # for test unit\n # [env, *rvm_context_prefix, 'ruby', path] # for minitest\n end", "def run_cmd(cmd)\n Chef::Log.info \"executing: #{cmd}\"\n result = Mixlib::ShellOut.new(cmd).run_command.stdout.strip\n return result\nend", "def from_cmd(cmd)\n so = shell_out(cmd)\n so.stdout.split($/)[0]\n end", "def rvm_wrap_cmd(cmd, user_dir = nil)\n profile = find_profile_to_source(user_dir)\n %{bash -c \"source #{profile} && #{cmd.gsub(/\"/, '\\\"')}\"}\n end", "def get_parallels_disk(options)\n message = \"Information:\\tDetermining directory for Parallels VM \"+options['name']\n command = \"prlctl list #{options['name']} --info |grep image |awk '{print $4}' |cut -f2 -d=\"\n vm_dir = execute_command(options,message,command)\n vm_dir = vm_dir.chomp.gsub(/'/,\"\")\n return vm_dir\nend", "def which(cmd)\n Videoreg::Util.which(cmd)\n end", "def command_name(cmd)\n cmd\n end", "def get_parallels_vm_status(options)\n message = \"Information:\\tDetermining status of Parallels VM \"+options['name']\n command = \"prlctl list \\\"#{options['name']}\\\" --info |grep '^Status' |grep ^State |cut -f2 -d:\"\n status = execute_command(options,message,command)\n status = status.chomp.gsub(/\\s+/,\"\")\n return status\nend", "def run\n _cmd = built_in_command( options[:args] )\n _cmd ||= options[:command] ? CommandRunner.new(options[:command]) : 0\n if _cmd.class == CommandRunner\n _cmd.run do |item|\n puts \"%s:\\n %s\\n\\n\" % [ item.class, item.desc ] if item.is_a?(UseCase) && ENV['ENVIRONMENT'] != 'test'\n end\n else\n _cmd\n end\n end", "def run(cmd)\n TV.new [\"--test\", cmd.split].flatten\nend", "def run_cmd(cmd)\n\tend", "def nodetool_cmd(cmd)\n `nodetool -h #{config[:hostname]} -p #{config[:port]} #{cmd}`\n end", "def startcmd\n if @resource[:binary]\n return @resource[:binary]\n else\n raise Puppet::Error,\n \"Services must specify a start command or a binary\"\n end\n end", "def cmdarg; end", "def cmdarg; end", "def cmdarg; end", "def cmd_path\n return @cmd_path unless @cmd_path.nil?\n\n @cmd_path = File.join(context.root_path, 'bin', cmd)\n # Return the path to the command if it exists on disk, or we have a gemfile (i.e. Bundled install)\n # The Bundle may be created after the prepare_invoke so if the file doesn't exist, it may not be an error\n return @cmd_path if PDK::Util::Filesystem.exist?(@cmd_path) || !PDK::Util::Bundler::BundleHelper.new.gemfile.nil?\n\n # But if there is no Gemfile AND cmd doesn't exist in the default path, we need to go searching...\n @cmd_path = alternate_bin_paths.map { |alternate_path| File.join(alternate_path, cmd) }\n .find { |path| PDK::Util::Filesystem.exist?(path) }\n return @cmd_path unless @cmd_path.nil?\n\n # If we can't find it anywhere, just let the OS find it\n @cmd_path = cmd\n end", "def cmd_to_run\n\tarr = ARGV.dup\n\tarr = default_cmd if arr.empty?\n\tarr\nend", "def cmdline\n begin\n # The arguments are separated by nulls (\\000) - Substitute it\n # with spaces, which is way more human.\n File.read(\"/proc/#{@pid}/cmdline\").gsub /\\000/, ' '\n rescue Errno::ENOENT\n nil\n end\n end", "def run_cmd cmd\n msg { \"{@Darn, you can't run commands yet.\\n\\n#{location.long_appearance}\" }\n end", "def run(cmd)\n puts \"\\033[1;37m#{cmd}\\033[0m\"\n result = `#{cmd}`\n abort unless $?.success?\n puts result unless result.empty?\n result\nend", "def build_command(cmd)\n cmd\n end", "def vsctl_cmd\n \"/usr/bin/ovs-vsctl\"\nend", "def read_vm_option(option, uuid = @uuid)\n out = execute_prlctl('list', uuid, '--no-header', '-o', option).strip\n raise Errors::ParallelsVMOptionNotFound, vm_option: option if out.empty?\n\n out\n end", "def servermanagercmd\n @servermanagercmd ||= begin\n locate_sysnative_cmd(\"servermanagercmd.exe\")\n end\n end", "def run_command\n output = \"docker run -d --name\"\n output << \" #{self.name}\"\n\n # use flags array to unpack config here\n self.flags.each { |flag| output << \" #{flag}\" } unless self.flags.nil?\n\n output << \" #{self.repo}:#{self.tag}\"\n output\n end", "def parameter_string\n @run_name + \".trin\"\n end", "def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end", "def getConfigCmd(prop, value)\n\n case prop\n when 'type'\n # 'value' defines type of operation\n type = case\n when value == 'a' : 1\n when value == 'b' : 2\n when value == 'g' : 3\n else\n raise \"Unknown type. Should be 'a', 'b', or 'g'.\"\n end\n return \"iwpriv #{@deviceName} set_mode #{type}\"\n\n when \"mode\"\n # 'value' defines mode of operation\n mode = case\n when value == 'Managed' : 'managed'\n when value == 'managed' : 'managed'\n when value == 'Master' : 'master'\n when value == 'master' : 'master'\n when value == 'ad-hoc' : 'ad-hoc'\n when value == 'adhoc' : 'ad-hoc'\n when value == 'monitor' : 'monitor'\n else\n raise \"Unknown mode '#{value}'. Should be 'managed', or 'ad-hoc'.\"\n end\n return \"iwconfig #{@deviceName} mode #{mode} essid dummy channel 1\"\n\n when \"essid\"\n @essid = value\n return \"iwconfig #{@deviceName} essid #{value}\"\n\n when \"frequency\"\n return \"iwconfig #{@deviceName} freq #{value}\"\n\n when \"tx_power\"\n return \"iwconfig #{@deviceName} txpower #{value}\"\n\n when \"rate\"\n return \"iwconfig #{@deviceName} rate #{value}\"\n\n when \"rts\"\n return \"iwconfig #{@deviceName} rts #{value}\"\n\n when \"channel\"\n return \"iwconfig #{@deviceName} channel #{value}\"\n\n end\n super\n end", "def commandResult\n\t\t\t%x(#{@cmd} 2> /dev/null)\n\t\tend", "def sh_string(cmd, default)\n val = sh(cmd).strip rescue nil\n (val.nil? || val.empty?) ? default : val\n end", "def cmd_if(test, rvm=false)\n load_rvm = \"\"\n load_rvm = \"#{rvm_env} \" if rvm\n r = capture %{#{load_rvm}if #{test} ; then echo true; else echo false; fi}, \n :shell => \"bash\"\n puts \" * Result is: #{r.to_s}\"\n if r.to_s =~ /true/\n true\n else\n false\n end\nend", "def configure_command(cmd)\n end", "def virtualbox_version\n cmd = windows? ?\n '\"%ProgramFiles%\\\\Oracle\\\\VirtualBox\\\\VBoxManage\" -v 2>NUL' :\n 'VBoxManage -v 2>/dev/null'\n `#{cmd}`[/[\\d\\.]+/] rescue nil\nend", "def sh_string(cmd, default = nil)\n val = sh(cmd).strip rescue nil\n val.nil? || val.empty? ? default : val\n end", "def cmd\n (@cmd ? @cmd : @ctx.cmd).join ' '\n end", "def run_cmd(cmd)\n Dir.chdir(Rails.root) {\n #@output = `cd #{CTMWEB_PATH} && #{cmd} 2>&1`\n cmd = \"#{cmd}\"\n @output = `#{cmd}`\n }\n result = $?.success?\n if result\n print \"OK\\n\".green\n else\n print \"ERROR\\n\".red\n puts \"#{@output.to_s.red}\"\n send_to_flowdock(\"CTMWEB\", \"Deployment for #{Rails.env.upcase} failed. (CMD: #{cmd})\", @tags)\n abort \"Deployment Halted.\".red\n end\nend", "def get_cmd(extra_params = '')\n\n cmd = 'dustmasker '+@extra_params + '-outfmt '+ @format + ' 2>/dev/null'\n return cmd\n\n end", "def `(cmd) #`\n\t\tRAILS_DEFAULT_LOGGER.debug(\"Running #{cmd}\")\n\t\tKernel.`(cmd) #`\n\tend", "def original_run_command; end", "def run(cmd_str)\n\tcmd_str.chars[$last_run_idx..-1].join('').match(/([RL]*)(A+)/)\nend", "def command_runner cmd:, repo:nil, branch:nil\n status = run_cmd(cmd)\n status\n end", "def dkrun_cmd(labeled: true, opts: nil, named: false)\n cmd = \"docker run\"\n if labeled\n release_labels = release_label_hash.map do |k, v|\n \"--label=#{k}=#{v}\"\n end.join(' ')\n cmd += \" #{release_labels}\"\n end\n cmd += \" --net #{netname}\" if netname\n cmd += \" --name #{container_name}\" if named\n cmd += \" #{opts}\" if opts\n cmd\n end", "def cmd(cmd)\n @log.info cmd unless @log == nil\n res = `#{cmd} 2>&1`\n @log.info res unless @log == nil\n $?\n end", "def original_run_command=(_arg0); end", "def doCmd(cmd)\n puts cmd;\n puts `#{cmd}`;\nend", "def raw_command\n @raw_command ||= @raw.split[0] || \"\"\n end", "def plain_command cmd, options={}\n system(cmd)\n exitstatus = $?.exitstatus == 0 || $?.exitstatus == 1\n show_output(exitstatus, options)\n exitstatus\n end", "def execute\n\n if @main_args.include?(\"-h\") || @main_args.include?(\"--help\")\n # Print the help for all the box commands.\n return help\n end\n\n # Currently we can only work with a single VM environment\n raise Errors::SingleVMEnvironmentRequired if @env.multivm?\n\n # Run the appropriate subcommand\n case @sub_command\n when 'sync'\n return execute_sync\n when 'monitor'\n return execute_monitor\n when nil\n return execute_monitor\n else\n return help\n end\n end", "def command\n return \"#{@command} #{options}\"\n end", "def run(cmd)\n output = `#{cmd.gsub(/\\s+/, \" \")} 2>&1`\n\n unless $?.exitstatus == 0\n #Kickvideo::Notifier.deliver_processing_error(@attachment.instance, @attachment, cmd, output)\n raise Kickvideo::ProcessingError, \"Error while running #{cmd} - #{output}\"\n end\n\n output\n end", "def get_virtualbox_version\n begin\n if windows?\n ver = `\"%ProgramFiles%\\\\Oracle\\\\VirtualBox\\\\VBoxManage\" -v 2>NULL`\n else\n ver = `VBoxManage -v 2>/dev/null`\n end\n rescue\n ver = ''\n end\n ver.gsub(/r.*/m, '')\nend", "def [](cmd_val)\n k = Argument.to_key(cmd_val)\n @commands[k]\n end", "def command\n return @raw_command\n end", "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\"\n return nil\n when \"bitop\"\n return argv[2]\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n return argv[1]\n end\n end", "def run_command(cmd)\n if config[:simulate]\n puts_and_logs \" - Simulate running \\\"#{cmd}\\\"\"\n return\n end\n if config[:debug]\n if config[:verbose]\n puts_and_logs \" - Running \\\"#{cmd}\\\"\"\n else\n logger.debug \" - Running \\\"#{cmd}\\\"\"\n end\n system cmd\n return\n end\n puts_and_logs \" - Running \\\"#{cmd}\\\"\" if config[:verbose]\n system(cmd + ' > /dev/null 2>&1')\n\n end", "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\",\"select\"\n nil\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n argv[1]\n end\n end", "def run_rvm_or(command_rvm, command_else = \"true\")\n parallel do |session|\n command_else = reformat_code(command_else)\n if Capistrano.const_defined?(:RvmMethods)\n # command_with_shell is defined in RvmMethods so rvm/capistrano has to be required first\n command_rvm = command_with_shell(reformat_code(command_rvm), fetch(:rvm_shell, \"bash\"))\n rvm_role = fetch(:rvm_require_role, nil)\n if rvm_role # mixed\n session.when \"in?(:#{rvm_role})\", command_rvm\n session.else command_else\n else # only rvm\n session.else command_rvm\n end\n else # no rvm\n session.else command_else\n end\n end\n end", "def run(command, verbose = false, message = nil)\n if verbose then\n puts \"#{message}\"\n puts command\n result = `#{command}`\n puts result\n return result\n else\n `#{command}`\n end\nend", "def run(command, verbose = false, message = nil)\n if verbose then\n puts \"#{message}\"\n puts command\n result = `#{command}`\n puts result\n return result\n else\n `#{command}`\n end\nend", "def command\n @property[:command]\n end", "def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend", "def which(cmd); end", "def which(cmd); end", "def which(cmd); end", "def getConfigCmd(prop, value)\n debug \"looking for property '#{prop}' in ethernet\"\n case prop\n when 'ip'\n return \"ifconfig #{@deviceName} #{value} netmask 255.255.0.0\"\n when 'up'\n return \"ifconfig #{@deviceName} up\"\n when 'down'\n return \"ifconfig #{@deviceName} down\"\n when 'netmask'\n return \"ifconfig #{@deviceName} netmask #{value}\"\n when 'mtu'\n return \"ifconfig #{@deviceName} mtu #{value}\"\n when 'mac'\n return \"ifconfig #{@deviceName} hw ether #{value}\"\n when 'arp'\n dash = (value == 'true') ? '' : '-'\n return \"ifconfig #{@deviceName} #{dash}arp\"\n when 'forwarding'\n flag = (value == 'true') ? '1' : '0'\n return \"echo #{flag} > /proc/sys/net/ipv4/conf/#{@deviceName}/forwarding\"\n when 'route'\n return getCmdForRoute(value)\n when 'filter'\n return getCmdForFilter(value)\n when 'gateway'\n return \"route del default dev eth1; route add default gw #{value}; route add 224.10.10.6 dev eth1\"\n end\n super\n end", "def run(cmd)\n result = `#{cmd}`\n raise Castanaut::Exceptions::ExternalActionError if $?.exitstatus > 0\n result\n end", "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\"\n return nil\n when \"bitop\"\n return argv[2]\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n return argv[1]\n end\n end", "def generate_cmd_line(cmd,sample,step)\n\t\t\t\tif step.is_multi? # if is a multi samples step call a different method\n\t\t\t\t\tset_multi_cmd(step,self.multi_samples)\n\t\t\t\t\tcmd = sub_multi(cmd,step)\n\t\t\t\telse\n\t\t\t\t\tcmd = sub_placeholders(cmd,sample,step) # normal step, perform usual substitutions\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Check that all placeholders have been substituted, if not terminate with an error\n\t\t\t\tcmd.scan(/<\\S+>/).each do |unsubstituted_tag|\n\t\t\t\t\t@@logger_error.error(\"Found an unsubstituted tag #{unsubstituted_tag} . Terminating the execution\".red)\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\t\treturn cmd\n\t\t\tend", "def vtysh_cmd(cmds)\n vtysh_opts = ['vtysh'].concat(cmds.map { |cmd| \"-c \\\"#{cmd}\\\"\" })\n if cmds.length > 1\n vtysh_opts.join(\"\\n\") # when multiple commands\n else\n vtysh_opts.join(' ') # when single command\n end\n end", "def command(cmd)\n \"do_#{cmd}\".intern\n end", "def run_cmd(input); end", "def get_fusion_vm_ip(options)\n options['ip'] = \"\"\n exists = check_fusion_vm_exists(options)\n if exists == true\n running = check_fusion_vm_is_running(options)\n if running.match(/yes/)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n message = \"Information:\\tDetermining IP for \"+options['name']\n command = \"'#{options['vmrun']}' getGuestIPAddress '#{fusion_vmx_file}'\"\n options['ip'] = execute_command(options,message,command)\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} is not running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return options['ip'].chomp\nend", "def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end", "def run(cmd)\r\n args = cmd.split\r\n Pdm::Runner.new.run args\r\nend", "def initialize(cmd_str,opt = nil)\n raise(CmdException,\"Command string is nil\") if cmd_str.nil?\n @cmd_str = cmd_str\n # parse option\n @opt = @@def_opt.clone\n @@def_opt.each_key do |key|\n if opt != nil && opt[key] != nil\n # use argument\n @opt[key] = opt[key]\n elsif RBatch.common_config != nil \\\n && RBatch.common_config[\"cmd_\" + key.to_s] != nil\n # use config\n @opt[key] = RBatch.common_config[\"cmd_\" + key.to_s]\n else\n # use default\n end\n end\n end", "def get_fusion_value(options)\n exists = check_fusion_vm_exists(options)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if exists == true\n message = \"Information:\\tGetting Parameter \"+options['param']+\" for \"+options['name']\n command = \"'#{options['vmrun']}' readVariable '#{fusion_vmx_file}' runtimeConfig '#{options['param']}'\"\n output = execute_command(options,message,command)\n handle_output(options,output)\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n quit(options)\n end\n return\nend" ]
[ "0.8105079", "0.8105079", "0.8105079", "0.8105079", "0.6743608", "0.59995025", "0.58677274", "0.5789821", "0.5727923", "0.5633322", "0.5628246", "0.56238335", "0.5592715", "0.5584428", "0.55658007", "0.5538986", "0.55275685", "0.5470546", "0.5460587", "0.54174024", "0.54144084", "0.5389283", "0.5375594", "0.5357352", "0.53261554", "0.5324307", "0.5316939", "0.5299578", "0.5294617", "0.52883404", "0.5284843", "0.52815896", "0.52579063", "0.5240821", "0.5233246", "0.52290654", "0.52290654", "0.52290654", "0.5182177", "0.5176594", "0.517279", "0.51424414", "0.51218057", "0.5121254", "0.51208144", "0.51041865", "0.50996196", "0.5095828", "0.5089692", "0.50763035", "0.5075519", "0.5061629", "0.50558335", "0.50374264", "0.50360125", "0.5033663", "0.50281364", "0.5018338", "0.4996647", "0.49957207", "0.49941987", "0.4994039", "0.499056", "0.49856928", "0.49785843", "0.4973255", "0.4972419", "0.4961877", "0.49603596", "0.49582827", "0.4955728", "0.4949368", "0.49473077", "0.49439496", "0.49422267", "0.49339616", "0.49287975", "0.49272022", "0.49229246", "0.49222797", "0.4921656", "0.4921656", "0.4915307", "0.4909637", "0.4903007", "0.4903007", "0.4903007", "0.4899261", "0.48949173", "0.48930052", "0.48922512", "0.48901767", "0.48841462", "0.4881481", "0.48692268", "0.48666933", "0.4865981", "0.48571616", "0.48528996" ]
0.8133074
1
GET /issue_areas GET /issue_areas.json
def index @issue_areas = IssueArea.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areas\n aux = WorkOrderArea.by_name\n render json: serialized_work_order_areas(aux)\n end", "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def index\n @areas = Area.all\n end", "def index\n @project_areas = ProjectArea.all\n end", "def area\n popolo.areas.find_by(id: area_id)\n end", "def index\n @areas = Area.with_ordered_countries\n respond_with(@areas)\n end", "def index\n @core_areas = Core::Area.find_mine(params).paginate(page: params[:page])\n\n respond_to do |format|\n format.html {}\n format.json {}\n end\n end", "def create\n @issue_area = IssueArea.new(issue_area_params)\n\n respond_to do |format|\n if @issue_area.save\n format.html { redirect_to @issue_area, notice: 'Issue area was successfully created.' }\n format.json { render :show, status: :created, location: @issue_area }\n else\n format.html { render :new }\n format.json { render json: @issue_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_issue_area\n @issue_area = IssueArea.find(params[:id])\n end", "def index\n @areas_skills = AreasSkill.all\n end", "def index\n @lab_areas = LabArea.all\n end", "def index\n @areas = Area.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @areas }\n format.json {render :json => @areas}\n end\n end", "def index\n @group_areas = GroupArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_areas }\n end\n end", "def index\r\n @domain = Domain.find(params[:domain_id])\r\n @areas = Area.includes(:domain).includes(:filter_type_property).\r\n includes(:interval_property).includes(:language_code_property).\r\n where(domain_id: @domain.id).rank(\"row_order\").page(params[:page]).per(@@page_size)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @areas }\r\n end\r\n end", "def index\n @area_codes = AreaCode.all\n end", "def areas\n self.areacodes.map{|areacode| Area.find areacode}\n end", "def show\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area }\n end\n end", "def show\n @breadcrumb = 'read'\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def show\r\n @area = Area.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @area }\r\n end\r\n end", "def areas(type = nil)\n if type\n if areas = @areas[type]\n areas.values\n else\n []\n end\n else\n @areas.values.map(&:values).flatten\n end\n end", "def index\n @survey_areas = SurveyArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_areas }\n end\n end", "def index\n @city_areas = CityArea.all\n end", "def index\n @specialization_areas = SpecializationArea.all\n end", "def index\n @sub_areas = SubArea.all\n end", "def index\n @research_areas = ResearchArea.all\n end", "def show\n set_user_and_user_areas\n @searched_areas << Area.find(params[:area][:id])\n render :index\n end", "def show\n @area_type = AreaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area_type }\n end\n end", "def index\n @area_code_details = AreaCodeDetail.all\n end", "def index\n @areas = Area.all\n @target_users = User.where(User.arel_table[:location].not_eq nil)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @areas }\n end\n end", "def issue_area_params\n params.require(:issue_area).permit(:name)\n end", "def show\n @interest_area = InterestArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest_area }\n end\n end", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def issues\n @query = Query.new(:name => \"_\")\n @issues = @query.issues(:order => \"issues.created_on desc\", :limit => 50, :include => [:project, :author])\n res = Array.new\n @issues.each do |is|\n res << {:issue_id => is.id, :issue_title => is.subject, :issue_content => is.description, :project_name => is.project.name,\n :author_name => is.author.to_s, :author_email => is.author.mail, :issue_created_at => is.created_on, :issue_status => is.status.to_s }\n end\n render :json => res.to_json\n end", "def index\n @practice_areas = PracticeArea.all\n end", "def index\n @area_attributes = AreaAttribute.all\n end", "def index\n areas = if current_user.moderator?\n ProductionArea.where.not(state: 0).eager_load(:map_layer)\n else\n current_user.production_areas.eager_load(:map_layer).with_translations(I18n.locale)\n end\n @cabinet_production_areas = areas\n end", "def update\n respond_to do |format|\n if @issue_area.update(issue_area_params)\n format.html { redirect_to @issue_area, notice: 'Issue area was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_area }\n else\n format.html { render :edit }\n format.json { render json: @issue_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @project_area_interests = ProjectAreaInterest.all\n end", "def worldmap_areas\n areas = []\n $data_areas.values.each { |area|\n areas.push(area) if area.map_id == BestiaryConfig::WORLDMAP_ID\n }\n areas\n end", "def areas()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Areas::AreasRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n @userareas = Userarea.all\n @users = User.all\n @areas = Area.all\n end", "def index\n @political_areas = PoliticalArea.all\n if params[:city_id].present?\n @political_areas = PoliticalArea.find(params[:city_id]).sub_areas\n end\n @political_areas = @political_areas.where(\"long_name like ?\", \"%#{params[:long_name]}%\") if params[:long_name]\n @political_areas = @political_areas.page params[:page]\n end", "def show\n @group_area = GroupArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group_area }\n end\n end", "def show\n @area = Area.find(params[:id])\n respond_with(@area)\n end", "def index\n @core_logistic_areas = Core::LogisticArea.find_mine(params).paginate(page: params[:page])\n respond_to do |format|\n format.js {}\n format.html {}\n end\n end", "def get_areas\n area_lists = @page.search('ul.list-balloon__list-col')\n\n areas = []\n if area_lists.length > 1\n area_lists.each do |area_list|\n a_tags = area_list.search('a')\n a_tags.each do |a|\n areas.push({\n name: a.text,\n uri: a.attribute('href').value\n })\n end\n end\n else\n a_tags = area_lists.search('a')\n a_tags.each do |a|\n areas.push({\n name: a.text,\n uri: a.attribute('href').value\n })\n end\n end\n\n areas\n end", "def index\n @micro_areas = MicroArea.all\n end", "def index\n @district_areas = DistrictArea.all\n end", "def index\n @district_areas = DistrictArea.all\n end", "def all_issues()\n @endpoint = \"/issues.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"issues\"].sort_by { |issue| issue[\"id\"] }\n end", "def show\n @survey_area = SurveyArea.find(params[:id])\n @survey_areas = Array.new\n @survey_areas.push(@survey_area)\n @json = @survey_area.survey_locations.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_area }\n end\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end", "def index\n @postulate_area_interests = PostulateAreaInterest.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @main_areas = MainArea.all\n @bproblems = Bproblem.all\n end", "def index\n @rescue_action_areas = RescueActionArea.where(rescue_action_id: params[:rescue_action_id])\n end", "def areas_json\n @json = {}\n @json[:id] = self.id\n @json[:country] = self.name\n @json[:country_lat] = self.lat\n @json[:country_lon] = self.lon\n\n @json[:iccas] = []\n self.sites.each do |site|\n site_details = {}\n site_details[:name] = site.name\n site_details[:url] = \"/sites/\" + site.id.to_s\n site_details[:lat] = site.lat\n site_details[:lng] = site.lon\n @json[:iccas] << site_details\n end\n return @json\n end", "def show\n @researcharea = Researcharea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @researcharea }\n end\n end", "def index\n manage_filter_state\n init_oco if !session[:organization]\n if session[:organization] != '0'\n # OCO organization active\n @areas = Area.joins(:department).where(departments: { organization_id: session[:organization] }).includes(:worker).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n else\n # OCO inactive\n @areas = Area.includes(:department, :worker).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @areas }\n format.js\n end\n end", "def show\n @country_area = CountryArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @country_area }\n end\n end", "def set_areas_skill\n @areas_skill = AreasSkill.find(params[:id])\n end", "def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end", "def searchByArea\n\t\turl = request.original_url\n\t\t\n\t\tbegin\n\n\t\t\tprms = CGI.parse(URI.parse(url).query)\n\n\n\t\t\tresults = Doctor.where(\"area LIKE ?\", \"%#{prms['area'][0]}%\")\n\t\t\trender json: results\n\t\trescue Exception => e\n\t\t\trender json: { errors: \"Some errors\" }, status: 422\n\t\tend\n\tend", "def index\n @area = Area.find(params[:area_id])\n @city = @area.city\n\n @rates = Rate.where(\"area_id = ?\",params[:area_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rates }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def set_area\n @area = Area.find_by_id(params[:id])\n if @area.blank?\n json_response(nil, :unprocessable_entity, :invalid_id)\n end\n end", "def issues\n workspace_id = zenhub_workspace_id\n repo_id = zenhub_repo_id\n url = \"https://api.zenhub.io/p2/workspaces/#{workspace_id}/repositories/#{repo_id}/board\" \n issues = Array.new\n uri = URI(url)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n request = Net::HTTP::Get.new(uri)\n request['Content-Type'] = 'application/json'\n request['X-Authentication-Token'] = ENV['TOKEN']\n\n http.request(request)\n end\n\n board = JSON.parse(response.body)\n board[\"pipelines\"].each do |columns|\n if columns[\"name\"] == COLUMN\n columns[\"issues\"].each do |issue|\n issues.push(issue['issue_number'])\n end\n end\n end\n issues\nend", "def index\n @issue_types = IssueType.all\n end", "def read_standard_areas(set_id)\n response = @mech.post(URLS[:standard_areas], {setId: set_id})\n\n return JSON.parse(fix_malformed_json(response.content))\n end", "def areas_of_specialization\n self.dig_for_array(\"areasOfSpecialization\")\n end", "def index\n @areas = Area.order(:position)\n end", "def index\n @parking_areas = ParkingArea.all\n end", "def index\n @issues = Issue.filter(\n params.slice(:build_product, :build_branch, \n :build_name, :build_id, :similar_to, :signature, :include_hit_count)\n )\n render json: @issues\n end", "def destroy\n @issue_area.destroy\n respond_to do |format|\n format.html { redirect_to issue_areas_url, notice: 'Issue area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def collecting_areas\n @open_counts = Admin::DigitizationQueueItem.open_status.group(:collecting_area).count\n end", "def index\n @tareas = Tarea.all\n end", "def show\n respond_with(@issue) do |format|\n format.json { render json: @issue.to_json }\n end\n end", "def index\n @issue_skills = IssueSkill.all\n render json: @issue_skills\n end", "def show\n @area_of_law = AreaOfLaw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area_of_law }\n end\n end", "def rec_areas_for_organization(orgid, params = {})\n path = \"#{ROOT_ORGANIZATIONS}/#{orgid}#{ROOT_REC_AREAS}\"\n\n rv = pagination_loop(params) do |p, c|\n api_call(path, params)\n end\n\n rv\n end", "def index\n @issue_groups = IssueGroup.all\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def index\n @area_histories = AreaHistory.all\n end", "def show\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def index\n authorize! :read, Issue\n\n respond_to do |format|\n format.html\n format.js\n format.json { render json: IssuesDatatable.new(view_context) }\n end\n end", "def update_areas\n if (canonical_address = address.try(:canonical_address))\n areas = canonical_address.areas\n elsif (zip = Postcode.search(postcode))\n areas = AreaZip.where(zip: zip.zip).map(&:area)\n if Settings.geography.area_lookup.use_open_north_api\n api = OpenNorthAPI.new\n area_codes = api.get_boundaries_for_lat_lng(zip.latitude, zip.longitude)\n area_codes.each do |area_type, code|\n areas << Area.find_by(area_type: area_type, code: code)\n end\n end\n if Settings.geography.area_lookup.use_canadian_province_lookup\n canadian_province_lookup = CanadianProvinceLookup.new\n if (code = canadian_province_lookup.get_province_for_postcode(zip.zip))\n areas << Area.find_by(area_type: 'canada_province', code: code)\n end\n end\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n mosaic = Mosaic::Mosaic.find_by(postcode: postcode.upcase.delete!(' '))\n end\n\n areas = (areas ||= []).uniq\n self.areas.clear\n self.areas << (areas || [])\n\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n if mosaic\n self.mosaic_group = mosaic.mosaic_group\n self.mosaic_code = mosaic.code\n save!\n end\n\n zip_source = zip || canonical_address\n if zip_source\n update_demographic_groups(zip_source.zip)\n end\n\n lat_lng_source = canonical_address || zip\n if lat_lng_source\n self.latitude = lat_lng_source.latitude\n self.longitude = lat_lng_source.longitude\n save!\n end\n end", "def index\n @jira_issues = JiraIssue.all\n end", "def index\n @zip_code_area_codes = ZipCodeAreaCode.all\n end", "def new\n @area_of_law = AreaOfLaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: admin_areas_of_law_path(@area_of_law) }\n end\n end", "def index\n @issues = current_user.issues\n end", "def index\n @area_editions = @layout.area_editions.all\n end", "def show\n @curriculum_area = CurriculumArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @curriculum_area }\n end\n end", "def search_for_areas\n @towns = use_cache get_controller_action_key do\n Town.all.reject{|town| town.level != 1 }\n end\n\n respond_to do |format|\n q = params[:query].mb_chars.capitalize.to_s\n @towns = @towns.select{ |t| Regexp.new(\"^#{q}.*\") =~ t.title }\n format.json\n end\n\n end" ]
[ "0.70127183", "0.6727345", "0.66888404", "0.6558727", "0.65512115", "0.6534904", "0.64769685", "0.6413627", "0.63966495", "0.63444394", "0.6341734", "0.6323693", "0.630118", "0.62706697", "0.6158841", "0.61516535", "0.6138727", "0.6120565", "0.6110637", "0.609412", "0.6085813", "0.60509217", "0.60397106", "0.6022433", "0.59980905", "0.5965074", "0.5922045", "0.5895693", "0.58892065", "0.5886663", "0.5886568", "0.58762467", "0.5859886", "0.5831706", "0.5821401", "0.58124715", "0.5793009", "0.57712215", "0.57673997", "0.5762374", "0.5739641", "0.57193846", "0.5694846", "0.5687824", "0.5684838", "0.5684147", "0.5655832", "0.56552297", "0.5653739", "0.5650639", "0.5650639", "0.56397784", "0.5632519", "0.56232136", "0.56035495", "0.56020486", "0.56020486", "0.56020486", "0.56020486", "0.56020486", "0.5563194", "0.5559041", "0.5557755", "0.5557574", "0.55526245", "0.5547031", "0.55461913", "0.55289096", "0.5516946", "0.5507105", "0.5505778", "0.5505778", "0.54972076", "0.5481099", "0.54758227", "0.54678077", "0.5467333", "0.54659444", "0.54427004", "0.54332525", "0.54326725", "0.5416988", "0.54155934", "0.5414062", "0.5413515", "0.5411061", "0.5406353", "0.5404057", "0.54025215", "0.53991354", "0.539063", "0.53882253", "0.53851867", "0.5367504", "0.53592926", "0.53591025", "0.53578454", "0.53467524", "0.53462905", "0.5343853" ]
0.79893744
0
GET /issue_areas/1 GET /issue_areas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @issue_areas = IssueArea.all\n end", "def set_issue_area\n @issue_area = IssueArea.find(params[:id])\n end", "def area\n popolo.areas.find_by(id: area_id)\n end", "def create\n @issue_area = IssueArea.new(issue_area_params)\n\n respond_to do |format|\n if @issue_area.save\n format.html { redirect_to @issue_area, notice: 'Issue area was successfully created.' }\n format.json { render :show, status: :created, location: @issue_area }\n else\n format.html { render :new }\n format.json { render json: @issue_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def index\n @areas = Area.all\n end", "def index\n @core_areas = Core::Area.find_mine(params).paginate(page: params[:page])\n\n respond_to do |format|\n format.html {}\n format.json {}\n end\n end", "def show\n @breadcrumb = 'read'\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area }\n end\n end", "def areas\n aux = WorkOrderArea.by_name\n render json: serialized_work_order_areas(aux)\n end", "def index\n @project_areas = ProjectArea.all\n end", "def show\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def show\r\n @area = Area.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @area }\r\n end\r\n end", "def show\n @area_type = AreaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area_type }\n end\n end", "def index\n @lab_areas = LabArea.all\n end", "def index\n @areas = Area.with_ordered_countries\n respond_with(@areas)\n end", "def index\n @group_areas = GroupArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_areas }\n end\n end", "def show\n @interest_area = InterestArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest_area }\n end\n end", "def index\n @areas_skills = AreasSkill.all\n end", "def index\n @areas = Area.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @areas }\n format.json {render :json => @areas}\n end\n end", "def index\r\n @domain = Domain.find(params[:domain_id])\r\n @areas = Area.includes(:domain).includes(:filter_type_property).\r\n includes(:interval_property).includes(:language_code_property).\r\n where(domain_id: @domain.id).rank(\"row_order\").page(params[:page]).per(@@page_size)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @areas }\r\n end\r\n end", "def index\n @survey_areas = SurveyArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_areas }\n end\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def show\n @group_area = GroupArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group_area }\n end\n end", "def show\n @researcharea = Researcharea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @researcharea }\n end\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n @area_codes = AreaCode.all\n end", "def update\n respond_to do |format|\n if @issue_area.update(issue_area_params)\n format.html { redirect_to @issue_area, notice: 'Issue area was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_area }\n else\n format.html { render :edit }\n format.json { render json: @issue_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @country_area = CountryArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @country_area }\n end\n end", "def show\n @area = Area.find(params[:id])\n respond_with(@area)\n end", "def issue_area_params\n params.require(:issue_area).permit(:name)\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def index\n @research_areas = ResearchArea.all\n end", "def index\n @area_code_details = AreaCodeDetail.all\n end", "def index\n @city_areas = CityArea.all\n end", "def show\n set_user_and_user_areas\n @searched_areas << Area.find(params[:area][:id])\n render :index\n end", "def index\n @specialization_areas = SpecializationArea.all\n end", "def index\n @sub_areas = SubArea.all\n end", "def show\n respond_with(@issue) do |format|\n format.json { render json: @issue.to_json }\n end\n end", "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def set_area\n @area = Area.find_by_id(params[:id])\n if @area.blank?\n json_response(nil, :unprocessable_entity, :invalid_id)\n end\n end", "def show\n @survey_area = SurveyArea.find(params[:id])\n @survey_areas = Array.new\n @survey_areas.push(@survey_area)\n @json = @survey_area.survey_locations.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_area }\n end\n end", "def show\n @curriculum_area = CurriculumArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @curriculum_area }\n end\n end", "def new\n @area_of_law = AreaOfLaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: admin_areas_of_law_path(@area_of_law) }\n end\n end", "def index\n @project_area_interests = ProjectAreaInterest.all\n end", "def issues\n @query = Query.new(:name => \"_\")\n @issues = @query.issues(:order => \"issues.created_on desc\", :limit => 50, :include => [:project, :author])\n res = Array.new\n @issues.each do |is|\n res << {:issue_id => is.id, :issue_title => is.subject, :issue_content => is.description, :project_name => is.project.name,\n :author_name => is.author.to_s, :author_email => is.author.mail, :issue_created_at => is.created_on, :issue_status => is.status.to_s }\n end\n render :json => res.to_json\n end", "def new\n @interest_area = InterestArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest_area }\n end\n end", "def show\n @area_of_law = AreaOfLaw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area_of_law }\n end\n end", "def index\n @practice_areas = PracticeArea.all\n end", "def index\n @areas = Area.all\n @target_users = User.where(User.arel_table[:location].not_eq nil)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @areas }\n end\n end", "def index\n @area_attributes = AreaAttribute.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def index\n @issues = Issue.all\n end", "def show\n @normal_issue = NormalIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @normal_issue }\n end\n end", "def show\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def show\n @issue = Issue.find(params[:id])\n logger.debug @issue.inspect\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @area_type = AreaType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area_type }\n end\n end", "def index\n @area = Area.find(params[:area_id])\n @city = @area.city\n\n @rates = Rate.where(\"area_id = ?\",params[:area_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rates }\n end\n end", "def index\n @political_areas = PoliticalArea.all\n if params[:city_id].present?\n @political_areas = PoliticalArea.find(params[:city_id]).sub_areas\n end\n @political_areas = @political_areas.where(\"long_name like ?\", \"%#{params[:long_name]}%\") if params[:long_name]\n @political_areas = @political_areas.page params[:page]\n end", "def show\n @base_issue = BaseIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @base_issue }\n end\n end", "def new\n @breadcrumb = 'create'\n @area = Area.new\n @departments = departments_dropdown\n @workers = workers_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def set_areas_skill\n @areas_skill = AreasSkill.find(params[:id])\n end", "def destroy\n @issue_area.destroy\n respond_to do |format|\n format.html { redirect_to issue_areas_url, notice: 'Issue area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def areas(type = nil)\n if type\n if areas = @areas[type]\n areas.values\n else\n []\n end\n else\n @areas.values.map(&:values).flatten\n end\n end", "def show\n @contentarea = Contentarea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contentarea }\n end\n end", "def index\n @core_logistic_areas = Core::LogisticArea.find_mine(params).paginate(page: params[:page])\n respond_to do |format|\n format.js {}\n format.html {}\n end\n end", "def show\n @issue_group = IssueGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue_group }\n end\n end", "def show\n # fetch sub problems and put it in json\n cause = []\n @problem.problem_references.each do |problem_reference|\n cause << problem_reference.sub_problem\n end\n @problem_attributes = @problem.attributes.merge(cause: cause)\n render json: @problem_attributes\n end", "def index\n @issue_types = IssueType.all\n end", "def areas\n self.areacodes.map{|areacode| Area.find areacode}\n end", "def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def index\n areas = if current_user.moderator?\n ProductionArea.where.not(state: 0).eager_load(:map_layer)\n else\n current_user.production_areas.eager_load(:map_layer).with_translations(I18n.locale)\n end\n @cabinet_production_areas = areas\n end", "def issue\n @issue = Issue.find(params[:id])\n end", "def index\n authorize! :read, Issue\n\n respond_to do |format|\n format.html\n format.js\n format.json { render json: IssuesDatatable.new(view_context) }\n end\n end", "def new\r\n @area = Area.new\r\n @area.domain_id = params[:domain_id]\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @area }\r\n end\r\n end", "def index\n @issue_skills = IssueSkill.all\n render json: @issue_skills\n end", "def new\n @country_area = CountryArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @country_area }\n end\n end", "def index\n @micro_areas = MicroArea.all\n end", "def new\n @proposal = Proposal.new\n @proposal.area_tags = [Area.find(params[:area_id]).area_tag.name_es] if params[:area_id]\n respond_to do |format|\n format.html\n format.floki { render :action => 'new.floki', :content_type => 'application/json', :layout => false}\n end\n end", "def index\n @postulate_area_interests = PostulateAreaInterest.all\n end", "def index\n @district_areas = DistrictArea.all\n end", "def index\n @district_areas = DistrictArea.all\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def all_issues()\n @endpoint = \"/issues.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"issues\"].sort_by { |issue| issue[\"id\"] }\n end", "def index\n @issues = Issue.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def index\n @issues = Issue.filter(\n params.slice(:build_product, :build_branch, \n :build_name, :build_id, :similar_to, :signature, :include_hit_count)\n )\n render json: @issues\n end", "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def index\n @main_areas = MainArea.all\n @bproblems = Bproblem.all\n end", "def new\n @researcharea = Researcharea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @researcharea }\n end\n end", "def index\n @notice = \"ALL Issues\"\n @@selected_label=nil\n @@found_by=false\n @@assigned_to=false\n get_bugs\n get_count_of_issue\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bugs }\n end\n end", "def get_issues(label='',mode)\n debug_msg(\"get_issues: #{label}\",3)\n case mode\n when 'inclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n debug_msg(uri,9)\n when 'exclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+not+in(#{label})\")\n debug_msg(uri,9)\n else\n raise StandardError \"mode has an unsupported value: #{mode}. should be 'inclusive' or 'exclusive'\"\n end\n jira_issues = Hash.new\n j_issue = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n # uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri.request_uri)\n debug_msg(request,10)\n request.basic_auth(\"#{USERNAME}\", \"#{PASSWORD}\")\n response = http.request (request)\n debug_msg(response,10)\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n debug_msg(\"DATA: #{data}\",9)\n data[\"issues\"].each do |item|\n debug_msg(\"ITEM: #{item}\",10)\n jira_id = item[\"key\"]\n j_id = item['key']\n j_issue[j_id] = Hash.new\n j_issue[j_id]['status'] = item['fields']['status']['name']\n j_issue[j_id]['summary'] = item['fields']['summary']\n# p item\n# p \"-----------------------------------------\"\n# binding.pry;\n summary_status = '[' + item['fields']['status']['name']+ '] '+item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['status']['name']\n# jira_issues[jira_id].['summary'] = item['fields']['summary']\n# jira_issues[jira_id].['status'] = item['fields']['status']['name']\n jira_issues[jira_id] = item['fields']['summary']\n\n # binding.pry;\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for #{label} \"\n end\n end\n #return jira_issues\n return j_issue\nend", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @issue_groups = IssueGroup.all\n end", "def index\n @userareas = Userarea.all\n @users = User.all\n @areas = Area.all\n end" ]
[ "0.7761095", "0.6578399", "0.6543199", "0.6533289", "0.6496538", "0.646605", "0.6439099", "0.6422843", "0.64179593", "0.640564", "0.6398376", "0.6366962", "0.6359093", "0.6271248", "0.6251754", "0.6250936", "0.6235553", "0.619187", "0.6141472", "0.6131239", "0.60808593", "0.60400414", "0.59755033", "0.5971804", "0.59650177", "0.5950209", "0.5947812", "0.59268725", "0.59013104", "0.58980864", "0.5866866", "0.58600426", "0.585051", "0.585051", "0.58484787", "0.58428437", "0.5842141", "0.58349246", "0.5828634", "0.58250844", "0.581413", "0.5777302", "0.5757037", "0.5747904", "0.57371265", "0.57315457", "0.57150114", "0.57124096", "0.570272", "0.5701979", "0.5701037", "0.56892747", "0.56687117", "0.5655799", "0.5655799", "0.5655799", "0.5655799", "0.5655799", "0.56423855", "0.5636324", "0.5636097", "0.56275624", "0.5626143", "0.5613969", "0.5611589", "0.5569668", "0.55668837", "0.5566795", "0.5564808", "0.5563334", "0.55441177", "0.5539755", "0.5529288", "0.55186445", "0.5510356", "0.55090535", "0.55076784", "0.5504884", "0.55035764", "0.5498772", "0.54945797", "0.5493242", "0.5487523", "0.5485216", "0.5473182", "0.54708296", "0.5470338", "0.5470338", "0.54686534", "0.54667944", "0.54622066", "0.544822", "0.54446733", "0.5423879", "0.54175496", "0.5413857", "0.5411732", "0.54109716", "0.54067767", "0.54056257", "0.5400932" ]
0.0
-1
POST /issue_areas POST /issue_areas.json
def create @issue_area = IssueArea.new(issue_area_params) respond_to do |format| if @issue_area.save format.html { redirect_to @issue_area, notice: 'Issue area was successfully created.' } format.json { render :show, status: :created, location: @issue_area } else format.html { render :new } format.json { render json: @issue_area.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def index\n @issue_areas = IssueArea.all\n end", "def issue_area_params\n params.require(:issue_area).permit(:name)\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_issue_area\n @issue_area = IssueArea.find(params[:id])\n end", "def create\n @breadcrumb = 'create'\n @area = Area.new(params[:area])\n @area.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: crud_notice('created', @area) }\n format.json { render json: @area, status: :created, location: @area }\n else\n @departments = departments_dropdown\n @workers = workers_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @postulate_area_interest = PostulateAreaInterest.new(postulate_area_interest_params)\n\n respond_to do |format|\n if @postulate_area_interest.save\n format.html { redirect_to @postulate_area_interest }\n format.json { render :show, status: :created, location: @postulate_area_interest }\n else\n format.html { render :new }\n format.json { render json: @postulate_area_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @area = Area.new(params[:area])\r\n\r\n respond_to do |format|\r\n if @area.save\r\n format.html { redirect_to areas_url(domain_id: @area.domain_id), notice: 'Area was successfully created.' }\r\n format.json { render json: @area, status: :created, location: @area }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @area.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @interest_area = InterestArea.new(params[:interest_area])\n\n respond_to do |format|\n if @interest_area.save\n format.html { redirect_to @interest_area, notice: 'Interest area was successfully created.' }\n format.json { render json: @interest_area, status: :created, location: @interest_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interest_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def create\n @project_area = ProjectArea.new(project_area_params)\n\n respond_to do |format|\n if @project_area.save\n format.html { redirect_to @project_area, notice: 'Project area was successfully created.' }\n format.json { render :show, status: :created, location: @project_area }\n else\n format.html { render :new }\n format.json { render json: @project_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @survey_area = SurveyArea.new(params[:survey_area])\n\n respond_to do |format|\n if @survey_area.save\n format.html { redirect_to @survey_area, notice: 'Survey area was successfully created.' }\n format.json { render json: @survey_area, status: :created, location: @survey_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @areas_skill = AreasSkill.new(areas_skill_params)\n\n respond_to do |format|\n if @areas_skill.save\n format.html { redirect_to @areas_skill, notice: 'Areas skill was successfully created.' }\n format.json { render :show, status: :created, location: @areas_skill }\n else\n format.html { render :new }\n format.json { render json: @areas_skill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue_area.update(issue_area_params)\n format.html { redirect_to @issue_area, notice: 'Issue area was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_area }\n else\n format.html { render :edit }\n format.json { render json: @issue_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def area_params\n params.require(:area).permit(:code, :name, :reservable, :status, :area_id, :institute_id,\n resources_attributes: [:id, :code, :name, :description, :movil, :pedagogic, :resource_id, :area_id, :_destroy])\n end", "def create\n #return render json: params[:recursos]\n @area = Area.new(area_params)\n @count = 0\n save_multiples_recursos if params[:recursos][:status] == '1'\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'El Área fue creada éxitosamente.' }\n format.json { render :show, status: :created, location: @area }\n else\n format.html { render :new }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @region = Region.new(region_params)\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to regions_path, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :new }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area_type = AreaType.new(params[:area_type])\n\n respond_to do |format|\n if @area_type.save\n format.html { redirect_to @area_type, notice: 'Area type was successfully created.' }\n format.json { render json: @area_type, status: :created, location: @area_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sub_area = SubArea.new(sub_area_params)\n\n respond_to do |format|\n if @sub_area.save\n format.html { redirect_to @sub_area, notice: 'Sub area was successfully created.' }\n format.json { render :show, status: :created, location: @sub_area }\n else\n format.html { render :new }\n format.json { render json: @sub_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n @area = Area.new(params[:area])\n\n @area.save!\n\n flash[:notice] = t(:success_created, :id => @area.id)\n redirect_to(areas_url)\n rescue => e\n# flash[:error] = t(:error_default, :message => e.message)\n render :action => :new\n end\n end", "def create\n @area = Area.new(area_params)\n @area.skus = params[:area][:skus]\n respond_to do |format|\n if @area.save\n format.html { redirect_to admin_areas_path, notice: 'Area was successfully created.' }\n format.json { render :show, status: :created, location: @area }\n else\n format.html { render :new }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lab_area = LabArea.new(lab_area_params)\n\n respond_to do |format|\n if @lab_area.save\n format.html { redirect_to @lab_area, notice: 'Lab area was successfully created.' }\n format.json { render :show, status: :created, location: @lab_area }\n else\n format.html { render :new }\n format.json { render json: @lab_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group_area = GroupArea.new(params[:group_area])\n\n respond_to do |format|\n if @group_area.save\n format.html { redirect_to @group_area, notice: 'Group area was successfully created.' }\n format.json { render json: @group_area, status: :created, location: @group_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area_attribute = AreaAttribute.new(area_attribute_params)\n\n respond_to do |format|\n if @area_attribute.save\n format.html { redirect_to @area_attribute, notice: 'Area attribute was successfully created.' }\n format.json { render action: 'show', status: :created, location: @area_attribute }\n else\n format.html { render action: 'new' }\n format.json { render json: @area_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area_code = AreaCode.new(area_code_params)\n\n respond_to do |format|\n if @area_code.save\n format.html { redirect_to @area_code, notice: 'Area code was successfully created.' }\n format.json { render :show, status: :created, location: @area_code }\n else\n format.html { render :new }\n format.json { render json: @area_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def area_params\n params.require(:area).permit(:name, :pincode)\n end", "def areas\n aux = WorkOrderArea.by_name\n render json: serialized_work_order_areas(aux)\n end", "def create\n @project_area_interest = ProjectAreaInterest.new(project_area_interest_params)\n\n respond_to do |format|\n if @project_area_interest.save\n format.html { redirect_to @project_area_interest }\n format.json { render :show, status: :created, location: @project_area_interest }\n else\n format.html { render :new }\n format.json { render json: @project_area_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_area\n @area = Area.find_by_id(params[:id])\n if @area.blank?\n json_response(nil, :unprocessable_entity, :invalid_id)\n end\n end", "def create\n require_user()\n @area_of_expertise = AreaOfExpertise.new(area_of_expertise_params)\n\n respond_to do |format|\n if @area_of_expertise.save\n format.html { redirect_to @area_of_expertise, notice: 'Area of expertise was successfully created.' }\n format.json { render :show, status: :created, location: @area_of_expertise }\n else\n format.html { render :new }\n format.json { render json: @area_of_expertise.errors, status: :unprocessable_entity }\n end\n end\n end", "def area_params\n params.require(:area).permit(:name)\n end", "def area_params\n params.require(:area).permit(:name, :active, :start_date, :end_date, :status, :audit_id)\n end", "def add_area(area)\n @areas[area.type] = {} unless @areas[area.type]\n @areas[area.type][area.key] = area\n end", "def create\n @researcharea = Researcharea.new(params[:researcharea])\n\n respond_to do |format|\n if @researcharea.save\n format.html { redirect_to @researcharea, notice: 'Research area was successfully created.' }\n format.json { render json: @researcharea, status: :created, location: @researcharea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @researcharea.errors, status: :unprocessable_entity }\n end\n end\n end", "def postulate_area_interest_params\n params.require(:postulate_area_interest).permit(:area_interest_id, :postulate_id)\n end", "def create\n @research_area = ResearchArea.create(research_area_params)\n\n respond_to do |format|\n if @research_area.save\n format.html { redirect_to @research_area, notice: 'Research area was successfully created.' }\n format.json { render :show, status: :created, location: @research_area }\n else\n format.html { render :new }\n format.json { render json: @research_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def area_params\n permitted = ProductionArea.globalize_attribute_names + [:edrpou_code, :site, :railway_track, :railway_distance,\n :trucks_road, :state_road_distance, :airport_distance,\n :total_area, :building_year, :free_floors_count,\n :free_floors, :production_area, :additional, :phone,\n :email, :rent_year, :sale, :date_info, :main_image,\n :gis_type_name, :status, :map_layer_id, :ownership_id,\n questionnaire_images_attributes: %i[id imgable_type\n imgable_id _destroy],\n questionnaire_file_attributes: %i[id fileable_type file\n fileable_id _destroy],\n geo_json_attributes: %i[id geo_type position],\n balancer_ids: [], infrastructure_type_ids: []]\n params.require(:production_area).permit(permitted)\n end", "def create\n param = area_params\n user_balancer = current_user.balancer_id\n param[:balancer_ids] << user_balancer unless param[:balancer_ids].include?(user_balancer.to_s)\n\n @cabinet_production_area = current_user.production_areas.new(param)\n respond_to do |format|\n if status_valid?(area_params[:status]) && @cabinet_production_area.save\n QuestionnaireImages.build(params, @cabinet_production_area)\n public_send(params[:production_area][:status])\n format.html { redirect_to cabinet_production_areas_path, notice: 'Запис успішно створено.' }\n format.json { render :show, status: :created, location: @cabinet_production_area }\n else\n format.html { render :new }\n format.json { render json: @cabinet_production_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def sub_area_params\n params.require(:sub_area).permit(:code_capes, :title, :description, :area_id)\n end", "def create\n @area = Area.new(area_params)\n if @area.save\n flash[:success] = 'Area was successfully created.'\n redirect_to :back\n else\n flash[:danger] = 'Area was not created.'\n redirect_to :back\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n flash[:notice] = 'Area was successfully created.'\n format.html { redirect_to(@area) }\n format.xml { render :xml => @area, :status => :created, :location => @area }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @area_code_detail = AreaCodeDetail.new(area_code_detail_params)\n\n respond_to do |format|\n if @area_code_detail.save\n format.html { redirect_to @area_code_detail, notice: 'Area code detail was successfully created.' }\n format.json { render :show, status: :created, location: @area_code_detail }\n else\n format.html { render :new }\n format.json { render json: @area_code_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @userarea = Userarea.new(userarea_params)\n\n respond_to do |format|\n if @userarea.save\n format.html { redirect_to @userarea, notice: 'Userarea was successfully created.' }\n format.json { render :show, status: :created, location: @userarea }\n else\n format.html { render :new }\n format.json { render json: @userarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def area_params\n params.require(:area).permit(:name, :city_id)\n end", "def set_areas_skill\n @areas_skill = AreasSkill.find(params[:id])\n end", "def destroy\n @issue_area.destroy\n respond_to do |format|\n format.html { redirect_to issue_areas_url, notice: 'Issue area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def create\n @area = Area.new(area_params)\n @area.start_date = Date.today\n @area.active = true\n @area.status = \"in progress\"\n if @area.save\n redirect_to new_waste_info_path(area: @area), notice: \"#{@area.name} has been added to the system\"\n else\n flash[:error] = \"This area could not be created.\"\n render \"new\"\n end\n end", "def create\n @country_area = CountryArea.new(params[:country_area])\n\n respond_to do |format|\n if @country_area.save\n format.html { redirect_to @country_area, notice: 'Country area was successfully created.' }\n format.json { render json: @country_area, status: :created, location: @country_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @country_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @question_content_area = QuestionContentArea.new(params[:question_content_area])\n\n respond_to do |format|\n if @question_content_area.save\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully created.' }\n format.json { render json: @question_content_area, status: :created, location: @question_content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_issue(issue_obj)\n @endpoint = \"/issues.json\"\n setup_post\n @req_obj = {\"issue\" => issue_obj}\n req_obj_to_json_body\n res = @http.request(@req)\n return JSON.load(res.body)[\"issue\"][\"id\"]\n end", "def create\n @city_area = current_user.cityAreas.build(city_area_params)\n\n respond_to do |format|\n if @city_area.save\n format.html { redirect_to @city_area, notice: \"City area was successfully created.\" }\n format.json { render :show, status: :created, location: @city_area }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @city_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @practice_area = PracticeArea.new(practice_area_params)\n\n respond_to do |format|\n if @practice_area.save\n format.html { redirect_to @practice_area, notice: 'Practice area was successfully created.' }\n format.json { render :show, status: :created, location: @practice_area }\n else\n format.html { render :new }\n format.json { render json: @practice_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_individual_areas\n @index.values.each do |n|\n geographic_area_type = (n.temp_area.geographic_area_type_name.blank? ? 'Unknown' : n.temp_area.geographic_area_type_name)\n n.geographic_area = GeographicArea.new(\n name: n.temp_area.name, # Clean name at this point if needed.\n data_origin: n.temp_area.source_table,\n geographic_area_type: GeographicAreaType.find_or_create_by(name: geographic_area_type),\n tdwgID: n.temp_area.tdwgID,\n iso_3166_a2: n.temp_area.iso_3166_a2,\n iso_3166_a3: n.temp_area.iso_3166_a3\n )\n end\n end", "def new\n if params[:area_id]\n @parent_area = Area.find(params[:area_id]) \n @area = @parent_area.children.build \n else\n @area = Area.new \n end\n @area.project_leaders = []\n respond_with(@area)\n \n end", "def project_area_params\n params.require(:project_area).permit(:project_id, :investigation_area_id)\n end", "def lab_area_params\n params.require(:lab_area).permit(:fk_region_id, :area_number, :is_active, :name, :sort_order)\n end", "def update_areas\n if (canonical_address = address.try(:canonical_address))\n areas = canonical_address.areas\n elsif (zip = Postcode.search(postcode))\n areas = AreaZip.where(zip: zip.zip).map(&:area)\n if Settings.geography.area_lookup.use_open_north_api\n api = OpenNorthAPI.new\n area_codes = api.get_boundaries_for_lat_lng(zip.latitude, zip.longitude)\n area_codes.each do |area_type, code|\n areas << Area.find_by(area_type: area_type, code: code)\n end\n end\n if Settings.geography.area_lookup.use_canadian_province_lookup\n canadian_province_lookup = CanadianProvinceLookup.new\n if (code = canadian_province_lookup.get_province_for_postcode(zip.zip))\n areas << Area.find_by(area_type: 'canada_province', code: code)\n end\n end\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n mosaic = Mosaic::Mosaic.find_by(postcode: postcode.upcase.delete!(' '))\n end\n\n areas = (areas ||= []).uniq\n self.areas.clear\n self.areas << (areas || [])\n\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n if mosaic\n self.mosaic_group = mosaic.mosaic_group\n self.mosaic_code = mosaic.code\n save!\n end\n\n zip_source = zip || canonical_address\n if zip_source\n update_demographic_groups(zip_source.zip)\n end\n\n lat_lng_source = canonical_address || zip\n if lat_lng_source\n self.latitude = lat_lng_source.latitude\n self.longitude = lat_lng_source.longitude\n save!\n end\n end", "def index\n @areas = Area.all\n end", "def index\n @project_areas = ProjectArea.all\n end", "def create\n @core_area = Core::Area.new(core_area_params)\n\n respond_to do |format|\n if params[:btn_cancel].present?\n format.html { redirect_to(action: \"index\")}\n format.json { head :no_content}\n elsif @core_area.save\n format.html { redirect_to @core_area, notice: 'Area was successfully created.' }\n format.json { render action: 'show', status: :created, location: @core_area }\n else\n format.html { render action: 'new' }\n format.json { render json: @core_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @areas_profissional = AreasProfissional.new(areas_profissional_params)\n\n respond_to do |format|\n if @areas_profissional.save\n format.html { redirect_to @areas_profissional, notice: 'Área cadastrada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @areas_profissional }\n else\n format.html { render :new }\n format.json { render json: @areas_profissional.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params.except(:area))\n @employee.area = employee_params[:area].to_i\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: \"Employee was successfully created.\" }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tarea = Tarea.new(tarea_params)\n\n respond_to do |format|\n if @tarea.save\n format.html { redirect_to @tarea, notice: 'Tarea was successfully created.' }\n format.json { render :show, status: :created, location: @tarea }\n else\n format.html { render :new }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @proposal = Proposal.new\n @proposal.area_tags = [Area.find(params[:area_id]).area_tag.name_es] if params[:area_id]\n respond_to do |format|\n format.html\n format.floki { render :action => 'new.floki', :content_type => 'application/json', :layout => false}\n end\n end", "def city_area_params\n params.require(:city_area).permit(:title, :slug, :user_id)\n end", "def new\n @area_type = AreaType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area_type }\n end\n end", "def sub_area_params\n params.require(:sub_area).permit(:name, :area_id, :sub_area_id)\n end", "def create\n input_params = rescue_action_area_params\n input_params[:rescue_action_id] = params[:rescue_action_id]\n\n @rescue_action_area = RescueActionArea.new(input_params)\n\n respond_to do |format|\n if @rescue_action_area.save\n format.html { redirect_to rescue_action_area_path(@rescue_action_area.rescue_action.id, @rescue_action_area.id), notice: 'Rescue action area was successfully created.' }\n format.json { render :show, status: :created, location: @rescue_action_area }\n else\n format.html { render :new }\n format.json { render json: @rescue_action_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def assign_areas(options={})\n options = {\n }.merge(options)\n\n # assign zip codes to areas\n @area_zips = {\n # Part of Austin\n :south => 0, # south of the river\n :central => 0, # near church, downtown\n :north => 0, # north 183N not quite out of town yet\n :northwest => 0, # cedar park, lake travis\n\n # Austin Outskirts\n :waynorth => 0, # pflugerville, round rock, georgetown\n :east => 0, # manor, elgin, hutto\n\n # Outside Austin\n :texas => 0, # outside austin area but still in Texas\n :outside_texas => 0, # outside Texas\n\n # Debug / Error checking\n :austin => 0, # for error checking / debug\n :other => 0, # for error checking / debug\n }\n\n @final_data.each_index do |i|\n record = @final_data[i]\n\n if record[:state] == 'TX'\n @final_data[i][:area] = :texas # Folks outside any of the cities below but still in Texas\n \n if record[:city] == 'Austin' # Folks in Austin\n @final_data[i][:area] = :austin # Don't want any left in Austin :area, all should here be assigned to a zip code below!\n case @final_data[i][:zip]\n when '78749','78739','78735','78736','78737','78745','78748','78704','78744','78747','78742','78746','78738','78733'\n @final_data[i][:area] = :south\n when '78703','78705','78751','78701','78712','78751','78756','78702','78731','78752','78767'\n @final_data[i][:area] = :central\n when '78758','78757','78759','78753','78729','78708','78727'\n @final_data[i][:area] = :north\n when '78717','78726','78730','78732','78750'\n @final_data[i][:area] = :northwest\n when '78725','78724','78754','78723','78741'\n @final_data[i][:area] = :east\n when '78728'\n @final_data[i][:area] = :waynorth\n end\n # cities near to Austin\n elsif record[:city] == 'Del valle'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Manchaca'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Buda'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Lockhart'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Kyle'\n @final_data[i][:area] = :south\n elsif record[:city] == 'San marcos'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Pflugerville'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Granger'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Round rock'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Georgetown'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Manor'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Webberville'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Elgin'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Bastrop'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Cedar park'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Hutto'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Lake travis'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Lago vista'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Lakeway'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Leander'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Spicewood'\n @final_data[i][:area] = :northwest\n end\n\n else # Folks outside of Texas (poor souls!)\n @final_data[i][:area] = :outside_texas\n end\n end\n \n \nend", "def set_area\n @area = Area.find(params[:area_id])\n end", "def set_postulate_area_interest\n @postulate_area_interest = PostulateAreaInterest.find(params[:id])\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to :success, notice: 'Issue was successfully created.' }\n format.json { render json: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @breadcrumb = 'create'\n @area = Area.new\n @departments = departments_dropdown\n @workers = workers_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def create\n #params[:area] == {\"parent_id\"=>\"21\",\"name\"=>\"test4\"} parent id from hidden field, name from field\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n #format.html { redirect_to(@area, :notice => 'Area was successfully created.') }\n format.html { redirect_to(locations_url, :notice => \"#{@area.to_s} was successfully created.\") }\n format.xml { render :xml => @area, :status => :created, :location => @area }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end", "def create\n @curriculum_area = CurriculumArea.new(curriculum_area_params)\n\n respond_to do |format|\n if @curriculum_area.save\n format.html { redirect_to [:admin, @curriculum_area], notice: 'Curriculum area was successfully created.' }\n format.json { render json: @curriculum_area, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curriculum_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @runner = Runner.new(runner_params)\n @runner.status = true\n @area = Area.find_by(name: @runner.area)\n @runner.area_id = @area.id\n respond_to do |format|\n if @runner.save\n format.html { redirect_to @runner, notice: 'Runner was successfully created.' }\n format.json { render :show, status: :created, location: @runner }\n else\n format.html { render :new }\n format.json { render json: @runner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n \n respond_to do |format|\n if @area.save\n flash[:notice] = 'Area creada correctamente.'\n format.html { params[:oper].nil? ? redirect_to(@area) : render(:text => \"Ok\")}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(params[:issue])\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_params\n params.require(:issue).permit(:place_id, :summary, :status, :description, :address, :scf_image_url, :lat, :lng, \n :geofence_radius, :custom_image, :question, :answer1, :answer2, :answer3, :answer4, :answer5, :answer6 )\n end", "def area_params\n params.require(:area).permit(:name, :theme_id, :label, :position, :navigation, :footer, :comments, :ascending, :mode, :paid, :restricted, array: [:sku])\n end", "def create\n @contentarea = Contentarea.new(params[:contentarea])\n\n respond_to do |format|\n if @contentarea.save\n format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' }\n format.json { render json: @contentarea, status: :created, location: @contentarea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contentarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @specialization_area = SpecializationArea.new(specialization_area_params)\n\n respond_to do |format|\n if @specialization_area.save\n format.html { redirect_to admin_specialization_area_path(@specialization_area), notice: 'Specialization area was successfully created.' }\n format.json { render :show, status: :created, location: @specialization_area }\n else\n format.html { render :new }\n format.json { render json: @specialization_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to issues_url, notice: 'Issue was successfully created.' }\n format.json { render json: @issue }\n else\n format.html { redirect_to issues_url, notice: 'There was a problem saving your issue. Do you need a tissue?' }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_rooms(rooms_id_array)\n if self.room_areas.empty?\n 1.upto(self.bedrooms) do \n room_area = RoomArea.new(:property_id => self.id,\n :room_id => Room.find_by_name(\"Room\").id)\n room_area.save\n end\n end\n for room_id in rooms_id_array do\n room_area = RoomArea.new(:property_id => self.id,\n :room_id => room_id)\n room_area.save\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to @issue, notice: 'Issue was successfully created.' }\n format.json { render :show, status: :created, location: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def pimo_params\n params.require(:pimo).permit(:area)\n end", "def new\n @interest_area = InterestArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest_area }\n end\n end", "def index\n @areas_skills = AreasSkill.all\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def create\n @district_area = DistrictArea.new(district_area_params)\n\n respond_to do |format|\n if @district_area.save\n format.html { redirect_to @district_area, notice: 'District area was successfully created.' }\n format.json { render :show, status: :created, location: @district_area }\n else\n format.html { render :new }\n format.json { render json: @district_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @district_area = DistrictArea.new(district_area_params)\n\n respond_to do |format|\n if @district_area.save\n format.html { redirect_to @district_area, notice: 'District area was successfully created.' }\n format.json { render :show, status: :created, location: @district_area }\n else\n format.html { render :new }\n format.json { render json: @district_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @area = Area.new(params[:area])\n end" ]
[ "0.6930734", "0.6652359", "0.6537024", "0.6382811", "0.62683016", "0.62683016", "0.6191356", "0.6113902", "0.60869265", "0.6041581", "0.59948945", "0.5951343", "0.58914816", "0.58670884", "0.58535504", "0.5826219", "0.58185035", "0.5800887", "0.5790258", "0.5739498", "0.57390785", "0.57283455", "0.5708596", "0.56974614", "0.5696207", "0.568919", "0.5677948", "0.56749845", "0.5668026", "0.56524086", "0.5647333", "0.56465715", "0.5617871", "0.5612447", "0.5583362", "0.55775374", "0.557143", "0.5551843", "0.55400604", "0.5536517", "0.5532741", "0.5526165", "0.55148876", "0.5502878", "0.54940444", "0.54926467", "0.54919094", "0.54842925", "0.54793996", "0.54793996", "0.5475512", "0.5474367", "0.546197", "0.5456523", "0.5436309", "0.5413329", "0.5398503", "0.53899497", "0.5379849", "0.5364952", "0.536334", "0.5360918", "0.5357628", "0.5351919", "0.53470445", "0.5336927", "0.5331649", "0.53216565", "0.5318148", "0.5310242", "0.5308792", "0.5303367", "0.5300936", "0.527423", "0.5264652", "0.52620053", "0.52603966", "0.525883", "0.52545625", "0.5250473", "0.52463156", "0.52402395", "0.52295053", "0.52264655", "0.52255774", "0.5225023", "0.52219194", "0.52197665", "0.52083576", "0.520024", "0.520024", "0.520024", "0.520024", "0.5195125", "0.51933753", "0.5179445", "0.5178554", "0.51701623", "0.51701623", "0.5169123" ]
0.74074733
0
PATCH/PUT /issue_areas/1 PATCH/PUT /issue_areas/1.json
def update respond_to do |format| if @issue_area.update(issue_area_params) format.html { redirect_to @issue_area, notice: 'Issue area was successfully updated.' } format.json { render :show, status: :ok, location: @issue_area } else format.html { render :edit } format.json { render json: @issue_area.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_issue_area\n @issue_area = IssueArea.find(params[:id])\n end", "def update\n @interest_area = InterestArea.find(params[:id])\n\n respond_to do |format|\n if @interest_area.update_attributes(params[:interest_area])\n format.html { redirect_to @interest_area, notice: 'Interest area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interest_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @area_attribute.update(area_attribute_params)\n format.html { redirect_to @area_attribute, notice: 'Area attribute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @area_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @area = Area.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @area.update_attributes(params[:area])\r\n format.html { redirect_to areas_url(domain_id: @area.domain_id), notice: 'Area was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @area.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @lab_area.update(lab_area_params)\n format.html { redirect_to @lab_area, notice: 'Lab area was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_area }\n else\n format.html { render :edit }\n format.json { render json: @lab_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @area = Area.find(params[:id])\n @area.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area,\n notice: (crud_notice('updated', @area) + \"#{undo_link(@area)}\").html_safe }\n format.json { head :no_content }\n else\n @departments = departments_dropdown\n @workers = @area.department.blank? ? workers_dropdown : workers_by_department(@area.department)\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area_type = AreaType.find(params[:id])\n\n respond_to do |format|\n if @area_type.update_attributes(params[:area_type])\n format.html { redirect_to @area_type, notice: 'Area type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n if params[:patent][:research_areas]\n research_area = ResearchArea.find(params[:patent][:research_areas].to_i)\n @patent.research_areas << research_area\n @patent.save\n format.json { render json: research_area }\n elsif @patent.update_attributes(params[:patent])\n format.html { redirect_to @patent, notice: 'Patent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n e_params = employee_params.except(:area)\n e_params.merge!(area: employee_params[:area].to_i)\n if @employee.update(e_params)\n format.html { redirect_to @employee, notice: \"Employee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey_area = SurveyArea.find(params[:id])\n\n respond_to do |format|\n if @survey_area.update_attributes(params[:survey_area])\n format.html { redirect_to @survey_area, notice: 'Survey area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project_area.update(project_area_params)\n format.html { redirect_to @project_area, notice: 'Project area was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_area }\n else\n format.html { render :edit }\n format.json { render json: @project_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sub_area.update(sub_area_params)\n format.html { redirect_to @sub_area, notice: 'Sub area was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_area }\n else\n format.html { render :edit }\n format.json { render json: @sub_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @areas_skill.update(areas_skill_params)\n format.html { redirect_to @areas_skill, notice: 'Areas skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @areas_skill }\n else\n format.html { render :edit }\n format.json { render json: @areas_skill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @group_area = GroupArea.find(params[:id])\n\n respond_to do |format|\n if @group_area.update_attributes(params[:group_area])\n format.html { redirect_to @group_area, notice: 'Group area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to course_path(@issue.courseid), notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @researcharea = Researcharea.find(params[:id])\n\n respond_to do |format|\n if @researcharea.update_attributes(params[:researcharea])\n format.html { redirect_to @researcharea, notice: 'Research area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @researcharea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project_area_interest.update(project_area_interest_params)\n format.html { redirect_to @project_area_interest}\n format.json { render :show, status: :ok, location: @project_area_interest }\n else\n format.html { render :edit }\n format.json { render json: @project_area_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n @area = Area.find(params[:id])\n @area.update_attributes(params[:area])\n\n flash[:notice] = t(:success_updated, :id => @area.id)\n redirect_to(areas_url)\n rescue => e\n# flash[:error] = t(:error_default, :message => e.message)\n render :action => :edit\n end\n end", "def update\n respond_to do |format|\n if @postulate_area_interest.update(postulate_area_interest_params)\n format.html { redirect_to @postulate_area_interest }\n format.json { render :show, status: :ok, location: @postulate_area_interest }\n else\n format.html { render :edit }\n format.json { render json: @postulate_area_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @map_area = MapArea.find(params[:id])\n respond_to do |format|\n if @map_area.update_attributes(params[:map_area])\n flash[:notice] = 'MapArea was successfully updated.'\n format.html { redirect_to map_areas_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @map_area = MapArea.find(params[:id])\n respond_to do |format|\n if @map_area.update_attributes(params[:map_area])\n flash[:notice] = 'MapArea was successfully updated.'\n format.html { redirect_to map_areas_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @issue.update(issue_params)\n render :show, status: :ok, location: @issue\n else\n render json: @issue.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to issues_url, notice: 'Issue was successfully updated.' }\n format.json { render json: {'success' => true} }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @issue.votes = 0\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n require_user()\n respond_to do |format|\n if @area_of_expertise.update(area_of_expertise_params)\n format.html { redirect_to @area_of_expertise, notice: 'Area of expertise was successfully updated.' }\n format.json { render :show, status: :ok, location: @area_of_expertise }\n else\n format.html { render :edit }\n format.json { render json: @area_of_expertise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n flash[:notice] = 'Area was successfully updated.'\n format.html { redirect_to(@area) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n flash[:notice] = 'Area was successfully updated.'\n format.html { redirect_to(@area) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @issue_area = IssueArea.new(issue_area_params)\n\n respond_to do |format|\n if @issue_area.save\n format.html { redirect_to @issue_area, notice: 'Issue area was successfully created.' }\n format.json { render :show, status: :created, location: @issue_area }\n else\n format.html { render :new }\n format.json { render json: @issue_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n #format.html { redirect_to(@area, :notice => \"#{@area.to_s} was successfully updated.\") }\n format.html { redirect_to(locations_url, :notice => \"#{@area.to_s} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if issue.save\n format.html { redirect_to issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to issues_path, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @normal_issue = NormalIssue.find(params[:id])\n\n respond_to do |format|\n if @normal_issue.update_attributes(params[:normal_issue])\n format.html { redirect_to @normal_issue, notice: 'Normal issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @normal_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @encounter_area_feature = EncounterAreaFeature.find(params[:id])\n\n respond_to do |format|\n if @encounter_area_feature.update_attributes(params[:encounter_area_feature])\n format.html { redirect_to(@encounter_area_feature, :notice => 'Encounter area feature was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @encounter_area_feature.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @appissue.update(appissue_params)\n format.html { redirect_to @appissue, notice: 'Appissue was successfully updated.' }\n format.json { render :show, status: :ok, location: @appissue }\n else\n format.html { render :edit }\n format.json { render json: @appissue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @area.skus = params[:area][:skus]\n if @area.update area_params\n format.html { redirect_to admin_areas_path, notice: 'Area was successfully updated.' }\n format.json { render :show, status: :ok, location: @area }\n else\n format.html { render :edit }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def issue_area_params\n params.require(:issue_area).permit(:name)\n end", "def update\n if @issue.update(issue_params)\n show\n else\n render json: @issue.errors, status: :unprocessable_entity\n end\n end", "def update\n @country_area = CountryArea.find(params[:id])\n\n respond_to do |format|\n if @country_area.update_attributes(params[:country_area])\n format.html { redirect_to @country_area, notice: 'Country area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @country_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @research_area.update(research_area_params)\n format.html { redirect_to @research_area, notice: 'Research area was successfully updated.' }\n format.json { render :show, status: :ok, location: @research_area }\n else\n format.html { render :edit }\n format.json { render json: @research_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_area\n @area = Area.find_by_id(params[:id])\n if @area.blank?\n json_response(nil, :unprocessable_entity, :invalid_id)\n end\n end", "def update\n @base_issue = BaseIssue.find(params[:id])\n\n respond_to do |format|\n if @base_issue.update_attributes(params[:base_issue])\n format.html { redirect_to @base_issue, :notice => 'Base issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @base_issue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @issues = args[:issues] if args.key?(:issues)\n end", "def update\n @errors = []\n @area = Area.find(params[:id])\n \n #Me fijo que haya seleccionado al menos un coordinador válido para el área.\n if !project_leaders_valid?(params[:area][:project_leaders].split(%r{,\\s*})) \n @errors = @errors.concat([\"Debe seleccionar un coordinador válido para el área \" + @area.name])\n end\n \n @area.attributes = params[:area]\n \n if @errors.empty? and @area.valid?\n @area.save\n \n #Actualizo los roles project_leader del área.\n #Primero saco todas los coordinadores que tiene el área. \n User.with_role_in_area('project_leader', @area).each do |user|\n user.has_no_role!(:project_leaders, @area)\n end\n \n #Agrego todos los nuevos project leaders al área. \n set_project_leaders(params[:area][:project_leaders].split(%r{,\\s*}), @area) \n end\n respond_with(@area)\n end", "def update\n respond_to do |format|\n if @project_issue.update(project_issue_params)\n format.html { redirect_to @project_issue, notice: 'Project issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area_of_law = AreaOfLaw.find(params[:id])\n\n respond_to do |format|\n if @area_of_law.update_attributes(params[:area_of_law])\n purge_all_pages\n format.html { redirect_to admin_areas_of_law_path, notice: 'Area of law was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { \n flash[:error] = 'Could not update the Area of Law'\n render action: \"edit\" \n }\n format.json { render json: @area_of_law.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @conference=Conference.find(params[:conference_id])\n @issue = @conference.issues.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to [@conference,@issue], notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n if @question_content_area.update_attributes(params[:question_content_area])\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sub_issue.update(sub_issue_params)\n format.html { redirect_to @sub_issue, notice: 'Sub issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_issue }\n else\n format.html { render :edit }\n format.json { render json: @sub_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to regions_path, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @area_code.update(area_code_params)\n format.html { redirect_to @area_code, notice: 'Area code was successfully updated.' }\n format.json { render :show, status: :ok, location: @area_code }\n else\n format.html { render :edit }\n format.json { render json: @area_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @issue_areas = IssueArea.all\n end", "def update\n respond_to do |format|\n if @issue_type.update(issue_type_params)\n format.html { redirect_to @issue_type, notice: 'Issue type was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_type }\n else\n format.html { render :edit }\n format.json { render json: @issue_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to issues_url, notice: 'Нарушение №'[email protected]_s+' обновлено.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n \n respond_to do |format|\n if @area.update_attributes(params[:area])\n flash[:notice] = 'Area actualizado correctamente.'\n format.html { redirect_to(@area) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @local_issue.update(local_issue_params)\n format.html { redirect_to @local_issue, notice: 'Local issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @local_issue }\n else\n format.html { render :edit }\n format.json { render json: @local_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @areas = Area.all\n @task_types = TaskType.all\n @items = RsItem.all\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 @contentarea = Contentarea.find(params[:id])\n\n respond_to do |format|\n if @contentarea.update_attributes(params[:contentarea])\n format.html { redirect_to @contentarea, notice: 'Contentarea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contentarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @specialization_area.update(specialization_area_params)\n format.html { redirect_to admin_specialization_area_path(@specialization_area), notice: 'Specialization area was successfully updated.' }\n format.json { render :show, status: :ok, location: @specialization_area }\n else\n format.html { render :edit }\n format.json { render json: @specialization_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jira_issue.update(jira_issue_params)\n format.html { redirect_to @jira_issue, notice: 'Jira issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @jira_issue }\n else\n format.html { render :edit }\n format.json { render json: @jira_issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @area_code_detail.update(area_code_detail_params)\n format.html { redirect_to @area_code_detail, notice: 'Area code detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @area_code_detail }\n else\n format.html { render :edit }\n format.json { render json: @area_code_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @curriculum_area = CurriculumArea.find(params[:id])\n\n respond_to do |format|\n if @curriculum_area.update(curriculum_area_params)\n format.html { redirect_to [:admin, @curriculum_area], notice: 'Curriculum area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curriculum_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_areas_skill\n @areas_skill = AreasSkill.find(params[:id])\n end", "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to issues_path, notice: 'O assunto foi atualizado com sucesso.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n if params[:recursos][:status] == '1'\n @count = count_of_resource\n save_multiples_recursos\n end\n respond_to do |format|\n if @area.update(area_params)\n format.html { redirect_to @area, notice: 'El Área fue modificada éxitosamente.' }\n format.json { render :show, status: :ok, location: @area }\n else\n format.html { render :edit }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @areas_profissional.update(areas_profissional_params)\n format.html { redirect_to @areas_profissional, notice: 'Área atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @areas_profissional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @city_area.update(city_area_params)\n format.html { redirect_to @city_area, notice: \"City area was successfully updated.\" }\n format.json { render :show, status: :ok, location: @city_area }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @city_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue_group = IssueGroup.find(params[:id])\n\n respond_to do |format|\n if @issue_group.update_attributes(params[:issue_group])\n format.html { redirect_to @issue_group, notice: 'Issue group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @issue_model = args[:issue_model] if args.key?(:issue_model)\n @issues = args[:issues] if args.key?(:issues)\n end", "def update!(**args)\n @issue_model = args[:issue_model] if args.key?(:issue_model)\n @issues = args[:issues] if args.key?(:issues)\n end", "def update\n respond_to do |format|\n if params[:btn_cancel].present?\n format.html { redirect_to @core_area}\n format.json { head :no_content }\n elsif @core_area.update(core_area_params)\n format.html { redirect_to @core_area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @core_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @issue_models = args[:issue_models] if args.key?(:issue_models)\n end", "def update\n @projectarea = Projectarea.find(params[:id])\n\n respond_to do |format|\n if @projectarea.update_attributes(params[:projectarea])\n flash[:notice] = 'Projectarea was successfully updated.'\n format.html { redirect_to(@projectarea) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @projectarea.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @issue_master.update(issue_master_params)\n @issue_master = IssueMaster.new\n @issue_masters = IssueMaster.all \n end", "def update\n @issue = Issue.find(params[:id])\n @feedback = Feedback.find(params[:issue][:feedback_id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to feedback_issue_path(@feedback.id), notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @native_issue_has_asana.update(native_issue_has_asana_params)\n format.html { redirect_to @native_issue_has_asana, notice: 'Native issue has asana was successfully updated.' }\n format.json { render :show, status: :ok, location: @native_issue_has_asana }\n else\n format.html { render :edit }\n format.json { render json: @native_issue_has_asana.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aoo_ref.update(aoo_ref_params)\n format.html { redirect_to @aoo_ref, notice: 'Aoo ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @aoo_ref }\n else\n format.html { render :edit }\n format.json { render json: @aoo_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(issue_id, attributes={})\n post(\"issue/#{issue_id}\", query: attributes)\n response.parsed_response\n end", "def update(issue_id, attributes={})\n post(\"issue/#{issue_id}\", query: attributes)\n response.parsed_response\n end", "def update\n respond_to do |format|\n if @practice_area.update(practice_area_params)\n format.html { redirect_to @practice_area, notice: 'Practice area was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice_area }\n else\n format.html { render :edit }\n format.json { render json: @practice_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n puts params[:meeting][:issue_ids]\n\n\n if params[:meeting][:issue_ids]\n\n issuesadded =params[:meeting][:issue_ids].reject { |e| e.to_s.empty? }\n Issueaction.where('actiontype = ? and meeting_id = ? and issue_id in (?)', Actiontype::AGENDA, params[:id], issuesadded).destroy_all\n\n\n issuesadded.each do |i|\n\n Issueaction.create(meeting_id: @meeting.id, structure_id: @meeting.structure_id, issue_id: i, actiontype: Actiontype::AGENDA)\n end\n end\n\n respond_to do |format|\n if @meeting.update(meeting_params)\n Userlog.create(user_id: current_user.id, loggable_type: 'Meeting', loggable_id: @meeting.id, action: 'Update')\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def update\n param = area_params\n user_balancer = @cabinet_production_area.user.balancer_id\n param[:balancer_ids] << user_balancer unless param[:balancer_ids].include?(user_balancer.to_s)\n\n respond_to do |format|\n if status_valid?(area_params[:status]) && @cabinet_production_area.update(param)\n QuestionnaireImages.build(params, @cabinet_production_area)\n delete_main_image?(area_params[:main_image], @cabinet_production_area)\n public_send(params[:production_area][:status])\n format.html { redirect_to cabinet_production_areas_path, notice: 'Запис успішно оновлено.' }\n format.json { render :show, status: :ok, location: @cabinet_production_area }\n else\n format.html { render :edit }\n format.json { render json: @cabinet_production_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def controller_issues_edit_after_save(context={ })\n # Get the updated issue\n issue = context[:issue]\n\n # TODO: Make the parameters safe and secure\n context[:params][:test].each do |id, value|\n\n # Get the testcase with the given id\n testcase = Testcase.find(id)\n\n # If the value is set to true\n if value.downcase == \"true\"\n # Create an association connecting the current testcase\n # with the given issue\n testcase.issues << issue unless testcase.issues.include? issue\n else\n # Remove the association, as it is not wanted (anymore)\n testcase.issues.delete(issue)\n end\n\n # Save the changes. TODO: What if it fails?\n testcase.save\n end\n end", "def update\n authorize @objective.strategy, :update_objective?\n respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective}\n format.json { render :show, status: :ok, location: @objective }\n else\n format.html { render :edit }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @area_edition.update(area_edition_params)\n format.html { redirect_to main_app.url_for([:edit, @product, @theme, @personalization, @layout, @area_edition]), notice: 'Area edition was successfully updated.' }\n format.json { render :show, status: :ok, location: @area_edition }\n else\n format.html { render :edit }\n format.json { render json: @area_edition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @area.update_attributes(area_params)\n flash[:notice] = \"#{@area.name} has been updated.\"\n redirect_to @area\n else\n render :action => 'edit'\n end\n end", "def update\n @area_usuario = AreaUsuario.find(params[:id])\n\n respond_to do |format|\n if @area_usuario.update_attributes(params[:area_usuario])\n format.html { redirect_to @area_usuario, notice: 'Area usuario was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def controller_issues_bulk_edit_before_save(context = { })\n case true\n\n when context[:params][:objective_id].blank?\n # Do nothing\n when context[:params][:objective_id] == 'none'\n # Unassign objective\n context[:issue].objective = nil\n else\n context[:issue].objective = Objective.find(context[:params][:objective_id])\n end\n\n return ''\n end", "def update\n respond_to do |format|\n if @tarea.update(tarea_params)\n format.html { redirect_to @tarea, notice: 'Tarea was successfully updated.' }\n format.json { render :show, status: :ok, location: @tarea }\n else\n format.html { render :edit }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6479621", "0.6479621", "0.6479621", "0.63736206", "0.6260628", "0.6223009", "0.61924714", "0.61846274", "0.6142388", "0.6111292", "0.61105484", "0.6103904", "0.5962165", "0.5955237", "0.59473336", "0.59217215", "0.5919821", "0.58968246", "0.5896768", "0.5896302", "0.58878076", "0.587516", "0.58688927", "0.5865818", "0.5852566", "0.5852152", "0.5852152", "0.5852152", "0.5852152", "0.5852152", "0.584625", "0.584625", "0.58452284", "0.5837085", "0.5815731", "0.5813715", "0.5809395", "0.5809395", "0.5808166", "0.5802243", "0.5801663", "0.5799382", "0.57932186", "0.57920694", "0.5790026", "0.5773176", "0.5769196", "0.5754848", "0.57545066", "0.5739042", "0.5738363", "0.5732813", "0.5730659", "0.5687653", "0.56811124", "0.56780124", "0.5670502", "0.56674075", "0.5653711", "0.56469756", "0.56359917", "0.56350815", "0.5625023", "0.5623779", "0.56157196", "0.56120723", "0.55957544", "0.55941164", "0.558897", "0.55840576", "0.5572685", "0.5571451", "0.55674607", "0.55469406", "0.5535854", "0.5525748", "0.55069524", "0.5505218", "0.55012834", "0.55012834", "0.55011094", "0.5495311", "0.54950047", "0.5489662", "0.54833925", "0.5482448", "0.54746634", "0.54695153", "0.54695153", "0.5467194", "0.54467857", "0.5442614", "0.54345167", "0.5428242", "0.5426118", "0.54244155", "0.5421972", "0.541345", "0.5407652", "0.538262" ]
0.72290885
0
DELETE /issue_areas/1 DELETE /issue_areas/1.json
def destroy @issue_area.destroy respond_to do |format| format.html { redirect_to issue_areas_url, notice: 'Issue area was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interest_area = InterestArea.find(params[:id])\n @interest_area.destroy\n\n respond_to do |format|\n format.html { redirect_to interest_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_area.destroy\n respond_to do |format|\n format.html { redirect_to core_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_area = SurveyArea.find(params[:id])\n @survey_area.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area.destroy\n respond_to do |format|\n format.html { redirect_to admin_areas_url, notice: 'Area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @area_type = AreaType.find(params[:id])\n @area_type.destroy\n\n respond_to do |format|\n format.html { redirect_to area_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_area.destroy\n respond_to do |format|\n format.html { redirect_to lab_areas_url, notice: 'Lab area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @country_area = CountryArea.find(params[:id])\n @country_area.destroy\n\n respond_to do |format|\n format.html { redirect_to country_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_attribute.destroy\n respond_to do |format|\n format.html { redirect_to area_attributes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @group_area = GroupArea.find(params[:id])\n @group_area.destroy\n\n respond_to do |format|\n format.html { redirect_to group_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @curriculum_area = CurriculumArea.find(params[:id])\n @curriculum_area.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_curriculum_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @postulate_area_interest.destroy\n respond_to do |format|\n format.html { redirect_to postulate_area_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.destroy\n format.html { redirect_to areas_url,\n notice: (crud_notice('destroyed', @area) + \"#{undo_link(@area)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to areas_url, alert: \"#{@area.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n respond_with(@area)\n end", "def destroy\n @researcharea = Researcharea.find(params[:id])\n @researcharea.destroy\n\n respond_to do |format|\n format.html { redirect_to researchareas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub_area.destroy\n respond_to do |format|\n format.html { redirect_to sub_areas_url, notice: 'Sub area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @area = Area.find(params[:id])\r\n domain_id = @area.domain_id\r\n @area.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to areas_url domain_id: domain_id, notice: 'Area was successfully deleted.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @project_area_interest.destroy\n respond_to do |format|\n format.html { redirect_to project_area_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area.destroy\n respond_to do |format|\n format.html { redirect_to areas_url, notice: 'El Área fue eliminada éxitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contentarea = Contentarea.find(params[:id])\n @contentarea.destroy\n\n respond_to do |format|\n format.html { redirect_to contentareas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_of_law = AreaOfLaw.find(params[:id])\n @area_of_law.destroy\n purge_all_pages\n\n respond_to do |format|\n format.html { redirect_to admin_areas_of_law_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_area.destroy\n respond_to do |format|\n format.html { redirect_to project_areas_url, notice: 'Project area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @projectarea = Projectarea.find(params[:id])\n @projectarea.destroy\n\n respond_to do |format|\n format.html { redirect_to(projectareas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n issues_permissions\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @research_area.destroy\n respond_to do |format|\n format.html { redirect_to research_areas_url, notice: 'Research area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_content_area = QuestionContentArea.find(params[:id])\n @question_content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to question_content_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @areas_skill.destroy\n respond_to do |format|\n format.html { redirect_to areas_skills_url, notice: 'Areas skill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @normal_issue = NormalIssue.find(params[:id])\n @normal_issue.destroy\n\n respond_to do |format|\n format.html { redirect_to normal_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.clients.delete_all\n @issue.screenshots.delete_all\n @issue.destroy\n respond_with_refresh('Issue was successfully destroyed.', 'success')\n end", "def destroy\n @city_area.destroy\n respond_to do |format|\n format.html { redirect_to city_areas_url, notice: \"City area was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @base_issue = BaseIssue.find(params[:id])\n @base_issue.destroy\n\n respond_to do |format|\n format.html { redirect_to base_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @encounter_area_feature = EncounterAreaFeature.find(params[:id])\n @encounter_area_feature.destroy\n\n respond_to do |format|\n format.html { redirect_to(encounter_area_features_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n if @area.children.size == 0 and @area.name != \"localhost\"\n @area.destroy\n flash[:notice] = \"Deleted #{@area.to_s}\" \n else\n flash[:notice] = \"#{@area.to_s} not deleted. It has children or is the localhost node.\" \n end\n\n respond_to do |format|\n #format.html { redirect_to(areas_url) }\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cabinet_production_area.destroy\n respond_to do |format|\n format.html { redirect_to cabinet_production_areas_path, notice: 'Запис успішно видалено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @district_area.destroy\n respond_to do |format|\n format.html { redirect_to district_areas_url, notice: 'District area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @district_area.destroy\n respond_to do |format|\n format.html { redirect_to district_areas_url, notice: 'District area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Нарушение №'[email protected]_s+' удалено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n require_user()\n @area_of_expertise.destroy\n respond_to do |format|\n format.html { redirect_to area_of_expertises_url, notice: 'Area of expertise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n render json: @objective \n end", "def destroy\n @rescue_action_area.destroy\n respond_to do |format|\n format.html { redirect_to rescue_action_areas_url(@rescue_action), notice: 'Rescue action area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue_group = IssueGroup.find(params[:id])\n @issue_group.destroy\n\n respond_to do |format|\n format.html { redirect_to issue_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_issue.destroy\n respond_to do |format|\n format.html { redirect_to project_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tarea.destroy\n respond_to do |format|\n format.html { redirect_to tareas_url, notice: 'Tarea was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @practice_area.destroy\n respond_to do |format|\n format.html { redirect_to practice_areas_url, notice: 'Practice area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subject_area = SubjectArea.find(params[:id])\n @subject_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(subject_areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n end", "def destroy\n @issue.destroy\n end", "def destroy\n @delivery_area.destroy\n respond_to do |format|\n format.html { redirect_to delivery_areas_url, notice: 'Delivery area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n courseid = @issue.courseid\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to course_path(courseid), notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n # expire_action(:controller => \"/issue\", :action => \"toc\")\n respond_to do |format|\n format.html { redirect_to admin_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shopping_area = ShoppingArea.find(params[:id])\n @shopping_area.destroy\n\n respond_to do |format|\n format.html { redirect_to shopping_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @milestone = Milestone.find(params[:id])\n @milestone.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_code_detail.destroy\n respond_to do |format|\n format.html { redirect_to area_code_details_url, notice: 'Area code detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_code.destroy\n respond_to do |format|\n format.html { redirect_to area_codes_url, notice: 'Area code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @observation = Observation.find(params[:observation_id])\n @area = Area.find(params[:area_id])\n @touch = @area.touches.find(params[:id])\n\n\n # @touch = Touch.find(params[:id])\n @touch.destroy\n\n respond_to do |format|\n format.html { redirect_to coral_observation_area_path(@area.observation.coral, @area.observation, @area), notice: 'Area was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_history.destroy\n respond_to do |format|\n format.html { redirect_to area_histories_url, notice: \"Area history was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n authorize! :destroy, @issue\n end", "def destroy\n @appissue.destroy\n respond_to do |format|\n format.html { redirect_to appissues_url, notice: 'Appissue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue_type.destroy\n respond_to do |format|\n format.html { redirect_to issue_types_url, notice: 'Issue type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @specialization_area.destroy\n respond_to do |format|\n format.html { redirect_to admin_specialization_areas_url, notice: 'Specialization area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @micro_area.destroy\n respond_to do |format|\n format.html { redirect_to micro_areas_url, flash: { success: \"Micro Área apagada com sucesso!\" } }\n format.json { head :no_content }\n end\n end", "def destroy\n @tarea = Tarea.find(params[:id])\n @tarea.destroy\n\n respond_to do |format|\n format.html { redirect_to(tareas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tarea.destroy\n respond_to do |format|\n format.html { redirect_to tareas_url, notice: 'La Tarea ha sido eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n @branch_route.destroy\n respond_to do |format|\n format.html { redirect_to branch_routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @native_issue_has_asana.destroy\n respond_to do |format|\n format.html { redirect_to native_issue_has_asanas_url, notice: 'Native issue has asana was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cause_analyasis = CauseAnalysis.find(params[:id])\n @cause_analyasis.destroy\n\n respond_to do |format|\n format.html { redirect_to cause_analyses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @objective = Objective.find(params[:id])\n @objective.destroy\n\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @am_run_observation_type = AmRunObservationType.find(params[:id])\n @am_run_observation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to am_run_observation_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @aoo_ref.destroy\n respond_to do |format|\n format.html { redirect_to aoo_refs_url, notice: 'Aoo ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_edition.destroy\n respond_to do |format|\n format.html { redirect_to main_app.url_for([@product, @theme, @personalization, @layout, :area_editions]), notice: 'Area edition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @idea = Idea.find(params[:id])\n \n #kill everything else like subideas and maps\n subideas = Subidea.where(:idea_id => @idea.id)\n subideas.each do |si|\n si.map.destroy\n si.destroy\n end\n \n @idea.destroy \n\n respond_to do |format|\n format.html { redirect_to(ideas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @magissue = Magissue.find(params[:id])\n @magissue.destroy\n\n respond_to do |format|\n format.html { redirect_to magissues_url }\n format.json { head :no_content }\n end\n end", "def delete_area(area)\n reset_meta_data\n segments.each do |seg|\n seg.delete_area(area)\n update_meta_data(seg) unless seg.empty?\n end\n segments.delete_if { |seg| seg.empty? }\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end" ]
[ "0.7194692", "0.7194692", "0.7194692", "0.7048286", "0.69548094", "0.69177425", "0.6882465", "0.6877776", "0.6877776", "0.6862402", "0.6862246", "0.68579644", "0.685396", "0.684552", "0.6825438", "0.68250924", "0.682498", "0.6789736", "0.6783404", "0.677249", "0.6748169", "0.67451495", "0.67451495", "0.6728976", "0.6726449", "0.66709507", "0.6670275", "0.66681856", "0.6634094", "0.66078955", "0.6562381", "0.6561468", "0.65560573", "0.65492576", "0.6523619", "0.6509914", "0.6500621", "0.6446901", "0.6439062", "0.6436459", "0.64336824", "0.64123046", "0.64067996", "0.64067996", "0.64067996", "0.64067996", "0.63828504", "0.6382419", "0.6382419", "0.6365687", "0.6349628", "0.63480043", "0.6332693", "0.6321599", "0.6319405", "0.6309547", "0.6308011", "0.62995666", "0.6284261", "0.6275348", "0.62645465", "0.62645465", "0.62645465", "0.62645465", "0.62645465", "0.62645465", "0.6263357", "0.62566125", "0.62566125", "0.6253994", "0.62505347", "0.6245777", "0.6243974", "0.62368214", "0.62365246", "0.62211716", "0.6218593", "0.6215026", "0.62027675", "0.61988324", "0.61916125", "0.6187794", "0.6186785", "0.6186785", "0.6180386", "0.61802936", "0.6175843", "0.61738014", "0.6169129", "0.61567426", "0.61387146", "0.61372095", "0.61354667", "0.61268955", "0.61251354", "0.61241573", "0.61194927", "0.61149365", "0.6112841", "0.61095536" ]
0.7535661
0
Use callbacks to share common setup or constraints between actions.
def set_issue_area @issue_area = IssueArea.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def issue_area_params params.require(:issue_area).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289145", "0.62875307", "0.6280997", "0.62420976", "0.62388235", "0.6216686", "0.62122375", "0.6208949", "0.619173", "0.6176307", "0.6173907", "0.6170346", "0.616111", "0.6150513", "0.6150023", "0.61446756", "0.6120429", "0.6112975", "0.6104845", "0.6102966", "0.6087884", "0.6079323", "0.60699135", "0.60602236", "0.60191786", "0.60170597", "0.60100305", "0.6009527", "0.60052776", "0.60052776", "0.600042", "0.5999317", "0.59933805", "0.5991528", "0.5991221", "0.5990094", "0.5979497", "0.5966058", "0.5958738", "0.59579456", "0.5957759", "0.5956938", "0.5951788", "0.59511644", "0.59423065", "0.59373474", "0.59361076", "0.59361076", "0.59331447", "0.5928005", "0.5924882", "0.5924011", "0.59169155", "0.5908037", "0.5907541", "0.59061426", "0.59056246", "0.5897408", "0.58960444", "0.58951247", "0.5893136", "0.5892312", "0.5890385", "0.58853275", "0.58801144", "0.58784765", "0.5872648", "0.58682626", "0.5867028", "0.58661693", "0.586578", "0.58643955", "0.5863193", "0.58609086", "0.5859997", "0.5858935", "0.5858632", "0.5853379", "0.5852741", "0.584806", "0.5847703" ]
0.0
-1
The following line would run the calculate function calculate(1,1)
def prompt_numbers puts "Give me a number" a = gets.chomp.to_f puts "Give me another number" b = gets.chomp.to_f return a, b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculation\n end", "def calculate\n (2 + 2) * 2\nend", "def calculate!\n calculate_amount\n calculate_fee\n calculate_insurance\n calculate_deposit\n end", "def calculate(a,b,c)\n s = a * b* c \n end", "def add(x,y)\n total = x + y\n puts total\n calculate(total)\nend", "def calculation(a,b, operation)\n operation.call(a,b)\n end", "def calculate(a,b)\n yield(a, b)\nend", "def calc(x)\n puts x*3\nend", "def calculation(a, b, &block) # &block is an explicit (named) parameter\n block.call(a, b)\nend", "def calculated; end", "def Calculate(x,y) do\n\n#to mam nam zwrocic dwa stringi latexowe, tablica whatever gotowe do druku\nend", "def calculate(num1, sym, num2)\n\tputs eval \"#{num1} #{sym} #{num2}\"\nend", "def compute(fdata)\n #print \"Jdu spocitat: \" + @calculate.to_s + \"\\n\"\n @calculator.evaluate(@calculate)\n end", "def calculate_in_state(state, *args)\r\n with_state_scope state do\r\n calculate(*args)\r\n end\r\n end", "def calculate_for(*args, &block)\n send(type, *args, &block)\n end", "def recalculate\n end", "def calc(input)\n LexicalCalculator.calculate(input)\nend", "def recalculate\n\tend", "def calculate_product(a,b)\n a*b\nend", "def calculation(a, b)\n yield(a, b)\nend", "def perform()\n 2 + 2\n end", "def calculation(a, b)\n yield(a, b) # yield calls an implicit (unnamed) block \nend", "def _calc\n raise \"you have to imprement your _calc\"\n end", "def evaluate\n\n end", "def my_calculate(*params)\n\n puts \"\\nStarting....\"\n\n operations = {}\n operands = []\n\n \n params.reverse.each do |p|\n\n puts \"param p is #{p.inspect}. Its class is #{p.class}\"\n\n #determine what p is\n operations = p if p.is_a?(Hash)\n operands << p if p.is_a?(Fixnum)\n\n end\n\n # perform operations\n\n #check the default operation\n if operations.size == 0\n\n puts \"\\n Performing add... for default operation\"\n result = my_add(operands)\n puts \"Result is #{result}.\"\n\n else\n\n operations.each do | key, val|\n \n if val == true \n if key == :add\n puts \"\\n Performing add...\"\n result = my_add(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :subtract\n puts \"\\n Performing subtract...\"\n result = my_subtract(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :multiply\n puts \"\\n Performing multiply...\"\n result = my_multiply(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :divide\n puts \"\\n Performing divide...\"\n result = my_divide(operands)\n puts \"Result is #{result}.\"\n \n else\n puts \"Unknow operation #{key}. It is ignored.\"\n \n \n end\n end\n \n \n end\n end\n \nend", "def calculate\n \t@num1 = params[:num1].to_i\n \t@num2 = params[:num2].to_i\n\n \tif params[:addition] then\n @result = @num1 + @num2\n elsif params[:subtraction] then\n @result = @num1 - @num2\n elsif params[:multiplication] then\n @result = @num1 * @num2\n elsif params[:division] then\n @result = @num1/@num2\n else\n \trender \"errorhandling\"\n \tflash[:error] = \"Couldn't calculate!\"\n end\n \t\n end", "def single_input_calc\n puts \"What would you like to calculate? - enter first number then operator then second number.\"\n to_calc = gets.strip\n arr = to_calc.split\n first_num = arr[0].to_i\n op = arr[1].to_s\n second_num = arr[2].to_i\n string_result = first_num.public_send(op, second_num)\n puts \"The result is: #{string_result}\"\n @arr_results << {first_number: first_num, modifier: op, second_number: second_num, result: string_result}\n end", "def calculate calculation, *args, &block\n\t\toptions = args.extract_options!.dup\n\t\tscope_options = extract_scope_options_from options\n\t\tsource = source_with_applied_scopes(scope_options)\n\t\tsource = block.call(source, data_source.scopes) if block_given?\n\t\tsource.send *([calculation] + args + [options])\n\tend", "def calc(*args)\n calculate = args.join().gsub(/[^\\d()+\\-*\\/.]/, '')\n # eval() rescue nil will NOT work, because it only catches subclasses\n # of the StandardError class\n begin\n eval(calculate)\n rescue Exception => exc\n nil\n end\n end", "def calculate\n formula_map = FormulaMap.new(@data)\n\n formula_map.parameters.each do |ts, parameter|\n @results[ts] = @calculator.evaluate(@formula, parameter)\n end\n end", "def uberX_fare_calculator\nend", "def calculate(op, x, y)\n case op\n when 'plus'\n x.to_f + y.to_f\n when 'minus'\n x.to_f - y.to_f\n when 'divide'\n x.to_f / y.to_f\n when 'multiple'\n x.to_f * y.to_f\n end\nend", "def calculate(b=2, e)\n\t\treturn calculateRange(b, e)\n\tend", "def calculator(num1, num2)\n\treturn num1 + num2, num1 - num2, num1 * num2, num1 / num2\nend", "def run_calculator\n\n while calculate != \"exit\"\n calculate\n\n end\n\nend", "def calc()\n\tputs \"Calculator:\"\n\tcalculate = true\n\twhile calculate == true\n\t\tfirst_num = input_num()\n\t\tputs \"> #{first_num}\"\n\t\toperator = input_operator()\n\t\tputs \"> #{first_num} #{operator}\"\n\t\tsecond_num = input_num()\n\t\tputs \"> #{first_num} #{operator} #{second_num}\"\n\t\t\n\t\tif operator == \"+\"\n\t\t\tadd(first_num, second_num)\n\t\telsif operator == \"-\"\n\t\t\tsubtract(first_num, second_num)\n\t\telsif operator == \"*\"\n\t\t\tmultiply(first_num, second_num)\n\t\telsif operator == \"/\" && second_num == 0\n\t\t\tputs \"Division by zero is undefined\"\n\t\telsif operator == \"/\"\n\t\t\tdivide(first_num, second_num)\n\t\telse\n\t\t\tputs \"Error\"\n\t\tend\n\t\tcalculate = leave?()\n\tend\nend", "def sum(x, y)\n\nend", "def calculateStuff (a,b)\n yield a,b\nend", "def calculate(x, operator, y)\n\t# lots of ways to do the below part ...\n\t# if/elsif would have worked,\n\t# as would a case statement\n\treturn x + y if operator == '+'\n\treturn x - y if operator == '-'\n\treturn x * y if operator == '*'\n\treturn x / y if operator == '/'\nend", "def perform(*args); end", "def calculate(op1, operator, op2)\n\tstring = op1.to_s + operator + op2.to_s\n\n\t# operator is assumed to be a string; \n\t# make one big string of it and the two operands \n\teval(string) # evaluate and return a value - never use eval ! eval is EVIL lol \nend", "def calculate\n puts \"#{3+4} is equal to 7\"\n yield\n yield\n puts \"after this is block\"\n\nend", "def calculator_1(operator, num1, num2)\n # See exercise 36\nend", "def all(*args)\n multi_calc(args)\n end", "def call(*) end", "def call(*) end", "def summator(x, y)\n p x + y\nend", "def calculate operator, num1, num2\n puts \"#{num1} #{operator} #{num2} = #{num1.send(operator, num2)}\"\nend", "def total(a,b)\r\n return (a+b)\r\nend", "def compute( &math_func )\n math_func.call( 3, 5 )\nend", "def do_calculation\n index = 0\n total = 0.0\n\n num_list_length = num_list.length\n\n ( num_list_length - 1 ).times do | i |\n total = num_list[i].to_f if i == 0\n index = 0 if index == 4\n\n total = total.send(OPERATIONS[index], num_list[i+1].to_f)\n index = index + 1\n end\n\n total\n end", "def main\n\n\tnum_mult\n\nend", "def process_result(new_result)\n self.result = new_result\n calculate\n end", "def call() end", "def read_and_calculate\n puts 'Insert the equation'\n entry = gets.chomp\n result = calculate(entry)\n puts result\n end", "def calculate(integer, operator, integer1)\n\tif operator == \"+\"\n\t\tp integer + integer1\n\telsif operator == \"-\"\n\t\tp integer - integer1\n\telsif operator == \"*\"\n\t\tp integer * integer1\n\telsif operator == \"/\"\n\t\tp integer / integer1\n\telse\n\t\tp \"I'm sorry that's not a valid equation!\"\n\t\t\n\tend\nend", "def calculate\n @equations = self.class.permutate(@inputs, @operators)\n @results = {}\n @equations.each do |eq|\n @results[eq] = eval(eq)\n end\n end", "def arithmetic2(a, b)\nend", "def calculate(value,operation)\n check_calculation_requirements(value)\n calculation_requirements.map do |requirement|\n send(requirement).send(operation,value.send(requirement))\n end\n end", "def eval(*args); end", "def calculate(starting_value, operations)\n sum = starting_value\n operations.each do |ops|\n operator = ops[0]\n operand = ops[1]\n \n case operator\n when '+'\n sum += operand \n when '-'\n sum -= operand\n when '*'\n sum *= operand\n when '/'\n sum /=operand\n else \n end\n end \n sum \nend", "def test_it_can_average\n calc = Calculator.new\n numbers1 = [1, 2, 3, 4, 5]\n numbers2= [2, 3, 4]\n\n\n #can also call result actual\n result1 = calc.total (numbers)\n result2 = calc.total(numbers2)\n result3= calc.average([0,10])\n\n assert_equal 15, expected1\n assert_equal 9, expected2\n assert_equal 7, expected1\n assert_equal 3, expected2\n\nend", "def math_problem(num1, num2)\n p \"I am solving this hard math problem\"\n return num1 + num2\n p num1 - num2 #this won't get executed\nend", "def calculate(operator, num1, num2)\n # Use case when to invoke each method\n case operator\n when \"add\", \"+\"\n puts \"#{num1} + #{num2} = #{add(num1, num2)}\"\n # Do I need a return here\n when \"subtract\", \"-\"\n puts \"#{num1} - #{num2} = #{subtract(num1, num2)}\"\n when \"multiply\", \"*\"\n puts \"#{num1} * #{num2} = #{multiply(num1, num2)}\"\n when \"divide\", \"/\"\n puts \"#{num1} / #{num2} = #{divide(num1, num2)}\"\n when \"modulo\", \"%\"\n puts \"#{num1} % #{num2} = #{mod(num1, num2)}\"\n when \"exponify\", \"**\"\n puts \"#{num1}^#{num2} = #{exponify(num1, num2)}\"\n end\nend", "def my_math_method(num1, num2)\n number = num1 + num2\n puts number\nend", "def eval\n execute\n end", "def my_math_method(num1, num2)\n sum = num1 + num2\n\tputs \"The sum of 2 + 2 is #{sum}\"\nend", "def multiply(x,y)\n x*y\nend", "def multiply(x,y)\n x*y\nend", "def multiply(x,y)\n x*y\nend", "def sum(x,y)\n return x + y\nend", "def my_math_method(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend", "def my_math_method(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend", "def calculate( op, a1, a2 = nil )\n case op\n when :abs; a2\n when :rel; a2\n when :mul; a1 * a2\n when :add; a1 + a2\n when :sub; a1 - a2\n when :inv; a1 * -1\n else 0\n end\n end", "def my_math_method(num1, num2)\n number = num1 + num2\n puts number\nend", "def calculate( a, operator, c )\n\tif operator == \"+\"\n\t\ta + c\n\telsif operator == \"-\"\n\t\ta - c\n\telsif operator == \"*\"\n\t\ta * c\n\telsif operator == \"/\"\n\t\ta/c\n\t\t\n\tend\n\t\nend", "def multiplier(num1, num2)\nnum1 * num2\nend", "def multiplier(num1, num2)\nnum1 * num2\nend", "def multiply (x,y)\n return x * y\nend", "def calculate\n self.total\n end", "def calculate number\n @left_operand = number\n\n return result()\n end", "def total(num1, num2)\n num1 + num2\nend", "def arithmetic1(n)\r\r\n n * 5 - 20\r\r\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n\nend", "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n\nend", "def calculator(operator, *numbers)\n result = 0\n if operator == \"*\"\n result = 1\n else\n result = numbers[0]\n numbers.shift\n end\n\n numbers.each do |arg|\n #result = arg operator.send result\n result = result.send(operator,arg)\n end\n return result\nend", "def in(function)\n eval(\"firstresult = 1.#{function}; self/firstresult\")\n end", "def solveMeFirst(a, b) {\n a+b;\nend", "def call(*args); end", "def multiply(x,y)\n x * y\nend", "def multiply(x,y)\n x * y\nend", "def multiply_numbers(first_num, second_num, third_num)\r\n\tproduct = first_num * second_num * third_num\r\n\tputs \"inside the method #{product}\"\r\nend", "def multiply(number_one, number_two)\nnumber_one * number_two\nend", "def calc_sum_two(first, second)\n\n puts \"the sum of #{first} and #{second} is #{first + second}\"\n\nend", "def perform\n multiples_3_and_5()\nend", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end" ]
[ "0.74688274", "0.74355286", "0.7231579", "0.70753103", "0.69653946", "0.6760296", "0.6726776", "0.6715163", "0.6704213", "0.6692412", "0.667871", "0.66573507", "0.662741", "0.6613849", "0.66029924", "0.65868723", "0.6584611", "0.6552796", "0.6539509", "0.6469822", "0.6452766", "0.6409857", "0.636218", "0.63599956", "0.6335918", "0.6302634", "0.62748903", "0.62556016", "0.6218578", "0.61948776", "0.6187775", "0.61774266", "0.6148558", "0.6136073", "0.61138165", "0.6097269", "0.6084963", "0.6082907", "0.6067987", "0.6033827", "0.60142404", "0.6012594", "0.6011491", "0.6009264", "0.60070235", "0.60070235", "0.60042006", "0.5994215", "0.59891075", "0.5988451", "0.5974261", "0.5973368", "0.5970212", "0.5966341", "0.5956338", "0.5953008", "0.5940354", "0.5919902", "0.59073484", "0.59049666", "0.58990467", "0.58754134", "0.58668506", "0.5850403", "0.58483136", "0.5838283", "0.5833215", "0.58320373", "0.58320373", "0.58320373", "0.5831308", "0.5827608", "0.5827608", "0.5817126", "0.5814949", "0.5811707", "0.5805691", "0.5805691", "0.5802434", "0.5799797", "0.57930833", "0.57851934", "0.578481", "0.578243", "0.578243", "0.57761645", "0.57722735", "0.5765064", "0.5765064", "0.5756407", "0.5756407", "0.57501584", "0.57483816", "0.57482797", "0.5747684", "0.57471436", "0.57471436", "0.57471436", "0.57471436", "0.57471436", "0.57471436" ]
0.0
-1
This function runs two other functions that prompt the user for input
def prompt function = prompt_function a, b = prompt_numbers return a, b, function end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_input(prompt); end", "def another_function()\n prompt = '@#$!%'\n print \"How old are you? \"\n print prompt\n age = $stdin.gets.chomp\n print \"How tall are you? \"\n print prompt\n height = $stdin.gets.chomp\n print \"How much do you weight?\"\n puts prompt\n weight = $stdin.gets.chomp\n print \"So, you are #{age} years old.\\nWeigh #{weight} pounds,\\nand #{height} inches tall\"\nend", "def get_user_input(prompt)\n print \"#{prompt}: \"\n gets.chomp\nend", "def ask_input\n\t\tputs \"where do you want to go ? N, S, W, E\"\n\t\tuser_input = gets.chomp\n\tend", "def fetch_input(prompt)\n\tprint prompt\n\tgets.chomp #implicit return again\nend", "def ask_for(detail)\n puts \"Enter #{detail}\"\n STDIN.gets.chomp \nend", "def user_input\n\tgets\nend", "def prompt_and_get_input_from_user\n prompt_user\n input = $stdin.readline.strip\nend", "def prompt(question)\n puts question\n gets.chomp\nend", "def get_input(prompt)\n #get a message to display to the user and return the entered value\n print prompt\n gets.chomp\nend", "def fetch_input(question_to_user)\n print question_to_user\n gets.chomp # return not needed\nend", "def prompt; end", "def prompt; end", "def prompt; end", "def prompt; end", "def prompt_function\n puts \"Add, subtract, multiply, divide?\"\n return gets.chomp.downcase #returns answer to above Q for: def prompt\nend", "def prompt(arg)\n puts(arg)\n gets.chomp\nend", "def prompt_input\n class_invariant\n print ps1\n command = gets.chomp\n class_invariant\n return command\n end", "def initial_prompt\n puts \"How would you like to explore?\"\n puts \"---------------------------------\"\n puts \"\"\n puts \"1) Search by Year\"\n puts \"2) Search by production title\"\n puts \"\\n\\t ** or type Exit **\"\n input = gets.strip.downcase\n case input\n when \"exit\"\n goodbye\n when \"1\"\n year_search\n when \"2\"\n production_search\n else \n unclear\n end\n end", "def user_input\n gets.chomp\nend", "def user_input\n gets.chomp\nend", "def user_input\n user_input = gets.chomp\nend", "def user_input\n puts \"Let's play rock, paper, scissors\"\n gets.chomp\nend", "def ask( prompt )\n print prompt\n gets.chomp\nend", "def input(thing)\n print \"Enter #{thing}: \"\n gets.chomp\nend", "def ask_user_for(something)\n # Print question asking for the name, price, or something else\n puts \"What is the #{something.capitalize}?\"\n print \"> \"\n # return the user´s input\n return gets.chomp\n end", "def asks_question(question)\n puts question\n gets.chomp\nend", "def get_user_input\n gets.chomp\nend", "def get_user_input\n gets.chomp\nend", "def list_or_continue_prompt\n puts \"For list, enter: 'list' ! To continue adding user, press enter! Type 'menu' to go back to the menu!\".center(50)\n answer = STDIN.gets.chomp\n if answer.downcase == \"list\" ; return student_list_print(@students) end\n if answer.downcase == \"menu\" ; return interactive_menu end\n put_in_user\nend", "def ask_for_user_input(msg=nil, opts={})\n print msg if msg\n print \": \"\n STDOUT.flush\n if opts[:password]\n system \"stty -echo\"\n result = STDIN.gets\n system \"stty echo\"\n puts\n else\n result = STDIN.gets\n end\n result.chomp\nend", "def prompt\n print \"=> \"\n gets.chomp\nend", "def get_user_input\n\n\tputs \"What is your name\"\n\t@name = gets\n\tputs \"You are about to enter the world of wrestling, if you want to step foot in it then you will be remembered with your ring name, not as #{@name}\"\n\tputs \"So speaking about ring names, What is your Ring name?\"\n\t@ring_name = gets\n\tputs \"A catchphrase is a thing that you like to say?\"\n\tputs \"What is your catchphrase?\"\n\t@catchphrase = gets\n\tputs \"What is your insult?\"\n\t@insult = gets\n\tputs \"What is your theme song\"\n\t@theme_song = gets\n\tputs \"What are the lyrics of your theme song\"\n\t@lyrics_of_theme_song = gets\n\tputs \"The Indie Circuit is where most people start, if you get promoted to the big leagues maybe you need to change your gimmick.\"\n\tputs \"If you decide to be in the Indies, What will the company be called?\"\n\t@company_indies = gets\n\tputs \"The big leagues are the places where very few people start, it is the main place of wrestling\"\n\tputs \"If you decide to be in the big leagues, you can choose either real or fictional companies, what will the fictional one be called?\"\n\t@company_big_leagues = gets\n\tputs \"If you want to be in a team, what will it be called. if you want to be a singles competitor then just put enter and select\n\tthe choice that you don't want to be in a tag team.\"\n\t@team_name = gets\n\tputs \"Who is your partner, just put a random name if you dont want to be in the tag team\n\tand do the same thing as the last question told you.\"\n\t@partner_tag_first = gets\n\tputs \"Getting back to the fictional company, what will your boss be called?\"\n\t@boss_name = gets\n\tputs \"who is the interviewer for the indies?\"\n\t@interviewername = gets\n\tputs \"If you are a heel during your debut in indies or big leagues, who will be your rival?\"\n\t@rival_name = gets\n\tputs \"but If you are a face during your debut in the indies or big leagues, who will be your rival?\"\n\t@rival_name_face = gets\n\tputs \"Ok so lets get to the story\"\n\n\nend", "def prompt\n puts \"Enter a number or bye\"\nend", "def get_user_input\n user_input_valid gets.chomp\n end", "def user_input\n input = gets.chomp\n end", "def get_user_input\n input = gets.chomp\n #input\nend", "def put_in_user\n #setting variables\n name, cohort, city, hobby = placeholder\n #prompting the user for input and receiving it\n puts \"Hey there, type your name\".center(50)\n name = STDIN.gets.chomp\n\n puts \"Put your cohort\".center(50)\n cohort_input = STDIN.gets.chomp\n cohort = cohort_input.downcase\n\n puts \"Put your city\".center(50)\n city = STDIN.gets.chomp\n\n puts \"Put your hobby\".center(50)\n hobby = STDIN.gets.chomp\n\n validation_of_user_input(name, cohort, city, hobby)\n\nend", "def createnewuser_prompt\n header\n puts \"\\n\\nPlease enter a username.\\n\"\n self.createnewuser_input = STDIN.gets.strip\n self.createnewuser_valid?\nend", "def user_input\n puts \"Do you often play video-games? (yes/no)\"\n print '> '\n frequency = gets.chomp.downcase\n if frequency == \"yes\"\n begin \n puts \"How many hours a week on average do you think you have played video-games in the past month?\"\n @weekly_playtime = Integer(gets.chomp)\n #integer part of kernel module - can be called anywhere on a file, can be called on a particular thing. will try to convert to_int then to_i if that fails. \n if weekly_playtime == 0\n puts \"Please be realistic, you did play video games.\"\n exit \n end \n rescue ArgumentError \n puts \"Error! please type a whole number!\"\n retry \n end \n elsif frequency == \"no\"\n puts \"Are you using a stick to press the keys while you're up on your high horse!?\"\n exit\n else \n puts \"Error! Try again with yes or no!\"\n user_input \n end \n end", "def user_prompt\n print \"(or \\\"add\\\" or \\\"exit\\\"): \"\n user_input = gets.chomp.downcase\n return user_input\nend", "def prompt(input)\n Kernel.puts(\"=> #{input}\")\nend", "def prompt_user\n puts \"Type 'h' to hit or 's' to stay\"\nend", "def prompt_user\n puts \"Type 'h' to hit or 's' to stay\"\nend", "def prompt_user\n puts \"Type 'h' to hit or 's' to stay\"\nend", "def query_user(user_prompt = 'Please enter a string: ', input_type = 'string')\n user_input = nil\n print user_prompt\n loop do\n user_input = gets.chomp\n case input_type\n when 'yesno'\n user_input = 'y' if user_input == 'Y' #give user some slack\n user_input = 'n' if user_input == 'N'\n return user_input if valid_yesno?(user_input)\n print \"Regrettably, a binary choice (\\'y\\' or \\'n\\') is required: \"\n when 'char'\n return user_input if valid_char?(user_input)\n print \"Sorry, single standard characters only. Please try again: \"\n when 'string'\n return user_input if valid_string?(user_input)\n print \"Sorry, standard keyboard characters only. \\nPlease try again: \"\n when 'int'\n return user_input.to_i if valid_int?(user_input)\n print 'Sorry, an integer is required. Try again: '\n when 'float'\n return user_input.to_f if valid_float?(user_input)\n print 'Sorry, a float is required. Try again: '\n else\n abort('Application Error: Improper input_type provided to query_user')\n end #case\n end #do\nend", "def ask(question)\n puts question\n gets.chomp\nend", "def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend", "def get_student_name\n puts \"\\nPlease enter the first names of the students\"\n puts \"(To finish, just hit return twice)\\n \"\n # get the first name\n STDIN.gets.chomp\nend", "def ask_user\n\tprint \"User: \".blue\n\tgets.chomp\nend", "def input_students\n puts \"Please enter the student's information\"\n puts \"When you're done entering information, just hit return twice\"\n while true\n name = ask_question(\"Enter full name: (hit enter if you've finished entering students)\")\n break if name.empty?\n cohort = ask_question(\"Enter cohort (e.g. 'February 2016'):\",'September 2016')\n hobby = ask_question(\"Enter main hobby:\",'n/a')\n location = ask_question(\"Enter location:\",'n/a')\n check_current_student_info(name,cohort,hobby,location)\n end\nend", "def prompt_user\n puts \"Type \\'h\\' to hit or \\'s\\' to stay\"\nend", "def get_input\n\t\tinput_given = gets.chomp\n\t\treturn nil if input_given == \"\"\n\t\tputs \"You entered '#{input_given}', are you happy with that? Y or N\"\n\t\tconfirmation = gets.chomp\n\t\twhile confirmation.upcase == 'N'\n\t\t\tputs \"Please re-enter\"\n\t\t\tinput_given = gets.chomp\n\t\t\tputs \"You entered '#{input_given}', are you happy with that? Y or N\"\n\t\t\tconfirmation = gets.chomp\n\t\tend\n\t\tinput_given\n\tend", "def prompt_action \n puts \"You have six options: list users, list channels, select user, select channel, display details, send message, or quit.\"\n puts \"\\n\"\n print \"Please enter your choice: \"\n return gets.chomp.downcase\nend", "def get_user_input\n puts\n puts \"Type your question below or select from the following:\"\n puts\n puts \"1) Type Q to exit program\"\n puts\n puts \"2) Type P to print all answers\"\n puts\n puts \"3) Type R to reset answers to originals\"\n puts\n puts \"4) Type A to add your own answers to the originals\"\n puts\n question = gets.strip.to_s.downcase\n puts\n handle_user_input(question)\n end", "def prompt_user(message)\n puts message\n print \">> \"\n gets.chomp\nend", "def ask()\n puts 'Do you like eating tacos? (y or n)'\n input = gets.chomp\n if input == 'y'\n print 'We can be friends!'\n return\n end\n if input == 'n'\n print 'Get out of my sight!'\n return\n end\n puts 'Try again'\n ask()\nend", "def user_answer\n $stdout.print('>> ')\n $stdin.gets.chomp\nend", "def action_0\nputs \"Are you ready to start a new game?\\n [ Y ] [ N ]\"\n user_input = gets.chomp.downcase\n if user_input == \"y\"\n action_1\n elsif user_input == \"n\"\n puts \"\\nSmart decision! Come back later :)\\n\\n\"\n exit\n else\n nil\n end\nend", "def prompt_user_song\n puts \"Please enter a song name or number:\"\nend", "def prompt(label)\n print \"#{label}: \"\n STDIN.gets\nend", "def prompt(states, cities)\n puts \"Would you like to add a city, add a state, or list all cities and states?\"\n puts \"1. City\\n2. State\\n3. List cities and states\\n4. No\"\n print \"\\n>\"\n response = $stdin.gets.chomp\n answer = response.downcase.strip\n if answer == \"1\"\n addcity(states, cities)\n elsif answer == \"2\"\n addstate(states, cities)\n elsif answer == \"3\"\n puts \"Here are the states\"\n Dict.list(states)\n puts \"Here are the cities\"\n Dict.list(cities)\n prompt(states, cities)\n elsif answer == \"4\"\n puts \"Goodbye!\"\n exit(0)\n else\n puts \"Please type either 1, 2, or 3\"\n prompt(states, cities)\n end\nend", "def prompt\n gets.strip\nend", "def userlogin_prompt\n header\n puts \"\\n\\nPlease enter your username to login.\\n\"\n self.userlogin_input = STDIN.gets.strip\n self.userlogin_valid?\nend", "def ask_for_(thing)\n puts \"What's the #{thing}?\"\n gets.chomp\n end", "def ask message\nprint message\nSTDIN.gets.chomp\nend", "def ask_user_for(something)\n puts \"What is the recipe #{something} ?\"\n return gets.chomp\n end", "def get_user_input\n puts \"\n What is your weekly income after tax?\n This can be pay from a job or even rent\n from a rental property you own\n Please enter a number.\".colorize(:light_blue)\n income = gets.chomp.to_f\n puts \"\n What is your weekly rent or morgage repayments? Please enter a number.\".colorize(:light_blue)\n rent = gets.chomp.to_f\n puts \"\n How much do you spend on groceries each week? Please enter a number.\".colorize(:light_blue)\n groceries = gets.chomp.to_f\n puts \"\n How much do you spend on insurance?\n Such as health insurance or pet \n insurance.\n Please enter a number.\".colorize(:light_blue)\n insurance = gets.chomp.to_f\n puts \"\n How much do you spend on recreation weekly?\n This can include going to the movies,\n having beers, getting a coffee in the\n morning and also subscriptions such as\n Netflix, Stan or Amazon Prime.\n Please enter a number.\".colorize(:light_blue)\n recreation = gets.chomp.to_f\n puts \"\n How much do you spend on utilities each week?\n utilities include Gas and Electricity, internet and\n phone bills.\n Please enter a number.\".colorize(:light_blue)\n utilities = gets.chomp.to_f\n puts \"\n How much do you spend on transport each week?\n some examples are public transport fees or\n petrol for the car.\n Please enter a number.\".colorize(:light_blue)\n transport = gets.chomp.to_f\n puts \"\n How much do you spend on fitness each week?\n This refers to gym memberships or even the\n purchase of protein powder and shakes.\n Please enter a number.\".colorize(:light_blue)\n fitness = gets.chomp.to_f\n puts \"\n How much do you spend on your children each week?\n Most of your childrens expenses will be included in\n the other categories, but this section is for extras.\n Such as, excursion fees.\n Please enter a number.\".colorize(:light_blue)\n children = gets.chomp.to_f\n return income, rent, groceries, insurance, recreation, utilities, transport, fitness, children\nend", "def user_input\n print '>> '.yellow\n case raw_input = gets.chomp\n when 'c', 'cancel' then tell_user \"\\n\";raise ProgramExceptions::Cancel.new\n else\n tell_user \"\\n\"\n return raw_input\n end\n rescue => error\n raise ProgramExceptions::Exit.new if\\\n error.class == ProgramExceptions::Exit ||\n (defined?(IRB) && error.class == IRB::Abort)\n raise error\n end", "def showMainMenu\r\n #clear user input field\r\n @userInput = \"\";\r\n #display main menu respond to user and wait for response\r\n @userRespone = \"Welcome To Voter Simulation! \\n\\nWhat would you like to do?\\n(C)reate, (L)ist, (U)pdate, (D)elete or (E)xit\"\r\n puts @userRespone;\r\n @userInput = gets.chomp;\r\n #call check user input after coming out of the loop\r\n checkUserInput();\r\n end", "def prompt(input)\n print \"#{input}: \".yellow\n STDIN.gets.chomp\n end", "def ask_meal_name \n prompt = TTY::Prompt.new\n what_is_the_name\n meal_name = prompt.ask(\"What is the name of your meal?\")\n your_meal(meal_name)\n return meal_name\nend", "def users_planet\n\n puts \"Please enter the name of your planet.\"\n user_planet_name = gets.chomp\n\n puts \"Please enter its volume.\"\n user_planet_volume = gets.chomp\n\n puts \"Is your planet solid?\"\n user_planet_solid = gets.chomp\n\n puts \"Please enter its diameter.\"\n user_planet_diameter = gets.chomp\n\n puts \"Please enter the time it takes to orbit its sun.\"\n user_planet_orbit_time = gets.chomp\n\nend", "def prompt(instructions)\n \n def decorate(instructions)\n '-' * (instructions.length + 2) \n end\n\n \n # Output instructions with borders \n puts decorate(instructions)\n puts \"|#{instructions}|\\n\"\n puts decorate(instructions) \n \n # flush buffer if not sync\n STDOUT.flush unless STDOUT.sync\n \n \n # getting user input and removing ending returnss and returning the input\n gets.chomp\n \nend", "def prompt( message )\n\tprint message\n\tgets.chomp\nend", "def prompt(message)\n print message\n gets.chomp\nend", "def ask(question, a, b)\n print \"#{question} (#{a}/#{b})> \"\n r = $stdin.gets.strip\n\n 4.times do\n unless r == a or r == b\n print \"\\nPlease type '#{a}' or '#{b}': \"\n r = $stdin.gets.strip\n end\n end\n\n unless r == a or r == b\n abort EXIT_MSG\n end\n\n r\nend", "def get_user_input\n puts 'Welcome to Google Books Searcher'\n puts 'Enter a search term:'\n gets.chomp\nend", "def prompt_user\n puts \"Please type in a path:\"\nend", "def prompt\n print yield\n gets.chomp\nend", "def prompt\n puts \" \"\n puts \"Welcome to the Simple Calculator!\"\n puts \"=================================\"\n puts \"Okay, let's calculate two numbers:\"\nend", "def prompt (name)\n puts \"What is your name?\"\n name = gets\n puts \"Hello #{name}!\"\n end", "def ask_name\n puts \"What's your name?\"\n gets.chomp\nend", "def gets_user_input\n puts \"We can help you find haunted hotels near you!\"\n puts \"Enter a location to get started:\"\n location = gets.chomp\nend", "def prompt(msg)\n print \"#{msg}: \"\n gets.chomp\nend", "def prompt(msg)\n print \"#{msg}: \"\n gets.chomp\nend", "def method_that_calls_the_other_methods\n puts \"Do you Want to run the keyboard_line method(use y for yes or n for no)\"\n input = gets.chop\n if (input == 'y') \n keyboard_line\n else\n puts \"No method was ran\"\n end\n\n puts \"Do you Want to run the rest of the methods\"\n input = gets.chop\n if (input == 'y')\n is_it_a_big_number\n hello_there\n get_info_from_user\n\n else\n puts \"the other methods were not ran\"\n end\nend", "def prompt_greeting(namehere)\n print(namehere)\n gets\nend", "def prompt_numbers\n puts \"give me a number\"\n a = gets.chomp.to_f\n puts \"give me another number\"\n b = gets.chomp.to_f\n return a, b\nend", "def inputLoop\r\n defaultInfo\r\n printCommands\r\n puts 'Your input:'\r\n input = gets.chomp\r\n while input != 'q'\r\n\r\n if input == 's'\r\n # puts 's selected.'\r\n resolveS\r\n elsif input[0] == 'u'\r\n resolveU(input)\r\n\r\n elsif input == 'v'\r\n resolveV\r\n\r\n elsif input[0] == 'c'\r\n #puts 'c selected.'\r\n resolveC(input)\r\n\r\n\r\n elsif input == 'b'\r\n #puts 'b selected.'\r\n resolveB\r\n elsif input == 'f'\r\n #puts 'f selected.'\r\n resolveF\r\n\r\n elsif input == 'q'\r\n #puts 'q selected. exiting program.'\r\n exit\r\n elsif input == 'z'\r\n defaultInfo\r\n else\r\n puts 'input unknown. try again.'\r\n end\r\n printCommands\r\n puts 'Your input:'\r\n input = gets.chomp\r\n end\r\n\r\n end", "def prompt(message)\n\tprint messaage\n\tgets.chomp # implicit return\nend", "def prompt(message)\n\tprint message\n\tgets.chomp\nend", "def do_manual\n display_world\n puts \"Press enter to continue\"\n STDOUT.flush\n input = STDIN.gets.chomp\n if input == \"quit\" or input == \"exit\"\n exit\n end\n end", "def prompt(msg)\n puts \" => #{msg}\"\n gets.chomp\nend", "def prompt\n\tputs \"Any Key to continue\"\n\tgets\nend", "def ask(prompt)\n print \"#{prompt}: \"\n $stdin.gets.chomp\n end", "def prompt(string)\n puts \"=> #{string}\"\n gets.chomp\nend", "def get_input\n\t#Get input from the user.\n return gets.chomp\nend", "def prompt_for_first_name\n puts \"Enter a first name:\"\n @firstname = gets.chomp\nend", "def query_user\n puts 'First, pick one:'\n puts '1. Get a user\\'s followers'\n puts '2. Get a user\\'s friends'\n step2 = gets\n case step2.strip\n when \"1\"\n find_followers\n @unique_user_ids = @followers - @my_friends\n puts \"There are #{@unique_user_ids.size} unique users that you don't follow\"\n follow_or_favorite\n when \"2\"\n find_friends\n @unique_user_ids = @friends - @my_friends\n puts \"There are #{@unique_user_ids.size} unique users that you don't follow\"\n follow_or_favorite\n else\n puts \"Sorry, that is not acceptable input, try again.\"\n $stdout.flush\n step1 = gets\n query_user\n end\nend" ]
[ "0.7458676", "0.7297848", "0.7268164", "0.7191035", "0.71856666", "0.7178354", "0.71561", "0.7130122", "0.7125505", "0.7123631", "0.71206594", "0.7100177", "0.7100177", "0.7100177", "0.7100177", "0.70945466", "0.7042461", "0.7015035", "0.70139223", "0.69977903", "0.69977903", "0.69973296", "0.69956344", "0.6988457", "0.69691277", "0.69644094", "0.6956357", "0.69519883", "0.69519883", "0.6951918", "0.69496065", "0.69401985", "0.6936931", "0.6927538", "0.69271356", "0.6912086", "0.6892065", "0.68863857", "0.6881351", "0.687959", "0.687817", "0.6878164", "0.68699515", "0.68699515", "0.68699515", "0.6867719", "0.6861091", "0.68608254", "0.6856207", "0.6854676", "0.6834533", "0.68288815", "0.6828865", "0.6827813", "0.6815814", "0.6815354", "0.68151826", "0.6810208", "0.6799299", "0.6797059", "0.67940617", "0.6793528", "0.6787263", "0.67869794", "0.6780968", "0.67679214", "0.6766614", "0.6765482", "0.67423004", "0.6737859", "0.6736729", "0.67259437", "0.67252994", "0.6724971", "0.6720931", "0.67197275", "0.66996163", "0.6698119", "0.66980493", "0.6697304", "0.6696823", "0.66924924", "0.66923296", "0.6691377", "0.66905224", "0.66905224", "0.66839516", "0.66828483", "0.66792846", "0.6673833", "0.667262", "0.66658765", "0.66648954", "0.665747", "0.66567504", "0.6654972", "0.664887", "0.6648573", "0.6643126", "0.6643072" ]
0.682595
54
Add param to filters
def add_filter_param(param, value) @mg_params[filter_param_name.to_sym][param] = value unless @mg_params[filter_param_name.to_sym].key?(param) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_filters(filters); end", "def add_filter\n @filter = true \n end", "def add_filter(filter)\n @filters << filter\n end", "def add_filter(filter_symbol)\n filters << filter_symbol\n end", "def add_filter(filter_argument = T.unsafe(nil), &filter_proc); end", "def to_param\n \"filter[#{name}]=#{value}\"\n end", "def Filter=(arg0)", "def add_facet_params(field, item)\n\t\tfilter(field).add(item).params\n\tend", "def add_filter(filter)\n @filters << filter\n self\n end", "def add_filter filter = nil, &block\n @filters.push( filter ) unless filter.blank?\n @filters.push( block ) if block_given?\n end", "def filter_parameters; end", "def filter_parameters; end", "def search_adding_filter(condition,value)\n conditions = params.dup[:conditions] || {}\n\n if PLURAL_FILTERS.include?(condition)\n conditions[condition] ||= []\n conditions[condition] << value\n else\n conditions[condition] = value\n end\n params.except(:quiet, :all, :facet).recursive_merge(:page => nil, :action => :show, :conditions => conditions)\n end", "def param_filter *args, **kwds, &blk\n if blk\n ParamFilter.with_block( self, *args, **kwds, &blk )\n else\n ParamFilter.with_methods( self, *args, **kwds )\n end\n end", "def filter_parameters=(_arg0); end", "def filter_parameters=(_arg0); end", "def filter(type, &b)\n @app.filters[type] << b\n end", "def register_filter(mod); end", "def set_filter(opts)\n opts = check_params(opts,[:filters])\n super(opts)\n end", "def parameters_to_filter\n @parameters_to_filter ||= []\n end", "def permitted_filter(params, key)\n params[key] = self[key] if has_key? key\n end", "def filters=(_arg0); end", "def filters=(_arg0); end", "def apply_filter\n end", "def filter\n params['filter_field'] || '*'\n end", "def add_filter(type, &block)\n filters[type] << block\n end", "def _add_filter(where, method_or_filter, options, block)\n self.filters[where] << [method_or_filter, options, block]\n end", "def add_filter(filter)\n @filters <<\n if filter =~ /\\./\n filter\n else\n \"solr.#{filter}FilterFactory\"\n end\n end", "def add_filters\n add_term_filters\n add_terms_filters\n add_range_filters\n end", "def add_filter(name, &block)\n raise ArgumentError, \"Expected block to be given\" if block.nil?\n\n @filters[name] = block\n end", "def filter_params\n params.require(:filter).permit(:name, :description, :opt_in)\n end", "def filters=( args )\n @filters.clear\n add_filters(*args)\n end", "def add_filter(name, assertion, equals)\n @filters << Filter.new(name, assertion, equals)\n end", "def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end", "def global_filter=(_arg0); end", "def add_filter(filter)\n @filters = (@filters << filter).sort_by do |f|\n f.respond_to?(:weight) ? f.weight : DEFAULT_WEIGHT\n end.reverse!\n end", "def register(params)\r\n @filter_field = params[\"filter\"]\r\n @return_field = params[\"return\"]\r\nend", "def filter(field, value)\n @filters << [field, value]\n @loaded = false\n self\n end", "def add_requirement( filter )\n\t\t\t@filterlist << filter\n\t\tend", "def register_filter(mod)\n StrainerFactory.add_global_filter(mod)\n end", "def also_use_rack_params_filters\n if cgi_data\n @params_filters ||= []\n @params_filters += cgi_data['action_dispatch.parameter_filter'] || []\n end\n end", "def register_filter(mod)\n Strainer.global_filter(mod)\n end", "def filter\n params[:filter] ? params[:filter] : \"active\"\n end", "def set_filter_to_newsfeed\n params[:filter] = 'newsfeed'\n @filter = 'newsfeed'\n end", "def filter_params\n params.require(:filter).permit(:title, :department, :user, :commit)\n end", "def filter_params\n params.fetch(:filter, {}).permit(:text, :type)\n end", "def filter_params\n params.require(:filter).permit(:name)\n end", "def filter(name, value=true)\n name = name.to_sym\n raise NameError, \":#{name} isn't in the defined filters\" unless @model.defined_filters.include? name\n new_filters = @options[:filters] + [[name, value]]\n\n chain_scope filters: new_filters\n end", "def parse_filters(params)\n if params['filters'].blank?\n Utilities::Geo::REGEXP_COORD.keys\n else\n params.permit(filters: [])[:filters].map(&:to_sym)\n end\n end", "def add_file_filter(file_filter)\n @filter_file = file_filter\n end", "def add_file_filter(file_filter)\n @filter_file = file_filter\n end", "def add_facet_params_and_redirect(field, item)\n new_params = filter(field).add(item).to_h\n\n # Delete any request params from facet-specific action, needed\n # to redir to index action properly.\n request_keys = blacklight_config.facet_paginator_class.request_keys\n new_params.extract!(*request_keys.values)\n\n new_params\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def filters\n end", "def filter_params\n params.require(:filter).permit(:name, :slug)\n end", "def add_filters(filters)\n filters.each do |field, value|\n Array(value).each { |v| add_filter(field, v) }\n end\n end", "def set_filter\n @filter = Filter.friendly.find(params[:id])\n end", "def set_filter(val)\n @filter = val\n build_path_query\n @filter\n end", "def filter\n @filter = params[:q]\n end", "def add_custom_search_filters(search); end", "def filter_params\n params.require(:filter).permit(:name, :brand, :description, :notes)\n end", "def filter_parameters\n if @filter_parameters\n @filter_parameters || []\n else\n defined?(Rails) && Rails.application.config.filter_parameters\n end\n end", "def raw_filter(param, sql:, query_param: nil, required: false, format_value: nil, array: false)\n param = param.to_sym\n raise ArgumentError, \"filter with param #{param} already defined\" if filters.key?(param)\n\n query_param ||= param.to_s.underscore\n format_value ||= ->(value, _opts) { value }\n filters[param] = Filter.new(param:, sql:, query_param:, required:, format_value:, array:)\n end", "def filter_method_params\n params.fetch(:filter_method, {})\n end", "def add_available_filter(field, options)\n @available_filters ||= ActiveSupport::OrderedHash.new\n @available_filters[field] = options\n @available_filters\n end", "def filter_params\n\t\treturn params[:voter].permit(:name_for_filter, :election_id_for_filter)\n\tend", "def add_condition(condition)\n @filter_list << condition\n end", "def filter_argument; end", "def filter_callback=(value)\r\n @filter = value\r\n end", "def define_filter(name, &block)\n filters[name.to_sym] = block\n nil\n end", "def named_filter; end", "def add_facet_params(field, item, source_params = params)\n\n if item.respond_to? :field\n field = item.field\n end\n\n facet_config = facet_configuration_for_field(field)\n\n value = facet_value_for_facet_item(item)\n\n p = source_params.dup\n p[:f] = (p[:f] || {}).dup # the command above is not deep in rails3, !@#$!@#$\n p[:f][field] = (p[:f][field] || []).dup\n\n if facet_config.single and not p[:f][field].empty?\n p[:f][field] = []\n end\n \n p[:f][field].push(value)\n\n if item and item.respond_to?(:fq) and item.fq\n item.fq.each do |f,v|\n p = add_facet_params(f, v, p)\n end\n end\n\n p\n end", "def filter_params\n params[:f] || {}\n end", "def add(name, filter_dsl)\n filter = @f.translate(filter_dsl)\n filter[:name] = name\n @f.add(filter)\n end", "def filter(filter)\n @filters << CGI.escape(filter)\n self\n end", "def advancedsearch\n params[:filter] = true;\n end", "def addfilter( newfilter )\n if not subfilter\n @subfilter = newfilter\n else\n subfilter.addfilter( newfilter )\n end\n return self\n end", "def add_facet_params(field, item, source_params = params)\n\n if item.respond_to? :field\n field = item.field\n end\n\n facet_config = facet_configuration_for_field(field)\n\n value = facet_value_for_facet_item(item)\n\n p = reset_search_params(source_params)\n p[:f] = (p[:f] || {}).dup # the command above is not deep in rails3, !@#$!@#$\n p[:f][field] = (p[:f][field] || []).dup\n\n if facet_config.single and not p[:f][field].empty?\n p[:f][field] = []\n end\n\n p[:f][field].push(value)\n\n if item and item.respond_to?(:fq) and item.fq\n item.fq.each do |f,v|\n p = add_facet_params(f, v, p)\n end\n end\n\n p\n end", "def filter(name, function)\n filters = (self.model.design_doc['filters'] ||= {})\n filters[name.to_s] = function\n end", "def custom_filters(scope)\n scope\n end", "def add_facet_params(field, item, source_params = params)\n\n if item.respond_to? :field\n field = item.field\n end\n\n facet_config = facet_configuration_for_field(field)\n\n value = facet_value_for_facet_item(item)\n\n p = reset_search_params(source_params)\n p[:f] = (p[:f] || {}).dup # the command above is not deep in rails3, !@#$!@#$\n p[:f][field] = (p[:f][field] || []).dup\n\n if facet_config.single and not p[:f][field].empty?\n p[:f][field] = []\n end\n \n p[:f][field].push(value)\n p[:f][field].uniq!\n\n if item and item.respond_to?(:fq) and item.fq\n item.fq.each do |f,v|\n p = add_facet_params(f, v, p)\n end\n end\n\n p\n end", "def filtered_parameters; end", "def filter_params\n params.require(:filter).permit(:template, :name, :code)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def filter(name, &block)\n @filters[name.to_s] = block\n end", "def add_attribute filter, action\n @attributes[filter] << action\n end", "def anonymous_filter_params\n p = params.required('payload')\n # p.permit!('controls_params')\n # p.permit!('columns_params')\n # p.permit!('sorting')\n # p.permit!('global_config')\n p.permit(\n 'name',\n 'controls_list' => [],\n 'controls_hl_mode' => [],\n 'controls_params' => {},\n 'columns_list' => [],\n 'columns_params' => {},\n 'sorting' => {},\n 'global_config' => {}\n ).merge(permit_hashes(p, [\n 'controls_params',\n 'columns_params',\n 'sorting',\n 'global_config'\n ]))\n end", "def do_params_filter scope\n filter_params.each do |k,value|\n if value.present?\n if self.class.custom_filter_fields[k].present?\n scope = self.class.custom_filter_fields[k].call scope, value\n elsif resource_class.column_names.include? k\n if resource_class.columns_hash[k].type == :boolean\n if value == '0'\n puts \"Should filter\"\n scope = scope.where(k => [false,nil])\n else\n scope = scope.where(k => true)\n end\n else\n scope = scope.where(k => value)\n end\n elsif resource_class.reflect_on_association(k.to_sym).present?\n klass = resource_class.reflect_on_association(k.to_sym).klass\n scope = do_inner_params_filter klass, value, scope\n else\n Rails.logger.warn(\"No filter is available for field #{k}\")\n end\n end\n end\n scope\n end", "def add_facet_params(field, value)\n p = params.dup\n p.delete :page\n p[:f]||={}\n p[:f][field] ||= []\n p[:f][field].push(value)\n p\n end", "def filtered(env)\n @filter ||= ActionDispatch::Http::ParameterFilter.new(Rails.application.config.filter_parameters)\n @filter.filter(env)\n end", "def filters; end", "def filters; end", "def set_filter\n @filter = Filter.find(params[:id])\n end", "def set_filter\n @filter = Filter.find(params[:id])\n end", "def set_filter\n @filter = Filter.find(params[:id])\n end", "def add_filter\n choice = Choice.find(params[:id])\n recommendation = Integer(params[:recommendation])\n product_filter_feature = case params[:type_filter]\n when \"product\" then ProductFilter::ProductFilterSimple.create_from_product(Product.find(params[:product_id]), recommendation)\n when \"feature\" then ProductFilter::ProductFilterFeature.create_from_feature(Feature.find(params[:feature_id]), recommendation)\n when \"rating\" then ProductFilter::ProductFilterRating.create_from_rating(Feature.find(params[:feature_id]), recommendation)\n end\n choice.product_filters << product_filter_feature\n redirect_to(edit_question_path(choice.question_id))\n end", "def do_params_filter_and_sort scope\n do_params_sort do_params_filter scope\n end", "def global_filter; end", "def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if [email protected]? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end", "def filters\n @filters ||= {}\n end" ]
[ "0.7667878", "0.73295593", "0.7155153", "0.7059293", "0.70547163", "0.7017768", "0.701622", "0.69522434", "0.6847494", "0.68402976", "0.67480344", "0.67480344", "0.67368716", "0.6736221", "0.6734661", "0.6734661", "0.6715528", "0.6713427", "0.66717345", "0.6602613", "0.65682346", "0.656384", "0.656384", "0.65514416", "0.6525049", "0.6516755", "0.649591", "0.6485806", "0.64843714", "0.6472596", "0.6459164", "0.645306", "0.6448354", "0.6435106", "0.6393195", "0.6388723", "0.63881266", "0.6387518", "0.6369352", "0.6362651", "0.6354943", "0.63447964", "0.63403153", "0.63373387", "0.6336978", "0.6324435", "0.6318645", "0.631197", "0.6306762", "0.63014555", "0.63014555", "0.6294801", "0.62942034", "0.6275383", "0.6272392", "0.6259452", "0.62572545", "0.62512803", "0.6241927", "0.6237572", "0.6234796", "0.6233256", "0.6232836", "0.6206995", "0.6204576", "0.61989444", "0.61950576", "0.6183976", "0.6182427", "0.6152131", "0.61514884", "0.61351615", "0.6130808", "0.61287725", "0.61241734", "0.6122989", "0.6120209", "0.611614", "0.61006725", "0.609895", "0.6096225", "0.6093119", "0.6092985", "0.6079792", "0.60773265", "0.6071213", "0.60657924", "0.6057864", "0.6049713", "0.60418344", "0.6040418", "0.6040418", "0.6037627", "0.6037627", "0.6037627", "0.6030231", "0.6029968", "0.6029607", "0.6025598", "0.6021644" ]
0.83977306
0
Get filter name by field
def get_filter_name(field, model = nil) field_name = model.present? ? "#{model.table_name}.#{field}" : field "#{name}[#{filter_param_name}][#{field_name}]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_name\n if filters.one?\n filters.keys.first.to_s\n else\n filters.keys.join('_and_')\n end\n end", "def field_name(field=nil)\n result = field_name_fragment\n result << \"[#{field}]\" if field\n result\n end", "def field_name\n @field.name\n end", "def field_name\r\n @field_name ||= begin\r\n %r/(\\w+)Field$/.match(name)[1]\r\n rescue\r\n %r/(\\w+)$/.match(name)[1]\r\n end\r\n end", "def field_name\n self.class.name.split(\"::\").last.downcase.sub(\"of\", \"_of_\"). \\\n sub(\"field\", \"\").downcase\n end", "def field_names(filter = [], include_inherited = true)\n names = fields.keys\n\n if include_inherited && has_parent?\n names.concat(inherited_fields)\n end\n\n unless filter.empty?\n names = names & filter.map(&:to_sym)\n end\n\n names.sort!\n names\n end", "def name\n \"\\\"#{filter_name}\\\" = \\\"#{filter_value}\\\"\"\n end", "def filter_label(filter_name, filters)\n filters[filter_name].try(:[], :label) || filter_name.to_s.humanize\n end", "def get_field_name\n\t\tend", "def search_field_name\n searchable_attribute_names.join(\"_or_\") + \"_cont\"\n end", "def field_name_for_index(field, args = {})\n solr_name(field, args)\n end", "def name_field\n category_ids = AttributeCategory.where(\n user_id: user_id,\n entity_type: self.class.name.downcase\n ).pluck(:id)\n\n # Todo these two queries should be able to be joined into one\n AttributeField.find_by(\n user_id: user_id,\n attribute_category_id: category_ids,\n field_type: 'name'\n )\n end", "def get_field_name(options)\r\n field_name = options[:field_name]\r\n\r\n field_name\r\n end", "def field_name\n @gapi.field_name\n end", "def for_field(field)\n @all.select { |f| f.field == field.to_sym }\n end", "def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end", "def filter\n params['filter_field'] || '*'\n end", "def contact_field_name(contact_field)\n contact_field_translations[contact_field]\n end", "def get_label_from_filters(filters)\n props = filters.properties\n return nil if props.empty?\n\n # filters.properties = [['label','Person'],['name','ilya']]\n idx = props.index{|p| p[0] == 'label'}\n props[idx][1] if idx\n end", "def name\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = 'name'\").first.value\n end", "def typus_fields_for(filter); end", "def search_field\n field_name = options[:search_field]\n field_name ||= ActiveFedora.index_field_mapper.solr_name(field, :facetable, type: :string)\n\n ERB::Util.h(field_name)\n end", "def solr_name(field_name, *opts)\n index_type, args = if opts.first.kind_of? Hash\n [:stored_searchable, opts.first]\n elsif opts.empty?\n [:stored_searchable, {type: :text}]\n else\n [opts[0], opts[1] || {type: :string}]\n end\n\n indexer(index_type).name_and_converter(field_name, args).first\n end", "def field name\n @fields[name]\n end", "def get_field(field_name)\n\t\tend", "def get(name)\n @filters.select {|f| f[:name] == name }\n end", "def name_as_search_key\n QueryField.mapping(@name)\n end", "def resource_attribute_name(field, direction = :from)\n (transforms(direction)[field] || field).to_sym\n end", "def filter_input_id\n \"#{self.form.object_name}_#{self.filter_field}\"\n end", "def filter_single(param, field)\n {\n 'term': { \"#{field}.keyword\": param }\n }\n end", "def to_field_name(name)\n # camelize strips leading underscores, which is undesirable.\n if name.to_s.starts_with?('_')\n \"_#{to_field_name(name.to_s[1..-1])}\"\n elsif Rails.config.camel_case\n name.to_s.camelize(:lower)\n else\n name.to_s\n end\n end", "def attribute_field_name(attr)\n attr.to_s.camelize(:lower)\n end", "def field_names\n @_field_path.map{ |field_| field_.name }\n end", "def field(name); end", "def name_filter(column, filter)\n value = filter[:value].to_s.parameterize.split('-')\n\n regex = value.map do |v|\n if v =~ /^\\d+$/\n roman = RomanNumerals.to_roman(Integer v).downcase\n v = \"(#{v}|#{roman})\"\n end\n # [[:<:]] begining of a word\n '[[:<:]]' + v + '.*?'\n end.join\n\n sanitize_sql_array([\"name_slug ~ ?\", regex])\n end", "def model_filters(model)\n model.attribute_names + model.reflection_names\n end", "def filter_string\n\t\treturn self.filter.to_s\n\tend", "def get_field_by_name(name)\n name = name.to_sym\n fields.values.find {|field| field.name == name}\n end", "def get_view_name(search_fields, prefix = \"find\")\n prefix + \"_by_\" + search_fields.join('_and_')\n end", "def selected_filter_option_names(filter)\n region_names = filter.regions(:name).sort\n country_names = filter.reduced_countries(:name).sort\n region_names.concat(country_names)\n end", "def define_field_name(field)\n (field.to_s + '_field').to_sym.tap do |field_method_name|\n field_method_names << field_method_name\n end\n end", "def named_filter; end", "def to_param\n \"filter[#{name}]=#{value}\"\n end", "def field\n raise \"Replace #field with the ElasticSearch field name\"\n end", "def get_field(field, collection)\n if field.is_a?(Hash) # rubocop:disable Style/ConditionalAssignment\n field = \"#{field[:table]}.#{field[:field]}\"\n else\n field = \"#{collection.table_name}.#{field}\"\n end\n field_base.gsub(Placeholder::FIELD, field)\n end", "def field_label(field)\n @__field_label_cache ||= {}\n @__field_label_cache[field] ||= field.to_s.sub(/_facet$|_display$|_[a-z]$/,'').gsub(/_/,' ')\n @__field_label_cache[field]\n end", "def name(value = nil)\n if value\n field_type.name(value)\n else\n # Return the name of the field\n @name\n end\n end", "def facet_field_names(lens = nil)\n blacklight_config_for(lens).facet_fields.values.map(&:field)\n end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def query_field; end", "def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end", "def current_department_filter_label\n filters = params_manager.filter_params\n if filters[:department].present?\n \"Department: #{clean_department_name(filters[:department])}\"\n else\n \"Department\"\n end\n end", "def type\n self.class.name.demodulize.underscore.gsub(/_filter$/, '').to_sym\n end", "def field name\n f = fields.find { |fld| fld.name == name.to_s }\n return nil if f.nil?\n yield f if block_given?\n f\n end", "def field(field)\n field = field.to_s\n result = []\n keys.sort.each do |name|\n result << self[name].get(field)\n end\n result\n end", "def build_filter filter, fields\n where = [fields.map { |f| \"#{f} like ?\" }.join(\" || \")]\n fields.count.times { |n| where << \"%#{filter}%\" }\n where\n end", "def field_query(field, value)\n \"_query_:\\\"{!field f=#{field}}#{value}\\\"\"\n end", "def evaluate_field_name(field_name_or_proc)\n return field_name_or_proc if field_name_or_proc.nil?\n\n field_name = field_name_or_proc.respond_to?(:call) ? field_name_or_proc.call(controller.const) : field_name_or_proc\n field_name.to_sym\n end", "def translation_for(field)\n object.class.human_attribute_name(field)\n end", "def filter\n @filter\n end", "def field_human_name(field)\n I18n.translate(\"#{model_name}.attributes.#{field}\", :count => 1, :default => Inflections.humanize(field), :scope => :models)\n end", "def get_string_field(field_name)\n\t\tend", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def name(index)\n i = get_field_index_by_external_id(index,@fields[:name])\n fields(index, i).to_s unless i.nil?\n end", "def name(index)\n i = get_field_index_by_external_id(index,@fields[:name])\n fields(index, i).to_s unless i.nil?\n end", "def filters_dutch_name(*args)\n create_filtered_accessor(\"filter_dutch_name\", args)\n end", "def filter\n\t\treturn @filter\n\tend", "def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end", "def field_by_name(name = nil)\n @fields.find { |h| h[:name].to_snym == name.to_snym }\n end", "def get_filterset_fields\n return self.class.filterset_fields&.map(&:to_s) || self.get_fields\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end", "def facet_field_names\n Blacklight.config[:facet][:field_names]\n end", "def get_custom_field_name_for_method(meth)\n if meth.to_s =~ /^(.+)=$/\n meth = $1\n end\n meth\n end", "def filter(name, function)\n filters = (self.model.design_doc['filters'] ||= {})\n filters[name.to_s] = function\n end", "def filter\r\n q = self.query\r\n return nil if q.nil?\r\n filter_name = q.ole_methods.detect{|m| m.to_s =~ /Filter\\Z/}\r\n return nil if filter_name.nil?\r\n q.send(filter_name.to_s.to_sym)\r\n end", "def field_names\n fields.keys\n end", "def get_filter\n if params[:jobfilter] && filters.any? { |f| f.filter_id == params[:jobfilter] }\n params[:jobfilter]\n end\n end", "def choice_field_name(value)\n \"#{name}___#{value}\"\n end", "def transform_field_name(key, name)\n hash = ::CUSTOM_FIELD_NAMES\n class_name = self.class.name.demodulize.underscore.to_sym\n return name if hash.nil? || hash[class_name].nil? || hash[class_name][key.to_sym].nil?\n hash[class_name][key.to_sym]\n end", "def field\n @field ||= quoted_field(field_name)\n end", "def field_name\n self.well_info.field_name\n end", "def index_field_label(document, field)\n lookup_display_name(document, field) || super\n end", "def facet_field_label field\n field_config = blacklight_config.facet_fields[field]\n field_config ||= Blacklight::Configuration::NullField.new(key: field)\n\n field_config.display_label('facet')\n end", "def filtro_particular(conscaso, params_filtro)\n return conscaso\n end", "def updateFilter(sender)\n NSLog @searchField.stringValue\n\n end", "def wc_query_field(field_id)\n @columns.each do |c|\n if c[:id] == field_id then \n return c[:query]\n end\n end\n field_id\n end", "def filtertype_op\n\t\t\tFILTERTYPE_OP[ self.filtertype.to_sym ]\n\t\tend", "def field\n @field ||= @options.fetch(:field, repository.adapter.field_naming_convention.call(name))\n end", "def display_name_without_user_filter(name)\n name[:display_name]\n end", "def current_filter\n filters[1..-1].inject(filters.first){|a,b| @object.send(b[1].to_sym) ? b : a }[1]\n end", "def facet_field(field)\n facet_fields[field.to_s] || []\n end", "def get_filter_string\n\t\treturn nil if @filters.size == 0\n\t\tfilters = []\n\n\t\t# Loop over each filtergroup\n\t\t# All conditions in a filtergroup are combined using AND\n\t\t# All filtergroups are combined using OR\n\t\[email protected]_with_index do |filter, index|\n\t\t\tfields = []\n\n\t\t\t# Loop over all conditions in a filter group\n\t\t\tfilter.each do |condition|\n\t\t\t\tfield = condition[:field]\n\t\t\t\toperator = condition[:operator]\n\t\t\t\tvalue = condition[:value]\n\n\t\t\t\t# Some filters operate on strings and need wildcards\n\t\t\t\t# Transform value if needed\n\t\t\t\tcase operator\n\t\t\t\t\twhen FilterOperators::LIKE\n\t\t\t\t\t\tvalue = \"%#{value}%\"\n\t\t\t\t\twhen FilterOperators::STARTS_WITH\n\t\t\t\t\t\tvalue = \"#{value}%\"\n\t\t\t\t\twhen FilterOperators::NOT_LIKE\n\t\t\t\t\t\tvalue = \"%#{value}%\"\n\t\t\t\t\twhen FilterOperators::NOT_STARTS_WITH\n\t\t\t\t\t\tvalue = \"#{value}%\"\n\t\t\t\t\twhen FilterOperators::ENDS_WITH\n\t\t\t\t\t\tvalue = \"%#{value}\"\n\t\t\t\t\twhen FilterOperators::NOT_ENDS_WITH\n\t\t\t\t\t\tvalue = \"%#{value}\"\n\t\t\t\t\twhen FilterOperators::EMPTY\n\t\t\t\t\t\t# EMPTY and NOT_EMPTY operators require the filter to be in a different format\n\t\t\t\t\t\t# This because they take no value\n\t\t\t\t\t\tfields.push(\"<Field FieldId=\\\"#{field}\\\" OperatorType=\\\"#{operator}\\\" />\")\n\t\t\t\t\t\tnext\n\t\t\t\t\twhen FilterOperators::NOT_EMPTY\n\t\t\t\t\t\tfields.push(\"<Field FieldId=\\\"#{field}\\\" OperatorType=\\\"#{operator}\\\" />\")\n\t\t\t\t\t\tnext\n\t\t\t\tend\n\n\t\t\t\t# Add this filterstring to filters\n\t\t\t\tfields.push(\"<Field FieldId=\\\"#{field}\\\" OperatorType=\\\"#{operator}\\\">#{value}</Field>\")\n\t\t\tend\n\n\t\t\t# Make sure all filtergroups are OR'ed and add them\n\t\t\tfilters.push(\"<Filter FilterId=\\\"Filter #{index}\\\">#{fields.join}</Filter>\")\n\t\tend\n\n\t\t# Return the whole filterstring\n\t\treturn \"<Filters>#{filters.join}</Filters>\"\n\tend", "def filer_name\n @filing.filer_name\n end", "def process_field(field_name)\n if ['id', 'name', 'first_name', 'node_id'].include?(field_name)\n \"#{table}.#{field_name}\"\n else\n super # raises\n end\n end", "def get_field(key)\n @form_fields.getField key.to_s\n end", "def columnName_to_fieldname (name)\n return name.downcase.gsub(' ','-')\nend", "def field_called(field_name)\n return nil if field_name.to_s.empty?\n # return nil if field_name.to_s.empty?\n @fields[field_name.to_sym]\n end", "def get_char_field(field_name)\n\t\tend", "def updateFilter(sender)\n CanastoLog.debug @searchField.stringValue\n end", "def condition_field\n @rule_details.conditions[0].field\n end" ]
[ "0.7092277", "0.70194924", "0.6902115", "0.67540735", "0.66454047", "0.662417", "0.65781116", "0.65339345", "0.648112", "0.6452713", "0.63599074", "0.6355486", "0.6303464", "0.6282133", "0.6263003", "0.61842185", "0.61584145", "0.6101875", "0.61001", "0.6095226", "0.59746104", "0.59712565", "0.5964614", "0.5963209", "0.5949833", "0.5948856", "0.5945631", "0.59255004", "0.5912848", "0.5908614", "0.5904392", "0.5886696", "0.5871941", "0.5867119", "0.58633363", "0.58337855", "0.5824519", "0.5810721", "0.58035475", "0.5802101", "0.57929224", "0.5787132", "0.5781049", "0.57265985", "0.57224816", "0.571801", "0.57118213", "0.57014996", "0.56946903", "0.5692938", "0.5676047", "0.5674931", "0.56748414", "0.56746763", "0.56706005", "0.5670341", "0.567021", "0.56685805", "0.5666008", "0.5664652", "0.5664392", "0.566118", "0.56569237", "0.5647279", "0.5647279", "0.56462175", "0.5624941", "0.56097275", "0.5607375", "0.5602808", "0.557984", "0.55639327", "0.55462146", "0.55419815", "0.55409104", "0.55332035", "0.5503535", "0.54852474", "0.5483686", "0.54834545", "0.5472829", "0.5464502", "0.5454732", "0.54504925", "0.5446862", "0.5445328", "0.5436001", "0.5401643", "0.53918535", "0.53871244", "0.53861016", "0.53856087", "0.5380782", "0.5378108", "0.53754973", "0.53738934", "0.53717786", "0.5369088", "0.53665817", "0.53655636" ]
0.85356957
0
Thinking Sphinx apply filters
def ts_apply_filters # TODO: Make filters for Thinking Sphinx end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filters; end", "def filters; end", "def index \n\n ...\r\n \r\n #add/remove any selected filters\n selected_filter_conditions(Widget)\n\n @widgets = Widget.find(:all,{}, {:conditions => @conditions, :include => @included}) \n \n # This can be combined with any named scopes eg \n # @widgets = Widget.active.popular.find(:all,{}, {:conditions => @conditions, :include => @included}) \n\r\n \n #generate filters for results\n filter_headings(Widget, @widgets)\n\n ...\n\r\n end\n\n\n....\n\n\nend", "def add_custom_search_filters(search); end", "def filters\n end", "def filters=(_arg0); end", "def filters=(_arg0); end", "def filter_index\n filter\n end", "def apply_filter\n end", "def generate_text_sql\n ThinkingSphinx.context.indexed_models.each do |model|\n model = model.constantize\n model.define_indexes\n model.sphinx_indexes.each do |idx|\n idx.sources.each do |src|\n puts \"#{model.to_s} SQL => \"\n puts src.to_sql\n end\n end\n end\nend", "def add_filters(filters); end", "def search\n @query = params[:keywords].nil? ? \"\" : params[:keywords]\n\n # prepare filters\n filters = apply_filters\n\n # do the search itself\n ultrasphinx_search(filters)\n params[:filter] = false;\n\n respond_to do |format|\n format.html { render :partial => 'dt/projects/search_results', :layout => 'layouts/dt_application'}\n end\n end", "def search(*args)\n options = args.extract_options!\n options[:class] = self\n args << options\n ThinkingSphinx::Search.search(*args)\n end", "def index\n index_filter\n end", "def Filter=(arg0)", "def add_filters\n add_term_filters\n add_terms_filters\n add_range_filters\n end", "def index\n @category = Category.find(params[:category_id], :include => 'subcategories')\n @location = Location.find(params[:location_id])\n @subcat_array = @category.subcategories.select{|v| v.location_id == @location.id }\n a = []\n for subcat in @subcat_array\n a = [a, subcat.id]\n end\n if nil == params[:query]\n @query_string = \"\"\n @chunks = nil\n else\n @query = params[:query].strip\n @chunks = self.make_chunks(@query)\n x=0\n y=0\n\n for chunk in @chunks\n x = x+1\n\t if x > 0 && x < @chunks.size && chunk != 'and' && chunk != 'or' && chunk != '^+' && chunk != '^-' && @chunks[x] != 'and' && @chunks[x] != 'or'\n @chunks[y] = chunk + ' or '\n else\n\t\t@chunks[y] = chunk + ' '\n end\n y = y+1 \n end\n @query_string = process_chunk(@chunks)\n end \n filters = {} \n filters['subcategory_id'] = a.flatten\n @search=Ultrasphinx::Search.new(:query => @query_string, :filters => filters)\n @search.run\n @results = @search.results\n @postings = @results.paginate :page => params[:page],:per_page =>2 \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @postings }\n end\n end", "def record_default_search\n Umbra::Record.search {\n fulltext params[:q]\n any_of do\n current_user_admin_collections.each { |collection|\n with(:collection, collection)\n }\n end\n order_by(sort_column.to_sym, sort_direction.to_sym)\n paginate :page => params[:page] || 1, :per_page => 30\n }\n end", "def uhook_filtered_search filters = {}\n create_scopes(filters) do |filter, value|\n case filter\n when :locale\n {:conditions => {:locale => value}}\n end\n end\n end", "def index\n @readers = TextFilter.new(Reader.all, filter_params).call\n end", "def index_filters\n {}\n end", "def filter\n end", "def search(params)\n filter_name, keywords, field_queries = extract params\n scope = filtered_by filter_name\n query = text_search keywords\n query = field_search field_queries, query\n scope.where query\n end", "def apply_filter(rel)\n if filter.present?\n Response.do_search(rel, filter, :mission => mission)\n else\n rel\n end\n end", "def apply_filters(query)\n query\n end", "def autofilter\n true\n end", "def elastic(name, opts = {})\n opts[:filter_name] ||= model.to_s.underscore\n opts[:filter_method] ||= \"function(doc, req) { return doc['#{model.model_type_key}'] == '#{self.model.to_s}'; }\")\n # Create a filter for this model\n filter(opts[:filter_name], opts[:filter_method])\n create_elastic_method(name, opts[:filter_name])\n end", "def find_with_searchlogic(*args)\n options = args.extract_options!\n options = filter_options_with_searchlogic(options)\n args << options\n find_without_searchlogic(*args)\n end", "def advancedsearch\n params[:filter] = true;\n end", "def named_filter; end", "def index!\n set_search_text!\n set_query_attributes!\n update_columns text: self.text, query: self.query\n end", "def add_term_filters\n body.filter(:term, posted: true)\n body.filter(:term, hidden_by_admin: false)\n body.filter(:term, restricted: false) unless include_restricted?\n body.filter(:term, unrevealed: false) unless include_unrevealed?\n body.filter(:term, anonymous: false) unless include_anon?\n body.filter(:term, chapter_count: 1) if options[:single_chapter]\n\n %i(complete language crossover).map do |field|\n value = options[field]\n body.filter(:term, field => value) unless value.nil?\n end\n add_tag_filters\n end", "def global_filter; end", "def add_range_filters\n %i(word_count hit_count kudos_count comments_count bookmarks_count revised_at).each do |countable|\n next unless options[countable]\n range = Search::RangeParser.string_to_range(options[countable])\n body.filter(:range, countable => range) unless range.blank?\n end\n add_date_range_filter\n add_word_count_filter\n end", "def collection_search_params_logic\n base_logic = [:default_solr_parameters, :add_query_to_solr, :add_access_controls_to_solr_params]\n base_logic += [:add_collection_filter, :some_rows]\n base_logic\n end", "def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end", "def index\n authorize! :read, Recipe\n @query = params[:query]\n @search_result = Recipe.search do\n fulltext params[:query]\n if params[:course_type_ids].present?\n all_of do\n params[:course_type_ids].each do |filter|\n with(:course_type_ids, filter)\n end\n end\n end\n if params[:exclu_course_type_ids].present?\n all_of do\n params[:exclu_course_type_ids].each do |filter|\n without(:course_type_ids, filter)\n end\n end\n end\n if params[:difficulty].present?\n all_of do\n params[:difficulty].each do |filter|\n with(:difficulty, filter)\n end\n end\n end\n if params[:exclu_difficulty].present?\n all_of do\n params[:exclu_difficulty].each do |filter|\n without(:difficulty, filter)\n end\n end\n end\n if params[:cost].present?\n all_of do\n params[:cost].each do |filter|\n with(:cost, filter)\n end\n end\n end\n if params[:exclu_cost].present?\n all_of do\n params[:exclu_cost].each do |filter|\n without(:cost, filter)\n end\n end\n end\n if params[:category_ids].present?\n all_of do\n params[:category_ids].each do |filter|\n with(:category_ids, filter)\n end\n end\n end\n if params[:exclu_category_ids].present?\n all_of do\n params[:exclu_category_ids].each do |filter|\n without(:category_ids, filter)\n end\n end\n end\n if params[:main_ingredient_ids].present?\n all_of do\n params[:main_ingredient_ids].each do |filter|\n with(:main_ingredient_ids, filter)\n end\n end\n end\n if params[:exclu_main_ingredient_ids].present?\n all_of do\n params[:exclu_main_ingredient_ids].each do |filter|\n without(:main_ingredient_ids, filter)\n end\n end\n end\n if params[:source_ids].present?\n all_of do\n params[:source_ids].each do |filter|\n with(:source_ids, filter)\n end\n end\n end\n if params[:exclu_source_ids].present?\n all_of do\n params[:exclu_source_ids].each do |filter|\n without(:source_ids, filter)\n end\n end\n end\n facet :course_type_ids\n facet :category_ids\n facet :main_ingredient_ids\n facet :source_ids\n facet :difficulty, :sort => :index\n facet :cost, :sort => :index\n paginate :page => params[:page] || 1, :per_page => 10\n order_by(:score, :desc)\n order_by(:created_at, :desc)\n end\n @query_params = params.except( :page )\n \n filters = [\n :course_type_ids, \n :exclu_course_type_ids, \n :difficulty, \n :exclu_difficulty, \n :cost, \n :exclu_cost, \n :category_ids, \n :exclu_category_ids, \n :main_ingredient_ids, \n :exclu_main_ingredient_ids, \n :source_ids, \n :exclu_source_ids\n ]\n filters.each do |filter|\n if params[filter].present?\n params[filter].map!{ |x| x.to_i }\n end\n end\n \n # @search_result.facet(:main_ingredient_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:course_type_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:category_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:source_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n \n sort_alphabetical(@search_result.facet(:main_ingredient_ids).rows)\n sort_alphabetical(@search_result.facet(:course_type_ids).rows)\n sort_alphabetical(@search_result.facet(:category_ids).rows)\n sort_alphabetical(@search_result.facet(:source_ids).rows)\n end", "def build_filter filter, fields\n where = [fields.map { |f| \"#{f} like ?\" }.join(\" || \")]\n fields.count.times { |n| where << \"%#{filter}%\" }\n where\n end", "def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = Supplier.ransack(params[:q]) \n @query.num_doc_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @suppliers = @results \n end", "def add_tag_filters\n return if options[:filter_ids].blank?\n options[:filter_ids].each do |filter_id|\n body.filter(:term, filter_ids: filter_id)\n end\n end", "def filter\n setup_instance_variables\n render 'index'\n end", "def process_text text\n @filter.process(Blogitr.expand_macros(@filter, text))\n end", "def search\n \n search = params[:search]\n miniresume = params[:miniresume]\n location = params[:location]\n\n #thinking_sphinx conditions - \n @adviceposts = Advicepost.search(search,miniresume,location,page: 1, per_page: 25)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adviceposts }\n end\n end", "def do_local_indexing(solr_doc); end", "def index\n @search = Author.search(params[:q])\n @authors = @search.result\n @search.build_condition if @search.conditions.empty?\n @search.build_sort if @search.sorts.empty?\n end", "def typus_fields_for(filter); end", "def index\n\t\t# simply call filter with category \"All\"\n\t\t@cat = \"All\"\n\t\tfilter\n end", "def strict_filters=(_arg0); end", "def add_filter\n @filter = true \n end", "def filter(name, function)\n filters = (self.model.design_doc['filters'] ||= {})\n filters[name.to_s] = function\n end", "def filter_parameters; end", "def filter_parameters; end", "def index\n @title = \"List filter samples\"\n\n #if params[:id].present?\n # logger.warn(\"#{Time.now} - filter_sampling filtered by: #{params[:id]}\") \n # filter_samples = FilterSample.find(:all, :conditions => [ \"sampling_id = ?\", params[:id]]) do\n # paginate :page => params[:page], :per_page => params[:rows] \n # order_by \"#{params[:sidx]} #{params[:sord]}\"\n # end\n #else\n # filter_samples = FilterSample.find(:all, :joins => [:sampling, :wfilter]) do\n # if params[:_search] == \"true\"\n # sampling.volume =~ \"%#{params[:sample_name]}%\" if params[:sample_name].present?\n \n # code =~ \"%#{params[:code]}%\" if params[:code].present?\n # barcode =~ \"%#{params[:barcode]}%\" if params[:barcode].present?\n # #wfilter.pore_size >= \"%#{params[:filter_name]}%\" if params[:filter_name].present?\n # wfilter.pore_size =~ \"%#{params[:filter_name]}%\" if params[:filter_name].present?\n # #pore_size >= \"%#{params[:filter_name]}%\" if params[:filter_name].present?\n # volume =~ \"%#{params[:volume]}%\" if params[:volume].present?\n # num_filters =~ \"%#{params[:num_filters]}%\" if params[:num_filters].present?\n # end\n #paginate :page => params[:page], :per_page => params[:rows] \n #if params[:sidx] == \"filter_name\"\n # order_by \"wfilters.pore_size #{params[:sord]}\"\n #elsif params[:sidx] == \"sample_name\"\n # order_by \"samplings.code #{params[:sord]}\"\n\n #set the database table name and column\n #elsif params[:sidx] == \"code\"\n # order_by \"filter_samples.code #{params[:sord]}\"\n #elsif params[:sidx] == \"num_filters\"\n # order_by \"filter_samples.num_filters #{params[:sord]}\"\n #elsif params[:sidx] == \"volume\"\n # order_by \"filter_samples.volume #{params[:sord]}\"\n #else\n # order_by \"#{params[:sidx]} #{params[:sord]}\"\n #end\n #end\n #end\n\n\n #respond_to do |format|\n # format.html # index.html.erb\n # #format.xml { render :xml => @filter_samples }\n # format.json { render :json => filter_samples.to_jqgrid_json(\n # [:id, \"act\",\"code\",:sample_name,\"barcode\",\"filter_name\",:num_filters,:volume,\"edit\"],\n # params[:page], params[:rows], filter_samples.total_entries) }\t\t\t\n #end\n\n index_columns ||= [:id, :act,:code,:sample_name, :barcode, :filter_name,:num_filters,:volume, :edit]\n current_page = params[:page] ? params[:page].to_i : 1\n rows_per_page = params[:rows] ? params[:rows].to_i : 10\n\n conditions={:page => current_page, :per_page => rows_per_page}\n conditions[:order] = params[\"sidx\"] + \" \" + params[\"sord\"] unless (params[:sidx].blank? || params[:sord].blank?)\n \n if params[:_search] == \"true\"\n conditions[:conditions]=filter_by_conditions(index_columns)\n end\n \n @filter_samples=FilterSample.paginate(conditions)\n total_entries=@filter_samples.total_entries\n \n respond_with(@filter_samples) do |format|\n format.json { render :json => @filter_samples.to_jqgrid_json(index_columns, current_page, rows_per_page, total_entries)} \n end\n\n\n end", "def index\n filter = params[:searchString] || ''\n filter = filter.tr('^A-Za-zА-Яа-я0-9', '')\n if not filter.blank?\n @tags = Tag.where('lower(name) like ?', \"%#{filter.mb_chars.downcase.to_s}%\").order(:name)\n else\n @tags = Tag.all\n end\n end", "def global_filter=(_arg0); end", "def default_text_filter\n # blog.text_filter.to_text_filter\n end", "def index\n @filter = DocumentFilter.new(filter_params)\n @documents = @filter.call.page(params[:page])\n end", "def filtered_index(type)\n return unless (term = params.dig(:filter, :term).strip)\n\n case type\n when :clade\n clade_filter(term)\n when :region\n region_filter(term)\n # when :user\n # user_filter(term)\n end\n end", "def filter\n @filter = params[:q]\n end", "def index\n # @search = Shelter.search do\n # fulltext params[:search]\n # end\n # @shelters = @search.results\n @shelters = Shelter.all\nend", "def index\n @has_documents = HasDocument.all\n @clauses = Clause.all\n end", "def apply_narrowing_filters\n @filters[:narrowing].each do |filter|\n @query = @query.where(filter => @options[filter])\n end\n @query\n end", "def searchUsing(filter)\n @zqlQuery = filter\n end", "def transformed_search opts\n\t\topts\n\tend", "def search_adding_filter(condition,value)\n conditions = params.dup[:conditions] || {}\n\n if PLURAL_FILTERS.include?(condition)\n conditions[condition] ||= []\n conditions[condition] << value\n else\n conditions[condition] = value\n end\n params.except(:quiet, :all, :facet).recursive_merge(:page => nil, :action => :show, :conditions => conditions)\n end", "def filter_by_extension\n if item[:extension] == \"haml\"\n filter :haml\n else\n filter :erb\n filter :kramdown, coderay_line_numbers: :table\n end\nend", "def filters\n mentos(:get_all_filters)\n end", "def index_keywords!\n all.each { |d| d.index_keywords! ? MongoidSearch::Log.green(\".\") : MongoidSearch::Log.red(\"F\") }\n end", "def filter; end", "def filter; end", "def filter; end", "def apply_filter(query)\n query\n end", "def apply_filter(query)\n query\n end", "def do_search(params)\n\n # This first section sets up basic search parameters based on what was requested.\n\n format = params[:format].present? ? params[:format] : 'none'\n\n order = params[:order].present? ? {field: params[:order].split[0], direction: params[:order].split[1]} : {}\n limit = params[:limit].present? ? params[:limit].to_i : 50\n page = params[:limit] ? (params[:offset].to_i / params[:limit].to_i) + 1 : 1\n s_op = params[:op].present? ? params[:op] : 'AND'\n role = params[:role].present? ? params[:role] : 'guest'\n\n linking_tool = params[:linking_tool].present?\n\n options = options_for_search(params)\n\n reviewed = params[:reviewed] && params[:reviewed] == \"1\" ? false : nil\n\n # Each model has a custom version of these functions (and a list of valid fields) to permit only the\n # appropriate search fields for each model. \n\n # \"Params\" are any fulltext fields\n # \"Filters\" are all non-fulltext fields (numbers, booleans, exact string matches)\n # \"Dates\" are specifically for fields that need to allow date comparison\n\n filters = filters_for_search(params)\n dates = dates_for_search(params)\n params = params_for_search(params)\n \n s = self.search do\n \n # Fulltext search is defined as a lambda function, since it needs to be able to be combined with non-fulltext\n # search options as the user decides.\n\n fulltext_search = lambda { |p, o| \n if params.present?\n p.each do |field, value|\n\n # Since there are unlimited rows for the advanced search, the user can submit multiple values for the same field\n # i.e. \"Title\" for an Entry could be \"Bible\" and \"Book\" separately. So, they are iterated over:\n\n value = Array(value)\n if value.kind_of? Array\n value.each do |v|\n\n # Each search field can also be qualified in various ways\n\n op = Array(options[field + \"_option\"]).shift\n \n # If searching for this 'without' the term, right now just add a '-' to the beginning of query to negate it\n \n if op && op == 'does not contain'\n fulltext \"-\" + v.gsub(' ', '+'), :fields => [field]\n elsif op && op == 'blank'\n with field.gsub('_search', ''), nil\n elsif op && op == 'not blank'\n without field.gsub('_search', ''), nil\n elsif op && op == 'before'\n with(field).less_than v\n elsif op && op == 'after'\n with(field).greater_than v\n else\n fulltext v, :fields => [field]\n end\n end\n end\n end\n end\n }\n\n if not reviewed.nil?\n with :reviewed, false\n end\n\n # The same process for exact-match fields, but this time the search is being run and narrowed (i.e. it is not\n # using a lambda function)\n\n if filters.present?\n filters.each do |field, value|\n value = Array(value)\n value.each do |v|\n op = Array(options[field + \"_option\"]).shift\n if op && op == 'blank'\n with field, nil\n elsif op && op == 'not blank'\n without field, nil\n elsif v.blank? # ignore blank\n elsif op && op == 'less than'\n with(field).less_than v\n elsif op && op == 'greater than'\n with(field).greater_than v\n elsif op && op == 'without'\n without field, v\n elsif v.kind_of?(Array) && v.all? { |v2| v2.blank? } # make sure it's not an array of blanks \n else\n if ['true', 'false'].include? v\n v = (v == 'true')\n end\n with field, v\n end\n end\n end\n end\n\n # The same process for Dates, but with different interpretations of the search field options to correspond\n # with date-based searching\n\n if dates.present?\n dates.each do |field, value|\n value = Array(value)\n value.each do |v|\n v = v.split(/[-\\/]/).join(\"\").ljust(8, '01')\n op = Array(options[field + \"_option\"]).shift\n begin\n if op && op == 'before'\n with(field).between(Date.new(0,1,1)..Date.parse(v))\n elsif op && op == 'after'\n with(field).between(Date.parse(v)..Date.today)\n elsif op && op == 'near'\n d = Date.parse(v)\n with(field).between((d - 1.month)..(d + 1.month))\n elsif op && op == 'exact'\n with(field, v)\n end\n rescue ArgumentError\n @error = \"Error in Date Search - please use format YYYY/MM/DD or similar\"\n end\n end\n end\n end\n\n # In order to use SUNSPOT'S 'and'/'or' options together with non-fulltext fields,\n # we create a lambda function for fulltext searching (above)\n\n # ( This may be an idiosycracy of Sunspot only, but that is the reason for this roundabout approach ) \n\n if s_op == 'OR'\n any do\n fulltext_search.call(params, options)\n end\n else\n all do\n fulltext_search.call(params, options)\n end\n end\n\n # Unfortunately, sunspot does not natively support MIXING fulltext and exact searches using the \"OR\" operator \n # - so we do that manually\n # \n # params[:fq] refer to 'filter queries', or queries that refer to a fixed set of objects (exact strings, numbers, etc.)\n # params[:q] refers to fulltext queries\n\n # What this block of code does is check whether the 'OR' operator is used, and if it has been added by sunspot correctly\n # to the Solr query - if not, it is added in the proper place\n\n adjust_solr_params do |params|\n new_q = []\n p_fq = []\n params[:fq].each do |fq|\n if not fq.include? \"type\"\n new_q.push('_query_:\"{!edismax} ' + fq + '\"')\n else\n p_fq.push(fq)\n end\n end\n params[:fq] = p_fq\n if params[:q].blank?\n # nothing here...\n elsif not params[:q].include? s_op\n params[:q] = '(_query_:\"{!edismax qf=\\'' + params[:qf] + '\\'}' + params[:q].gsub('\"', '\\\"') + '\")'\n params.delete(:qf)\n end\n if params[:q].blank?\n if new_q.length > 0\n params[:q] = new_q.join(\" #{s_op} \")\n else\n params[:q] = \"*\"\n end\n else\n params[:q] = ([params[:q]] + new_q).join(\" #{s_op} \")\n end\n if linking_tool\n # NOTE: remove 'approved' thing here to make unapproved records show up in linking tool...\n params[:q] = '(' + params[:q] + ') AND (_query_:\"{!edismax qf=\\'deprecated\\'}false\") AND (_query_:\"{!edismax qf=\\'draft\\'}false\")'\n elsif role != \"admin\" && self.model_name.to_s == 'Entry'\n params[:q] = '(' + params[:q] + ') AND (_query_:\"{!edismax qf=\\'draft\\'}false\")'\n end\n end\n\n # Finally, page number, count and order_by field are accounted for, and the search results are returned\n\n paginate :per_page => limit, :page => page\n\n order.present? ? order_by(order[:field], order[:direction]) : order_by(:score, :desc)\n\n end\n\n return s\n end", "def index\n render_collection filter_labels(filter_params), status: :ok\n end", "def filter_parameters=(_arg0); end", "def filter_parameters=(_arg0); end", "def set_index\n # binding.pry\n @alpha = params[:alpha]\n if @alpha.nil? \n @alpha = \"A\"\n end\n if @alpha == 'num'\n @alpha = \"#\"\n srch = ['sort_title ~* ?', \"^\\\\d+\"]\n \n else\n srch = [\"title LIKE ? or title LIKE ?\", \"#{@alpha}%\", \"The #{@alpha}%\"]\n end\n\n @shows=Show.approved.includes(:episodes).where(srch).order(:sort_title)\n\n \n end", "def search filter\n if filter && is_searchable?\n filter = [filter, Chronic.parse(filter).strftime(\"%Y-%m-%d\")] rescue filter\n handle_joins(self.fields, scoped.select(\"DISTINCT(`#{self.table_name}`.`id`), `#{self.table_name}`.*\"))\n .where(build_filter(filter, self.fields))\n else\n scoped\n end\n end", "def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end", "def add_terms_filters\n add_work_type_filter\n add_user_filter\n add_pseud_filter\n add_collection_filter\n end", "def index\n if params[:search].present? || params[:date_filter].present?\n # @ingoing = Document.search(\n # params[:search], \n # where: {\n # outgoing: false,\n # date: {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day, \n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # } \n # }, \n # order: {created_at: :desc} )\n # @outgoing = Document.search(\n # params[:search], \n # where: {\n # outgoing: true,\n # date: {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day, \n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # } \n # }, \n # order: {created_at: :desc} )\n\n search = params[:search].present? ? params[:search] : \"*\"\n where = {}\n\n # if params[:date_filter].present?\n # where[:date] = {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day,\n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # }\n # end\n\n # @ingoing = Document.search(search, where.merge(outgoing: false))\n # @outgoing = Document.search(search, where.merge(outgoing: true))\n\n # search = params[:search].present? ? params[:search] : \"*\"\n # where = {misspellings: false}\n\n if params[:date_filter].present?\n where[:date] = {\n gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day,\n lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n }\n end\n\n @ingoing = Document.search( search, where: where.merge(:outgoing => false), order: {created_at: :desc}, misspellings: false )\n @outgoing = Document.search( search, where: where.merge(:outgoing => true), order: {created_at: :desc}, misspellings: false )\n\n else\n @documents = Document.where(archival: false)\n @ingoing = @documents.where(outgoing: false).order('created_at desc')\n @outgoing = @documents.where(outgoing: true).order('created_at desc')\n end\n\n respond_to do |format|\n format.html\n format.xlsx {\n render xlsx: \"index\", filename: \"documents_spreadsheet.xlsx\"\n }\n end\n end", "def index\n if params.has_key?(:filters) && (params[:filters].has_key?(:with_category) || params[:filters].has_key?(:with_filter_category)) \n if params[:filters].has_key?(:with_category)\n approved_posts = Category.find(params[:filters][:with_category]).posts.approved\n else\n approved_posts = Category.find(params[:filters][:with_filter_category]).posts.approved\n end\n else \n approved_posts = Post.approved\n end\n if params.has_key?(:sort) && params[:sort] == 'asc'\n approved_posts = approved_posts.asc\n else\n approved_posts = approved_posts.desc\n end\n approved_posts = filtrate(approved_posts)\n @pagy, @posts = pagy(approved_posts)\n @categories = Category.all\n if params[:filters]\n @search_text = params[:filters][:with_text]\n end\n end", "def index\n @category = Category.find(params[:category_id], :include => 'subcategories')\n if 1 == @category.id\n @field_sort = (nil == params[:field_sort] )? 'departure' : params[:field_sort]\n elsif 5 == @category.id\n @field_sort = (nil == params[:field_sort] )? 'departure' : params[:field_sort]\n else \n @field_sort = (nil == params[:field_sort] )? 'organizer_sort' : params[:field_sort]\n end \n @list_mode = (nil == params[:list_mode] )? 'descending' : params[:list_mode]\n @month = (nil== params[:month] )? -99: params[:month] \n @year = (nil==params[:year] )? Date.today.year: params[:year]\n\n @subcategory = Subcategory.find(params[:subcategory_id])\n logger.debug(\"\\nHey Fellas, subcategory is ... #{@subcategory.id}\\n\")\n @location = Location.find(params[:location_id])\n if nil == params[:query]\n @query_string = \"\"\n @chunks = nil\n else\n @query = params[:query].strip\n @chunks = self.make_chunks(@query)\n x=0\n y=0\n\n for chunk in @chunks\n if 0 ==y\n @chunks[y] = chunk\n else\n\t @chunks[y] = ' ' + chunk\n end\n y = y+1 \n end\n @query_string = process_chunk(@chunks)\n end \n filters = {} \n filters['subcategory_id'] = @subcategory.id\n if @category.id == 1\n filters['departure_year'] = @year.to_i\n if -99 != @month.to_i\n filters['departure_month'] = @month.to_i\n end\n end\n @search=Ultrasphinx::Search.new(:query => @query_string, :filters => filters, :sort_by => @field_sort, :sort_mode=>@list_mode)\n @search.run\n @results = @search.results\n @postings = @results.paginate :page => params[:page],:per_page =>PER_PAGE, :month=>params[:month], :year=>params[:year] , :query=>params[:query] \n\n if @chunks != nil and @postings.size <1 \n flash[:notice] = \"No search results found for this query. All words must match when searching by keyword.\"\n end \n\n respond_to do |format|\n if @category.id.to_i == 1\n\tformat.html # index.html.erb\n else\n format.html {render :layout =>\"subcategories_directory\" } # index.html.erb\n end\n format.xml { render :xml => @postings }\n end\n end", "def index\n\n extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title => t('blacklight.search.rss_feed') )\n extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title => t('blacklight.search.atom_feed') )\n\n\n if params[\"queries\"]\n do_refine_style_query\n else\n (@response, @document_list) = get_search_results\n end\n\n @filters = params[:f] || []\n\n respond_to do |format|\n format.html { save_current_search_params }\n format.rss { render :layout => false }\n format.atom { render :layout => false }\n format.json do\n @marshalled_results ||= marshall_nodes(@document_list.map{|d| d[\"id\"]})\n if params[\"nodesOnly\"] || params[\"queries\"]\n render json: @marshalled_results\n else\n render json: json_response\n end\n end\n end\n end", "def filter_models(solr_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << \"{!terms f=has_model_ssim}#{models_to_solr_clause}\"\n end", "def index\n if params[:search]\n @tutorials = Tutorial.search(params[:search]).order(\"created_at DESC\")\n else\n @tutorials = Tutorial.all.order('created_at DESC')\n end\n=begin\n #for sunspot\n @search = Tutorial.search do\n fulltext params[:search]\n end\n @tutorials = @search.results\n=end\n end", "def process_filters(records,filter_params)\n return records unless filter_params\n filter_params.each do |field,filter_param|\n if filter_param.has_key?(\"value\")\n value = filter_param[\"value\"]\n next unless value.present?\n condition = filter_param[\"condition\"] || 'eq'\n case condition\n when \"eq\"\n value = true if value == 'true'\n value = [false, nil] if value == 'false'\n records = records.where(field.to_sym => value)\n when \"cont\"\n records = records.where(\"#{field} LIKE '%#{value}%'\")\n when \"ncont\"\n records = records.where(\"#{field} NOT LIKE '%#{value}%'\")\n when \"gt\"\n records = records.where(\"#{field} > ?\", value)\n when \"lt\"\n records = records.where(\"#{field} < ?\", value)\n end\n end\n end\n return records\n end", "def find(filters, &block)\n ds = db[:tokens.as(:t0)]\n f = filters[0]\n ds = ds.where(:t0__word_id=>f.word) if f.word\n ds = ds.where(:t0__tag_id=>f.tag) if f.tag\n i = 0\n filters[1..-1].each do |f|\n as = \"t#{i+=1}\"\n h = {}\n h[:\"#{as}__word_id\"] = f.word if f.word\n h[:\"#{as}__tag_id\"] = f.tag if f.tag\n g = {}\n g[:\"#{as}__word_id\"] = f.ex_word if f.ex_word\n g[:\"#{as}__tag_id\"] = f.ex_tag if f.ex_tag\n ds = ds.join(:tokens.as(as)){ |j, lj, js| {:text_id.qualify(j) => :text_id.qualify(lj), :position.qualify(j) => :position.qualify(lj) + 1} }.where(h).exclude(g)\n end\n select = ds.select(:t0__text_id.as(:text_id), :t0__src_begin.as(:src_begin), :\"t#{i}__src_end\".as(:src_end),\n :t0__tagged_begin.as(:tagged_begin), :\"t#{i}__tagged_end\".as(:tagged_end), :t0__position.as(:pos_begin), :\"t#{i}__position\".as(:pos_end))\n\n puts select.sql\n puts select.explain\n\n select.to_enum.each do |e|\n block.call [e[:text_id], e[:src_begin], e[:src_end], e[:tagged_begin], e[:tagged_end], e[:pos_begin], e[:pos_end]]\n end\n end", "def set_index_match_types(types)\n set_nested_global(\"indexed_search/word\", :index_match_types, types)\nend", "def search(*rules); end", "def search(*rules); end", "def handling_fulltext\n options = yield\n add_sort_by_relevance options if fulltext_name_filtering?\n options\n end", "def search\n @page_title = t('titles.search_results')\n @query = params[:query]\n query = @query.to_s.gsub(/[\\/\\\\]/, \" \")\n ferret_results = ThinkingSphinx.search(\n Riddle.escape(query),\n page: params[:page],\n per_page: 10\n )\n # Probably not the best way to do this, strip out Products from the\n # search results unless the status is set to 'show_on_website'. It\n # would be better to filter these out during the ActsAsFerret.find\n # above, but since this is a multi-model search, there doesn't seem\n # to be a way to do SQL filtering on just one of the models being\n # searched.\n @results = []\n ferret_results.each do |r|\n unless (r.is_a?(Product) && !r.show_on_website?(website)) ||\n (r.has_attribute?(:brand_id) && r.brand_id != website.brand_id) ||\n (r.respond_to?(:belongs_to_this_brand?) && !r.belongs_to_this_brand?(website)) ||\n (r.is_a?(Artist) && !r.belongs_to_this_brand?(website))\n @results << r\n end\n end\n render_template\n end", "def search(query); end", "def find_for_index(filter_conditions:)\n search.where(filter_conditions)\n end", "def index\n @runs = policy_scope(Run)\n filtering_service = FilterRunsService.new from: params[:from], to: params[:to], runs: @runs\n\n # making a readable description to user filter\n @desc = filtering_service.description\n @runs = filtering_service.filter \n end", "def adv_search_set_text\n if @edit[@expkey].history.idx.zero? # Are we pointing at the first exp\n @edit[:adv_search_applied][:text] = if @edit[:new_search_name]\n _(\" - Filtered by \\\"%{text}\\\"\") % {:text => @edit[:new_search_name]}\n else\n _(\" - Filtered by \\\"%{text}\\\" report\") %\n {:text => @edit[:adv_search_report]}\n end\n else\n @edit[:custom_search] = true\n @edit[:adv_search_applied][:text] = _(\" - Filtered by custom search\")\n end\n end", "def execute()\n filters = prepare_filters\n return_filtered_model(filters)\n end", "def index \n @filter = params[:filter] || \"order_by_title\"\n @books = Book.send(@filter) # Filter book index based on a filter param - default is order by title\n end" ]
[ "0.6395649", "0.6395649", "0.6394962", "0.6393056", "0.6343207", "0.6331165", "0.6331165", "0.62281", "0.61923224", "0.6096554", "0.60748357", "0.60746837", "0.604416", "0.60266453", "0.60153943", "0.6001512", "0.5982304", "0.597698", "0.5964869", "0.5903267", "0.5897382", "0.5890498", "0.5870574", "0.5868731", "0.58668107", "0.583708", "0.57905775", "0.5757917", "0.57472557", "0.5734695", "0.5721928", "0.57108617", "0.5702041", "0.5687962", "0.56770617", "0.56769377", "0.56723297", "0.5664914", "0.5664363", "0.5648048", "0.563022", "0.56301945", "0.56231725", "0.56090343", "0.5586988", "0.55801064", "0.5579864", "0.55756515", "0.55733323", "0.556655", "0.5549374", "0.5549374", "0.5548579", "0.55445564", "0.554345", "0.5531205", "0.5530404", "0.5527728", "0.5519224", "0.55176646", "0.5508212", "0.5506827", "0.5504068", "0.5500752", "0.54954267", "0.5494634", "0.54941463", "0.54796916", "0.54794073", "0.54794073", "0.54794073", "0.54729944", "0.54729944", "0.5466745", "0.54660326", "0.54654664", "0.54654664", "0.54613775", "0.54497373", "0.5446426", "0.54452604", "0.54440194", "0.54387724", "0.5433522", "0.54286474", "0.5425784", "0.5424826", "0.54240054", "0.5413059", "0.5406464", "0.5405666", "0.5405666", "0.539426", "0.5394064", "0.5390699", "0.53878963", "0.5380679", "0.5375502", "0.53713125", "0.5358801" ]
0.8029215
0
Following solution is optimized for time, but not space O(n) time complexity O(n) space complexity
def kth_to_last(head, k) count = 0 current_node = head node_hash = {} while current_node node_hash[count] = current_node count += 1 current_node = current_node.next end node_hash[node_hash.keys.size - k].value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def three_sum_fastest(arr)\n count = 0\n\n (0..arr.length - 2).each { |i|\n set = Set.new\n\n (i + 1..arr.length - 1).each { |j|\n if set.include?(-arr[i] - arr[j])\n count += 1\n end\n\n set.add(arr[j])\n }\n }\n count\nend", "def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def find3(a, X)\n # scan through array\n # build hash storing complement in each key\n complements = {}\n a.each_with_index do |val, ind|\n if complements[X - val]\n complements[X - val].push(ind)\n else\n complements[X - val] = [ind]\n end\n end\n\n # scan through the array again\n # get complement\n # for each value scan the remainder of the arrray\n # for a value such taht a + b = the complement\n\n # for each character we have built a dictionary such that, we can find\n # x = a + complement\n\n # [1, 2, 3]\n # 1 + 2 = 3\n # 1 + 3 = 4 =>\n\n # for each value in the array (a) look at all following values (b) and see if a + b\n # is in the dictionary, if it is, check that their indices do not collide with the index\n # stored at dict(a+b)\n\n a.each_with_index do |va, i|\n a.each_with_index do |vb, j|\n break if i == j\n\n complement = va + vb\n indices = complements[complement]\n\n indices.each do |z|\n # every index is unique\n return [i, j, z] unless z == i || z == j\n end\n end\n end\n\n return nil\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend", "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend", "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend", "def solution(a)\n left = 0\n right = a.sum\n a.each_with_index do |element, index|\n right -= element\n return index if left == right\n left += element\n end\n -1\nend", "def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend", "def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend", "def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\nend", "def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend", "def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend", "def slow_solution(a)\n m = 0\n a.size.times do |i|\n a[i] = a[i].abs\n m = [a[i], m].max\n end\n maxsum = a.sum # sum of absolute val of all nums in array\n # maxsum = a.map(&:abs).sum <- Ruby shortcut\n\n # If dp = 1 at an index, it means some combo of elements in a add up to that index\n dp = [0] * (maxsum + 1)\n dp[0] = 1\n\n a.size.times do |j|\n maxsum.downto(0).each do |possible_sum|\n puts \"a[j]: #{a[j]}, possible sum: #{possible_sum}\"\n if (dp[possible_sum] == 1) and (possible_sum + a[j] <= maxsum)\n\n # if possible_sum + new element a[j] is possible sum, dp = 1!\n dp[possible_sum + a[j]] = 1\n puts \"Mark #{possible_sum + a[j]} as possible sum in dp\"\n end\n end\n puts \"row: #{j}, a[j]: #{a[j]}, dp: #{dp}\"\n puts\n end\n\n min_q_minus_p = maxsum\n\n # Divide array a into 2 parts, where P = sum of part 1 and Q = sum of part 2,\n # P + Q = maxsum, and P <= maxsum / 2 <= Q.\n # We want largest possible P to get smallest possible Q-P.\n\n # loop from 0 to maxsum / 2, covering every possible P, Q division\n (maxsum / 2 + 1).times do |possible_half_sum|\n # puts \"possible_half_sum: #{possible_half_sum}\"\n if dp[possible_half_sum] == 1 # means P or Q = possible_half_sum\n q_minus_p = maxsum - 2 * possible_half_sum\n # puts \"Q - P: #{q_minus_p}\"\n min_q_minus_p = [min_q_minus_p, q_minus_p].min\n # puts \"min Q - P: #{min_q_minus_p}\"\n end\n end\n\n min_q_minus_p\nend", "def solution(a)\n n = a.size\n starting = Array.new(n, 0)\n ending = Array.new(n, 0)\n\n (1..n - 2).each {|i| starting[i] = [starting[i - 1] + a[i], 0].max}\n (1..n - 2).reverse_each {|i| ending[i] = [ending[i + 1] + a[i], 0].max}\n\n sum = 0\n (1..n - 2).each {|i| sum = [sum, starting[i - 1] + ending[i + 1]].max}\n sum\nend", "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend", "def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend", "def largest_contiguous_sub_sum2(arr)\n #one varable tracks largest sum\n #one variable tracks current sum\n #O(n) + O(1)\n # list = [2, 3, -6, 7, -6, 7]\n\n # largest_sum= arr.first\n\n # i = 0\n # arr_end = true\n\n # while arr_end\n # current_sum = arr[i]\n # if arr[i+1] == nil\n # arr_end = false\n # puts \"This is current sum: #{current_sum}\"\n # else\n # if current_sum > largest_sum\n # current_sum += arr[i+1]\n # largest_sum = current_sum\n # end\n # end\n # if i < arr.length\n # arr_end = true\n # i += 1\n # end\n # end\n # largest_sum\n \n\n\n # arr.each_with_index do |ele, idx|\n # if ele > largest_sum\n # largest_sum = ele\n # end\n\n # i = idx\n # sum = ele\n # while i < arr.length - 1\n # if sum <= sum + arr[i+1]\n # largest_sum = sum + arr[i+1]\n # end\n # sum = sum + arr[i+1]\n # i+=1\n # end\n # end\n # largest_sum\n\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def find_solution(arr)\n arr.each_with_index do |e, i|\n rest = arr[0..i - 1] + arr[i + 1..-1]\n prod = rest.reduce(:*)\n arr[i] = prod\n end\n\n arr\nend", "def solution(arr)\n dp = Array.new(arr.max+2, 0)\n arr.each { |a| dp[a] += 1 }\n\n for i in 2...dp.size do\n dp[i] = [dp[i-2] + i*dp[i], dp[i-1]].max\n end\n dp.last\nend", "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend", "def solution(x, a)\n count = 1\n indices = []\n while count <= x\n indices << a.find_index(count)\n count += 1\n end\n\n if indices.include?(nil)\n -1\n else\n indices.sort.last\n end\nend", "def solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def solution(a)\n stack = []\n\n a.each_with_index do |n, i|\n if stack.empty?\n stack << [i, n]\n next\n end\n\n last_value = stack.last[1]\n\n if n == last_value\n stack << [i, n]\n else\n stack.pop\n end\n end\n\n return -1 if stack.empty?\n\n i, cd = stack.last\n\n count = a.inject(0) do |acc, n|\n cd == n ? acc + 1 : acc\n end\n\n count > a.length / 2 ? i : -1\nend", "def seesaw?(arr)\n left_sum = 0\n arr.each_index do |i| #O(n)\n if i > 0\n left_sum = arr[0...i].reduce(:+) #O(n)\n end\n if i < arr.size-1\n right_sum = arr[i+1..-1].reduce(:+); #O(n)\n else\n right_sum = 0\n end\n if left_sum == right_sum\n return true\n end\n end\n return false\nend", "def my_solution(array)\n hash = {}\n\n array.each do |element|\n hash[element] = 0 if element > 0\n end\n\n (1..array.size).each do |i|\n return i if hash[i].nil?\n end\nend", "def naive_algorithm(arr)\n\tproduct = 0\n\tarr.each do |i|\n\t arr.each do |j|\n\t \tp = arr[i] * arr[j]\n\t \tproduct = p if product < p\n\t end\t\n\tend\t\t\n\tproduct\nend", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend", "def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end \n current_sum += list[i] # O(1)\n if current_sum > max # O(1)\n max = current_sum # O(1)\n end\n end\n\n max # O(1)\n\nend", "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend", "def solution(x, a)\n perm = (1..x).to_a\n return -1 unless (perm - a).empty?\n a.index(a.uniq.last)\nend", "def solution(a)\n candidate = a[0]\n count = 0\n index = 0\n a.each_with_index do |d, idx|\n count = candidate == d ? count += 1 : count -= 1\n if count == 0\n candidate = d\n count = 1\n index = idx\n end\n end\n a.count { |d| d == candidate } * 2 > a.length ? index : -1\nend", "def solution(a)\n # we could do radix sort and then loop over all the items in order to find the missing element\n # in the ordered list or use the Gauss theorem: https://study.com/academy/lesson/finding-the-sum-of-consecutive-numbers.html\n #\n # if we use the Gauss theorem we can do:\n # sum = (1 + N+1) * ( N / 2 )\n #\n # if (1 + N+1) % 2 == 1 we need to sum also (n+1+1)/2 + 1\n #\n # then remove every item from the sum: the remainder is the missing number\n len = a.length\n sum = (1 + len + 1) * ((len + 1) / 2)\n sum += ((len + 1) / 2.0).ceil unless (len + 1) % 2 == 0\n\n a.reduce(sum) do |sum, i|\n sum - i\n end\nend", "def solution(n, a)\n counters = Array.new(n, 0)\n max = 0\n a.each do |item|\n if item >= 1 && item <= n\n counters[item - 1] += 1\n max = counters[item - 1] if counters[item - 1] > max\n elsif item == n + 1\n counters = Array.new(n, max)\n end\n end\n\n counters\nend", "def solve_again_with_issues(array, sum)\n result = {}\n freq = {}\n count = 0\n\n array.each do |el|\n freq[el] ? freq[el] += 1 : freq[el] = 1\n end\n\n array.each do |el|\n if freq[sum - el] && !result[sum - el]\n count += freq[sum - el]\n end\n end\n count/2\nend", "def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend", "def fast_lcss(arr)\n i_arr = []\n biggest = 0\n max_sub_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sum = i_arr.inject(0) do |a, b|\n a + b\n end\n max_sub_arr = i_arr if sum > biggest\n biggest = sum if sum > biggest \n end\n i_arr = []\n arr.shift\n end\n max_sub_arr\nend", "def solve(nums)\n arr = nums.map {|num| num * num}\n arr.each_with_index do |el1, idx1|\n arr.each_with_index do |el2, idx2|\n if idx2 > idx1\n if arr.include?(el1 + el2)\n if (arr.index(el1 + el2) != idx1) && (arr.index(el1 + el2) != idx2)\n return true\n end\n end\n end\n end\n end\n false\nend", "def solution(a)\n ((1..a.size + 1).to_a - a).first\nend", "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend", "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend", "def brute_force_two_sum(array, target)\n indexes = []\n array.each.with_index do |n1, index1|\n array.each.with_index do |n2, index2|\n indexes.push(index1) if target - n1 == n2 && index1 != index2\n end\n end\n indexes\nend", "def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend", "def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend", "def solution(k, m, a)\n from = a.max\n to = a.inject(:+)\n min = from\n while from <= to\n mid = (from + to) / 2\n if check(mid, k, m, a)\n min = mid\n to = mid - 1\n else\n from = mid + 1\n end\n end\n min\nend", "def solution(a)\n first_sum = a[0]\n second_sum = a.inject(&:+) - a.first\n result = (first_sum - second_sum).abs\n\n a[1..-2].each do |elem|\n first_sum = first_sum + elem\n second_sum = second_sum - elem\n tmp_result = (first_sum - second_sum).abs\n result = tmp_result if tmp_result < result\n end\n\n result\nend", "def largest_contiguous_subsum_once(arr)\n largest_subsum = 0\n current = 0\n\n arr.each do |elm|\n current += elm\n if largest_subsum < current\n largest_subsum = current\n elsif current < 0\n current = 0 \n end \n end \n\n # (0...arr.count).each do |i|\n # current_subsum = (largest_subsum + arr[i])\n # if current_subsum > largest_subsum \n # largest_subsum = current_subsum \n # elsif current_subsum < 0 \n # largest_subsum = 0 \n # end\n # end \n\n largest_subsum \nend", "def three_sum(nums)\n n = nums.length\n result = []\n for i in 0...n-2\n req_sum = 0\n hsh = Hash.new\n curr_sum = req_sum - nums[i]\n \n for j in (i+1)...n\n num = curr_sum - nums[j]\n if hsh[num]\n elements = [nums[i], num, nums[j]].sort\n result << elements unless result.include?(elements)\n end\n hsh[nums[j]] = true\n end \n end\n result\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def solution(n, a)\n max = 0\n counters = Array.new(n, max)\n a.each do |counter|\n if counter == n + 1\n counters.fill(max)\n else\n counters[counter - 1] += 1\n max = counters[counter - 1] if counters[counter - 1] > max\n end\n end\n counters\nend", "def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend", "def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend", "def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend", "def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend", "def okay_two_sum?(arr, target)\n sorted = arr.sort # n log n => quicksort => is nlogn DOMINANT\n sorted.each_with_index do |num, i| # => O(n)\n # return true if sorted[i] + sorted[-1 - i] == target\n return true if sorted[i + 1 .. - 1].bsearch {|number| target - num <=> number} # => O(log(n))\n # ASK TA ABOUT BSEARCH\n # bsearch {|ele| pivot <=> ele}\n end\n false\nend", "def findDiffSquares(n)\n sum = 0\n (1..n).each { |i|\n (1..n).each { |j|\n sum += i*j unless i == j\n }\n }\n sum\nend", "def solution(array)\n result = Array.new(array.length, 0)\n\n array.each do |element|\n if result[element - 1]\n result[element - 1] += 1\n else\n result[element - 1] = 1\n end\n end\n\n result.uniq.size == 1 ? 1 : 0\nend", "def better_sum1(arr, target) # this one is going to return true or false\n pairs = Set.new\n\n arr.each do |ele|\n if pairs.include?(ele)\n return true\n else\n pairs << target - ele\n end\n end\n false\nend", "def sum_to_n? arr, n\n #arr.product(arr).any? {|c| sum(c) == n && c[0] != c[1] } ----1.3\n arr = arr.sort\n low = 0\n high = arr.length - 1\n while low < high\n if arr[low] + arr[high] == n\n return true\n end\n arr[low] + arr[high] < n ? low += 1 : high -= 1 \n end\n return false\nend", "def solution(a)\n (0..a.size - 2).map { |i| ( a[0..i].inject(:+) - a[i+1..a.size].inject(:+) ).abs }.min\nend", "def two_sum?(array, target)\n #O(n)\n hash = Hash.new(0)\n i = 1\n array.each do |ele|\n hash[ele] = i \n i += 1\n end\n hash.each_key do |k|\n return true if hash.has_key?(target - k) && hash[k] != hash[target - k]\n end\n false \nend", "def solution(x, a)\r\n # write your code in Ruby 2.2\r\n arr=[];\r\n i=0;\r\n l=a.count\r\n \r\n while(arr.count<=x)\r\n \r\n if(arr[i].nil?)\r\n arr << i\r\n end\r\n \r\n i+=1\r\n end\r\n i\r\nend", "def better_contig_subsum(arr)\n max_sum = arr.inject(&:+) # O(n)\n temp_sum = max_sum\n\n loop do # O(n)\n left = temp_sum - arr.first\n right = temp_sum - arr.last\n\n if arr.length == 1\n if arr.first > max_sum\n return arr.first\n else\n return max_sum\n end\n end\n\n if right >= left\n max_sum = right if right >= max_sum\n temp_sum = right\n arr.pop\n else\n max_sum = left if left >= max_sum\n temp_sum = left\n arr.shift\n end\n end\n\n max_sum\nend", "def solution(a)\n len = a.size\n unique = {}\n i = 0\n while i < len\n item = a[i]\n if unique.has_key?(item)\n unique[item] += 1\n else\n unique[item] = 1\n end\n i += 1\n end\n pairs = 0\n unique.each do |key,count|\n (1...count).step {|n| pairs += n }\n end\n return pairs > 1_000_000_000 ? 1_000_000_000 : pairs\nend", "def largest_contiguous_subsum2(list)\n result = list.first\n sum = list.first\n\n list.each_with_index do |n, i|\n next if i == 0\n\n sum = 0 if sum < 0\n\n sum += n\n\n result = sum if sum > result\n end\n\n result\nend", "def sum_upon_sums(array)\n # Step 0: initialize variables => O(1)\n max = -1\n sum = 0\n\n # Step 1: Get Max and Sum => O(n)\n array.each do |num|\n max = num if num >= max\n sum += num\n end\n\n # Step 2: Get summation => O(1)\n summation = max * (max + 1) / 2\n\n # Step 3: Return Missing value by subtracting summation and sum => O(1)\n summation - sum\nend", "def get_products_but_self(arr)\n # raise 'need more than itself to get all other products' if arr.length < 2\n # result = [] \n # #first just try to come up with a way that works even if it's slow \n # arr.each_with_index do |el,idx|\n # arr[idx] = 1 \n # result << arr.reduce(:*) O(n) in a O(n) loop \n # arr[idx] = el \n # end \n # result This works, Time: O(n^2) space:O(n), created 1 new array Now try to optimize \n \n # Faster way, trying greedy way, constanly update the variable\n products_before_el = [1] # when we are at the first el, the product before that we use 1\n products_after_el = [] #we know that product after the last el, we can use 1, and since\n #we can only multiply, we backwards from the last el for products after el\n end_idx = arr.length - 1 \n products_after_el[end_idx] = 1\n (1..end_idx).each do |i| # time O(n)\n products_before_el[i] = products_before_el[i-1]*arr[i-1]\n products_after_el[end_idx - i] = products_after_el[end_idx - i + 1]*arr[end_idx - i +1]\n end \n result = []\n arr.length.times do |i| \n result[i] = products_before_el[i] * products_after_el[i]\n end \n result \n\n # Can we improve on space? \nend", "def two_sum_v3?(arr, target) \n hash = Hash.new\n arr.each { |ele| hash[ele] = ele } #o(n)\n arr.each do |ele| #o(n)\n search_value = target - ele\n return true if !hash[search_value].nil? && hash[search_value] != ele\n end\n false\nend", "def two_sum(arr) #o(ns)\n set = Set.new\n arr.each{|el| set << el}\n arr.select{|el| set.include?(-1 * el)}\nend", "def two_sum_brute nums\n (0...nums.length).each do |i|\n ((i + 1)...nums.length).each do |j|\n if nums[i] + nums[j] == 0\n return i, j\n end\n end\n end\n nil\nend", "def seesaw2?(arr)\n left_sum = 0\n right_sum = arr.size > 1 ? arr[1..-1].reduce(:+) : 0\n\n arr.each_index do |i| #O(n)\n return true if left_sum == right_sum\n left_sum += arr[i]\n i < arr.size-1 ? right_sum -= arr[i+1] : right_sum = 0\n end\n return false\nend", "def better_two_sum?(arr, target_sum)\n hash = {}\n arr.each_with_index do |ele,i|\n hash[ele] = i\n end\n arr.each_with_index do |ele,i|\n target = target_sum - ele\n return true if !hash[target].nil? && i != hash[target]\n end\n \n false\nend", "def solution(a)\n\traise ArgumentError.new(\"a has to be non empty array of max size #{MAX_LEN}\") if !a.is_a? Array or a.empty? or a.length > MAX_LEN\n\tret = 0\n\t#puts a.inspect\n\tmy_h = Hash.new\n\ta.each do |e|\n\t\tif my_h.include? e\n\t\t\tmy_h[e] += 1\n\t\telse\n\t\t\tmy_h[e] = 1\n\t\tend\n\tend\n\n\tmy_h_sort = my_h.sort_by {|k, v| -v}\n\t# -> my_h_sort[value][occurances]\n\treturn 0 if my_h_sort.first[1] < a.size/2\n\tleader_val = my_h_sort.first[0]\n\n\tocc_array = Array.new\n\toccurances = 0\n\ta.each do |e|\n\t\toccurances += 1 if e == leader_val\n\t\tocc_array.push(occurances)\n\tend\n\t#puts occ_array.inspect\n\n\tfor idx in (0...a.length-1) do\n\t\tsum1 = occ_array[idx]\n\t\tsum2 = occ_array.last - occ_array[idx]\n\n\t\t# puts \"#{idx}+1 < #{sum1*2}\"\n\t\t# puts \"#{(a.length - idx -1)} < #{(sum2*2 )} \"\n\n\t\tif (idx+1) < sum1 * 2 && (a.length - idx - 1 ) < sum2 * 2\n\t\t\t## we have a leader\n\t\t\t#puts \"YEAH #{idx}\"\n\t\t\tret += 1\n\t\tend\n\t\t\t#puts \"-------- ret: #{ret}\"\n\tend\n\treturn ret\nend", "def find_amicables(n)\n pairs = []\n sum = 0\n for i in 0..n do \n next if pairs.include? i\n d = sum_proper_divisors(i)\n next if d == i\n p = sum_proper_divisors(d)\n if p == i \n pairs << d\n pairs << i\n sum += d + i\n end\n end\n return sum\nend", "def solution(a)\n return nil unless a || a.empty?\n num_hash = {}\n a.each do |num|\n num_hash[num] = 1\n end\n\n 1.upto(a.size + 1) do |item|\n return item if !num_hash.has_key? item \n end\n\nend", "def largest_contiguous_subsum_2(list)\n largest_sum = 0\n current_sum = 0\n\n list.each do |el|\n largest_sum = current_sum \n current_sum += el \n if current_sum < el \n current_sum = el \n end \n largest_sum = current_sum if largest_sum < current_sum\n end\n\n largest_sum\nend", "def solution(a)\n if a.count >= 3\n distances = []\n last = nil\n (1...a.count - 1).each { |i|\n if a[i] > a[i - 1] and a[i] > a[i + 1]\n distances << i - last if last\n last = i\n end\n }\n puts distances.inspect\n \n (distances.count + 1).downto(1) { |flags|\n return flags if distances.all? { |d| d >= flags }\n }\n end\n 0\nend", "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend", "def three_sum_fast(arr)\n arr = merge_sort(arr)\n count = 0\n\n (0..arr.length - 1).each { |i|\n (i + 1..arr.length - 1).each { |j|\n if bin_search(arr, -arr[i] - arr[j]) > j\n count += 1\n end\n }\n }\n count\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n arr =[]\r\n a.each_with_index{|el,i|\r\n \r\n if !arr.index(el) \r\n arr << el\r\n end\r\n \r\n }\r\n arr.count\r\nend", "def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end", "def solution(a, k)\n # write your code in Ruby 2.2\n \n unless a.empty?\n for i in 1..k\n last = a.pop\n a.insert(0, last)\n end\n end\n \n return a\nend", "def find_lis_brute_force array\n max_count = -1\n # Generate all the possible sets. This is done by generating all binary numbers from 1 to 2^n.\n # The presence of a 0 in the binary number at a position will grant entry to the element at that position to the set\n for i in 1..((2**array.count) - 1)\n itr = array.count - 1\n set = []\n while i > 0\n if i%2 == 1\n set << array[itr]\n end\n i = i/2\n itr -= 1\n end\n max_count = max(max_count, evaluate(set))\n end\n return max_count\nend", "def sub_sum(list)\n array = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n array << list[idx1..idx2] #O(n)\n end\n end \n array.map {|sub| sub.length > 1 ? sub.sum : sub.first}.max\nend", "def two_sum?(arr, target_sum) # O(N)\n hash = Hash.new(0)\n count = Hash.new(0)\n\n arr.each do |num|\n hash[num] = target_sum - num\n count[num] += 1\n end\n\n hash.each do |key, value|\n if hash.has_key?(value) \n if key == value \n if count[value] > 1\n return true\n end\n else\n return true\n end\n end\n end\n\n false\nend", "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end" ]
[ "0.72011554", "0.68064815", "0.6800744", "0.6755844", "0.6687568", "0.66418976", "0.6629113", "0.6614764", "0.66100013", "0.6604537", "0.65870476", "0.6581771", "0.65489805", "0.65482247", "0.6546301", "0.6541277", "0.65363646", "0.65175325", "0.6500247", "0.6492299", "0.64884025", "0.64798695", "0.64781415", "0.6466118", "0.64650273", "0.6464611", "0.64525545", "0.644924", "0.64442736", "0.6435792", "0.64139867", "0.63956755", "0.6391802", "0.6385082", "0.6375268", "0.63632005", "0.63592416", "0.63571423", "0.634799", "0.63473773", "0.63462484", "0.63452953", "0.6340266", "0.6333657", "0.63320416", "0.63282967", "0.6327232", "0.63154566", "0.63134295", "0.63122004", "0.62885493", "0.6281014", "0.6275606", "0.6266922", "0.62556756", "0.62450975", "0.62445", "0.6241737", "0.62406933", "0.62273115", "0.62212926", "0.6221059", "0.6218955", "0.6215918", "0.62142426", "0.6211416", "0.6211113", "0.62086374", "0.6208104", "0.6193775", "0.61927634", "0.61908215", "0.61865425", "0.6185403", "0.6176646", "0.61754555", "0.61745816", "0.6169689", "0.61659807", "0.6165399", "0.61649835", "0.61642236", "0.6162288", "0.61582637", "0.615731", "0.6150478", "0.6146814", "0.6143857", "0.6142086", "0.6141088", "0.61402714", "0.6138136", "0.61374056", "0.6135811", "0.6126904", "0.61244535", "0.611986", "0.6119291", "0.6117345", "0.61151356", "0.6112446" ]
0.0
-1
The following is optimized for time and space O(n) time complexity 0(1) space complexity
def kth_to_last_space_optimized(head, k) count = 1 current_node = head while current_node count += 1 current_node = current_node.next end current_node = head target = count - k count = 1 while current_node return current_node.value if count == target count += 1 current_node = current_node.next end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def three_sum_fastest(arr)\n count = 0\n\n (0..arr.length - 2).each { |i|\n set = Set.new\n\n (i + 1..arr.length - 1).each { |j|\n if set.include?(-arr[i] - arr[j])\n count += 1\n end\n\n set.add(arr[j])\n }\n }\n count\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end \n current_sum += list[i] # O(1)\n if current_sum > max # O(1)\n max = current_sum # O(1)\n end\n end\n\n max # O(1)\n\nend", "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend", "def seesaw?(arr)\n left_sum = 0\n arr.each_index do |i| #O(n)\n if i > 0\n left_sum = arr[0...i].reduce(:+) #O(n)\n end\n if i < arr.size-1\n right_sum = arr[i+1..-1].reduce(:+); #O(n)\n else\n right_sum = 0\n end\n if left_sum == right_sum\n return true\n end\n end\n return false\nend", "def naive_algorithm(arr)\n\tproduct = 0\n\tarr.each do |i|\n\t arr.each do |j|\n\t \tp = arr[i] * arr[j]\n\t \tproduct = p if product < p\n\t end\t\n\tend\t\t\n\tproduct\nend", "def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\nend", "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend", "def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend", "def largest_contiguous_sub_sum2(arr)\n #one varable tracks largest sum\n #one variable tracks current sum\n #O(n) + O(1)\n # list = [2, 3, -6, 7, -6, 7]\n\n # largest_sum= arr.first\n\n # i = 0\n # arr_end = true\n\n # while arr_end\n # current_sum = arr[i]\n # if arr[i+1] == nil\n # arr_end = false\n # puts \"This is current sum: #{current_sum}\"\n # else\n # if current_sum > largest_sum\n # current_sum += arr[i+1]\n # largest_sum = current_sum\n # end\n # end\n # if i < arr.length\n # arr_end = true\n # i += 1\n # end\n # end\n # largest_sum\n \n\n\n # arr.each_with_index do |ele, idx|\n # if ele > largest_sum\n # largest_sum = ele\n # end\n\n # i = idx\n # sum = ele\n # while i < arr.length - 1\n # if sum <= sum + arr[i+1]\n # largest_sum = sum + arr[i+1]\n # end\n # sum = sum + arr[i+1]\n # i+=1\n # end\n # end\n # largest_sum\n\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend", "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend", "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend", "def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend", "def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend", "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend", "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend", "def two_sum(arr) #o(ns)\n set = Set.new\n arr.each{|el| set << el}\n arr.select{|el| set.include?(-1 * el)}\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def two_sum?(array, target)\n #O(n)\n hash = Hash.new(0)\n i = 1\n array.each do |ele|\n hash[ele] = i \n i += 1\n end\n hash.each_key do |k|\n return true if hash.has_key?(target - k) && hash[k] != hash[target - k]\n end\n false \nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend", "def bad_two_sum?(arr, target)\n arr.each_with_index do |num1, idx1| #O(n)\n arr.each_with_index do |num2, idx2| #O(n)\n return true if idx2 > idx1 && num1 + num2 == target #O(1)\n end\n end\n false\nend", "def largest_contiguous_subsum_once(arr)\n largest_subsum = 0\n current = 0\n\n arr.each do |elm|\n current += elm\n if largest_subsum < current\n largest_subsum = current\n elsif current < 0\n current = 0 \n end \n end \n\n # (0...arr.count).each do |i|\n # current_subsum = (largest_subsum + arr[i])\n # if current_subsum > largest_subsum \n # largest_subsum = current_subsum \n # elsif current_subsum < 0 \n # largest_subsum = 0 \n # end\n # end \n\n largest_subsum \nend", "def stones(n, a, b)\n ar=[0]\n (n-1).times do |val|\n tmp=[]\n ar.each do |v|\n tmp << v+a if !tmp.include?(v+a)\n tmp << v+b if !tmp.include?(v+b)\n end\n ar=tmp\n end\n ar.sort\nend", "def fast_lcss(arr)\n i_arr = []\n biggest = 0\n max_sub_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sum = i_arr.inject(0) do |a, b|\n a + b\n end\n max_sub_arr = i_arr if sum > biggest\n biggest = sum if sum > biggest \n end\n i_arr = []\n arr.shift\n end\n max_sub_arr\nend", "def solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\nend", "def seesaw2?(arr)\n left_sum = 0\n right_sum = arr.size > 1 ? arr[1..-1].reduce(:+) : 0\n\n arr.each_index do |i| #O(n)\n return true if left_sum == right_sum\n left_sum += arr[i]\n i < arr.size-1 ? right_sum -= arr[i+1] : right_sum = 0\n end\n return false\nend", "def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend", "def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend", "def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend", "def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend", "def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend", "def solution(a)\n left = 0\n right = a.sum\n a.each_with_index do |element, index|\n right -= element\n return index if left == right\n left += element\n end\n -1\nend", "def sum_to_n? arr, n\n #arr.product(arr).any? {|c| sum(c) == n && c[0] != c[1] } ----1.3\n arr = arr.sort\n low = 0\n high = arr.length - 1\n while low < high\n if arr[low] + arr[high] == n\n return true\n end\n arr[low] + arr[high] < n ? low += 1 : high -= 1 \n end\n return false\nend", "def okay_two_sum?(arr, target)\n sorted = arr.sort # n log n => quicksort => is nlogn DOMINANT\n sorted.each_with_index do |num, i| # => O(n)\n # return true if sorted[i] + sorted[-1 - i] == target\n return true if sorted[i + 1 .. - 1].bsearch {|number| target - num <=> number} # => O(log(n))\n # ASK TA ABOUT BSEARCH\n # bsearch {|ele| pivot <=> ele}\n end\n false\nend", "def fibonacci(n)\n return fib_helper([0, 1], 2, n)\n # if you'd like to test what i THINK is an O(1) space complexity solution.....\n # i did run this through the tests and it SHOULD work:\n # return faster_fib_helper([0, 1], 2, n)\nend", "def two_sum?(arr, target_sum) # O(N)\n hash = Hash.new(0)\n count = Hash.new(0)\n\n arr.each do |num|\n hash[num] = target_sum - num\n count[num] += 1\n end\n\n hash.each do |key, value|\n if hash.has_key?(value) \n if key == value \n if count[value] > 1\n return true\n end\n else\n return true\n end\n end\n end\n\n false\nend", "def find3(a, X)\n # scan through array\n # build hash storing complement in each key\n complements = {}\n a.each_with_index do |val, ind|\n if complements[X - val]\n complements[X - val].push(ind)\n else\n complements[X - val] = [ind]\n end\n end\n\n # scan through the array again\n # get complement\n # for each value scan the remainder of the arrray\n # for a value such taht a + b = the complement\n\n # for each character we have built a dictionary such that, we can find\n # x = a + complement\n\n # [1, 2, 3]\n # 1 + 2 = 3\n # 1 + 3 = 4 =>\n\n # for each value in the array (a) look at all following values (b) and see if a + b\n # is in the dictionary, if it is, check that their indices do not collide with the index\n # stored at dict(a+b)\n\n a.each_with_index do |va, i|\n a.each_with_index do |vb, j|\n break if i == j\n\n complement = va + vb\n indices = complements[complement]\n\n indices.each do |z|\n # every index is unique\n return [i, j, z] unless z == i || z == j\n end\n end\n end\n\n return nil\nend", "def third_anagram?(str1, str2)\n beginning_time = Time.now\n str1.split(\"\").sort == str2.split(\"\").sort #O(nlogn)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend", "def solution(a)\n n = a.size\n starting = Array.new(n, 0)\n ending = Array.new(n, 0)\n\n (1..n - 2).each {|i| starting[i] = [starting[i - 1] + a[i], 0].max}\n (1..n - 2).reverse_each {|i| ending[i] = [ending[i + 1] + a[i], 0].max}\n\n sum = 0\n (1..n - 2).each {|i| sum = [sum, starting[i - 1] + ending[i + 1]].max}\n sum\nend", "def three_sum(nums)\n n = nums.length\n result = []\n for i in 0...n-2\n req_sum = 0\n hsh = Hash.new\n curr_sum = req_sum - nums[i]\n \n for j in (i+1)...n\n num = curr_sum - nums[j]\n if hsh[num]\n elements = [nums[i], num, nums[j]].sort\n result << elements unless result.include?(elements)\n end\n hsh[nums[j]] = true\n end \n end\n result\nend", "def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend", "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend", "def three_sum_fast(arr)\n arr = merge_sort(arr)\n count = 0\n\n (0..arr.length - 1).each { |i|\n (i + 1..arr.length - 1).each { |j|\n if bin_search(arr, -arr[i] - arr[j]) > j\n count += 1\n end\n }\n }\n count\nend", "def find_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n fast = nums[ fast ]\n slow = nums[ slow ]\n if fast == slow\n new_node = nums[ 0 ]\n while new_node != slow\n new_node = nums[ new_node ]\n slow = nums[ slow ]\n end\n return slow\n end\n end\n end\nend", "def solution(x, a)\r\n # write your code in Ruby 2.2\r\n arr=[];\r\n i=0;\r\n l=a.count\r\n \r\n while(arr.count<=x)\r\n \r\n if(arr[i].nil?)\r\n arr << i\r\n end\r\n \r\n i+=1\r\n end\r\n i\r\nend", "def findDiffSquares(n)\n sum = 0\n (1..n).each { |i|\n (1..n).each { |j|\n sum += i*j unless i == j\n }\n }\n sum\nend", "def canBeSum(n, array, cache)\n\ti = 0\n\twhile array[i] <= n / 2\n\t\tif cache[n-array[i]] # array.include?(n-array[i]) is OK, but very slow\n\t\t\treturn true\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn false\nend", "def two_sum_v3?(arr, target) \n hash = Hash.new\n arr.each { |ele| hash[ele] = ele } #o(n)\n arr.each do |ele| #o(n)\n search_value = target - ele\n return true if !hash[search_value].nil? && hash[search_value] != ele\n end\n false\nend", "def sum_upon_sums(array)\n # Step 0: initialize variables => O(1)\n max = -1\n sum = 0\n\n # Step 1: Get Max and Sum => O(n)\n array.each do |num|\n max = num if num >= max\n sum += num\n end\n\n # Step 2: Get summation => O(1)\n summation = max * (max + 1) / 2\n\n # Step 3: Return Missing value by subtracting summation and sum => O(1)\n summation - sum\nend", "def better_sum1(arr, target) # this one is going to return true or false\n pairs = Set.new\n\n arr.each do |ele|\n if pairs.include?(ele)\n return true\n else\n pairs << target - ele\n end\n end\n false\nend", "def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend", "def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\n subs.each do |sub| #O(n**2)\n sub_sum = 0 #O(1)\n sub.each {|s| sub_sum += s} #O(n)\n subs_sum << sub_sum #O(1)\n end\n subs_sum.inject do |acc,el| #O(n)\n if acc > el #O(1)\n acc #O(1)\n else\n el #O(1)\n end\n end\n end", "def find_missing(array, n)\n i = 0\n\n (1..n).each { |number| i = i ^ number }\n array.each { |number| i = i ^ number }\n\n i\nend", "def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend", "def largest_contiguous_subsum2(list)\n result = list.first\n sum = list.first\n\n list.each_with_index do |n, i|\n next if i == 0\n\n sum = 0 if sum < 0\n\n sum += n\n\n result = sum if sum > result\n end\n\n result\nend", "def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend", "def solution(x, a)\n perm = (1..x).to_a\n return -1 unless (perm - a).empty?\n a.index(a.uniq.last)\nend", "def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend", "def solution(a)\n ((1..a.size + 1).to_a - a).first\nend", "def slow_solution(a)\n m = 0\n a.size.times do |i|\n a[i] = a[i].abs\n m = [a[i], m].max\n end\n maxsum = a.sum # sum of absolute val of all nums in array\n # maxsum = a.map(&:abs).sum <- Ruby shortcut\n\n # If dp = 1 at an index, it means some combo of elements in a add up to that index\n dp = [0] * (maxsum + 1)\n dp[0] = 1\n\n a.size.times do |j|\n maxsum.downto(0).each do |possible_sum|\n puts \"a[j]: #{a[j]}, possible sum: #{possible_sum}\"\n if (dp[possible_sum] == 1) and (possible_sum + a[j] <= maxsum)\n\n # if possible_sum + new element a[j] is possible sum, dp = 1!\n dp[possible_sum + a[j]] = 1\n puts \"Mark #{possible_sum + a[j]} as possible sum in dp\"\n end\n end\n puts \"row: #{j}, a[j]: #{a[j]}, dp: #{dp}\"\n puts\n end\n\n min_q_minus_p = maxsum\n\n # Divide array a into 2 parts, where P = sum of part 1 and Q = sum of part 2,\n # P + Q = maxsum, and P <= maxsum / 2 <= Q.\n # We want largest possible P to get smallest possible Q-P.\n\n # loop from 0 to maxsum / 2, covering every possible P, Q division\n (maxsum / 2 + 1).times do |possible_half_sum|\n # puts \"possible_half_sum: #{possible_half_sum}\"\n if dp[possible_half_sum] == 1 # means P or Q = possible_half_sum\n q_minus_p = maxsum - 2 * possible_half_sum\n # puts \"Q - P: #{q_minus_p}\"\n min_q_minus_p = [min_q_minus_p, q_minus_p].min\n # puts \"min Q - P: #{min_q_minus_p}\"\n end\n end\n\n min_q_minus_p\nend", "def largest_contiguous_subsum_2(list)\n largest_sum = 0\n current_sum = 0\n\n list.each do |el|\n largest_sum = current_sum \n current_sum += el \n if current_sum < el \n current_sum = el \n end \n largest_sum = current_sum if largest_sum < current_sum\n end\n\n largest_sum\nend", "def better_subsum(arr) # o(n)\n largest = 0 \n sum = 0 \n i = 0 \n j = 0\n\n while i != arr.length-1\n largest += arr[j]\n sum = largest if largest > sum \n if j == arr.length-1 \n i+=1 \n j = i \n largest = 0 \n else\n j+=1\n end \n end \n sum \n end", "def two_sum_brute nums\n (0...nums.length).each do |i|\n ((i + 1)...nums.length).each do |j|\n if nums[i] + nums[j] == 0\n return i, j\n end\n end\n end\n nil\nend", "def largest_contiguous_subsum_v2(arr) # O(n)\n\n largest_sum = arr[0]\n current_sum = arr[0]\n \n (1...arr.length).each do |i|\n if current_sum < 0\n if current_sum < arr[i]\n current_sum = arr[i]\n end\n else\n current_sum += arr[i]\n end\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend", "def my_min1(arr)\n arr.each do |el1| #O(n)\n if arr.all? {|el2| el1 <= el2 } #O(n + 1)\n return el1\n end\n end \nend", "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend", "def my_solution(array)\n hash = {}\n\n array.each do |element|\n hash[element] = 0 if element > 0\n end\n\n (1..array.size).each do |i|\n return i if hash[i].nil?\n end\nend", "def bad_contig_subsum(arr)\n # n! || n^3 ?\n sub_arrays = []\n arr.each_index do |i|\n (i...arr.length).each do |j|\n sub_arrays << arr[i..j]\n end\n end\n\n # above * n^2 ? << bottleneck\n max = sub_arrays.first.inject(&:+)\n sub_arrays.each do |sub_arr|\n sub_sum = sub_arr.inject(&:+)\n max = sub_sum if sub_sum > max\n end\n max\nend", "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end", "def better_contig_subsum(arr)\n max_sum = arr.inject(&:+) # O(n)\n temp_sum = max_sum\n\n loop do # O(n)\n left = temp_sum - arr.first\n right = temp_sum - arr.last\n\n if arr.length == 1\n if arr.first > max_sum\n return arr.first\n else\n return max_sum\n end\n end\n\n if right >= left\n max_sum = right if right >= max_sum\n temp_sum = right\n arr.pop\n else\n max_sum = left if left >= max_sum\n temp_sum = left\n arr.shift\n end\n end\n\n max_sum\nend", "def okay_two_sum(arr, target)\n #O(n)\n arr.sort!\n i = 0\n j = arr.length - 1\n while i < j\n sum = arr[i] + arr[j]\n return true if sum == target\n if sum < target\n i += 1\n else\n j -= 1\n end\n end\n false\nend", "def okay_two_sum?(arr, target)\r\n arr = arr.sort #n log n\r\n i, j = 0, arr.length - 1 #2\r\n\r\n while j > i #n\r\n curr_sum = arr[i] + arr[j]\r\n if curr_sum > target\r\n j -= 1\r\n elsif curr_sum < target\r\n i += 1\r\n else\r\n return true\r\n end\r\n end\r\n false\r\nend", "def solve(nums)\n arr = nums.map {|num| num * num}\n arr.each_with_index do |el1, idx1|\n arr.each_with_index do |el2, idx2|\n if idx2 > idx1\n if arr.include?(el1 + el2)\n if (arr.index(el1 + el2) != idx1) && (arr.index(el1 + el2) != idx2)\n return true\n end\n end\n end\n end\n end\n false\nend", "def solution(n, a)\n counters = Array.new(n, 0)\n max = 0\n a.each do |item|\n if item >= 1 && item <= n\n counters[item - 1] += 1\n max = counters[item - 1] if counters[item - 1] > max\n elsif item == n + 1\n counters = Array.new(n, max)\n end\n end\n\n counters\nend", "def sub_sum2(array)\n arr = []\n sum = 0\n array.each do |el|\n arr << [el] \n end\n array.each do |el|\n array.shift\n arr << array\n end\n # p arr\n result = 0\n arr.each do |set|\n if set.reduce(:+) > result\n result = set.reduce(:+)\n end \n end \n result\nend", "def largest_contiguous_subsum(list)\n new_arr = []\n\n (0...list.length).each do |idx1| #O(n)\n (0...list.length).each do |idx2| #O(n)\n if idx2 >= idx1 #O(1)\n new_arr << list[idx1..idx2].sum #O(1)\n end \n end \n \n end \n \n return new_arr.max #O(n)\nend", "def two_sum_to_zero?(array)\n # len = array.length - 1\n # len.times do |i|\n # (i + 1).upto(len) do |j|\n # return true if array[i] + array[j] == 0\n # end\n # end\n # false\n nums_hash = {}\n array.each do |el|\n return true if nums_hash[-(el)]\n nums_hash[el] = true\n end\n false\nend", "def euler29(n)\n terms = []\n 2.upto(n) do |i|\n 2.upto(n) do |j|\n if terms.include?(i ** j) == false\n terms << i ** j\n end\n end\n end\n \n terms.length\nend", "def sub_sum_better(list)\n largest_sum = list.first\n\n #iterate over once.\n # as you iterate keep a tally of the sum.\n # indexing into an array is O(1)\n # [2, 3, -6, 7, -6, 7]\n\n sub_sum = 0\n list.each do |el|\n sub_sum += el\n largest_sum = sub_sum if sub_sum > largest_sum\n\n sub_sum = 0 if sub_sum < 0\n end\n\n largest_sum\nend", "def largest_contiguous_subsum(list) # O(n^2)\n array = []\n list.each_with_index do |ele1, i1| # O(n^2)\n (i1...list.length).each do |i2|\n array << list[i1..i2]\n end\n end\n\n max_sum = array.first.sum\n array[1..-1].each do |subarr| # O(n^2)\n sum = subarr.sum\n if sum > max_sum\n max_sum = sum\n end\n end\n\n max_sum\n\nend", "def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend", "def get_products_but_self(arr)\n # raise 'need more than itself to get all other products' if arr.length < 2\n # result = [] \n # #first just try to come up with a way that works even if it's slow \n # arr.each_with_index do |el,idx|\n # arr[idx] = 1 \n # result << arr.reduce(:*) O(n) in a O(n) loop \n # arr[idx] = el \n # end \n # result This works, Time: O(n^2) space:O(n), created 1 new array Now try to optimize \n \n # Faster way, trying greedy way, constanly update the variable\n products_before_el = [1] # when we are at the first el, the product before that we use 1\n products_after_el = [] #we know that product after the last el, we can use 1, and since\n #we can only multiply, we backwards from the last el for products after el\n end_idx = arr.length - 1 \n products_after_el[end_idx] = 1\n (1..end_idx).each do |i| # time O(n)\n products_before_el[i] = products_before_el[i-1]*arr[i-1]\n products_after_el[end_idx - i] = products_after_el[end_idx - i + 1]*arr[end_idx - i +1]\n end \n result = []\n arr.length.times do |i| \n result[i] = products_before_el[i] * products_after_el[i]\n end \n result \n\n # Can we improve on space? \nend", "def checkArray(a)\n\tn = a.length-1\n\tcount = 0\n\tfor i in 0..n do\n\t\tfor j in (i+1)..n do\n\t\t\tfor k in (j+1)..n do\n\t\t\t\tif (a[i] + a[j] + a[k] == 0)\n\t\t\t\t\tcount += 1\n\t\t\t\t\treturn count;\n\t\t\t\telse\n\t\t\t\t\treturn count;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend" ]
[ "0.70928335", "0.6901146", "0.66407204", "0.6599523", "0.657768", "0.6498791", "0.6490742", "0.6478487", "0.64626044", "0.6419806", "0.64079374", "0.6394649", "0.6379443", "0.636823", "0.636227", "0.6349882", "0.63466394", "0.63365704", "0.6320437", "0.63151544", "0.63094366", "0.629739", "0.6273328", "0.6266073", "0.62630486", "0.625578", "0.62552834", "0.6231225", "0.6207977", "0.62066257", "0.6205999", "0.6197873", "0.61956763", "0.6190221", "0.61872214", "0.617724", "0.6175309", "0.61729383", "0.61701006", "0.61691153", "0.616437", "0.61567575", "0.6153733", "0.6149412", "0.61467344", "0.61448044", "0.6138051", "0.61339617", "0.6133611", "0.61306375", "0.61273915", "0.6120758", "0.6110014", "0.6108461", "0.610207", "0.60935676", "0.609034", "0.60890365", "0.60836387", "0.608358", "0.6079034", "0.60734814", "0.6072757", "0.60686326", "0.6064573", "0.6063891", "0.606334", "0.6061125", "0.606034", "0.6051026", "0.60500616", "0.60438985", "0.6043578", "0.6043074", "0.60422385", "0.6039039", "0.6028433", "0.6025986", "0.6025077", "0.60247743", "0.60221267", "0.60171276", "0.6012559", "0.6012496", "0.6011961", "0.6008651", "0.60046095", "0.59976655", "0.599224", "0.59884036", "0.5987612", "0.5980347", "0.5977285", "0.59771854", "0.597356", "0.59723306", "0.5972091", "0.59719765", "0.5971161", "0.5967145", "0.5966901" ]
0.0
-1
Convert CFPropertyList to binary format; since we have to count our objects we simply unique CFDictionary and CFArray
def to_str(opts={}) @unique_table = {} @count_objects = 0 @string_size = 0 @int_size = 0 @misc_size = 0 @object_refs = 0 @written_object_count = 0 @object_table = [] @object_ref_size = 0 @offsets = [] binary_str = "bplist00" unique_and_count_values(opts[:root]) @count_objects += @unique_table.size @object_ref_size = Binary.bytes_needed(@count_objects) file_size = @string_size + @int_size + @misc_size + @object_refs * @object_ref_size + 40 offset_size = Binary.bytes_needed(file_size) table_offset = file_size - 32 @object_table = [] @written_object_count = 0 @unique_table = {} # we needed it to calculate several values, but now we need an empty table opts[:root].to_binary(self) object_offset = 8 offsets = [] 0.upto(@object_table.size-1) do |i| binary_str += @object_table[i] offsets[i] = object_offset object_offset += @object_table[i].bytesize end offsets.each do |offset| binary_str += Binary.pack_it_with_size(offset_size,offset) end binary_str += [offset_size, @object_ref_size].pack("x6CC") binary_str += [@count_objects].pack("x4N") binary_str += [0].pack("x4N") binary_str += [table_offset].pack("x4N") return binary_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_plist\n @attributes.to_plist\n end", "def to_plist\n attributes.to_plist\n end", "def dict_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"d\",val.value.size) # d=1101, type indicator for dictionary\n\n val.value.each_key do |k|\n str = CFString.new(k)\n key = str.to_binary(self)\n bdata += Binary.pack_it_with_size(@object_ref_size,key)\n end\n\n val.value.each_value do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size,v.to_binary(self))\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def to_plist(format=:xml)\n format = case format\n when :xml\n NSPropertyListXMLFormat_v1_0\n when :binary\n NSPropertyListBinaryFormat_v1_0\n when :open_step\n NSPropertyListOpenStepFormat\n else\n raise ArgumentError, \"invalid format `#{format}'\"\n end\n #error = Pointer.new(:object)\n data = NSPropertyListSerialization.dataFromPropertyList(self,\n format:format,\n errorDescription:nil)\n #raise error[0] if error[0].to_s.size > 0\n NSMutableString.alloc.initWithData(data, encoding:NSUTF8StringEncoding)\n end", "def items_to_bytes\n bytes = []\n @items.each do |item|\n bytes << item.key\n bytes << item.value\n end\n bytes\n end", "def to_plist\n node = XML::Node.new('array')\n values.each do |attribute|\n node << attribute.to_s.to_plist\n end\n node\n end", "def to_plist\n plist = serialize_for_plist.to_plist\n # Fix ^M encoding CR issue\n plist.gsub(/\\r\\n?/, \"\\n\")\n end", "def to_plist\n @policy.to_plist({:plist_format => CFPropertyList::List::FORMAT_XML, :formatted => true})\n end", "def embed_property_value_list( property_value_list )\n count = 1 \n property_value_list.each do |property_value_pair|\n PropertyValue.create(:item_id => self.id, \n :property_id => property_value_pair[:property_id],\n :value_id => property_value_pair[:value_id],\n :position => count)\n count += 1 \n end\n end", "def encode(list)\n pack(list).map { |i| [i.length,i.first] }\nend", "def to_plist(envelope = true)\n Plist::Emit.dump(self, envelope)\n end", "def encode_modified(list)\n pack(list).map { |i| i.length > 1 ? [i.length,i.first] : i.first }\nend", "def property_options\n return @array.map {|property|\n {\n name: property.print_list,\n value: property.property_id\n }\n }\n end", "def serialize_for_plist\n h = {}\n if exclusively_raw?\n h = raw_tags\n else\n # Take care of the straight forward mappings\n keys = [:name,:display_name,:receipts,:description,:minimum_os_version,:maximum_os_version,\n :installs,:RestartAction,:package_path,:autoremove,:installer_type,:installed_size,:installer_item_size,\n :installer_item_location,:uninstaller_item_location,:uninstaller_item_size,:uninstallable, :uninstall_method, :unattended_install, :unattended_uninstall,\n :preinstall_script, :postinstall_script, :uninstall_script, :preuninstall_script, :postuninstall_script,\n :requires,:update_for,:catalogs,:version, :force_install_after_date, :installer_choices_xml]\n\n keys.each do |key|\n h[key.to_s] = self.send(key) if self.send(key).present?\n end\n\n # Add append any special cases to the hash\n h[\"category\"] = self.package_category.to_s\n\n # Supported Architectures\n sa = self.supported_architectures.delete_if {|e| e == \"\"}\n h[\"supported_architectures\"] = sa unless sa.empty?\n # Requires\n h[\"requires\"] = self.requires.map {|p| p.to_s(:version) } unless self.requires.empty?\n h[\"installer_item_location\"] = download_name\n\n # Add any raw tags\n h = h.merge(raw_tags) if append_raw?\n\n h.delete(\"RestartAction\") if h[\"RestartAction\"] == \"None\"\n end\n h\n end", "def xfprops(io)\n _, cprops = io.read(4).unpack('vv')\n\n result = {\n # reserved (2 bytes): MUST be zero and MUST be ignored.\n cprops: cprops, # cprops (2 bytes): An unsigned integer that specifies the number of XFProp structures in xfPropArray.\n xfPropArray: [] # xfPropArray (variable): An array of XFProp. Each array element specifies a formatting property. The array of properties specifies the full set of formatting properties.\n }\n\n cprops.times { result[:xfPropArray] << xfprop(io) }\n\n result\n end", "def to_s\n result = []\n all_properties_hash.each do |k, v|\n result << \"#{k} = #{v}\"\n end\n result.join(\"; \")\n end", "def list_item_properties(properties = {})\n props = { id: properties[:id], list_id: @id,\n contact_ids: [properties[:contact_ids]].flatten,\n account_id: properties[:account_id],\n field_values: coded_field_values(properties[:field_values]) }\n props.delete_if { |_k, v| v.nil? || v.is_a?(Array) && v.compact.empty? }\n end", "def array_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"a\", val.value.size) # a is 1010, type indicator for arrays\n\n val.value.each do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self));\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def to_binary\n Formatters::Binary.new.serialize self\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"certificateList\", @certificate_list)\n end", "def save_config\n plist = CFPropertyList::List.new\n plist.value = CFPropertyList.guess(@config)\n plist.save(@file, CFPropertyList::List::FORMAT_XML)\n end", "def marshal_dump#:nodoc:\n fields_to_serialize.map{|field| instance_variable_value(field)}\n end", "def to_s\n p = @properties.merge({}) do |_k, _o, n|\n if n.is_a?(Array)\n n.flatten.map(&:to_s).join(',')\n else\n n\n end\n end\n p.map { |kv| kv.join('=') }.join(\"\\n\")\n end", "def create_shadowhashdata(label, data)\n plist = NSMutableDictionary.new\n plist[label] = data\n NSPropertyListSerialization.objc_send(\n :dataFromPropertyList, plist,\n :format, NSPropertyListBinaryFormat_v1_0,\n :errorDescription, nil\n )\n end", "def to_s\n p = properties.merge({}) do |_k, _o, n|\n if n.is_a?(Array)\n n.flatten.map(&:to_s).join(',')\n else\n n\n end\n end\n p.map { |kv| kv.join('=') }.join(\"\\n\")\n end", "def to_s\n p = properties.merge({}) do |_k, _o, n|\n if n.is_a?(Array)\n n.flatten.map(&:to_s).join(',')\n else\n n\n end\n end\n p.map { |kv| kv.join('=') }.join(\"\\n\")\n end", "def to_hash; @caesars_properties.to_hash; end", "def to_s\n bits=\"\"\n @fields.each {|f| \n if f.kind_of? Fields::Field\n bits << f.bitstring\n else\n bits << f.to_bitstring\n end\n }\n [bits].pack('B*')\n end", "def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end", "def strip_data(property, file)\n property_type = property.type_var.val[0...-1]\n return property.data if property_type == 'IntProperty' || property_type == 'FloatProperty' || property_type == 'QWordProperty'\n return property.data.val[0...-1] if property_type == 'StrProperty' || property_type == 'NameProperty'\n return property.data.byte_val.val[0...-1] if property_type == 'ByteProperty'\n return property.data == 1 if property_type == 'BoolProperty'\n # Must be an array at this point.\n data_list = {}\n loop_times = (@name == \"Goals\" ? GOALS_DATA_SIZE : STATS_DATA_SIZE)\n property.data.times{|prop_number|\n sub_data = {}\n loop_times.times do\n arr_property = Property.new(file)\n if arr_property.name != \"None\"\n sub_data[arr_property.name] = arr_property.data\n end\n end\n data_list[prop_number.to_s] = sub_data\n }\n data_list\n end", "def export_obj faces, filename\n v = []\n v_index = {}\n f = []\n\n faces.each do |face|\n f << []\n face.each do |vert|\n if(v_index[vert.to_s].nil?)\n v << vert\n v_index[vert.to_s] = v.length-1\n f[f.length-1] << v.length\n else\n f[f.length-1] << v_index[vert.to_s] + 1\n end\n end\n end\n\n first_part = \"v \" + v.join(\"\\nv \")\n f_strings = f.map {|face| face.join(\" \")}\n second_part = \"\\nf \" + f_strings.join(\"\\nf \")\n\n File.write(\"#{filename}.obj\", first_part + second_part)\nend", "def generate\n to_plist(info)\n end", "def make_geoid_info_from_marshal_list(list)\n if !File.exists?(list) then\n fr_error \"No such list or marshal file #{list}\"\n return nil\n end\n\n begin\n marshaled_info = Marshal.restore(File.open(list))\n rescue TypeError \n # Assume it's a marshal list & proceed\n else # It worked -- it's a marshal file!\n return [marshaled_info]\n end\n\n # If we got here, it's a list file\n marshal_list = File.read(list).split($/).map { |f|\n if f =~ /^\\// then\n f\n else\n File.join(File.dirname(list), f)\n end\n }\n marshal_list.each { |f|\n if !File.exists?(f) then\n fr_error \"No such marshalled file: #{f}\"\n return nil\n end\n }\n all_info = []\n marshal_list.each{ |f|\n all_info << Marshal.restore(File.open(f))\n }\n # return marshal infos\n all_info\n end", "def build_properties\n properties.each do |key,val|\n prop = listing_properties.find_or_initialize_by(key:key)\n prop.value = val\n\n end\n end", "def to_jaxb_json_hash\n _h = super\n if !list.nil?\n _ha = Array.new\n list.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['setlist'] = _ha\n end\n return _h\n end", "def data\n @data ||= { @label => convert_to_blob(@hash) }.to_plist\n end", "def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end", "def marshal_dump\n [@tokens, @count, @index, @pairs]\n end", "def marshal_dump\n [@lsi_vector, @lsi_norm, @raw_vector, @raw_norm, @categories, @word_hash]\n end", "def to_binary()\n return self.unpack('B*').join\n end", "def plist_edid_patch( sp, offset, bytes )\n p = []\n p.push \"#{sp}<dict>\"\n p.push plist_key_value( sp + \" \", \"offset\", \"integer\", offset )\n p.push plist_key_value( sp + \" \", \"data\", \"data\", Base64.strict_encode64( bytes.pack('C*') ).to_s )\n p.push \"#{sp}</dict>\"\n return p\n end", "def to_bson\n [ self ].pack(bson_pack_directive)\n end", "def variants_multiply_properties(list)\n return if list.empty?\n keys = list.first.keys\n raise \"Must have same properties\" unless list.collect { |h| h.keys }.uniq.length == keys.length\n raise \"Must have unique list\" unless list.uniq.length == list.length\n self.variants = self.variants.collect do |vd|\n list.collect do |h|\n v = vd.dup\n if num = keys.delete('supplier_num')\n v.supplier_num = num\n elsif post = keys.delete('postfix')\n v.supplier_num += post\n else\n v.supplier_num += keys.collect { |k| \"-#{h[k]}\" }.join\n end\n v.properties = v.properties.merge(h)\n v\n end\n end.flatten\n end", "def write_plist_file(plist, file_path, format='xml')\n if format == 'xml'\n plist_format = CFPropertyList::List::FORMAT_XML\n else\n plist_format = CFPropertyList::List::FORMAT_BINARY\n end\n\n begin\n plist_to_save = CFPropertyList::List.new\n plist_to_save.value = CFPropertyList.guess(plist)\n plist_to_save.save(file_path, plist_format)\n rescue IOError => e\n fail(\"Unable to write the file #{file_path}. #{e.inspect}\")\n end\n end", "def binary_representation(allow_z=true,allow_m=true) #:nodoc:\r\n rep = [length].pack(\"V\")\r\n #output the list of geometries without outputting the SRID first and with the same setting regarding Z and M\r\n each {|geometry| rep << geometry.as_ewkb(false,allow_z,allow_m) }\r\n rep\r\n end", "def save_list(file_path)\n jsonArray = @array.map { |property| \n {\n \"property_id\": property.property_id,\n \"type\": property.type,\n \"address\": {\n \"street_number\": property.address[:street_number],\n \"street_name\": property.address[:street_name],\n \"suburb\": property.address[:suburb]\n },\n \"weekly_rent\": property.rent,\n \"status\": property.status,\n \"landlord\": {\n \"first_name\": property.landlord.first_name,\n \"last_name\": property.landlord.last_name\n },\n \"tenant\": {\n \"first_name\": property.tenant.first_name,\n \"last_name\": property.tenant.last_name\n }\n }\n }\n \n File.write(file_path, JSON.pretty_generate(jsonArray))\n end", "def make_fresh_writelist\n @to_write = {}\n @data.keys.each do |namelist|\n @to_write[namelist] = Array.new(@data[namelist].size, '')\n end\n end", "def marshal_dump; end", "def proptextlistarray(name) #:nodoc:\n @properties.select{ |f| f.name? name }.map{ |p| Vpim.decode_text_list(p.value_raw) }.flatten\n end", "def wddx_serialize # :nodoc:\n \"<binary length='#{self.length}'>#{self.encode}</binary>\"\n end", "def merge_properties( properties_list )\n props = ::Yacl::Properties.new\n properties_list.reverse.each do |p|\n props.merge!( p )\n end\n return props\n end", "def hash\n @list.each_slice(16).map do |sub|\n \"%02x\" % sub.reduce(:^)\n end.join\n end", "def hash\n @list.each_slice(16).map do |sub|\n \"%02x\" % sub.reduce(:^)\n end.join\n end", "def munge_list_coids\n @colist.items.each do |item|\n coids = item.attr 'coids'\n next unless coids\n\n newcoids = []\n coids.split(' ').each do |coid|\n newcoids << munge_coid(coid)\n end\n item.attributes['coids'] = newcoids.join ' '\n end\n end", "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def data\n @data ||= { @label => format(@hash) }.to_plist\n end", "def encode_body(buffer)\n buffer << property_id.to_msgpack\n end", "def encode_body(buffer)\n buffer << property.to_msgpack\n end", "def retrieve_chrb_property_values(prop_list)\n values = {}\n prop_list.each {|p| values[p.name] = p.default}\n\n catch :done do\n loop do\n prop_list.each do |prop|\n case prop.type\n when :integer\n value = ask(prop.description + \" \", lambda {|r| r.to_i}) {|q| q.default = values[prop.name]}\n when :boolean\n choose do |menu|\n menu.layout = :one_line\n menu.prompt = \"#{prop.description} \" + (values[prop.name] ? \"[y] \" : \"[n] \")\n menu.default = values[prop.name] ? 'y' : 'n'\n menu.choice 'y' do value = true end\n menu.choice 'n' do value = false end\n end\n else\n value = ask(prop.description + \" \") do |q|\n q.default = values[prop.name]\n end\n end\n values[prop.name] = value\n end\n\n say(\"=\" * 78)\n say(\"<%= color('New chrb properties', BOLD) %>\")\n say(\"-------------------\")\n values.each_pair do |key, val|\n say(\"#{key} = #{val}\\n\")\n end\n\n choose do |menu|\n menu.layout = \"<%= color(@prompt, BOLD) %> \"\n menu.prompt = \"\\nIs it OK? \"\n menu.choice 'y' do throw :done end\n menu.choice 'n'\n end\n end\n end\n values\n end", "def to_s(flatten_form=true)\n fill(flatten_form)\n @baos.toByteArray\n end", "def _serialize_write_data(data, slist)\n bytes = pickle.dumps(data)\n nbytes = len(bytes)\n if not nbytes\n raise Exception(\"write DataObject has no attachment\")\n end\n slist.set_nbytes(nbytes)\n slist.set_bytes(bytes)\n return\nend", "def all_property_hash\n hash = {}\n items = @all_properties\n for prop in items\n hash[prop] = {}\n end\n return hash\n end", "def to_binary\n # single pass over params for speed\n pack_code = nil\n compression = nil\n each_accessionable_param do |param|\n acc = param.accession\n if !pack_code && (code=ACC_TO_UNPACK_CODE[acc])\n pack_code = code\n end\n if compression.nil?\n compression = \n case acc\n when COMPRESSION_ACC then true\n when NO_COMPRESSION_ACC then false\n end\n end\n end\n # can speed these up:\n unless pack_code\n describe! DEFAULT_DTYPE_ACC\n pack_code = ACC_TO_UNPACK_CODE[DEFAULT_DTYPE_ACC]\n end\n if compression.nil?\n describe! DEFAULT_COMPRESSION_ACC\n compression = \n case DEFAULT_COMPRESSION_ACC\n when COMPRESSION_ACC then true\n when NO_COMPRESSION_ACC then false\n end\n end\n\n # TODO: support faster pack method with nmatrix or narray\n string = self.pack(pack_code) \n string = Zlib::Deflate.deflate(string) if compression\n Base64.strict_encode64(string)\n end", "def marshal_dump\r\n [@depth, @map_id, @event_id, @list, @index + 1, @branch]\r\n end", "def to_hash\n @list\n end", "def to_binary; ''; end", "def marshal_dump\n return [@scale, @map_width, @map_height, @layer, @scroll_x, @scroll_y]\n end", "def wddx_serialize #:nodoc:\n hash = {}\n if self.respond_to?(:to_wddx_properties)\n self.send(:to_wddx_properties).each do |prop|\n if prop.respond_to?(:id2name)\n hash[prop.id2name] = self.send(prop)\n elsif prop =~ /^@[^@]/\n hash[prop.gsub(/@/, \"\")] = instance_variable_get(prop)\n end\n end\n else\n hash = self.instance_variables.sort.inject({}) {|h, var| h[var.to_s.gsub(/@/, \"\")] = instance_variable_get(var); h}\n end\n hash.wddx_serialize\n end", "def pack_bit_fields\n @unpacked = []\n \n self.class.fields.each_with_index do |name, position|\n \n if bit_fields = self.class.bit_fields[name]\n \n bit_value = 0\n bit_fields.each do |(bit_name, bits_number, bit_mask)|\n masked = @attributes[bit_name] & bit_mask\n \n raise ValueOverflow, \n \"the value #{@attributes[bit_name]} \"+\n \"is too big for #{bits_number} bits\" if masked != @attributes[bit_name]\n \n bit_value = bit_value << bits_number\n bit_value |= masked\n end\n \n # Value of fields composed by binary fields is always overwritten\n # by the composition of the latter\n attributes[name] = bit_value\n end\n \n @unpacked[position] = @attributes[name] || 0\n \n end\n \n @raw = @unpacked.pack( self.class.unpack_recipe )\n end", "def pack(generate = false)\n vals = []\n # for each property, get the value\n # or generate one if there is a lambda/defaut value\n each_pair do |key, value|\n # if the value is nil and there is a lambda\n # generate it\n if generate and value.nil?\n l = self.class::LAMBDAS[key]\n if l\n if l.is_a?(Proc)\n # it's a proc. invoke it.\n value = l.call if l.is_a?(Proc)\n else\n value = l\n end\n end\n end\n # in general it would be inconsistent to flatten legitimate field values\n # (e.g. in case the value was actually nil or an array), however we know\n # that thse are never legitimate field values so it must have been\n # explicitly set in order to support composite fields (or the user is crazy)\n if !value.nil?\n if value.is_a?(Array)\n vals += value\n else\n vals << value\n end\n end\n end\n \n packed = vals.pack(self.class::FIELD_SPEC_STRING)\n raise \"Packed struct size #{packed.length} does not match struct size: \" + self.class::SIZE.to_s if packed.length != self.class::SIZE\n packed\n end", "def to_bencode\n BEncode.dump(self)\n end", "def date_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT\n\n bdata = Binary.type_bytes(\"3\", 3) # 3 is 0011, type indicator for date\n @object_table[saved_object_count] = bdata + [val].pack(\"d\").reverse\n\n return saved_object_count\n end", "def encode_list(value)\n encode_string(value.map { |s| encode_string(s) }.join)\n end", "def formatted_props\n props.map do |name, flags|\n formatted_flags = flags\n .inspect\n .gsub(\"=>\", \" => \")\n .gsub(\"{\", \"{ \")\n .gsub(\"}\", \" }\")\n \"#{name.inspect} => #{formatted_flags}\"\n end.join(\",\\n \")\n end", "def compose_d(marshal, compress)\n flags = SERIALIZER_FLAG[marshal]\n flags |= COMPRESSED_FLAG if compress\n\n [flags].pack('C')\nend", "def convert_properties_to(obj, medium, properties)\n direction = medium == :ruby ? :to_ruby : :to_db\n properties.to_h.each_pair do |key, value|\n next if skip_conversion?(obj, key, value)\n\n converted_value = convert_property(key, value, direction)\n if properties.is_a?(ActiveGraph::AttributeSet)\n properties.write_cast_value(key, converted_value)\n else\n properties[key] = converted_value\n end\n end\n end", "def to_s\n each_with_object([]) do |(name, value), array|\n if value.is_a?(Component::Attr)\n # Flatten nested hashs and inject them unless empty\n value = value.to_s\n array << value unless value.empty?\n else\n name = [@prefix, name].compact.join(\"-\").gsub(/[\\W_]+/, \"-\")\n array << %(#{name}=\"#{value}\") unless value.nil?\n end\n end.sort.join(\" \")\n end", "def to_configure_properties\n ['@security', '@channel_flags', '@clas', '@race', '@traits', '@sign', '@stuff']\n end", "def get_field_deserializers()\n return super.merge({\n \"certificateList\" => lambda {|n| @certificate_list = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Pkcs12CertificateInformation.create_from_discriminator_value(pn) }) },\n })\n end", "def marshal_dump\n data\n end", "def read_binary_dict(fname,fd,length)\n dict = {}\n\n # first: read keys\n if(length != 0) then\n buff = fd.read(length * @object_ref_size)\n keys = buff.unpack(@object_ref_size == 1 ? \"C*\" : \"n*\")\n\n # second: read object refs\n buff = fd.read(length * @object_ref_size)\n objects = buff.unpack(@object_ref_size == 1 ? \"C*\" : \"n*\")\n\n # read real keys and objects\n 0.upto(length-1) do |i|\n key = read_binary_object_at(fname,fd,keys[i])\n object = read_binary_object_at(fname,fd,objects[i])\n dict[key.value] = object\n end\n end\n\n return CFDictionary.new(dict)\n end", "def read_binary_array(fname,fd,length)\n ary = []\n\n # first: read object refs\n if(length != 0) then\n buff = fd.read(length * @object_ref_size)\n objects = buff.unpack(@object_ref_size == 1 ? \"C*\" : \"n*\")\n\n # now: read objects\n 0.upto(length-1) do |i|\n object = read_binary_object_at(fname,fd,objects[i])\n ary.push object\n end\n end\n\n return CFArray.new(ary)\n end", "def translate_to_binary(array_of_hex)\n array_of_binary = []\n array_of_hex.each do |num|\n array_of_binary << sprintf(\"%b\", num).rjust(32, '0')\n end\n array_of_binary\n end", "def convert_java_util_list(object)\n array_list = []\n object.size.times do\n |i| array_list << wrap_java_object(object.get(i))\n end\n array_list\n end", "def serialized_data\n\t\tdata = strip_hash( @data )\t\t\t\n\t\treturn Marshal.dump( data )\n\tend", "def get_properties\r\n #Assumes PropertyName=PropertyString with or without whitespace around =\r\n properties = Hash.new\r\n File.open(@filename, \"r:\" + PropertyFileAttributes::CATEGORY_ENCODINGS[@category]).each_line do |s| \r\n m = PropertyFileAttributes::PROPERTY_FILE_REGEX.match(s)\r\n if m != nil\r\n property = m[1]\r\n property = PropertyFileAttributes.convert_to_utf8(property)\r\n #This is a hack to get rid of the unicode non-break space that sometimes find their way into international files\r\n property = PropertyFileAttributes.remove_break_space(property).strip() \r\n value = m[2]\r\n value = PropertyFileAttributes.convert_to_utf8(value)\r\n value = PropertyFileAttributes.remove_break_space(value).strip()\r\n properties[property] = value\r\n end\r\n end \r\n @number_properties = properties.size\r\n properties\r\n end", "def to_ruby\n [key,fields]\n end", "def property_ids\n result = Array.new\n self.properties.each do |p|\n result << p.id\n end\n result\n end", "def to_ary\n [property, messages]\n end", "def bson_debinarize(bson_doc)\n raise ArgumentError, \"bson_doc must be a BSON::OrderedHash\" unless bson_doc.is_a?(BSON::OrderedHash)\n \n # each key and value is passed by reference and is modified in-place\n bson_doc.each do |k,v|\n if v.is_a?(BSON::Binary)\n bson_doc[k] = Base64.encode64(v.to_s)\n elsif v.is_a?(BSON::OrderedHash)\n bson_doc[k] = bson_debinarize(v)\n end\n end\n \n bson_doc \nend", "def bayslist_to_productslist(ref_hash, list_of_bays)\n list_of_items = []\n for bays in list_of_bays\n list_of_items.push(ref_hash[bays.to_sym])\n end\n return list_of_items\nend", "def to_s\n to_ary\n end", "def to_ary() end", "def marshal_dump\n [version]\n end", "def write_hash(hash)\n\t\twrite_byte(3)\n\t\thash.each do |key, value|\n\t\t\twrite_utf(key.to_s)\n\t\t\twrite(value)\n\t\tend\n\n\t\t# write the end object flag 0x00, 0x00, 0x09\n\t\twrite_int16_network(0)\n\t\twrite_byte(9)\n\tend", "def save(properties)\r\n File.open(@filename, \"w:\" + PropertyFileAttributes::CATEGORY_ENCODINGS[@category]) do |f| \r\n properties.each do |k,v|\r\n property = k\r\n text = v\r\n #Since our patches should be in UTF-8, convert strings to latin1 for any latin1 files.\r\n if PropertyFileAttributes::CATEGORY_ENCODINGS[@category] != \"UTF-8\"\r\n property = property.encode(PropertyFileAttributes::CATEGORY_ENCODINGS[@category])\r\n text = text.encode(PropertyFileAttributes::CATEGORY_ENCODINGS[@category])\r\n end\r\n f.puts(\"#{property}=#{text}\")\r\n end\r\n end\r\n end", "def to_data(prog, offset, data)\n if data.is_a?(Hash)\n res = \"\\x0\"*@struct_size\n @members.each do |n, m|\n if data.key?(n.to_sym)\n items = Array(data[n.to_sym])\n item_offset = m.offset\n m.count.times do |index|\n s = member_item_to_data(prog, m, offset + item_offset, items[index])\n res[item_offset, size=s.bytesize] = s\n item_offset += size\n end\n end\n end\n elsif data.respond_to? :to_z80bin\n res = data.to_z80bin[0,@struct_size].ljust(@struct_size, \"\\x0\")\n elsif data.is_a?(String)\n res = data.dup.force_encoding(Encoding::ASCII_8BIT)[0,@struct_size].ljust(@struct_size, \"\\x0\")\n else\n data = Array(data)\n res = ''\n index = 0\n @members.reject {|_, m| m.alias}.each do |_, m|\n m.count.times do\n s = member_item_to_data(prog, m, offset, data[index])\n offset += s.bytesize\n index += 1\n res << s\n end\n end\n end\n res\n end", "def to_plist_node\n Plist::Emit.plist_node(self.to_s)\n end", "def write_out_list list, list_path\n output = File.new list_path, \"w\"\n if list.class == Array\n list.each do\n |app|\n output.puts \"#{app[0]} #{app[1]}\"\n end\n elsif list.class == Hash\n list.each do\n |app,count|\n output.puts \"#{app} #{count}\"\n end\n end\n output.flush\n output.close\nend", "def to_s\n '#<Twilio.Preview.TrustedComms.CpsList>'\n end" ]
[ "0.6139177", "0.60764384", "0.60576075", "0.5864793", "0.57980335", "0.57768667", "0.5773309", "0.56523263", "0.5488065", "0.5468661", "0.5372827", "0.534327", "0.5326962", "0.5317539", "0.528196", "0.5281396", "0.5261453", "0.52338505", "0.51893896", "0.51809084", "0.5177891", "0.51654327", "0.5165104", "0.5110525", "0.51062024", "0.51062024", "0.5078049", "0.5055447", "0.5046836", "0.50460565", "0.50122994", "0.5001964", "0.49914515", "0.49901077", "0.49845514", "0.49839675", "0.4939828", "0.49369314", "0.49203742", "0.49162242", "0.4914618", "0.49124345", "0.49110755", "0.48957112", "0.48756647", "0.48685613", "0.4866092", "0.48652515", "0.48556933", "0.48471007", "0.48457894", "0.48424384", "0.48424384", "0.48347005", "0.48317397", "0.48204365", "0.479577", "0.4784241", "0.47738093", "0.47569817", "0.475333", "0.47483906", "0.47473964", "0.47463557", "0.47351918", "0.47323585", "0.4704317", "0.46931973", "0.46893814", "0.46766376", "0.4671803", "0.46681184", "0.4667716", "0.4655851", "0.46531123", "0.46467486", "0.46447966", "0.46409133", "0.46393296", "0.4631494", "0.46290746", "0.4622327", "0.4622203", "0.46214873", "0.46153405", "0.4614105", "0.46062768", "0.45993868", "0.45986876", "0.45895746", "0.45862895", "0.4582387", "0.45767477", "0.4575869", "0.45757177", "0.4572194", "0.45684996", "0.4566992", "0.4561466", "0.45610988" ]
0.5590915
8
read a binary int value
def read_binary_int(fname,fd,length) raise CFFormatError.new("Integer greater than 8 bytes: #{length}") if length > 3 nbytes = 1 << length val = nil buff = fd.read(nbytes) case length when 0 then val = buff.unpack("C") val = val[0] when 1 then val = buff.unpack("n") val = val[0] when 2 then val = buff.unpack("N") val = val[0] when 3 hiword,loword = buff.unpack("NN") val = hiword << 32 | loword end return CFInteger.new(val); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_int\n return @as_int unless @as_int.nil?\n _pos = @_io.pos\n @_io.seek(0)\n @as_int = @_io.read_u2be\n @_io.seek(_pos)\n @as_int\n end", "def read_int(offset, stream = @index)\n stream.seek(offset)\n stream.read(4).unpack('L')[0]\n end", "def read_value_i\n b_read = 0\n ie = @file.read INT_SIZE\n return nil if ie.nil? || ie.bytesize < INT_SIZE\n b_read += ie.bytesize\n\n i = ie.unpack(PACK_INT).first\n [i, b_read]\n end", "def read_int32\n read('N', 4)\n end", "def int\n Util.from_bytes :int, value\n end", "def as_int\n return @as_int unless @as_int.nil?\n _pos = @_io.pos\n @_io.seek(0)\n @as_int = @_io.read_u1\n @_io.seek(_pos)\n @as_int\n end", "def as_int\n return @as_int unless @as_int.nil?\n _pos = @_io.pos\n @_io.seek(0)\n @as_int = @_io.read_u1\n @_io.seek(_pos)\n @as_int\n end", "def read_int!(bytes, md)\n bytes = bytes.slice!(0..3)\n md << bytes\n bytes.unpack('N')[0]\n end", "def get_int\n raise EOFError if @position + 4 > @size\n value = @response[@position, 4].unpack('N*').first\n @position += 4\n return value\n end", "def _int2b(data)\n data.unpack('v').first\n end", "def read_value_s\n b_read = 0\n lu = @file.read INT_SIZE\n return nil if lu.nil? || lu.bytesize < INT_SIZE\n b_read += lu.bytesize\n\n l = lu.unpack(PACK_UINT).first\n s = @file.read l\n return nil if s.nil? || s.bytesize < l\n b_read += s.bytesize\n\n [s, b_read]\n end", "def read_int16\n read('n', 2)\n end", "def getbyte\n read(1).ord\n end", "def parseInt(b, o)\n\t\t\t\tif b[o].ord >> 4 != 0b0001\n\t\t\t\t\traise \"NotINT\"\n\t\t\t\tend\n\n\t\t\t\tl = 2 ** (b[o].ord & 0x0F)\n\t\t\t\tv = readVar(b, o + 1, l)\n\n\t\t\t\t#p b[o].to_s(16), b[o+1].to_s(16), l, v\n\n\t\t\t\treturn v, l\n\t\t\tend", "def get_int(offset)\n \n @contents.pos = offset\n # convert the four bytes to a signed integer\n return @contents.read(4).unpack('l')[0]\n end", "def read_bits_int(n)\n read_bits_int_be(n)\n end", "def read_int64; end", "def _int1b(data)\n data.unpack('C').first\n end", "def BinaryConverter(str)\r\n return str.to_i(2)\r\nend", "def to_int\ntmp = self.raw_bytes.unpack \"C*\"\ntmp.inject do |r, i|\nr * 256 | i\nend\nend", "def read_7bit_encoded_int(buf=nil)\n l = 0 # length\n s = 0 # shift\n b = \"\" # byte\n buf = buf.scan(/./m) if buf\n begin\n if not buf\n b = self.read_int\n else\n b = buf.shift.unpack(\"C\").first\n end\n l |= (b & 0x7f) << s\n s += 7\n end while ((b & 0x80) != 0)\n return l\n end", "def get_int2(offset)\n s = @buf[offset..offset+2]\n s = s.unpack(\"n\")\n s.to_s.to_i\n end", "def decode_vint(data)\n value = 0\n size = 1\n\n bytes = data.bytes.to_a\n # Size of the integer is defined in first byte only\n first_byte = bytes.first\n size = 1\n while ((first_byte & (1 << (8-size))) == 0)\n size += 1\n invalid_data(\"Invalid variable int encoded: #{data}\") if (size > 8)\n end\n # Replace first byte with its true value\n bytes[0] = first_byte & ((1 << (8-size))-1)\n # Read all\n size.times do |idx|\n value = (value << 8) + bytes[idx]\n end\n\n return value, size\n end", "def parse_int(bytes)\n if bytes.is_a?(Array) then bytes = bytes.join end\n bytes.unpack('H*')[0].scan(/../).reverse.join.to_i(16)\nend", "def read_int(signed = false, mut = :STD, order = :BIG)\n val = 0\n case order\n when :BIG\n val |= read_byte(signed) << 24\n val |= read_byte(signed) << 16\n val |= read_byte(signed) << 8\n val |= read_byte(signed, mut)\n when :MIDDLE\n val |= read_byte(signed) << 8\n val |= read_byte(signed)\n val |= read_byte(signed) << 24\n val |= read_byte(signed) << 16\n when :INVERSE_MIDDLE\n val |= read_byte(signed) << 16\n val |= read_byte(signed) << 24\n val |= read_byte(signed)\n val |= read_byte(signed) << 8\n when :LITTLE\n val |= read_byte(signed, mut)\n val |= read_byte(signed) << 8\n val |= read_byte(signed) << 16\n val |= read_byte(signed) << 24\n end\n val\n end", "def read_bignum; end", "def decoder(data)\n result = CKB::Utils.hex_to_bin(data).unpack(\"Q<\")[0]\n return result.to_i\nend", "def get_byte\n get(1).ord\n end", "def getbyte\n read(1)\n end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def _int4b(data)\n data.unpack('V').first\n end", "def varint(io)\n # https://github.com/ruby-protobuf/protobuf/blob/master/lib/protobuf/varint_pure.rb\n value = index = 0\n begin\n byte = io.readbyte\n value |= (byte & 0x7f) << (7 * index)\n index += 1\n end while (byte & 0x80).nonzero?\n value\n end", "def get_int1(offset)\n @buf[offset]\n end", "def get_i32\n res, @data = @data.unpack(\"Na*\")\n self.underrun! unless res\n res - ((res & INT_MASK) << 1)\n end", "def read_uint8(position = nil)\n seek(position)\n data = read_and_advance(1)\n BinData::Uint8.read(data).to_i\n end", "def binary_to_int(bitstring)\n\tint = 0\n\t#-- Loop through the chars\n\tbitstring.reverse.each_char.with_index do |char, index|\n\t\tif char != '0' && char != '1'\n\t\t\tputs \"This is not a valid binary representation. Bye.\"\n\t\t\tbreak\n\t\tend\n if char == '1'\n \tint += pow_of_2(index)\n end\n\tend\n\treturn int\nend", "def read(i)\n self.v = i.kind_of?(Integer) ? i.to_i : i.to_s.unpack(@packstr).first\n self\n end", "def read_binary\n raise NotImplementedError\n end", "def to_i\n\t\tk = 0\n\t\tsize.times do |i|\n\t\t\tk |= @bytes[i] << (size - i - 1) * 8\n\t\tend\n\t\treturn k\n\tend", "def read_byte; end", "def _sint2b(data)\n data.unpack('s').first\n end", "def to_i_from_bytes(big_endian=false)\n bs = big_endian ? bytes.reverse_each : bytes.each\n bs.with_index.inject(0) { |sum,(b,i)| (b << (8*i)) + sum }\n end", "def read_32int_le(file)\n file.read(4).unpack('L<')[0]\n end", "def read_byte\n @buffer.shift(BYTE_LENGTH).join.to_i(2) if @buffer.length >= BYTE_LENGTH\n end", "def serial_read_int()\n return serial_read_line().hex\n end", "def read_bit\n @buffer.shift if @buffer.length >= 1\n end", "def int_to_binary(value)\n nbytes = 0\n nbytes = 1 if value > 0xFF # 1 byte integer\n nbytes += 1 if value > 0xFFFF # 4 byte integer\n nbytes += 1 if value > 0xFFFFFFFF # 8 byte integer\n nbytes = 3 if value < 0 # 8 byte integer, since signed\n\n bdata = Binary.type_bytes(\"1\", nbytes) # 1 is 0001, type indicator for integer\n buff = \"\"\n\n if(nbytes < 3) then\n fmt = \"N\"\n\n if(nbytes == 0) then\n fmt = \"C\"\n elsif(nbytes == 1)\n fmt = \"n\"\n end\n\n buff = [value].pack(fmt)\n else\n # 64 bit signed integer; we need the higher and the lower 32 bit of the value\n high_word = value >> 32\n low_word = value & 0xFFFFFFFF\n buff = [high_word,low_word].pack(\"NN\")\n end\n\n return bdata + buff\n end", "def integer(buf, n)\n limit = 2**n - 1\n i = !n.zero? ? (buf.getbyte & limit) : 0\n\n m = 0\n while (byte = buf.getbyte)\n i += ((byte & 127) << m)\n m += 7\n\n break if (byte & 128).zero?\n end if (i == limit)\n\n i\n end", "def read_uint32\n read(4).unpack(UINT32).first\n end", "def integer(buf, n)\n limit = 2**n - 1\n i = !n.zero? ? (buf.getbyte & limit) : 0\n\n m = 0\n while byte = buf.getbyte do\n i += ((byte & 127) << m)\n m += 7\n\n break if (byte & 128).zero?\n end if (i == limit)\n\n i\n end", "def read_m\n Integer(@file.gets)\n end", "def read_u1\n read(1).first & 0xff\n end", "def readbyte\n end", "def to_i\n @bits.to_i\n end", "def get_int64\n raise EOFError if @position + 8 > @size\n hi, lo = @response[@position, 8].unpack('N*N*')\n @position += 8\n return (hi << 32) + lo\n end", "def integer(buf, n)\n limit = 2**n - 1\n i = !n.zero? ? (buf.getbyte & limit) : 0\n\n m = 0\n buf.each_byte do |byte|\n i += ((byte & 127) << m)\n m += 7\n\n break if (byte & 128).zero?\n end if (i == limit)\n\n i\n end", "def to_i\n handle.to_i(16)\n end", "def to_int() end", "def to_int() end", "def read_byte(data, offset)\n out = data[offset,1].unpack('C').first rescue 0\n return out\n end", "def net_unpack_int(net_int)\n net_int.ord - NET_INT_OFFSET\nend", "def read_byte(signed = false, mut = :STD)\n val = 0\n val |= mutate(@payload.next_byte, mut)\n signed ? val : val & 0xff\n end", "def get_int4(offset)\n s = @buf[offset..offset+4]\n s = s.unpack(\"N\")\n s.to_s.to_i\n end", "def read_sint16(position = nil)\n seek(position)\n data = read_and_advance(2)\n BinData::Int16be.read(data).to_i\n end", "def prim_read length\n buf = \"\".encode Encoding::BINARY\n if length.nil?\n buf << b until (b = _read_byte).nil?\n else\n until length.zero? || (b = _read_byte).nil?\n buf << b\n length -= 1\n end\n end\n return buf\n end", "def read_byte\n buf = read_all(1)\n return Bytes.get_string_byte(buf, 0)\n end", "def read_varint(data: nil, stream: nil, offset: 0)\n if data && !stream\n return [nil, 0] if data.bytesize < 1 + offset\n\n bytes = BTC::Data.bytes_from_data(data, offset: offset, limit: 9) # we don't need more than 9 bytes.\n\n byte = bytes[0]\n\n if byte < 0xfd\n return [byte, offset + 1]\n elsif byte == 0xfd\n return [nil, 1] if data.bytesize < 3 + offset # 1 byte prefix, 2 bytes uint16\n return [bytes[1] +\n bytes[2]*256, offset + 3]\n elsif byte == 0xfe\n return [nil, 1] if data.bytesize < 5 + offset # 1 byte prefix, 4 bytes uint32\n return [bytes[1] +\n bytes[2]*256 +\n bytes[3]*256*256 +\n bytes[4]*256*256*256, offset + 5]\n elsif byte == 0xff\n return [nil, 1] if data.bytesize < 9 + offset # 1 byte prefix, 8 bytes uint64\n return [bytes[1] +\n bytes[2]*256 +\n bytes[3]*256*256 +\n bytes[4]*256*256*256 +\n bytes[5]*256*256*256*256 +\n bytes[6]*256*256*256*256*256 +\n bytes[7]*256*256*256*256*256*256 +\n bytes[8]*256*256*256*256*256*256*256, offset + 9]\n end\n\n elsif stream && !data\n\n if stream.eof?\n raise ArgumentError, \"Can't parse varint from stream because it is already closed.\"\n end\n\n if offset > 0\n buf = stream.read(offset)\n return [nil, 0] if !buf\n return [nil, buf.bytesize] if buf.bytesize < offset\n end\n\n prefix = stream.read(1)\n\n return [nil, offset] if !prefix || prefix.bytesize == 0\n\n byte = prefix.bytes[0]\n\n if byte < 0xfd\n return [byte, offset + 1]\n elsif byte == 0xfd\n buf = stream.read(2)\n return [nil, offset + 1] if !buf\n return [nil, offset + 1 + buf.bytesize] if buf.bytesize < 2\n return [buf.unpack(\"v\").first, offset + 3]\n elsif byte == 0xfe\n buf = stream.read(4)\n return [nil, offset + 1] if !buf\n return [nil, offset + 1 + buf.bytesize] if buf.bytesize < 4\n return [buf.unpack(\"V\").first, offset + 5]\n elsif byte == 0xff\n buf = stream.read(8)\n return [nil, offset + 1] if !buf\n return [nil, offset + 1 + buf.bytesize] if buf.bytesize < 8\n return [buf.unpack(\"Q<\").first, offset + 9]\n end\n\n else\n raise ArgumentError, \"Either data or stream must be specified.\"\n end\n end", "def i32\n next_bytes(4).unpack(\"l>\").first\n end", "def get_tag_value_int (tag_path)\n\n $test_logger.log(\"Get tag value in integer #{tag_path}\")\n\n #Get tag text and data type\n tag_val, data_type = get_tag_value tag_path, true\n\n #Parse int value\n int_val = 0\n if data_type == DataType::HEX\n int_val = tag_val.hex\n elsif data_type == DataType::DEC || data_type == DataType::DEC_BIG\n int_val = tag_val.to_i\n end\n\n #Return int value\n int_val\n end", "def read__UI8\r\n readbyte\r\n end", "def read_byte\n read('C', 1)\n end", "def to_i(byte_endianness=:little_endian, bits_little_endian=false)\n i = 0\n bytes = convert_endianness(byte_endianness, :big_endian)\n bytes = bytes.reverse_byte_bits if bits_little_endian\n bytes.each_byte do |b|\n i <<= 8\n i |= b\n end\n i\n end", "def decode_integer(data)\n tag, value, remainder = decode_tlv(data)\n raise InvalidTag, tag.to_s if tag != INTEGER_TAG\n return decode_integer_value(value), remainder\n end", "def to_i\n # This will be common. Memoize for efficiency.\n @int_val ||= hex.to_i(16)\n end", "def row_from_binary(binary_string)\n binary_string.slice(0,7).to_i(2)\nend", "def binary(integer)\n\nend", "def binary(integer)\n\nend", "def binread(*args, **kwd); end", "def get_int\n return 0 if @seed.nil?\n bytes = get_4_bytes\n ((bytes[2].to_i) << 16) |\n ((bytes[1].to_i) << 8) |\n (bytes[0].to_i)\n end", "def getbyte\n end", "def getbyte\n end", "def to_int(*) end", "def i32u\n little? ? BinUtils.get_int32_le(read(4)) : BinUtils.get_int32_be(read(4))\n end", "def write_int(value, stream = @index)\n stream.write([value].pack('L'))\n end", "def getBits(binary)\n length = binary[0].length\n return length\n end", "def getbyte(i)\n @vbits.getbyte(i)\n end", "def get_int_data(index)\n $test_logger.log(\"Get int data from location #{index}\")\n byt_data = get_data_at(index)\n \n #Convert to signed 32-bit integer from unsigned integer \n byt_data = Common.uint32_to_int32(byt_data)\n \n byt_data\n end", "def getMediumInt\n\t\t\tnum_array = read(3).unpack(\"C*\")\n\t\t\tnum = num_array[0]<< 16 ^ num_array[1]<< 8 ^ num_array[2]\n\t\t\treturn num\n\t\tend", "def read_uint_by_size(size)\n case size\n when 1\n read_uint8\n when 2\n read_uint16\n when 3\n read_uint24\n when 4\n read_uint32\n when 6\n read_uint48\n when 8\n read_uint64\n else\n raise \"Integer size #{size} not implemented\"\n end\n end", "def read_uint48(position = nil)\n seek(position)\n data = read_and_advance(6)\n BinData::Uint48be.read(data).to_i\n end", "def read\n read_object(read_byte)\n end", "def binary_string_to_number(string)\n string = string.clone.force_encoding(Encoding::ASCII_8BIT)\n string.bytes.inject(0) do |number, byte|\n number * 256 + byte.ord\n end\n end", "def getbyte(index, signed=false)\n if @offset+index >= @read_buffer.bytesize\n swap_buffers\n end\n b = @read_buffer.getbyte(@offset+index)\n (signed && b >= 0x80) ? b - 0x100 : b\n end", "def getbyte(n)\n self\n end", "def read16\n\tval = (getc() << 8) + getc()\n\tval = -(val & 0x7fff) if (val & 0x8000).nonzero?\n\treturn val\n end", "def read_uint64(position = nil)\n seek(position)\n data = read_and_advance(8)\n BinData::Uint64be.read(data).to_i\n end", "def to_int\n end", "def read_uint32(position = nil)\n seek(position)\n data = read_and_advance(4)\n BinData::Uint32be.read(data).to_i\n end", "def test_decode_integer()\n input = [131, 98, 0, 0, 4, 210]\n expected = 1234\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def rlongint(bytes)\n res = i = 0\n bytes.times do\n res |= rbyte << i\n i += 8\n end\n res\n end" ]
[ "0.7664172", "0.75506127", "0.74316055", "0.7430628", "0.732355", "0.72860515", "0.72324526", "0.715396", "0.70769686", "0.7073567", "0.7015265", "0.70132434", "0.7009441", "0.69623375", "0.6928583", "0.6905657", "0.6901286", "0.68502516", "0.6789339", "0.6773747", "0.6761497", "0.66891235", "0.6678369", "0.6676008", "0.66722834", "0.66419524", "0.6634416", "0.66309464", "0.6605577", "0.6599037", "0.65805894", "0.65626174", "0.6549462", "0.6541983", "0.6534138", "0.65179765", "0.6480698", "0.6476151", "0.6454642", "0.6450841", "0.64340854", "0.6430617", "0.64304715", "0.6408211", "0.6379433", "0.6376627", "0.635842", "0.6349314", "0.634744", "0.6347187", "0.63236237", "0.63185185", "0.6285357", "0.62846047", "0.62766945", "0.62601227", "0.62550485", "0.624044", "0.624044", "0.6230339", "0.62204856", "0.6218797", "0.6217969", "0.6209556", "0.6192129", "0.6163659", "0.61594856", "0.6156783", "0.6140552", "0.6126949", "0.6117214", "0.6106848", "0.610572", "0.60979694", "0.6078023", "0.6064509", "0.6064509", "0.6053253", "0.60514754", "0.604711", "0.604711", "0.60384625", "0.6029819", "0.6028875", "0.60258484", "0.6025479", "0.6024256", "0.6015446", "0.6012166", "0.60074717", "0.60070175", "0.598126", "0.59694684", "0.59436053", "0.59429127", "0.59408754", "0.59327286", "0.593211", "0.5922211", "0.59180367" ]
0.7823983
0
read a binary real value
def read_binary_real(fname,fd,length) raise CFFormatError.new("Real greater than 8 bytes: #{length}") if length > 3 nbytes = 1 << length val = nil buff = fd.read(nbytes) case length when 0 then # 1 byte float? must be an error raise CFFormatError.new("got #{length+1} byte float, must be an error!") when 1 then # 2 byte float? must be an error raise CFFormatError.new("got #{length+1} byte float, must be an error!") when 2 then val = buff.reverse.unpack("f") val = val[0] when 3 then val = buff.reverse.unpack("d") val = val[0] end return CFReal.new(val) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def real_to_binary(val)\n bdata = Binary.type_bytes(\"2\",3) # 2 is 0010, type indicator for reals\n buff = [val].pack(\"d\")\n return bdata + buff.reverse\n end", "def read_bignum; end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def read_int64; end", "def read_binary\n raise NotImplementedError\n end", "def read_value_s\n b_read = 0\n lu = @file.read INT_SIZE\n return nil if lu.nil? || lu.bytesize < INT_SIZE\n b_read += lu.bytesize\n\n l = lu.unpack(PACK_UINT).first\n s = @file.read l\n return nil if s.nil? || s.bytesize < l\n b_read += s.bytesize\n\n [s, b_read]\n end", "def float\n little? ? read(4).unpack1('e') : read(4).unpack1('g')\n end", "def value(data)\n BinData::FloatLe.read(data)\n end", "def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n if(object_type != \"0\" && object_length == 15) then\n object_length = read_binary_object(fname,fd)\n object_length = object_length.value\n end\n\n retval = nil\n case object_type\n when '0' then # null, false, true, fillbyte\n retval = read_binary_null_type(object_length)\n when '1' then # integer\n retval = read_binary_int(fname,fd,object_length)\n when '2' then # real\n retval = read_binary_real(fname,fd,object_length)\n when '3' then # date\n retval = read_binary_date(fname,fd,object_length)\n when '4' then # data\n retval = read_binary_data(fname,fd,object_length)\n when '5' then # byte string, usually utf8 encoded\n retval = read_binary_string(fname,fd,object_length)\n when '6' then # unicode string (utf16be)\n retval = read_binary_unicode_string(fname,fd,object_length)\n when 'a' then # array\n retval = read_binary_array(fname,fd,object_length)\n when 'd' then # dictionary\n retval = read_binary_dict(fname,fd,object_length)\n end\n\n return retval\n end", "def read_u1\n read(1).first & 0xff\n end", "def read_binary_int(fname,fd,length)\n raise CFFormatError.new(\"Integer greater than 8 bytes: #{length}\") if length > 3\n\n nbytes = 1 << length\n\n val = nil\n buff = fd.read(nbytes)\n\n case length\n when 0 then\n val = buff.unpack(\"C\")\n val = val[0]\n when 1 then\n val = buff.unpack(\"n\")\n val = val[0]\n when 2 then\n val = buff.unpack(\"N\")\n val = val[0]\n when 3\n hiword,loword = buff.unpack(\"NN\")\n val = hiword << 32 | loword\n end\n\n return CFInteger.new(val);\n end", "def value(data)\n BinData::DoubleLe.read(data)\n end", "def as_int\n return @as_int unless @as_int.nil?\n _pos = @_io.pos\n @_io.seek(0)\n @as_int = @_io.read_u2be\n @_io.seek(_pos)\n @as_int\n end", "def _sint2b(data)\n data.unpack('s').first\n end", "def getvalue\n dt = @datatype || String\n case dt.to_s\n when \"String\"\n return @buffer\n when \"Integer\"\n return @buffer.to_i\n when \"Float\"\n return @buffer.to_f\n else\n return @buffer.to_s\n end\n end", "def getvalue\n dt = @datatype || String\n case dt.to_s\n when \"String\"\n return @buffer\n when \"Integer\"\n return @buffer.to_i\n when \"Float\"\n return @buffer.to_f\n else\n return @buffer.to_s\n end\n end", "def read_byte; end", "def float64()\n _read_type(8, \"float64\").unpack(\"G\").first\n end", "def data\n read_attribute(binary ? :binary_data : :data)\n end", "def read_value_i\n b_read = 0\n ie = @file.read INT_SIZE\n return nil if ie.nil? || ie.bytesize < INT_SIZE\n b_read += ie.bytesize\n\n i = ie.unpack(PACK_INT).first\n [i, b_read]\n end", "def read\n read_object(read_byte)\n end", "def read_binary_data(fname,fd,length)\n buff = \"\";\n buff = fd.read(length) if length > 0\n return CFData.new(buff,CFData::DATA_RAW)\n end", "def read_long; end", "def read_binary(file); end", "def read_bit\n @buffer.shift if @buffer.length >= 1\n end", "def get_float\n raise EOFError if @position + 4 > @size\n uval = @response[@position, 4].unpack('N*').first;\n @position += 4\n return ([uval].pack('L')).unpack('f*').first\n end", "def to_f\n @bits.to_f\n end", "def get_b\n n = self.get_i32\n OSC::Blob.new(self.get_data(n))\n end", "def double\n little? ? read(8).unpack1('E') : read(8).unpack1('G')\n end", "def get_f64\n res, @data = @data.unpack(\"Ga*\")\n self.underrun! unless res\n res\n end", "def read_byte(signed = false, mut = :STD)\n val = 0\n val |= mutate(@payload.next_byte, mut)\n signed ? val : val & 0xff\n end", "def as_int\n return @as_int unless @as_int.nil?\n _pos = @_io.pos\n @_io.seek(0)\n @as_int = @_io.read_u1\n @_io.seek(_pos)\n @as_int\n end", "def float\n Util.from_bytes :float, value\n end", "def _int2b(data)\n data.unpack('v').first\n end", "def as_int\n return @as_int unless @as_int.nil?\n _pos = @_io.pos\n @_io.seek(0)\n @as_int = @_io.read_u1\n @_io.seek(_pos)\n @as_int\n end", "def read\n Typelib.to_ruby(raw_read)\n end", "def getbyte\n read(1).ord\n end", "def read_uint64(position = nil)\n seek(position)\n data = read_and_advance(8)\n BinData::Uint64be.read(data).to_i\n end", "def convert_binary\n end", "def readable_real?() end", "def double\n Util.from_bytes :double, value\n end", "def read_record\n n_read = 0\n tu = @file.read INT_SIZE\n return nil if tu.nil? || tu.bytesize < INT_SIZE\n if (tu == (ZERO_BYTE_ASCII_8BIT * INT_SIZE))\n # empty record. skip this page.\n @file.seek(PAGE_SIZE - INT_SIZE, IO::SEEK_CUR)\n return nil\n end\n n_read += tu.bytesize\n t = tu.unpack(PACK_UINT).first\n\n return nil if @file.eof?\n lu = @file.read INT_SIZE\n return nil if lu.nil? || lu.bytesize < INT_SIZE\n n_read += lu.bytesize\n l = lu.unpack(PACK_UINT).first\n\n if false # l == 7016996765293437281\n puts \"*************** #{__FILE__} #{__LINE__} *************\"\n puts \"at: #{@file.tell}\"\n end\n\n if l > MAX_VALUE_SIZE\n raise ParseError.new \"Read size that exceeds the maximum size for a value.\"\n end\n\n k = nil\n begin\n k = @file.read l\n rescue NoMemoryError => e\n # puts \"*************** #{__FILE__} #{__LINE__} *************\"\n # puts \"#{e.message} at #{l}\"\n raise\n end\n\n return nil if k.nil? || k.bytesize < l\n n_read += k.bytesize\n d = if t != WRITE_TYPE_INDEXES[:array]\n [t, k]\n else\n asu = @file.read INT_SIZE\n return nil if asu.nil? || asu.bytesize < INT_SIZE\n n_read += asu.bytesize\n as = asu.unpack(PACK_UINT).first\n [t, k, as]\n end\n return nil if d.nil?\n\n v = nil\n\n raw_v = nil\n case d[0]\n when WRITE_TYPE_INDEXES[:array]\n a = []\n d[2].times do |i|\n raw_v, b_read = read_value_s\n n_read += b_read\n break if raw_v.nil?\n a.push(raw_v)\n end\n v = a\n when WRITE_TYPE_INDEXES[:hash], WRITE_TYPE_INDEXES[:set]\n raw_v, b_read = read_value_s\n return nil if raw_v.nil?\n n_read += b_read\n v = MultiJson.decode(raw_v)\n when WRITE_TYPE_INDEXES[:string]\n v, b_read = read_value_s\n return nil if v.nil?\n n_read += b_read\n when WRITE_TYPE_INDEXES[:counter]\n v, b_read = read_value_i\n return nil if v.nil?\n n_read += b_read\n end\n\n pages_read = n_read / PAGE_SIZE\n remainder = (n_read % PAGE_SIZE)\n if remainder > 0\n @file.seek((PAGE_SIZE - remainder), IO::SEEK_CUR)\n pages_read += 1\n end\n\n [d, v, pages_read]\n end", "def readbyte\n end", "def float\n r = little? ? @data.byteslice(@pos, 4).unpack('e')[0] : @data.byteslice(@pos, 4).unpack('g')[0]\n @pos += 4\n r\n end", "def hex_to_float(txt)\n # Numerals::Format[:hexbin].read(txt, type: Float)\n # txt.scanf(\"%A\").first\n Float(txt)\nend", "def dbl_from_float(val, little_endian=true)\n code = little_endian ? 'E':'G'\n [val].pack(code)\nend", "def test_decode_bit_binary()\n input = [131, 77, 0, 0, 0, 4, 4, 195, 139, 30, 64]\n expected = Erlang::BitBinary.new(4, \"\\303\\213\\036@\")\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def value_type\n 'BINARY'\n end", "def binread(fname)\n File.open(fname, 'rb'){ |f|\n return f.read\n }\n end", "def getbyte\n read(1)\n end", "def decode_val( encoding, size, io )\n # plain string\n if encoding == Protocol::ENCODINGS[:plain]\n io.read_unpacked size, 'a' + size.to_s\n # number\n elsif encoding == Protocol::ENCODINGS[:number]\n io.read_unpacked size, size == 4 ? 'l<' : 'q<'\n else\n raise 'Unknown data encoding.'\n end\n end", "def test_decode_float()\n input = [\n 131, 99, 49, 46, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,\n 48, 48, 48, 48, 56, 56, 56, 50, 101, 43, 48, 48, 0, 0, 0, 0, 0]\n expected = 1.1\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def byte\n Util.from_bytes :byte, value\n end", "def dbl_from_text(txt, little_endian=true)\n code = little_endian ? 'E':'G'\n [txt].pack(code)\nend", "def field_to_binary(field_type, field_value)\n case field_type\n when \"boolean\"\n if field_value == \"true\"\n \"\\x01\".b\n elsif field_value == \"false\"\n \"\\x00\".b\n else\n raise \"Expected true/false, got #{field_value}\"\n end\n when \"float\"\n # Works with any of: \"123\", \"123.4\", \"123,4\"\n [field_value.gsub('\"', '').sub(\",\", \".\").to_f].pack(\"f\")\n when \"int\"\n [field_value.gsub('\"', '').to_i].pack(\"l\")\n when \"short\"\n [field_value.gsub('\"', '').to_i].pack(\"v\")\n when \"string\"\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n [str.size].pack(\"v\") + str.pack(\"v*\")\n when \"optstring\"\n # this is really stupid\n if field_value == \"nil\"\n \"\\x00\"\n else\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n \"\\x01\" + [str.size].pack(\"v\") + str.pack(\"v*\")\n end\n when /\\Ablob:(\\d+)/\n bloblen = $1.to_i\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value)\n else\n str = eval('\"' + field_value + '\"')\n end\n raise \"Blob expected to have #{bloblen} bytes, had #{str.size}\" unless str.size == bloblen\n str\n else\n warn \"Unknown ft/fv #{field_type} #{field_value}\"\n \"x\"\n end\n end", "def read_int32\n read('N', 4)\n end", "def in_binary\n Bases.val(self).in_binary\n end", "def read(i)\n self.v = i.kind_of?(Integer) ? i.to_i : i.to_s.unpack(@packstr).first\n self\n end", "def get_bytes()\n @value\n end", "def read(str)\n str = str.sysread(size) if not str.kind_of?(::String)\n @value = str.unpack(format).first\n size\n end", "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def read_byte\n buf = read_all(1)\n return Bytes.get_string_byte(buf, 0)\n end", "def test_decode_binary()\n input = [\n 131, 109, 0, 0, 0, 24, 110, 111, 119, 32, 103, 101, 116, 32, 121,\n 111, 117, 114, 32, 97, 115, 115, 32, 116, 111, 32, 109, 97, 114,\n 115]\n expected = Erlang::Binary.new('now get your ass to mars')\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def get_int64\n raise EOFError if @position + 8 > @size\n hi, lo = @response[@position, 8].unpack('N*N*')\n @position += 8\n return (hi << 32) + lo\n end", "def read_property_binary f, type, index_type=false, element_type=false\n # print \"reading one #{type}: \"\n # pick String#unpack specifiers based on our endian-ness\n case @format\n when \"binary_big_endian\"\n e, f32, f64 = \">\", \"g\", \"G\"\n when \"binary_little_endian\"\n e, f32, f64 = \"<\", \"e\", \"E\"\n end\n case type\n when \"char\", \"int8\"\n f.read(1).unpack(\"c\").first\n when \"uchar\", \"uint8\"\n f.read(1).unpack(\"C\").first\n when \"short\", \"int16\"\n f.read(2).unpack(\"s#{e}\").first\n when \"ushort\", \"uint16\"\n f.read(2).unpack(\"S#{e}\").first\n when \"int\", \"int32\"\n f.read(4).unpack(\"l#{e}\").first\n when \"uint\", \"uint32\"\n f.read(4).unpack(\"L#{e}\").first\n when \"float\", \"float32\"\n f.read(4).unpack(f32).first\n when \"double\", \"float64\"\n f.read(8).unpack(f64).first\n when \"list\"\n count = read_property_binary(f, index_type)\n count.times.collect { read_property_binary(f, element_type) }\n end\n end", "def read\n if sample = raw_read\n return Typelib.to_ruby(sample)\n end\n end", "def getbyte\n end", "def getbyte\n end", "def read_binary_date(fname,fd,length)\n raise CFFormatError.new(\"Date greater than 8 bytes: #{length}\") if length > 3\n\n nbytes = 1 << length\n val = nil\n buff = fd.read(nbytes)\n\n case length\n when 0 then # 1 byte CFDate is an error\n raise CFFormatError.new(\"#{length+1} byte CFDate, error\")\n when 1 then # 2 byte CFDate is an error\n raise CFFormatError.new(\"#{length+1} byte CFDate, error\")\n when 2 then\n val = buff.reverse.unpack(\"f\")\n val = val[0]\n when 3 then\n val = buff.reverse.unpack(\"d\")\n val = val[0]\n end\n\n return CFDate.new(val,CFDate::TIMESTAMP_APPLE)\n end", "def read_byte\n read('C', 1)\n end", "def read()\n File.open(\"/tmp/mount/y0\", \"r\").read.to_f\nend", "def get_byte\n get(1).ord\n end", "def read(bits=nil)\n bits ||= word_size\n binary = []\n\n bits.times do |i|\n block_index, bit_index = @pointer.divmod(8)\n data = @blocks[block_index] || 0\n binary << (((data >> (7 - bit_index)) & 1) == 1)\n @pointer += 1\n end\n\n binary.map{|b| b ? '1' : '0' }.join.to_i(2)\n end", "def read(cursor, field_length)\n cursor.name(@data_type.name) { cursor.read_bytes(field_length) }\n end", "def read_external(in_stream)\n # fieldNumber = in.readShort ();\n # value = in.readUTF();\n end", "def double\n r = little? ? @data.byteslice(@pos, 8).unpack('E')[0] : @data.byteslice(@pos, 8).unpack('G')[0]\n @pos += 8\n r\n end", "def read_int(offset, stream = @index)\n stream.seek(offset)\n stream.read(4).unpack('L')[0]\n end", "def binary_string; end", "def decode_bits(cursor, cursor_bits, nbr_bits)\n value = nil\n nbr_bits_to_read = cursor_bits + nbr_bits\n if (nbr_bits_to_read > 24)\n # The value is split between 4 bytes\n value = (BinData::Uint32be.read(@data[cursor..cursor+3]) >> (32-nbr_bits_to_read)) & ((1 << nbr_bits)-1)\n elsif (nbr_bits_to_read > 16)\n # The value is split between 3 bytes\n value = (BinData::Uint24be.read(@data[cursor..cursor+2]) >> (24-nbr_bits_to_read)) & ((1 << nbr_bits)-1)\n elsif (nbr_bits_to_read > 8)\n # The value is split between 2 bytes\n value = (BinData::Uint16be.read(@data[cursor..cursor+1]) >> (16-nbr_bits_to_read)) & ((1 << nbr_bits)-1)\n else\n # The value is accessible through the same byte (@data[cursor])\n value = (@data[cursor].ord >> (8-nbr_bits_to_read)) & ((1 << nbr_bits)-1)\n end\n cursor, cursor_bits = inc_cursor_bits(cursor, cursor_bits, nbr_bits)\n\n return value, cursor, cursor_bits\n end", "def blob(val)\n val.gsub(/[\\000-\\037\\047\\134\\177-\\377]/) do |b|\n \"\\\\#{ b[0].to_s(8).rjust(3, '0') }\"\n end\n end", "def get_value\r\n @bitstring\r\n end", "def value_read; end", "def getBin\n case @binDataType\n when 'B'\n bin = Bin.new('information', BytesValue.new(randString(@binDataSize)))\n when 'S'\n bin = Bin.new('information', StringValue.new(randString(@binDataSize)))\n else\n bin = Bin.new('information', IntegerValue.new(2**63))\n end\n\n bin\nend", "def to_f(data)\n return ((data[1].ord + (256 * data[0].ord)) / 1.2)\n end", "def read\n if sample = raw_read\n Typelib.to_ruby(sample)\n end\n end", "def read_int16\n read('n', 2)\n end", "def accumulated_real_energy\n @bytes.sint32(8)\n end", "def read(io)\n data = self.new\n data.read(io)\n data.single_value? ? data.value : data\n end", "def get_float\n get(4).unpack('f')\n end", "def read_binary_string(fname,fd,length)\n buff = \"\"\n buff = fd.read(length) if length > 0\n\n @unique_table[buff] = true unless @unique_table.has_key?(buff)\n return CFString.new(buff)\n end", "def get_f32\n res, @data = @data.unpack(\"ga*\")\n self.underrun! unless res\n res\n end", "def unpack(binary)\n end", "def unpack_value(hex_string)\n convert_to_signed_binary(translate_to_binary(hex_string.to_i(16))).to_f\n end", "def binread(*args, **kwd); end", "def short_binary_type; end", "def read_binary_file(path)\n File.open(path, 'rb') {|f| f.read }\n end", "def bytes\n @number\n end", "def read_byte\n @buffer.shift(BYTE_LENGTH).join.to_i(2) if @buffer.length >= BYTE_LENGTH\n end", "def value\n @bytes.pack('C*')\n end", "def getbyte()\n #This is a stub, used for indexing\n end" ]
[ "0.71810484", "0.70387715", "0.68851215", "0.67749465", "0.6718428", "0.65083176", "0.63742584", "0.6350838", "0.6321549", "0.63113016", "0.63111025", "0.62680936", "0.626058", "0.6202346", "0.6136513", "0.6136513", "0.6105215", "0.60897", "0.6017096", "0.6011622", "0.5988135", "0.5974352", "0.5970505", "0.5956285", "0.5942877", "0.59190863", "0.58930314", "0.58809125", "0.586194", "0.5826335", "0.58253914", "0.5822964", "0.58143264", "0.58110267", "0.5788057", "0.57722735", "0.5737318", "0.57370657", "0.5736683", "0.5736201", "0.57335645", "0.5731086", "0.5715213", "0.57137823", "0.57042074", "0.57010484", "0.5682277", "0.56757855", "0.5653311", "0.5640877", "0.56290406", "0.5625099", "0.5614107", "0.5611251", "0.55881834", "0.5578946", "0.5569863", "0.5564831", "0.554786", "0.55438626", "0.5518005", "0.54848933", "0.5464683", "0.5463241", "0.5462164", "0.5458125", "0.54565763", "0.54565763", "0.545376", "0.5451993", "0.5447921", "0.54461974", "0.5442564", "0.5430318", "0.54298955", "0.5428324", "0.5422585", "0.54153013", "0.54021955", "0.54020256", "0.54007286", "0.5399986", "0.53984165", "0.53954697", "0.5395264", "0.5385985", "0.5381055", "0.536859", "0.53548336", "0.53509855", "0.53440136", "0.5332135", "0.53268725", "0.5316093", "0.53104025", "0.530832", "0.53036", "0.5299031", "0.5297939", "0.52909917" ]
0.783559
0
read a binary date value
def read_binary_date(fname,fd,length) raise CFFormatError.new("Date greater than 8 bytes: #{length}") if length > 3 nbytes = 1 << length val = nil buff = fd.read(nbytes) case length when 0 then # 1 byte CFDate is an error raise CFFormatError.new("#{length+1} byte CFDate, error") when 1 then # 2 byte CFDate is an error raise CFFormatError.new("#{length+1} byte CFDate, error") when 2 then val = buff.reverse.unpack("f") val = val[0] when 3 then val = buff.reverse.unpack("d") val = val[0] end return CFDate.new(val,CFDate::TIMESTAMP_APPLE) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_date; end", "def date_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT\n\n bdata = Binary.type_bytes(\"3\", 3) # 3 is 0011, type indicator for date\n @object_table[saved_object_count] = bdata + [val].pack(\"d\").reverse\n\n return saved_object_count\n end", "def reg_binary_to_date(str)\n\t\tbegin\n\t\tcut=str.scan(/..../)\n\t\tyear=(cut[0][2,4]+cut[0][0,2]).hex.to_i\n\t\tmonth=(cut[1][2,4]+cut[1][0,2]).hex.to_i\n\t\tweekday=(cut[2][2,4]+cut[2][0,2]).hex.to_i\n\t\tdate=(cut[3][2,4]+cut[3][0,2]).hex.to_i\n\t\thour=(cut[4][2,4]+cut[4][0,2]).hex.to_i\n\t\tmin=(cut[5][2,4]+cut[5][0,2]).hex.to_i\n\t\tif min < 10 then\n\t\t\tmin=\"0#{min}\"\n\t\tend\n\t\tt = Time.gm(year,month,date,hour,min)\n\t\tmonth = t.strftime(\"%B\")\n\t\tweekday = t.strftime(\"%A\")\n\t\treturn \"#{weekday}, #{date} #{month} #{year} #{hour}:#{min}\"\n\t\trescue\n\t\t\treturn 'Error resolving last connected date'\n\t\tend\n\tend", "def read_date=(_); end", "def date1904() @@date1904; end", "def value\n self.class.get_date(@bits)\n end", "def get_1904\n @date_1904\n end", "def value(data)\n timestamp = BinData::Uint32be.read(data)\n return \"0000-00-00 00:00:00\" if timestamp.zero?\n\n DateTime.strptime(timestamp.to_s, \"%s\").strftime \"%Y-%m-%d %H:%M:%S\"\n end", "def to_binary_dos_time; end", "def ruby_value\n ::Date.parse(@date_time_value.strftime(\"%Y%m%d\"))\n end", "def read_pic_date(filename)\n date = read_pic_edate(filename) \n if date == nil \n date = read_pic_fdate(filename) \n end\n return date\nend", "def read_binary\n raise NotImplementedError\n end", "def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n if(object_type != \"0\" && object_length == 15) then\n object_length = read_binary_object(fname,fd)\n object_length = object_length.value\n end\n\n retval = nil\n case object_type\n when '0' then # null, false, true, fillbyte\n retval = read_binary_null_type(object_length)\n when '1' then # integer\n retval = read_binary_int(fname,fd,object_length)\n when '2' then # real\n retval = read_binary_real(fname,fd,object_length)\n when '3' then # date\n retval = read_binary_date(fname,fd,object_length)\n when '4' then # data\n retval = read_binary_data(fname,fd,object_length)\n when '5' then # byte string, usually utf8 encoded\n retval = read_binary_string(fname,fd,object_length)\n when '6' then # unicode string (utf16be)\n retval = read_binary_unicode_string(fname,fd,object_length)\n when 'a' then # array\n retval = read_binary_array(fname,fd,object_length)\n when 'd' then # dictionary\n retval = read_binary_dict(fname,fd,object_length)\n end\n\n return retval\n end", "def date\n (birthday.to_time + 10**9).to_date\n end", "def read_date(date)\r\n case date\r\n when /(\\d{2})\\.\\s{0,}(\\d{2})\\.\\s{0,}(\\d{4})/ # format DD.MM.YYYY nebo DD. MM. YYYY\r\n date.scan(/(\\d{2})\\.\\s{0,}(\\d{2})\\.\\s{0,}(\\d{4})/) do |sep|\r\n new_date = \"#{sep[2]}-#{sep[1]}-#{sep[0]}\"\r\n return new_date\r\n end\r\n when /(\\d{2})\\/(\\d{2})\\/(\\d{4})/\r\n date.scan(/(\\d{2})\\/(\\d{2})\\/(\\d{4})/) do |sep|\r\n new_date = \"#{sep[2]}-#{sep[0]}-#{sep[1]}\"\r\n return new_date\r\n end\r\n when /(\\d{4})\\-(\\d{2})\\-(\\d{2})/ # format YYYY-MM-DD\r\n return date\r\n else\r\n puts \"ERROR! Neplatny format \\\"#{date}\\\" (prijejte format do funkce \\\"read_date\\\")\"\r\n end\r\nend", "def manufacture_date\n bf = data['ManufactureDate']\n day = bf & ((2**5)-1)\n month = (bf & (((2**4)-1) << 5)) >> 5\n year = ((bf & (((2**7)-1) << 9)) >> 9) + 1980\n\n # Ruby 1.8 lacks Time#strptime\n Time.parse Date.new(year, month, day).to_s\n end", "def ruby_value\n to_datetime\n end", "def read_date(taglib, **opts)\n v10_year = taglib.id3v1_tag.year.to_s if taglib.id3v1_tag.year > 0\n v24_date = read_first_tag(taglib, ['TDRC'])\n\n # check variables in order of importance\n date_str = v24_date || v10_year\n puts \"MP3#date: date_str = \\\"#{date_str}\\\"\" if $DEBUG\n\n date_str\n end", "def read_date_attribute(node, attr_name)\n if node.attributes[attr_name]\n begin\n Model::IncompleteDate.new node.attributes[attr_name]\n rescue ArgumentError\n nil\n end\n end\n end", "def read_pic_edate(filename)\n date = EXIFR::JPEG.new(filename).date_time\nend", "def read_binary(file); end", "def decode_date(value)\n return nil if value.blank?\n value.is_a?(String) ? value.gsub(' ', '0').to_date : value.to_date\n rescue\n nil\n end", "def decode_datetime(value)\n days, milliseconds = value.unpack('l2')\n seconds = milliseconds / 1000\n DateTime.jd(days, seconds/3600, seconds/60 % 60, seconds % 60) rescue nil\n end", "def parse_date(input, msg = T.unsafe(nil)); end", "def date(input, format); end", "def date\n parse!\n @date\n end", "def serial_to_date (s)\r\n\t\t# round down and convert from string if need be\r\n\t\t# zero day is actually \"Jan 0\" and indexing starts from 1, so subtract 2\r\n\t\ts = s.to_i() - 2\r\n\t\t# add to zero day\r\n\t\treturn JAN_1_1900 + s\r\n\tend", "def read_int64; end", "def typecast_to_primitive(value)\n if value.respond_to?(:to_date)\n value.to_date\n elsif value.is_a?(::Hash) || value.respond_to?(:to_mash)\n typecast_hash_to_date(value)\n else\n ::Date.parse(value.to_s)\n end\n rescue ArgumentError\n value\n end", "def read_byte; end", "def date\n Date.parse(@data['date'])\n end", "def ndvi_file_to_date (s) \n\t#MT3RG_2007_50-56_250m_composite_ndvi.rgb.jpg\n\t bits = s.split(\"_\")\n\t start_day = bits[2].split(\"-\").first\n\treturn(Time.gm(bits[1].to_i, 1,1,0,0,0) + start_day.to_i * 24*60*60)\nend", "def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end", "def date\n @date ||= Date.parse(@attrs[:date]) rescue nil\n end", "def parse_date(date)\n Icalendar::Values::DateOrDateTime.new(date)\n end", "def datetime_data(object)\n return object unless object.present?\n\n DateTime.strptime(object, '%Y-%m-%d').to_s\n rescue ArgumentError => e\n rescue_and_retry_datetime(object, e)\n end", "def base_date\n return DATE_SYSTEM_1900 if @xml.nil?\n\n @xml.xpath('//workbook/workbookPr[@date1904]').each do |workbookPr|\n return DATE_SYSTEM_1904 if workbookPr['date1904'] =~ /true|1/i\n end\n\n DATE_SYSTEM_1900\n end", "def typecast_value_date(value)\n case value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when Date\n value\n when String\n Sequel.string_to_date(value)\n when Hash\n Date.new(*[:year, :month, :day].map{|x| (value[x] || value[x.to_s]).to_i})\n else\n raise InvalidValue, \"invalid value for Date: #{value.inspect}\"\n end\n end", "def get_data\n data = @data.unpack(\"C*\")\n year = data[0..1]\n year = Shared::interpret_bytes_2(year)\n #Year, Month, Day, Hour, Min, Sec, UTC\n return Time.new(year, data[2],\n data[3], data[4],\n data[5], data[6], \"UTC\")\n end", "def easy_date; date; end", "def date_at(event)\n f = path event\n return nil unless File.size? f\n DateTime.parse File.read(f)\n end", "def convert_day_to_date string\r\n Date.strptime(string.to_s,\"%Y%m%d\")\r\n end", "def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end", "def extract_date(str)\n\t\tDate.strptime(str, '%m/%d/%Y')\n\tend", "def date\n Date.parse(@obj['date'])\n end", "def base_date\n @base_date ||= lambda do\n date_base_element = workbook.search('workbookPr').attribute('date1904')\n if date_base_element && date_base_element.value.to_i == 1\n Date.parse('1904-01-01')\n else\n Date.parse('1900-01-01')\n end\n end.call\n end", "def get_date(property, data, single: true)\n get_property(property, data, single: single) do |value, _type|\n DateTime.parse(value)\n end\n end", "def parse_dob(dob)\n LineParser.dob(dob.split('-').map(&:to_i))\n end", "def read\n read_object(read_byte)\n end", "def convert_birthday(params)\n\t\tif params[:birthday_year].nil? || params[:birthday_month].nil? || params[:birthday_day].nil?\n\t\t\tnil\n\t\telse\n\t\t\tDate.parse(\"#{params[:birthday_year]}-#{params[:birthday_month]}-#{params[:birthday_day]}\")\n\t\tend\n\tend", "def get_revdate(doc_path)\n doc = Nokogiri::HTML(File.open(doc_path)) { |config| config.strict.nonet}\n revdate = doc.search('//span[@id=\"revdate\"]').text.strip\n DateTime.strptime(revdate, '%Y-%m-%d') if /^\\d{4}-\\d{2}-\\d{2}$/.match(revdate)\nend", "def convert_date( date )\n\n date_format = '%Y-%m-%d'\n begin\n return DateTime.strptime( date, date_format )\n rescue => e\n return nil\n end\n end", "def to_date string\n \n end", "def typecast_hash_to_date(value)\n Date.new(*extract_time(value)[0, 3].map(&:to_i))\n end", "def date(date)\n Date.strptime(date,\"%m/%d/%y\")\n rescue ArgumentError => e \n raise unless e.to_s =~ /invalid date/\n raise BadTime, e.to_s\n end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def parse_dob(dob)\n LineParser.dob(dob.split('/').map(&:to_i))\n end", "def get_date(property, data, uri = nil, single: true)\n get_property(property, data, uri, single: single) { |value, type| DateTime.parse(value) }\n end", "def getdate(key, format)\r\n @value = getvalue(key)\r\n return SVUtils::getdate(@value, format)\r\n end", "def readbyte\n end", "def typecast_to_date(value)\n if value.is_a?(Hash)\n typecast_hash_to_date(value)\n elsif value.is_a?(Time) # sometimes people think date is time!\n value.to_date\n elsif value.to_s =~ /ˆ(\\d{4})[\\-|\\/](\\d{2})[\\-|\\/](\\d{2})$/\n # Faster than parsing the date\n Date.new($1.to_i, $2.to_i, $3.to_i)\n else\n Date.parse(value)\n end\n rescue ArgumentError\n nil\n end", "def read_long; end", "def get_date(sqlite_date)\n sqlite_date.nil? ? nil : sqlite_date[0..9]\n end", "def parse_date(value)\n ::Date.parse(value)\n end", "def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end", "def convert_date(value)\n begin\n return Date.parse(value)\n rescue\n return nil\n end\n end", "def parse_date(row)\n raw_date = row[0]\n if raw_date\n Date.strptime(raw_date, '%m/%d/%y')\n else\n nil\n end\nend", "def parse_date(date, fmt = nil)\n return nil if(date.blank?)\n return DateTime.strptime(date, fmt) if(fmt) # format given\n return DateTime.new(date.to_i) if(date.size < 5) # this short should be a year\n DateTime.parse(date)\n end", "def read_cell_date_or_time(row, idx)\n cell = read_cell_content(row, idx)\n cell = cell.to_s.to_f\n if cell < 1.0\n value_type = :time\n f = cell * 24.0 * 60.0 * 60.0\n secs = f.round\n h = (secs / 3600.0).floor\n secs = secs - 3600 * h\n m = (secs / 60.0).floor\n secs = secs - 60 * m\n s = secs\n value = h * 3600 + m * 60 + s\n else\n datetime = row.send(:_datetime, cell)\n\n if datetime.hour != 0 ||\n datetime.min != 0 ||\n datetime.sec != 0\n value_type = :datetime\n value = datetime\n else\n value_type = :date\n value = row.send(:_date, cell)\n end\n end\n\n [value_type, value]\n end", "def get_byte(offset) datap[offset].unpack('C*')[0] end", "def purchase_date\n read_datetime_from_string('purchase_date')\n end", "def getDateStr\n return \"\" if @line.length < 15\n tmpStr = @line[0..14]\n begin\n DateTime.strptime(tmpStr, \"%b %d %H:%M:%S\")\n out = tmpStr\n rescue\n out = \"\"\n end\n return out \n end", "def read_pic_fdate(filename)\n date = File.mtime(filename)\nend", "def read_binary_file(path)\n File.open(path, 'rb') {|f| f.read }\n end", "def typecast_hash_to_date(value)\n ::Date.new(*extract_time(value)[0, 3])\n end", "def typecast_to_date(value)\n if value.kind_of?(Hash)\n typecast_hash_to_date(value)\n else\n Date.parse(value.to_s)\n end\n end", "def jira_date str\n DateTime.parse(str)\n rescue => e\n puts \"Can not parse #{ str }: #{ e }\"\n nil\n end", "def to_date(string)\n Date.parse(string)\n rescue\n nil\n end", "def convert_binary\n end", "def value_to_date(value)\n return value.strftime(NW_DATE_FORMAT) if value.respond_to? :strftime\n # Force the resulting string into 8 characters otherwise\n value = value.to_s\n value << ' ' until value.size == 8 if value.size < 8\n value = value[0..7] if value.size > 8\n value\n end", "def date_parse raw_day, raw_month\n str_month = raw_month.scan(@regex_monthes)[0]\n month = @monthes[str_month]\n return if not month\n day = raw_day.to_i\n return if day==0\n today = Date.today\n if day < today.day and month == 12\n year = today.year + 1\n else\n year = today.year\n end\n #puts year, year.class, month, month.class, day, day.class\n return \"#{year}-#{\"%02d\"%month}-#{\"%02d\"%day}\"\nend", "def to_date\n if latest?\n Date.new(10_000, 1, 1)\n elsif timestamp?\n to_time.to_date\n else\n fail \"Version tag #{self} cannot be converted to a date!\"\n end\n end", "def parse_date(date)\n month, day, year = date.split(\"/\")\n\n DateTime.new year.to_i, month.to_i, day.to_i\n end", "def type_literal_generic_date(column)\n :date\n end", "def date\n @match_buffer[\"date\"]\n end", "def read(str)\n return unless str\n force_binary(str)\n self[:timestamp].read str[0,8]\n self[:incl_len].read str[8,4]\n self[:orig_len].read str[12,4]\n self[:data].read str[16,self[:incl_len].to_i]\n self\n end", "def readable_date\n date.strftime(\"%B %d, %Y\")\n end", "def match_date( val )\n\t\treturn Date.parse( val ) rescue nil\n\tend", "def write_date(time)\n\t\twrite_byte(11)\n\t\twrite_double(time.to_f * 1000)\n\t\toffset = Time.zone_offset(Time.now.zone)\n\t\twrite_int16_network(offset / 60 * -1)\n\tend", "def test_rfc6351_value_date_with_day\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>---28</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:---28\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def params_to_date(params,key)\r\n date = Date.civil(params[key][:year].to_i, params[key][:month].to_i, params[key][:day].to_i)\r\n end", "def data\n read_attribute(binary ? :binary_data : :data)\n end", "def test_rfc6351_value_date_with_year_month_day\n xml = <<XML\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<vcards xmlns=\"urn:ietf:params:xml:ns:vcard-4.0\">\n <vcard>\n <bday>\n <date-and-or-time>20150128</date-and-or-time>\n </bday>\n </vcard>\n</vcards>\nXML\n vobj = <<VOBJ\nBEGIN:VCARD\nVERSION:4.0\nBDAY:20150128\nEND:VCARD\nVOBJ\n assert_xml_reflexively_equals_to_mime_dir(xml, vobj)\n end", "def date_value\n Time.parse(value) if value.present?\n end", "def convert_to_date(str_date)\n Date.parse(str_date) if str_date\n end", "def test_binary\n mode = is19? ? \"rb:ascii-8bit\" : \"rb\"\n bin_file_content = File.open(\"#{FIXTURES}/favicon.ico\", mode).read\n c = WDDX.load(WDDX::Binary.new(bin_file_content).to_wddx)\n assert_equal bin_file_content, c.data.bin_data \n end", "def d(date_string)\n Date.parse(date_string)\nend", "def change_date(date)\n require 'date'\n date = DateTime.parse(date)\nend", "def to_date(date)\n return date if date.is_a?(Date)\n Date.parse(date)\n end", "def open_datetime\n Time.parse(data.fetch('openDate'))\n end" ]
[ "0.65893734", "0.656487", "0.65204334", "0.64839846", "0.63936645", "0.6314313", "0.5901791", "0.57451266", "0.5666163", "0.562766", "0.56220925", "0.5616594", "0.5577351", "0.55132914", "0.5490037", "0.54841167", "0.54658884", "0.5410722", "0.5404405", "0.53968966", "0.53851044", "0.5378514", "0.5364289", "0.535919", "0.5355776", "0.53470904", "0.5345034", "0.533864", "0.53246063", "0.5316888", "0.5290338", "0.52784926", "0.5262261", "0.52515465", "0.5241242", "0.5224911", "0.52081406", "0.52041423", "0.5197863", "0.5183279", "0.5177945", "0.5170084", "0.516777", "0.5161992", "0.51528895", "0.5139609", "0.51211524", "0.51053226", "0.51026195", "0.5097043", "0.5091379", "0.5088648", "0.50795764", "0.5070827", "0.50653684", "0.5059696", "0.50523746", "0.50367373", "0.5030537", "0.50168186", "0.50029606", "0.49868757", "0.49844068", "0.49828175", "0.49773103", "0.49773103", "0.49685022", "0.4964413", "0.49615353", "0.49608094", "0.4957952", "0.49466363", "0.49455902", "0.49450955", "0.49427196", "0.49403483", "0.4938421", "0.49335808", "0.49311495", "0.4930344", "0.49292746", "0.49247783", "0.4923482", "0.49176526", "0.49022332", "0.49004793", "0.48988464", "0.4890461", "0.48885232", "0.48863283", "0.48851144", "0.48848614", "0.48836064", "0.48761573", "0.486566", "0.4859765", "0.48579782", "0.4842295", "0.48412195", "0.48409325" ]
0.7879995
0
Read a binary data value
def read_binary_data(fname,fd,length) buff = ""; buff = fd.read(length) if length > 0 return CFData.new(buff,CFData::DATA_RAW) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_binary\n raise NotImplementedError\n end", "def read_byte; end", "def data\n read_attribute(binary ? :binary_data : :data)\n end", "def read\n read_object(read_byte)\n end", "def read_byte(data, offset)\n out = data[offset,1].unpack('C').first rescue 0\n return out\n end", "def readbyte\n end", "def read_binary(file); end", "def read_byte\n buf = read_all(1)\n return Bytes.get_string_byte(buf, 0)\n end", "def read_data_byte(offset) [offset + 1, get_byte(offset)] end", "def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n if(object_type != \"0\" && object_length == 15) then\n object_length = read_binary_object(fname,fd)\n object_length = object_length.value\n end\n\n retval = nil\n case object_type\n when '0' then # null, false, true, fillbyte\n retval = read_binary_null_type(object_length)\n when '1' then # integer\n retval = read_binary_int(fname,fd,object_length)\n when '2' then # real\n retval = read_binary_real(fname,fd,object_length)\n when '3' then # date\n retval = read_binary_date(fname,fd,object_length)\n when '4' then # data\n retval = read_binary_data(fname,fd,object_length)\n when '5' then # byte string, usually utf8 encoded\n retval = read_binary_string(fname,fd,object_length)\n when '6' then # unicode string (utf16be)\n retval = read_binary_unicode_string(fname,fd,object_length)\n when 'a' then # array\n retval = read_binary_array(fname,fd,object_length)\n when 'd' then # dictionary\n retval = read_binary_dict(fname,fd,object_length)\n end\n\n return retval\n end", "def getbyte\n read(1).ord\n end", "def get_byte(offset) datap[offset].unpack('C*')[0] end", "def getbyte\n read(1)\n end", "def read_data\n unpacker.read\n end", "def read_byte\n @buffer.shift(BYTE_LENGTH).join.to_i(2) if @buffer.length >= BYTE_LENGTH\n end", "def read_byte\n read('C', 1)\n end", "def read_binary_file(path)\n File.open(path, 'rb') {|f| f.read }\n end", "def read(bytes = @length)\n return nil if @pos >= @length\n bytes = @length - @pos if bytes.nil?\n bytes = @length - @pos if @pos + bytes > @length\n\n out = @data[@pos, bytes] if @data.kind_of?(String)\n out = @data.read(bytes) if @data.kind_of?(NTFS::DataRun)\n\n @pos += out.size\n out\n end", "def read_value_s\n b_read = 0\n lu = @file.read INT_SIZE\n return nil if lu.nil? || lu.bytesize < INT_SIZE\n b_read += lu.bytesize\n\n l = lu.unpack(PACK_UINT).first\n s = @file.read l\n return nil if s.nil? || s.bytesize < l\n b_read += s.bytesize\n\n [s, b_read]\n end", "def get_data\n return @data.unpack(\"S>*\")\n end", "def data; Marshal.load(Base64.decode64(read_attribute(:data))); end", "def readbyte\n getbyte || raise(EOFError)\n end", "def unpack(binary)\n end", "def read\n return nil if FileTest.exist?(@fname)==false\n\n open(@fname,\"rb\") do |file| #Read & Binary mode\n @data = Marshal.load(file)\n end\n @data\n end", "def data\n self.data_pointer.read_string(self.data_size)\n end", "def read_byte(signed = false, mut = :STD)\n val = 0\n val |= mutate(@payload.next_byte, mut)\n signed ? val : val & 0xff\n end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def getbyte\n end", "def getbyte\n end", "def read_binary_int(fname,fd,length)\n raise CFFormatError.new(\"Integer greater than 8 bytes: #{length}\") if length > 3\n\n nbytes = 1 << length\n\n val = nil\n buff = fd.read(nbytes)\n\n case length\n when 0 then\n val = buff.unpack(\"C\")\n val = val[0]\n when 1 then\n val = buff.unpack(\"n\")\n val = val[0]\n when 2 then\n val = buff.unpack(\"N\")\n val = val[0]\n when 3\n hiword,loword = buff.unpack(\"NN\")\n val = hiword << 32 | loword\n end\n\n return CFInteger.new(val);\n end", "def read_bit\n @buffer.shift if @buffer.length >= 1\n end", "def read__UI8\r\n readbyte\r\n end", "def get_data\n return @data.unpack(\"C*\")\n end", "def readbyte\n map_exceptions do\n @socket.readbyte\n end\n end", "def data\n unless @data\n stream.pos = header.sh_offset\n @data = stream.read(header.sh_size).force_encoding('ascii-8bit')\n end\n @data\n end", "def read_uint8(position = nil)\n seek(position)\n data = read_and_advance(1)\n BinData::Uint8.read(data).to_i\n end", "def read_u1\n read(1).first & 0xff\n end", "def read(cursor, field_length)\n cursor.name(@data_type.name) { cursor.read_bytes(field_length) }\n end", "def read\n data = @handle.availableData\n return data\n end", "def data\n dis_data.read\n end", "def raw_bytes\n @raw_bytes ||= read_raw_bytes\n end", "def binread(fname)\n File.open(fname, 'rb'){ |f|\n return f.read\n }\n end", "def decode_val( encoding, size, io )\n # plain string\n if encoding == Protocol::ENCODINGS[:plain]\n io.read_unpacked size, 'a' + size.to_s\n # number\n elsif encoding == Protocol::ENCODINGS[:number]\n io.read_unpacked size, size == 4 ? 'l<' : 'q<'\n else\n raise 'Unknown data encoding.'\n end\n end", "def read_bignum; end", "def read(bytes)\n raise \"read(bytes) must be overridden\"\n end", "def get_byte\n get(1).ord\n end", "def read_binary(path)\n if exist? path\n File.binread(expand path)\n else\n nil\n end\n end", "def get_bin(id)\n File.read(File.join(File.expand_path(File.dirname(__FILE__)),'data',id.to_s),mode: 'rb')\n end", "def read_binary_string(fname,fd,length)\n buff = \"\"\n buff = fd.read(length) if length > 0\n\n @unique_table[buff] = true unless @unique_table.has_key?(buff)\n return CFString.new(buff)\n end", "def read_data(return_bytes_length)\n length = return_bytes_length\n data = ''\n while length > 0\n ret = serial.read(1)\n data += ret\n length -= ret.length\n end\n data\n end", "def binread(*args, **kwd); end", "def read_int64; end", "def bytes(*args); data(1, *args); end", "def get_bytes()\n @value\n end", "def read_record\n n_read = 0\n tu = @file.read INT_SIZE\n return nil if tu.nil? || tu.bytesize < INT_SIZE\n if (tu == (ZERO_BYTE_ASCII_8BIT * INT_SIZE))\n # empty record. skip this page.\n @file.seek(PAGE_SIZE - INT_SIZE, IO::SEEK_CUR)\n return nil\n end\n n_read += tu.bytesize\n t = tu.unpack(PACK_UINT).first\n\n return nil if @file.eof?\n lu = @file.read INT_SIZE\n return nil if lu.nil? || lu.bytesize < INT_SIZE\n n_read += lu.bytesize\n l = lu.unpack(PACK_UINT).first\n\n if false # l == 7016996765293437281\n puts \"*************** #{__FILE__} #{__LINE__} *************\"\n puts \"at: #{@file.tell}\"\n end\n\n if l > MAX_VALUE_SIZE\n raise ParseError.new \"Read size that exceeds the maximum size for a value.\"\n end\n\n k = nil\n begin\n k = @file.read l\n rescue NoMemoryError => e\n # puts \"*************** #{__FILE__} #{__LINE__} *************\"\n # puts \"#{e.message} at #{l}\"\n raise\n end\n\n return nil if k.nil? || k.bytesize < l\n n_read += k.bytesize\n d = if t != WRITE_TYPE_INDEXES[:array]\n [t, k]\n else\n asu = @file.read INT_SIZE\n return nil if asu.nil? || asu.bytesize < INT_SIZE\n n_read += asu.bytesize\n as = asu.unpack(PACK_UINT).first\n [t, k, as]\n end\n return nil if d.nil?\n\n v = nil\n\n raw_v = nil\n case d[0]\n when WRITE_TYPE_INDEXES[:array]\n a = []\n d[2].times do |i|\n raw_v, b_read = read_value_s\n n_read += b_read\n break if raw_v.nil?\n a.push(raw_v)\n end\n v = a\n when WRITE_TYPE_INDEXES[:hash], WRITE_TYPE_INDEXES[:set]\n raw_v, b_read = read_value_s\n return nil if raw_v.nil?\n n_read += b_read\n v = MultiJson.decode(raw_v)\n when WRITE_TYPE_INDEXES[:string]\n v, b_read = read_value_s\n return nil if v.nil?\n n_read += b_read\n when WRITE_TYPE_INDEXES[:counter]\n v, b_read = read_value_i\n return nil if v.nil?\n n_read += b_read\n end\n\n pages_read = n_read / PAGE_SIZE\n remainder = (n_read % PAGE_SIZE)\n if remainder > 0\n @file.seek((PAGE_SIZE - remainder), IO::SEEK_CUR)\n pages_read += 1\n end\n\n [d, v, pages_read]\n end", "def data_as_bytes\n raise \"subclass responsibility\"\n end", "def read_word(data, offset)\n out = data[offset,4].unpack('V').first rescue 0\n return out\n end", "def unpack\n @data.unpack('A4cN') \n end", "def prim_read length\n buf = \"\".encode Encoding::BINARY\n if length.nil?\n buf << b until (b = _read_byte).nil?\n else\n until length.zero? || (b = _read_byte).nil?\n buf << b\n length -= 1\n end\n end\n return buf\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 2\n data << @data[0]\n data << (@data[1] ? 1 : 0)\n end", "def decoder(data)\n result = CKB::Utils.hex_to_bin(data).unpack(\"Q<\")[0]\n return result.to_i\nend", "def read\n @fileobj.seek @data_offset\n @data = @fileobj.read @data_size\n end", "def read_uint8(data: nil, stream: nil, offset: 0)\n _read_fixint(name: :uint8, length: 1, pack_format: PACK_FORMAT_UINT8, data: data, stream: stream, offset: offset)\n end", "def read_all_bytes\n # 1. Open file with option \"r\" (reading) and \"b\" (binary, useful for window system)\n open_file\n \n # 2. Read all bytes\n begin\n bytes = @file_handle.read(self.size).unpack(\"C*\")\n return bytes\n rescue\n # re-raise system the excepiton\n raise\n return nil\n ensure\n # 3. Close the file\n close_file\n end\n end", "def read_all_bytes\n # 1. Open file with option \"r\" (reading) and \"b\" (binary, useful for window system)\n open_file\n \n # 2. Read all bytes\n begin\n bytes = @file_handle.read(self.size).unpack(\"C*\")\n return bytes\n rescue\n # re-raise system the excepiton\n raise\n return nil\n ensure\n # 3. Close the file\n close_file\n end\n end", "def value(data)\n BinData::DoubleLe.read(data)\n end", "def read_struct_data(bytes)\n self.class.set_values_from_byte_to_object(bytes, self)\n end", "def bytes\n\t\tbin.unpack('C*')\n\tend", "def data\n raise RuntimeError, 'No raw data set' unless @raw\n\n header, @chunk_id, @chunk_count, crc32, b = Payload.decode(@raw).unpack('a4LLLa*')\n\n raise FormatError unless header == HEADER\n raise ChecksumError unless Zlib.crc32(b) == crc32\n\n b\n end", "def read() end", "def get_byte(close_after_single_read=false)\n end", "def read(str)\n str = str.sysread(size) if not str.kind_of?(::String)\n @value = str.unpack(format).first\n size\n end", "def read(length = bytes_remaining)\n value = @data.byteslice(@pos, length)\n @pos += length\n value\n end", "def read_value_i\n b_read = 0\n ie = @file.read INT_SIZE\n return nil if ie.nil? || ie.bytesize < INT_SIZE\n b_read += ie.bytesize\n\n i = ie.unpack(PACK_INT).first\n [i, b_read]\n end", "def i8u\n @io.getbyte\n end", "def read\n Typelib.to_ruby(raw_read)\n end", "def _int2b(data)\n data.unpack('v').first\n end", "def unpack\nraw_bytes.unpack \"NnnCCa6\"\nend", "def read_varint(data: nil, stream: nil, offset: 0)\n if data && !stream\n return [nil, 0] if data.bytesize < 1 + offset\n\n bytes = BTC::Data.bytes_from_data(data, offset: offset, limit: 9) # we don't need more than 9 bytes.\n\n byte = bytes[0]\n\n if byte < 0xfd\n return [byte, offset + 1]\n elsif byte == 0xfd\n return [nil, 1] if data.bytesize < 3 + offset # 1 byte prefix, 2 bytes uint16\n return [bytes[1] +\n bytes[2]*256, offset + 3]\n elsif byte == 0xfe\n return [nil, 1] if data.bytesize < 5 + offset # 1 byte prefix, 4 bytes uint32\n return [bytes[1] +\n bytes[2]*256 +\n bytes[3]*256*256 +\n bytes[4]*256*256*256, offset + 5]\n elsif byte == 0xff\n return [nil, 1] if data.bytesize < 9 + offset # 1 byte prefix, 8 bytes uint64\n return [bytes[1] +\n bytes[2]*256 +\n bytes[3]*256*256 +\n bytes[4]*256*256*256 +\n bytes[5]*256*256*256*256 +\n bytes[6]*256*256*256*256*256 +\n bytes[7]*256*256*256*256*256*256 +\n bytes[8]*256*256*256*256*256*256*256, offset + 9]\n end\n\n elsif stream && !data\n\n if stream.eof?\n raise ArgumentError, \"Can't parse varint from stream because it is already closed.\"\n end\n\n if offset > 0\n buf = stream.read(offset)\n return [nil, 0] if !buf\n return [nil, buf.bytesize] if buf.bytesize < offset\n end\n\n prefix = stream.read(1)\n\n return [nil, offset] if !prefix || prefix.bytesize == 0\n\n byte = prefix.bytes[0]\n\n if byte < 0xfd\n return [byte, offset + 1]\n elsif byte == 0xfd\n buf = stream.read(2)\n return [nil, offset + 1] if !buf\n return [nil, offset + 1 + buf.bytesize] if buf.bytesize < 2\n return [buf.unpack(\"v\").first, offset + 3]\n elsif byte == 0xfe\n buf = stream.read(4)\n return [nil, offset + 1] if !buf\n return [nil, offset + 1 + buf.bytesize] if buf.bytesize < 4\n return [buf.unpack(\"V\").first, offset + 5]\n elsif byte == 0xff\n buf = stream.read(8)\n return [nil, offset + 1] if !buf\n return [nil, offset + 1 + buf.bytesize] if buf.bytesize < 8\n return [buf.unpack(\"Q<\").first, offset + 9]\n end\n\n else\n raise ArgumentError, \"Either data or stream must be specified.\"\n end\n end", "def data\n @buffer.string\n end", "def read\n data = @data\n @data = ''\n data\n end", "def byte\n Util.from_bytes :byte, value\n end", "def read_and_unpack_byte\n byte = @sock.read(1)\n raise SocketReadError if byte.nil?\n byte = byte.unpack('C')[0]\n end", "def read8(data, options = {})\n read_memory(extract_address(data, options), number: 1)\n end", "def read(str)\n return unless str\n force_binary(str)\n self[:timestamp].read str[0,8]\n self[:incl_len].read str[8,4]\n self[:orig_len].read str[12,4]\n self[:data].read str[16,self[:incl_len].to_i]\n self\n end", "def get_b\n n = self.get_i32\n OSC::Blob.new(self.get_data(n))\n end", "def write_binary(name, data)\n\t\t# read in binary as well?\n\t\twritten = File.open(name, 'wb') do |io| # write ASCII-8BIT (i.e. binary?)\n\t\t\tio.write(data)\n\t\tend\n\t\tRails.logger.info \"(i) w_b #{name} - bytes written - #{written}\"\n\t\tRails.logger.info \"(i) w_b - *data bytes length* - #{data.bytes.length}\"\n\t\twritten\n\tend", "def _sint2b(data)\n data.unpack('s').first\n end", "def read\n return unless ::File.exist?(@file)\n\n @data = Bencode.decode(::File.read(@file))\n end", "def read(meta = @meta)\n buffer, size = next_read(meta)\n size == 0 ? nil : buffer.get_bytes(size)\n end", "def read(id)\n path(id).binread\n end", "def bytes\n Base64.decode64(data)\n end", "def read_string(data, offset, length, encoding)\n if \"UTF-16\".casecmp(encoding) == 0\n out = data[offset, length].unpack('v*').pack('U*')\n else\n out = data[offset, length].unpack('C*').pack('U*')\n end\n return out\n end", "def read_short(data, offset)\n out = data[offset,2].unpack('v').first rescue 0\n return out\n end", "def as_int\n return @as_int unless @as_int.nil?\n _pos = @_io.pos\n @_io.seek(0)\n @as_int = @_io.read_u2be\n @_io.seek(_pos)\n @as_int\n end", "def getbyte(index, signed=false)\n if @offset+index >= @read_buffer.bytesize\n swap_buffers\n end\n b = @read_buffer.getbyte(@offset+index)\n (signed && b >= 0x80) ? b - 0x100 : b\n end", "def read_binary_real(fname,fd,length)\n raise CFFormatError.new(\"Real greater than 8 bytes: #{length}\") if length > 3\n\n nbytes = 1 << length\n val = nil\n buff = fd.read(nbytes)\n\n case length\n when 0 then # 1 byte float? must be an error\n raise CFFormatError.new(\"got #{length+1} byte float, must be an error!\")\n when 1 then # 2 byte float? must be an error\n raise CFFormatError.new(\"got #{length+1} byte float, must be an error!\")\n when 2 then\n val = buff.reverse.unpack(\"f\")\n val = val[0]\n when 3 then\n val = buff.reverse.unpack(\"d\")\n val = val[0]\n end\n\n return CFReal.new(val)\n end", "def getbyte()\n #This is a stub, used for indexing\n end", "def data\n bytes = lp_data.bytes.to_a.pack('C*')\n case lp_type\n when 1,2\n bytes.force_encoding('utf-16le').strip\n when 3\n bytes\n when 4\n bytes.unpack('V').first\n when 5\n bytes.unpack('N').first\n when 7\n str = bytes.force_encoding('utf-16le')\n str.split(\"\\0\".encode('utf-16le'))\n when 11\n bytes.unpack('Q<').first\n else\n \"\"\n end\n end", "def read_bytes_full\n @_io.read\n end" ]
[ "0.7632058", "0.73937154", "0.73124635", "0.72500354", "0.7006242", "0.69913465", "0.69329166", "0.6918088", "0.68678564", "0.6830702", "0.6812567", "0.6698399", "0.6693482", "0.6627418", "0.66016376", "0.6594737", "0.6592734", "0.65844", "0.65458167", "0.6540291", "0.6513359", "0.65117455", "0.65082014", "0.64997214", "0.64637834", "0.6443045", "0.64347774", "0.64281535", "0.64281535", "0.6403144", "0.63920194", "0.638913", "0.6386166", "0.63509923", "0.6292165", "0.628243", "0.6277942", "0.62697965", "0.62509614", "0.6240575", "0.6238738", "0.620933", "0.62064135", "0.61891824", "0.6180701", "0.61788654", "0.61728144", "0.61577773", "0.6152446", "0.6147894", "0.6144739", "0.61434543", "0.61379695", "0.6120439", "0.611902", "0.6103086", "0.6096337", "0.6086602", "0.6073304", "0.60718143", "0.60684466", "0.6065513", "0.60649586", "0.60620165", "0.60620165", "0.60620147", "0.60452294", "0.6043329", "0.60375756", "0.6027946", "0.6021761", "0.60154676", "0.6012849", "0.601267", "0.6002449", "0.6001887", "0.599806", "0.5993867", "0.599276", "0.59879225", "0.5987285", "0.5982032", "0.5965613", "0.5958128", "0.59531736", "0.59502196", "0.594011", "0.59316134", "0.592095", "0.59162605", "0.59152704", "0.5909649", "0.5903966", "0.5898441", "0.58953756", "0.58917505", "0.5886956", "0.5886648", "0.5879025", "0.5871802" ]
0.7130284
4
Read a binary string value
def read_binary_string(fname,fd,length) buff = "" buff = fd.read(length) if length > 0 @unique_table[buff] = true unless @unique_table.has_key?(buff) return CFString.new(buff) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_string(length)\n BinData::Stringz.read(read_and_advance(length))\n end", "def read_binary\n raise NotImplementedError\n end", "def read(str)\n str = str.sysread(size) if not str.kind_of?(::String)\n @value = str.unpack(format).first\n size\n end", "def binary_string; end", "def read_byte\n buf = read_all(1)\n return Bytes.get_string_byte(buf, 0)\n end", "def read_binary_unicode_string(fname,fd,length)\n # The problem is: we get the length of the string IN CHARACTERS;\n # since a char in UTF-16 can be 16 or 32 bit long, we don't really know\n # how long the string is in bytes\n buff = fd.read(2*length)\n\n @unique_table[buff] = true unless @unique_table.has_key?(buff)\n return CFString.new(Binary.charset_convert(buff,\"UTF-16BE\",\"UTF-8\"))\n end", "def read_string(data, offset, length, encoding)\n if \"UTF-16\".casecmp(encoding) == 0\n out = data[offset, length].unpack('v*').pack('U*')\n else\n out = data[offset, length].unpack('C*').pack('U*')\n end\n return out\n end", "def string_to_binary(value)\n self.class.string_to_binary(value)\n end", "def read(str)\n return unless str\n force_binary(str)\n self[:timestamp].read str[0,8]\n self[:incl_len].read str[8,4]\n self[:orig_len].read str[12,4]\n self[:data].read str[16,self[:incl_len].to_i]\n self\n end", "def read_byte; end", "def string(str)\n integer(str.bytesize, 0) << str.dup.force_encoding('binary')\n end", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def read\n read_object(read_byte)\n end", "def read_string; end", "def convertBinaryToString(binary)\n # Use the pack function to encode the binary\n str = [binary].pack('b*')\n return str\n end", "def string(str)\n integer(str.bytesize, 0) + str.dup.force_encoding('binary')\n end", "def read_value_s\n b_read = 0\n lu = @file.read INT_SIZE\n return nil if lu.nil? || lu.bytesize < INT_SIZE\n b_read += lu.bytesize\n\n l = lu.unpack(PACK_UINT).first\n s = @file.read l\n return nil if s.nil? || s.bytesize < l\n b_read += s.bytesize\n\n [s, b_read]\n end", "def read_string\n string = unpack_byteslice('Z*', @content.bytesize)\n @cursor += string.size + 1\n string\n end", "def binary(string)\n string.force_encoding(Encoding::ASCII_8BIT)\n end", "def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n if(object_type != \"0\" && object_length == 15) then\n object_length = read_binary_object(fname,fd)\n object_length = object_length.value\n end\n\n retval = nil\n case object_type\n when '0' then # null, false, true, fillbyte\n retval = read_binary_null_type(object_length)\n when '1' then # integer\n retval = read_binary_int(fname,fd,object_length)\n when '2' then # real\n retval = read_binary_real(fname,fd,object_length)\n when '3' then # date\n retval = read_binary_date(fname,fd,object_length)\n when '4' then # data\n retval = read_binary_data(fname,fd,object_length)\n when '5' then # byte string, usually utf8 encoded\n retval = read_binary_string(fname,fd,object_length)\n when '6' then # unicode string (utf16be)\n retval = read_binary_unicode_string(fname,fd,object_length)\n when 'a' then # array\n retval = read_binary_array(fname,fd,object_length)\n when 'd' then # dictionary\n retval = read_binary_dict(fname,fd,object_length)\n end\n\n return retval\n end", "def binary_to_string(value)\n # TODO: Figure out what Cassandra's blobs look like\n value\n end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def read(str)\n PacketGen.force_binary(str)\n io = StringIO.new(str)\n parse_section(io)\n self\n end", "def str_value\n return @str_value unless @str_value.nil?\n if is_string != 0\n io = _parent.strings._io\n _pos = io.pos\n io.seek(value_or_ofs_value)\n @str_value = (io.read_bytes_term(0, false, true, true)).force_encoding(\"UTF-8\")\n io.seek(_pos)\n end\n @str_value\n end", "def decode_val( encoding, size, io )\n # plain string\n if encoding == Protocol::ENCODINGS[:plain]\n io.read_unpacked size, 'a' + size.to_s\n # number\n elsif encoding == Protocol::ENCODINGS[:number]\n io.read_unpacked size, size == 4 ? 'l<' : 'q<'\n else\n raise 'Unknown data encoding.'\n end\n end", "def read_binary(file); end", "def str2bin(message)\n binary = message.unpack(\"B*\")[0]\n return binary\nend", "def binary_to_text(b)\n [b].pack(\"B*\")\nend", "def binread(fname)\n File.open(fname, 'rb'){ |f|\n return f.read\n }\n end", "def row_from_binary(binary_string)\n binary_string.slice(0,7).to_i(2)\nend", "def read(str)\n\t\t\tforce_binary(str)\n\t\t\treturn self if str.nil?\n\t\t\tself[:snap_oui].read(\"\\x00\" + str[3,3])\n\t\t\tself[:snap_type].read(str[6,2])\n\t\t\tself[:body].read(str[8,str.size])\n\t\t\tself\n\t\tend", "def getbyte\n read(1).ord\n end", "def string_to_binary(value)\n # Escape data prior to insert into a bytea column\n if value\n res = ''\n value.each_byte { |b| res << sprintf('\\\\\\\\%03o', b) }\n res\n end\n end", "def string_to_bin(string)\n\tsize = pay_size_enc(string.length)\n\tdata = string.unpack(\"B*\")[0].split(\"\")\n\n\tans = size.concat(data)\nend", "def string\n Util.from_bytes :string, value\n end", "def read_string\n raise NotImplementedError\n end", "def test_decode_bit_binary()\n input = [131, 77, 0, 0, 0, 4, 4, 195, 139, 30, 64]\n expected = Erlang::BitBinary.new(4, \"\\303\\213\\036@\")\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def read(i)\n self.v = i.kind_of?(Integer) ? i.to_i : i.to_s.unpack(@packstr).first\n self\n end", "def read(str)\n\t\t\tforce_binary(str)\n\t\t\treturn self if str.nil?\n\t\t\tself[:a1].read str[0,4]\n\t\t\tself[:a2].read str[4,4]\n\t\t\tself[:a3].read str[8,4]\n\t\t\tself[:a4].read str[12,4]\n\t\t\tself\n\t\tend", "def convert_to_binary\n @input.class == String ? @input : @input.to_s(2)\n end", "def bin2str(binary)\n str = [binary].pack(\"B*\")\n return str\nend", "def readbyte\n end", "def read__UI8\r\n readbyte\r\n end", "def read_binary_file(path)\n File.open(path, 'rb') {|f| f.read }\n end", "def read_u1\n read(1).first & 0xff\n end", "def get_value\r\n @bitstring\r\n end", "def read_binary_data(fname,fd,length)\n buff = \"\";\n buff = fd.read(length) if length > 0\n return CFData.new(buff,CFData::DATA_RAW)\n end", "def read_string\n val = ''\n while (res = read)\n break if res == 10\n\n val << res\n end\n val\n end", "def read_binary(path)\n if exist? path\n File.binread(expand path)\n else\n nil\n end\n end", "def BinaryConverter(str)\r\n return str.to_i(2)\r\nend", "def read(str)\n parse(str, ber: true)\n self\n end", "def read_byte\n read('C', 1)\n end", "def getbyte\n read(1)\n end", "def unpack(binary)\n end", "def data\n read_attribute(binary ? :binary_data : :data)\n end", "def test_decode_binary()\n input = [\n 131, 109, 0, 0, 0, 24, 110, 111, 119, 32, 103, 101, 116, 32, 121,\n 111, 117, 114, 32, 97, 115, 115, 32, 116, 111, 32, 109, 97, 114,\n 115]\n expected = Erlang::Binary.new('now get your ass to mars')\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def read_byte(data, offset)\n out = data[offset,1].unpack('C').first rescue 0\n return out\n end", "def read_string(data: nil, stream: nil, offset: 0)\n if data && !stream\n\n string_length, read_length = read_varint(data: data, offset: offset)\n\n # If failed to read the length prefix, return nil.\n return [nil, read_length] if !string_length\n\n # Check if we have enough bytes to read the string itself\n return [nil, read_length] if data.bytesize < read_length + string_length\n\n string = BTC::Data.ensure_binary_encoding(data)[read_length, string_length]\n\n return [string, read_length + string_length]\n\n elsif stream && !data\n\n string_length, read_length = read_varint(stream: stream, offset: offset)\n return [nil, read_length] if !string_length\n\n buf = stream.read(string_length)\n\n return [nil, read_length] if !buf\n return [nil, read_length + buf.bytesize] if buf.bytesize < string_length\n\n return [buf, read_length + buf.bytesize]\n else\n raise ArgumentError, \"Either data or stream must be specified.\"\n end\n end", "def read(str)\n force_binary(str)\n return self if str.nil?\n self[:icmp_type].read(str[0,1])\n self[:icmp_code].read(str[1,1])\n self[:icmp_sum].read(str[2,2])\n self[:body].read(str[4,str.size])\n self\n end", "def read(str)\n read_type = str[0].unpack('C').first\n if read_type.zero?\n Pad.new.read(str)\n elsif read_type == 255\n End.new.read(str)\n elsif DHCP_OPTIONS.key?(read_type)\n Option.new(DHCP_OPTIONS[read_type][1] || {}).private_read(str)\n else\n super\n end\n end", "def get_byte\n get(1).ord\n end", "def read(id)\n path(id).binread\n end", "def xlunicodestring(data)\n io = data.to_sio\n cch, flags = io.read(3).unpack('vC')\n _read_unicodestring(io, cch, flags)\n end", "def getbyte\n end", "def getbyte\n end", "def decoded\n if @stream\n if @str.respond_to?(:rewind)\n @str.rewind\n end\n @str.read\n else\n @str\n end\n end", "def read(str)\n force_binary(str)\n return self if str.nil?\n self[:ndp_type].read(str[0,1])\n self[:ndp_code].read(str[1,1])\n self[:ndp_sum].read(str[2,2])\n self[:ndp_reserved].read(str[4,4])\n self[:ndp_tgt].read(str[8,16])\n self[:ndp_opt_type].read(str[24,1])\n self[:ndp_opt_len].read(str[25,1])\n self[:ndp_lla].read(str[26,str.size])\n self\n end", "def read_binary_int(fname,fd,length)\n raise CFFormatError.new(\"Integer greater than 8 bytes: #{length}\") if length > 3\n\n nbytes = 1 << length\n\n val = nil\n buff = fd.read(nbytes)\n\n case length\n when 0 then\n val = buff.unpack(\"C\")\n val = val[0]\n when 1 then\n val = buff.unpack(\"n\")\n val = val[0]\n when 2 then\n val = buff.unpack(\"N\")\n val = val[0]\n when 3\n hiword,loword = buff.unpack(\"NN\")\n val = hiword << 32 | loword\n end\n\n return CFInteger.new(val);\n end", "def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end", "def convert_binary\n end", "def serialize_to_string\n sio = ProtocolBuffers.bin_sio\n serialize(sio)\n return sio.string\n end", "def read_word(data, offset)\n out = data[offset,4].unpack('V').first rescue 0\n return out\n end", "def bytes(str)\n Simms::Bytes.new(str)\n end", "def byte\n Util.from_bytes :byte, value\n end", "def read_byte\n @buffer.shift(BYTE_LENGTH).join.to_i(2) if @buffer.length >= BYTE_LENGTH\n end", "def read str\n\t\tforce_binary str\n\t\treturn self if str.nil?\n\t\tself[:arp_hw].read str[0,2]\n\t\tself[:arp_proto].read str[2,2]\n\t\tself[:arp_hw_len].read str [4,1]\n\t\tself[:arp_proto_len].read str[5,1]\n\t\tself[:arp_opcode].read str[6,2]\n\t\tself[:arp_src_mac].read str[8,6]\n\t\tself[:arp_src_ip].read str[14,4]\n\t\tself[:arp_dest_mac].read str[18,6]\n\t\tself[:arp_dest_ip].read str[24,4]\n\t\tself[:body].read str[28, str.size]\n\t\tself\n\tend", "def to_string_or_binary(value)\n encoding = value.encoding\n if encoding == Encoding::ASCII_8BIT\n Puppet::Pops::Types::PBinaryType::Binary.from_binary_string(value).to_s\n else\n # Transform to UTF-8 (do not assume UTF-8 is correct) with source invalid byte\n # sequences and UTF-8 undefined characters replaced by the default unicode uFFFD character\n # (black diamond with question mark).\n value.encode(Encoding::UTF_8, encoding, :invalid => :replace, :undef => :replace)\n end\n end", "def decode(string)\n [string.tr(\" \\n\", '01')].pack('B*')\n end", "def prim_read length\n buf = \"\".encode Encoding::BINARY\n if length.nil?\n buf << b until (b = _read_byte).nil?\n else\n until length.zero? || (b = _read_byte).nil?\n buf << b\n length -= 1\n end\n end\n return buf\n end", "def value_type\n 'BINARY'\n end", "def test_binary\n base64_binary_xml = <<EOF\n <llsd>\n <binary>dGhlIHF1aWNrIGJyb3duIGZveA==</binary>\n </llsd>\nEOF\n\n # <binary/> should return blank binary blob... in ruby I guess this is just nil\n\n assert_equal 'dGhlIHF1aWNrIGJyb3duIGZveA==', LLSD.parse(base64_binary_xml)\n end", "def string_to_binary(val)\n saved_object_count = -1\n\n unless(@unique_table.has_key?(val)) then\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @unique_table[val] = saved_object_count\n utf16 = false\n\n val.each_byte do |b|\n if(b > 127) then\n utf16 = true\n break\n end\n end\n\n if(utf16) then\n bdata = Binary.type_bytes(\"6\",Binary.charset_strlen(val,\"UTF-8\")) # 6 is 0110, unicode string (utf16be)\n val = Binary.charset_convert(val,\"UTF-8\",\"UTF-16BE\")\n\n val.force_encoding(\"ASCII-8BIT\") if val.respond_to?(\"encode\")\n @object_table[saved_object_count] = bdata + val\n else\n bdata = Binary.type_bytes(\"5\",val.bytesize) # 5 is 0101 which is an ASCII string (seems to be ASCII encoded)\n @object_table[saved_object_count] = bdata + val\n end\n else\n saved_object_count = @unique_table[val]\n end\n\n return saved_object_count\n end", "def unpack\nraw_bytes.unpack \"NnnCCa6\"\nend", "def read_bignum; end", "def read_byte(signed = false, mut = :STD)\n val = 0\n val |= mutate(@payload.next_byte, mut)\n signed ? val : val & 0xff\n end", "def to_byte_val(s)\n val = 0\n s.each_char do |x|\n val *= 2\n val += x.to_i\n end\n return val\nend", "def read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend", "def test_a_binary\n binary = @wddx.data[\"aBinary\"]\n assert binary.kind_of?(WDDX::Binary)\n assert_equal \"MIIBJASHETAS\", binary.encode \n end", "def decode(string)\n Marshal.load(string.unpack('m').first)\n end", "def read(str)\n if self.class == Browser\n return self if str.nil?\n\n PacketGen.force_binary str\n self[:opcode].read str[0]\n\n opcode_klass = Browser.const_get(self[:opcode].to_human) if Browser.const_defined?(self[:opcode].to_human)\n if opcode_klass\n opcode_klass.new.read str\n else\n private_read str\n end\n else\n private_read str\n end\n end", "def read_binary length\n if @split\n if @split.first.size >= length\n result = @split.shift[0...length]\n unshift_split if @split.size == 1\n return result\n end\n unshift_split\n end\n unless @pending\n size = reduce(0){|x,y|x+y.size}\n return nil unless size >= length\n @pending = dup\n clear\n remainder = size - length\n if remainder > 0\n last_string = @pending[-1]\n @pending[-1] = last_string[0...-remainder]\n push last_string[-remainder..-1]\n end\n end\n # eat newline\n return nil unless read_line\n result = @pending.join\n @pending = nil\n result\n end", "def read(len=nil)\n read_len = len ? compute_decode_read_len(len) : nil\n generic_read(len, read_len) { |data| Krypt::Hex.decode(data) }\n end", "def data\n self.data_pointer.read_string(self.data_size)\n end", "def get_bin(id)\n File.read(File.join(File.expand_path(File.dirname(__FILE__)),'data',id.to_s),mode: 'rb')\n end", "def read(str)\n\t\t\tforce_binary(str)\n\t\t\treturn self if str.nil?\n\t\t\tself[:icmp_type].read(str[0,1])\n\t\t\tself[:icmp_code].read(str[1,1])\n\t\t\tself[:icmp_sum].read(str[2,2])\n\t\t\tself[:body].read(str[4,str.size])\n\t\t\tself\n\t\tend", "def get_byte\n byte = @connection.getbyte.to_s 2\n byte = \"0\" * (8 - byte.length) + byte\n end", "def read(offset, how_much)\n @str[offset, how_much]\n end", "def utf8read(x)\n File.open(x,\"rb\"){|f|\n if f.getbyte!=0xef || f.getbyte!=0xbb || f.getbyte!=0xbf\n f.pos=0 # skip UTF-8 byte order mark\n end\n data=f.read\n ec1=Encoding::Converter.new(\"utf-8\",\"utf-16\",{\n :undef=>:replace,\n :invalid=>:replace\n })\n ec2=Encoding::Converter.new(\"utf-16\",\"utf-8\",{\n :undef=>:replace,\n :invalid=>:replace,\n :replace=>\"\\uFFFD\"\n })\n data=ec1.convert(data)\n data=ec2.convert(data)\n return data\n }\nend", "def read\n Typelib.to_ruby(raw_read)\n end" ]
[ "0.72143054", "0.70673025", "0.6999473", "0.6976893", "0.69134617", "0.69010377", "0.684761", "0.6814804", "0.679744", "0.6681768", "0.65348625", "0.65180916", "0.65180916", "0.65172774", "0.6513126", "0.65090585", "0.6474409", "0.6444584", "0.64056027", "0.6397608", "0.6388214", "0.6367851", "0.63677615", "0.63626885", "0.6350927", "0.6341588", "0.6338285", "0.6335422", "0.63340664", "0.6300305", "0.62917614", "0.629016", "0.62455535", "0.6234162", "0.6228784", "0.62237424", "0.62192124", "0.62173706", "0.6196613", "0.61876446", "0.6185905", "0.61847615", "0.61772734", "0.61711264", "0.61581916", "0.6116348", "0.6115417", "0.60964507", "0.6084539", "0.6066573", "0.6066054", "0.6064002", "0.6053741", "0.6028781", "0.60201913", "0.6016037", "0.6010609", "0.59757143", "0.5968297", "0.5945892", "0.5930761", "0.59293205", "0.5927736", "0.5926859", "0.5923425", "0.5923425", "0.5918725", "0.5918527", "0.59124583", "0.59100014", "0.59066635", "0.5898434", "0.5894886", "0.58915895", "0.58724105", "0.5865213", "0.5864189", "0.58633435", "0.5857544", "0.5855488", "0.5847794", "0.58408594", "0.5825817", "0.58184385", "0.581673", "0.5810685", "0.5806551", "0.57977843", "0.57927847", "0.5790203", "0.5776539", "0.577496", "0.5762161", "0.5758751", "0.57585365", "0.5758404", "0.57551426", "0.57445735", "0.57395077", "0.5728754" ]
0.7048001
2
Read a unicode string value, coded as UTF16BE
def read_binary_unicode_string(fname,fd,length) # The problem is: we get the length of the string IN CHARACTERS; # since a char in UTF-16 can be 16 or 32 bit long, we don't really know # how long the string is in bytes buff = fd.read(2*length) @unique_table[buff] = true unless @unique_table.has_key?(buff) return CFString.new(Binary.charset_convert(buff,"UTF-16BE","UTF-8")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_string(data, offset, length, encoding)\n if \"UTF-16\".casecmp(encoding) == 0\n out = data[offset, length].unpack('v*').pack('U*')\n else\n out = data[offset, length].unpack('C*').pack('U*')\n end\n return out\n end", "def get_utf16_of(character)\n character.encode('UTF-16BE').unpack('H*').first.upcase\nend", "def from_utf16\r\n ret = Iconv.iconv(\"utf-8\", \"utf-16le\", self).first\r\n if ret[-1] == 0\r\n ret = ret[0..-2]\r\n end\r\n end", "def from_utf16_buffer\r\n self[0..index(\"\\0\\0\\0\")+2].from_utf16\r\n end", "def xlunicodestring(data)\n io = data.to_sio\n cch, flags = io.read(3).unpack('vC')\n _read_unicodestring(io, cch, flags)\n end", "def to_utf16(str)\n if str.respond_to?(:encode)\n str.encode('UTF-16BE')\n else\n Iconv.conv('UTF-16BE', 'UTF-8', str)\n end\n end", "def utf8read(x)\n File.open(x,\"rb\"){|f|\n if f.getbyte!=0xef || f.getbyte!=0xbb || f.getbyte!=0xbf\n f.pos=0 # skip UTF-8 byte order mark\n end\n data=f.read\n ec1=Encoding::Converter.new(\"utf-8\",\"utf-16\",{\n :undef=>:replace,\n :invalid=>:replace\n })\n ec2=Encoding::Converter.new(\"utf-16\",\"utf-8\",{\n :undef=>:replace,\n :invalid=>:replace,\n :replace=>\"\\uFFFD\"\n })\n data=ec1.convert(data)\n data=ec2.convert(data)\n return data\n }\nend", "def shortxlunicodestring(io)\n cch, flags = io.read(2).unpack('CC')\n _read_unicodestring(io, cch, flags)\n end", "def uC\n self.force_encoding('UTF-16LE').encode('UTF-8').strip\n end", "def write_utf16be_string(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n\n return -1 if (args.size < 3) # Check the number of args\n\n record = 0x00FD # Record identifier\n length = 0x000A # Bytes to follow\n\n row = args[0] # Zero indexed row\n col = args[1] # Zero indexed column\n strlen = args[2].length\n str = args[2]\n xf = xf_record_index(row, col, args[3]) # The cell format\n encoding = 0x1\n str_error = 0\n\n # Check that row and col are valid and store max and min values\n return -2 if check_dimensions(row, col) != 0\n\n # Limit the utf16 string to the max number of chars (not bytes).\n if strlen > 32767* 2\n str = str[0..32767*2]\n str_error = -3\n end\n\n num_bytes = str.length\n num_chars = (num_bytes / 2).to_i\n\n # Check for a valid 2-byte char string.\n raise \"Uneven number of bytes in Unicode string\" if num_bytes % 2 != 0\n\n # Change from UTF16 big-endian to little endian\n str = str.unpack('n*').pack('v*')\n\n # Add the encoding and length header to the string.\n str_header = [num_chars, encoding].pack(\"vC\")\n str = str_header + str\n\n unless @str_table[str]\n @str_table[str] = str_unique\n add_str_unique(1)\n end\n\n add_str_total(1)\n \n header = [record, length].pack(\"vv\")\n data = [row, col, xf, @str_table[str]].pack(\"vvvV\")\n\n # Store the data or write immediately depending on the compatibility mode.\n if @compatibility != 0\n tmp = []\n tmp[col] = header + data\n @table[row] = tmp\n else\n append(header, data)\n end\n\n return str_error\n end", "def to_utf16\r\n Iconv.iconv(\"utf-16LE\", \"utf-8\", self).first + \"\\x00\\x00\"\r\n end", "def toutf16(str)\n ::NKF::nkf('-w16m', str)\n end", "def str_to_uni_z(str)\n enc = str.encode('UTF-16LE').force_encoding('binary')\n enc += \"\\x00\\x00\"\n return enc\n end", "def get\n self.data.force_encoding(Encoding::UTF_16BE).encode(Encoding::UTF_8)\n end", "def str_value\n return @str_value unless @str_value.nil?\n if is_string != 0\n io = _parent.strings._io\n _pos = io.pos\n io.seek(value_or_ofs_value)\n @str_value = (io.read_bytes_term(0, false, true, true)).force_encoding(\"UTF-8\")\n io.seek(_pos)\n end\n @str_value\n end", "def read_utf!(bytes, md)\n utf_length = read_unsigned_short!(bytes, md)\n bytes = bytes.slice!(0..(utf_length - 1))\n md << bytes\n bytes\n end", "def read(str)\n str = str.sysread(size) if not str.kind_of?(::String)\n @value = str.unpack(format).first\n size\n end", "def uniz_to_str(uniz)\n uniz.force_encoding('UTF-16LE').encode('UTF-8')\n end", "def from_utf8(str)\n Iconv.new(Intermediate,\"UTF-8\").iconv(str).unpack(PackFormat)\n end", "def translate_data(data)\n if data[0..3] == \"\\x4c\\x6f\\xa7\\x94\"\n # EBCDIC\n data = _ebcdic_to_ascii(data)\n elsif data[0..3] == \"\\x00\\x3c\\x00\\x3f\"\n # UTF-16BE\n data = uconvert(data, 'utf-16be', 'utf-8')\n elsif data.size >= 4 and data[0..1] == \"\\xfe\\xff\" and data[2..3] != \"\\x00\\x00\"\n # UTF-16BE with BOM\n data = uconvert(data[2..-1], 'utf-16be', 'utf-8')\n elsif data[0..3] == \"\\x3c\\x00\\x3f\\x00\"\n # UTF-16LE\n data = uconvert(data, 'utf-16le', 'utf-8')\n elsif data.size >=4 and data[0..1] == \"\\xff\\xfe\" and data[2..3] != \"\\x00\\x00\"\n # UTF-16LE with BOM\n data = uconvert(data[2..-1], 'utf-16le', 'utf-8')\n elsif data[0..3] == \"\\x00\\x00\\x00\\x3c\"\n # UTF-32BE\n data = uconvert(data, 'utf-32be', 'utf-8')\n elsif data[0..3] == \"\\x3c\\x00\\x00\\x00\"\n # UTF-32LE\n data = uconvert(data, 'utf-32le', 'utf-8')\n elsif data[0..3] == \"\\x00\\x00\\xfe\\xff\"\n # UTF-32BE with BOM\n data = uconvert(data[4..-1], 'utf-32BE', 'utf-8')\n elsif data[0..3] == \"\\xff\\xfe\\x00\\x00\"\n # UTF-32LE with BOM\n data = uconvert(data[4..-1], 'utf-32LE', 'utf-8')\n elsif data[0..2] == \"\\xef\\xbb\\xbf\"\n # UTF-8 with BOM\n data = data[3..-1]\n else\n # ASCII-compatible\n end\n return data\nend", "def toutf16; Kconv.toutf16(self) end", "def re_encode_to_utf8(s)\n (s.valid_encoding? ?\n s :\n s.encode('UTF-16be', invalid: :replace, replace: '?')\n ).encode('UTF-8')\nend", "def read_string(length)\n BinData::Stringz.read(read_and_advance(length))\n end", "def get_utf8_of(character)\n character.unpack('H*').first.upcase\nend", "def to_utf8(raw_text)\n if raw_text.platform_id == 1 && raw_text.encoding_id == 0\n return raw_text\n else\n begin\n raw_text.encode(\"UTF-8\", \"UTF-16BE\")\n rescue\n raw_text\n end\n end\n end", "def uC\n NWRFCLib::Cutf16le_to_utf8.iconv(self).strip\n end", "def read__UI8\r\n readbyte\r\n end", "def decode_val( encoding, size, io )\n # plain string\n if encoding == Protocol::ENCODINGS[:plain]\n io.read_unpacked size, 'a' + size.to_s\n # number\n elsif encoding == Protocol::ENCODINGS[:number]\n io.read_unpacked size, size == 4 ? 'l<' : 'q<'\n else\n raise 'Unknown data encoding.'\n end\n end", "def unicode_text(pdf, str, options={})\n pdf.text(e(\"\\xfe\\xff#{str}\", :encoding => 'UTF-16BE'), options) # start Unicode UTF-16BE encoding\n end", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def set(string)\n self.data = string.encode(Encoding::UTF_16BE)\n end", "def write_utf16le_string(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n\n return -1 if (args.size < 3) # Check the number of args\n\n record = 0x00FD # Record identifier\n length = 0x000A # Bytes to follow\n\n row = args[0] # Zero indexed row\n col = args[1] # Zero indexed column\n str = args[2]\n format = args[3] # The cell format\n\n # Change from UTF16 big-endian to little endian\n str = str.unpack('n*').pack(\"v*\")\n\n return write_utf16be_string(row, col, str, format)\n end", "def convert_unicode(str)\n while true\n u_idx = str.index(/\\\\u[0-9a-fA-F]{4}/)\n break if u_idx == nil\n\n u_str = str.slice(u_idx, 6)\n str.sub!(u_str, u_str[2..5].hex.chr)\n end\n str\n end", "def transcode(str)\n return str.force_encoding(Encoding::UTF_8)\nend", "def wide_string(str)\n # if given a nil string, assume caller wants to pass a nil pointer to win32\n return nil if str.nil?\n\n str.encode('UTF-16LE')\n end", "def read(str)\n return unless str\n force_binary(str)\n self[:timestamp].read str[0,8]\n self[:incl_len].read str[8,4]\n self[:orig_len].read str[12,4]\n self[:data].read str[16,self[:incl_len].to_i]\n self\n end", "def to_utf8; convert_format(ASCII8BIT, UTF8); end", "def toUtf8(str)\n str = str.force_encoding('UTF-8')\n return str if str.valid_encoding?\n str.encode(\"UTF-8\", 'binary', invalid: :replace, undef: :replace, replace: '')\nend", "def utf8str(code)\n if (code & ~(0x7f)) == 0\n # UCS-4 range 0x00000000 - 0x0000007F\n return(code.chr)\n end\n\n buf = \"\"\n if (code & ~(0x7ff)) == 0\n # UCS-4 range 0x00000080 - 0x000007FF\n buf << (0b11000000 | (code >> 6)).chr\n buf << (0b10000000 | (code & 0b00111111)).chr\n return(buf)\n end\n\n if (code & ~(0x000ffff)) == 0\n # UCS-4 range 0x00000800 - 0x0000FFFF\n buf << (0b11100000 | (code >> 12)).chr\n buf << (0b10000000 | ((code >> 6) & 0b00111111)).chr\n buf << (0b10000000 | (code & 0b0011111)).chr\n return(buf)\n end\n\n # Not used -- JSON only has UCS-2, but for the sake\n # of completeness\n if (code & ~(0x1FFFFF)) == 0\n # UCS-4 range 0x00010000 - 0x001FFFFF\n buf << (0b11110000 | (code >> 18)).chr\n buf << (0b10000000 | ((code >> 12) & 0b00111111)).chr\n buf << (0b10000000 | ((code >> 6) & 0b00111111)).chr\n buf << (0b10000000 | (code & 0b0011111)).chr\n return(buf)\n end\n\n if (code & ~(0x03FFFFFF)) == 0\n # UCS-4 range 0x00200000 - 0x03FFFFFF\n buf << (0b11110000 | (code >> 24)).chr\n buf << (0b10000000 | ((code >> 18) & 0b00111111)).chr\n buf << (0b10000000 | ((code >> 12) & 0b00111111)).chr\n buf << (0b10000000 | ((code >> 6) & 0b00111111)).chr\n buf << (0b10000000 | (code & 0b0011111)).chr\n return(buf)\n end\n\n # UCS-4 range 0x04000000 - 0x7FFFFFFF\n buf << (0b11111000 | (code >> 30)).chr\n buf << (0b10000000 | ((code >> 24) & 0b00111111)).chr\n buf << (0b10000000 | ((code >> 18) & 0b00111111)).chr\n buf << (0b10000000 | ((code >> 12) & 0b00111111)).chr\n buf << (0b10000000 | ((code >> 6) & 0b00111111)).chr\n buf << (0b10000000 | (code & 0b0011111)).chr\n return(buf)\n end", "def read_sint16(position = nil)\n seek(position)\n data = read_and_advance(2)\n BinData::Int16be.read(data).to_i\n end", "def decode_string_member(member)\n return nil if @cred_struct[member].null?\n\n @cred_struct[member]\n .read_string_dn\n .force_encoding('utf-16le')\n .strip\n end", "def lpwidestring(data)\n io = data.to_sio\n cch = io.read(2).unpack('v').first\n _read_unicodestring(io, cch, 1) # has double-byte characters\n end", "def string\n Util.from_bytes :string, value\n end", "def transcode(str)\n str.force_encoding('UTF-8')\nend", "def read_string; end", "def read_int16\n read('n', 2)\n end", "def clean(str)\n st = str.encode('UTF-16', 'UTF-8', :invalid => :replace, :replace => '')\n return st.encode('UTF-8', 'UTF-16')\nend", "def unicode(str)\n Rex::Text.to_unicode(str)\n end", "def xlunicodestringnocch(io, cch)\n flags = io.read(1).unpack('C').first\n _read_unicodestring(io, cch, flags)\n end", "def _utf8(str)\n return str.force_encoding(Encoding::UTF_8)\nend", "def get_utf8cstring(string,buffer,bufferSize)\n JavaScriptCore::Lib.JSStringGetUTF8CString(string,buffer,bufferSize)\n end", "def read_u1\n read(1).first & 0xff\n end", "def unicode(str)\n\t\tRex::Text.to_unicode(str)\n\tend", "def read_string\n string = unpack_byteslice('Z*', @content.bytesize)\n @cursor += string.size + 1\n string\n end", "def unicode(str)\n Rex::Text.to_unicode(str)\n end", "def read_uint16(position = nil)\n seek(position)\n data = read_and_advance(2)\n BinData::Uint16be.read(data).to_i\n end", "def data\n bytes = lp_data.bytes.to_a.pack('C*')\n case lp_type\n when 1,2\n bytes.force_encoding('utf-16le').strip\n when 3\n bytes\n when 4\n bytes.unpack('V').first\n when 5\n bytes.unpack('N').first\n when 7\n str = bytes.force_encoding('utf-16le')\n str.split(\"\\0\".encode('utf-16le'))\n when 11\n bytes.unpack('Q<').first\n else\n \"\"\n end\n end", "def force_utf32; end", "def force_utf32; end", "def force_utf32; end", "def decode(base16_string)\n base16_string.to_i(BASE)\n end", "def get_unicode_of(character)\n character.unpack('U*').first.to_s(16).rjust(4, '0').upcase\nend", "def to_utf8(str)\n str = str.force_encoding(ENCODING)\n return str if str.valid_encoding?\n str.encode(ENCODING, 'binary', invalid: :replace, undef: :replace,\n replace: '')\n end", "def fix_encoding!(str)\n\t#str.force_encoding(\"UTF-8\")\n\t#pp str.encoding, str.valid_encoding?\n\tstr.encode!(\"UTF-16BE\", :invalid=>:replace, :replace=>\"?\")\n\tstr.encode!(\"UTF-8\")\nend", "def read16\n\tval = (getc() << 8) + getc()\n\tval = -(val & 0x7fff) if (val & 0x8000).nonzero?\n\treturn val\n end", "def read_word(data, offset)\n out = data[offset,4].unpack('V').first rescue 0\n return out\n end", "def to_utf8(v)\n return v unless v.is_a?(String)\n return v if (enc = v.encoding) == (utf = Encoding::UTF_8)\n Encoding::Converter.new(enc, utf).convert(v) rescue v.dup.force_encoding(utf)\nend", "def u16\n next_bytes(2).unpack(\"S>\").first\n end", "def read_string\n raise NotImplementedError\n end", "def read(str)\n parse(str, ber: true)\n self\n end", "def i8u\n @io.getbyte\n end", "def sterilize(str)\n str.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n str.gsub!(0x00.chr,'[NUL]')\n str.gsub!(0x01.chr,'[SOH]')\n str.gsub!(0x02.chr,'[STX]')\n str.gsub!(0x03.chr,'[ETX]')\n str.gsub!(0x04.chr,'[EOT]')\n str.gsub!(0x05.chr,'[ENQ]')\n str.gsub!(0x06.chr,'[ACK]')\n str.gsub!(0x07.chr,'[BEL]')\n # 0x08 is backspace\n # 0x09 is TAB\n # 0x10 is line feed\n str.gsub!(0x0B.chr,'[VT]')\n # 0x0c is form feed\n # 0x0d is carriage return\n str.gsub!(0x0E.chr,'[SO]')\n str.gsub!(0x0F.chr,'[SI]')\n str.gsub!(0x10.chr,'[DLE]')\n str.gsub!(0x11.chr,'[DC1]')\n str.gsub!(0x12.chr,'[DC2]')\n str.gsub!(0x13.chr,'[DC3]')\n str.gsub!(0x14.chr,'[DC4]')\n str.gsub!(0x15.chr,'[NAK]')\n str.gsub!(0x16.chr,'[SYN]')\n str.gsub!(0x17.chr,'[ETB]')\n str.gsub!(0x18.chr,'[CAN]')\n str.gsub!(0x19.chr,'[EM]')\n str.gsub!(0x1a.chr,'[SUB]')\n str.gsub!(0x1C.chr,'[FS]')\n str.gsub!(0x1D.chr,'[GS]')\n str.gsub!(0x1E.chr,'[RS]')\n str.gsub!(0x1F.chr,'[US]')\n str\n end", "def decode_string(raw, offset=0)\n if raw.bytesize < offset + 4\n raise DecodeError, \"data too short\"\n end\n\n size_s = raw.byteslice(offset, 4)\n\n size = size_s.unpack(\"L>\").first\n\n if raw.bytesize < offset + 4 + size\n raise DecodeError, \"data too short\"\n end\n\n string = raw.byteslice(offset + 4, size)\n\n [string, 4 + size]\n end", "def to_utf (str)\n encoded_str = ''\n str.split('').each {|char| \n encoded_char = char.encode('UTF-8')\n encoded_char.bytes.each {|byte|\n encoded_str << \"%#{byte.to_s(16)}\"\n }\n }\n return encoded_str\nend", "def to_utf8(str)\n str = str.force_encoding('UTF-8')\n return str if str.valid_encoding?\n str.encode(\"UTF-8\", 'binary', invalid: :replace, undef: :replace, replace: '')\n end", "def from_file!(input_file)\r\n File.open(input_file, \"rb:UTF-16LE\") do |file|\r\n @number_of_strings = file.read(4).unpack('I').first\r\n @offset_to_strings = file.read(4).unpack('I').first\r\n\r\n @number_of_strings.times do\r\n file.seek(4, File::SEEK_CUR)\r\n offset = file.read(4).unpack('I').first\r\n old_offset = file.pos\r\n\r\n file.pos = @offset_to_strings + offset\r\n strings << file.gets(UTF_16_NULL).chop.encode(\"UTF-8\") + LOCSTR_END_OF_LINE \r\n\r\n file.pos = old_offset\r\n end\r\n end\r\n end", "def i16u\n little? ? BinUtils.get_int16_le(read(2)) : BinUtils.get_int16_be(read(2))\n end", "def read_binary_string(fname,fd,length)\n buff = \"\"\n buff = fd.read(length) if length > 0\n\n @unique_table[buff] = true unless @unique_table.has_key?(buff)\n return CFString.new(buff)\n end", "def read_hex(length=2)\n num = ''\n while peek_char.match(/[\\dA-Fa-f]/)\n num += next_char\n if num.length >= length\n break\n end\n end\n unless (1..length).include?(num.length)\n raise UnpickleException, \"Bad hex sequence in string\"\n end\n return num.to_i(16)\n end", "def read_byte\n buf = read_all(1)\n return Bytes.get_string_byte(buf, 0)\n end", "def unpack\nraw_bytes.unpack \"NnnCCa6\"\nend", "def to_utf8(str)\n if RUBY_VERSION == \"1.8.7\"\n str\n else\n str.force_encoding(Encoding::UTF_8.name)\n end\n end", "def force_utf32=(_arg0); end", "def force_utf32=(_arg0); end", "def force_utf32=(_arg0); end", "def read_string(token)\n opening_char = @marker.character\n token.kind = case opening_char\n when ?' then :single_string_lit\n when ?\" then :double_string_lit\n end\n\n escape = false\n chars = []\n\n while current = read_next()\n if escape\n current = case current\n when ?x, ?X\n # unicode hex escape\n peeked = peek_next()\n if !self.class::isxdigit(peeked)\n raise_error(:malformed_unicode_escape,\n \"Malformed unicode literal in string - no hex code provided.\")\n end\n\n hexnums = current == ?x ? 4 : 8\n\n current = 0\n begin\n current = current << 4 | (case peeked\n when ?A, ?a then 0xA\n when ?B, ?b then 0xB\n when ?C, ?c then 0xC\n when ?D, ?d then 0xD\n when ?E, ?e then 0xE\n when ?F, ?f then 0xF\n when ?0 then 0x0\n when ?1 then 0x1\n when ?2 then 0x2\n when ?3 then 0x3\n when ?4 then 0x4\n when ?5 then 0x5\n when ?6 then 0x6\n when ?7 then 0x7\n when ?8 then 0x8\n when ?9 then 0x9\n end)\n read_next()\n peeked = peek_next()\n hexnums -= 1\n end while self.class::isxdigit(peeked) && hexnums > 0\n current.chr(Encoding::UTF_8)\n\n when ?r then ?\\r\n when ?n then ?\\n\n when ?t then ?\\t\n when ?0 then ?\\0\n when ?b then ?\\b\n when ?a then ?\\a\n when ?f then ?\\f\n when ?v then ?\\v\n else current\n end\n escape = false\n else\n if current == opening_char\n break\n elsif current == ?\\\\\n escape = true\n next\n end\n end\n\n chars << current\n end\n\n raise_error(:unterminated_string, \"Unterminated string\") if !current\n\n token.value = chars.join('')\n end", "def read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend", "def non_utf8_character\n [0x92].pack('C*')\n end", "def ctcp_decode(str)\n ctcp_dequote(str.delete(\"\\x01\"))\n end", "def isutf8;\tKconv.isutf8(self) end", "def read_string\n strout = ''\n if next_char != '\\''\n raise UnpickleException, \"Couldn't find leading quote for string\"\n end\n while not at_end?\n c = next_char\n case c\n when \"\\\\\"\n opt = next_char\n case opt\n when 'x'\n strout += read_hex(2).chr\n when '0'\n num = ''\n while peek_char.match(/[0-7]/)\n num += next_char\n if num.length >= 3\n break\n end\n end\n unless (1..3).include?(num.length)\n raise UnpickleException, \"Bad \\\\0 sequence in string\"\n end\n strout += num.to_i(8).chr\n when 'n'\n strout += \"\\n\"\n when \"\\\\\"\n strout += \"\\\\\"\n when 't'\n strout += \"\\t\"\n when \"'\"\n strout += \"'\"\n else\n raise UnpickleException, \"Unexpected \\\\ escape: \\\\#{opt}\"\n end\n when \"'\"\n # valid end of string...\n break\n else\n strout += c\n end\n end\n if next_char != \"\\n\"\n raise UnpickleException, \"Expected \\\\n after string\"\n end\n return strout\n end", "def read_byte; end", "def utf8(string)\n string.force_encoding(Encoding::UTF_8)\n end", "def read(offset, how_much)\n @str[offset, how_much]\n end", "def string\n str = basic_string\n if str.respond_to? :force_encoding\n str.force_encoding InternalEncoding\n end\n\n convert(str, @encoding)\n end", "def make_utf8(str)\n return Kconv.toutf8(str.strip)\n end", "def shift_string(buffer)\n len = shift_short(buffer)\n str = shift_data(buffer,len)\n # Strings in MQTT v3.1 are all UTF-8\n str.force_encoding('UTF-8')\n end", "def read(str)\n msg_type = Types::Int8.new.read(str)\n\n case msg_type\n when 12, 13\n DHCPv6::Relay.new.read(str)\n else\n super\n end\n end", "def read_universal_char(len)\n p = get_pos(-2)\n r = 0\n len.times do\n c = readc\n case c\n when *'0'..'9' then r = (r << 4) | (c.ord - '0'.ord)\n when *'a'..'f' then r = (r << 4) | (c.ord - 'a'.ord + 10)\n when *'A'..'F' then r = (r << 4) | (c.ord - 'A'.ord + 10)\n else\n raise \"#{p}: invalid universal character: #{c}\"\n # errorp(p, \"invalid universal character: %c\", c)\n end\n end\n if !is_valid_ucn(r)\n raise \"#{p}: invalid universal character: \\\\#{(len == 4) ? 'u' : 'U'}#{format(\"%0#{len}d\", r)}\"\n # errorp(p, \"invalid universal character: \\\\%c%0*x\", (len == 4) ? 'u' : 'U', len, r);\n end\n r\n end" ]
[ "0.79713976", "0.7114958", "0.70792717", "0.6842437", "0.6825415", "0.6810971", "0.66008973", "0.6565299", "0.64788467", "0.6384433", "0.62750787", "0.6213166", "0.61774117", "0.6167788", "0.613427", "0.6095045", "0.60800445", "0.6056757", "0.60370576", "0.6020688", "0.6003825", "0.5954738", "0.58976585", "0.5877601", "0.58361095", "0.5825251", "0.5821146", "0.58137685", "0.57744104", "0.5725156", "0.5725156", "0.5705997", "0.5687756", "0.5648523", "0.56449175", "0.5644367", "0.5643799", "0.5633881", "0.5624206", "0.5617048", "0.55955523", "0.5593687", "0.5590306", "0.5584973", "0.5577417", "0.55251807", "0.5514299", "0.5510688", "0.54991174", "0.5485483", "0.54840475", "0.5444016", "0.54435575", "0.54309005", "0.54257506", "0.5413896", "0.5406593", "0.5372802", "0.5361841", "0.5361841", "0.5361841", "0.53528726", "0.53280014", "0.5303779", "0.52961874", "0.5289752", "0.52786595", "0.5268981", "0.52563965", "0.52556247", "0.5235373", "0.5223877", "0.52205294", "0.5200542", "0.51992154", "0.5194364", "0.5193481", "0.51920384", "0.51889324", "0.51842654", "0.51836526", "0.51789176", "0.5176619", "0.5173726", "0.5173726", "0.5173726", "0.51710695", "0.5168093", "0.51624227", "0.5158711", "0.51558846", "0.5155197", "0.5154861", "0.5145787", "0.5143893", "0.5135931", "0.5119207", "0.5119175", "0.5114554", "0.51052547" ]
0.71791196
1
Read an binary array value, including contained objects
def read_binary_array(fname,fd,length) ary = [] # first: read object refs if(length != 0) then buff = fd.read(length * @object_ref_size) objects = buff.unpack(@object_ref_size == 1 ? "C*" : "n*") # now: read objects 0.upto(length-1) do |i| object = read_binary_object_at(fname,fd,objects[i]) ary.push object end end return CFArray.new(ary) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n if(object_type != \"0\" && object_length == 15) then\n object_length = read_binary_object(fname,fd)\n object_length = object_length.value\n end\n\n retval = nil\n case object_type\n when '0' then # null, false, true, fillbyte\n retval = read_binary_null_type(object_length)\n when '1' then # integer\n retval = read_binary_int(fname,fd,object_length)\n when '2' then # real\n retval = read_binary_real(fname,fd,object_length)\n when '3' then # date\n retval = read_binary_date(fname,fd,object_length)\n when '4' then # data\n retval = read_binary_data(fname,fd,object_length)\n when '5' then # byte string, usually utf8 encoded\n retval = read_binary_string(fname,fd,object_length)\n when '6' then # unicode string (utf16be)\n retval = read_binary_unicode_string(fname,fd,object_length)\n when 'a' then # array\n retval = read_binary_array(fname,fd,object_length)\n when 'd' then # dictionary\n retval = read_binary_dict(fname,fd,object_length)\n end\n\n return retval\n end", "def read_binary\n raise NotImplementedError\n end", "def read\n read_object(read_byte)\n end", "def read_binary(file); end", "def deserialize(raw)\n\t\tread_value = nil\n\t\tbegin\n\t\t\traise ToolException.new \"only deserialization from byte-array is supported\" if raw.class != Array\n\t\t\tif @is_array\n\t\t\t\texpected_array_length = @size * array_depth\n\t\t\t\traise ToolException.new \"byte-array length (#{raw.length}) and expected byte-array length (#{expected_array_length}) mismatch for variable '#{@name}'\" if raw.length != expected_array_length\n\t\t\t\tread_value = @type.downcase == 'char' ? \"\" : []\n\t\t\t\tindex = 0\n\t\t\t\teach_element_size = @size\n\t\t\t\tend_index = each_element_size - 1\n\t\t\t\t\n\t\t\t\twhile index < raw.length\n\t\t\t\t\telement = parse_value raw[index..end_index]\n\t\t\t\t\tif element.class == String\n\t\t\t\t\t\tread_value += element \n\t\t\t\t\telse\n\t\t\t\t\t\tread_value.push element\n\t\t\t\t\tend\n\t\t\t\t\tindex += each_element_size\n\t\t\t\t\tend_index += each_element_size\n\t\t\t\tend\n\n\t\t\t\tread_value.flatten! if read_value.class == Array\n\t\t\telse\n\t\t\t\tread_value = parse_value raw\n\t\t\tend\n\t\trescue ToolException => ex\n\t\t\traise ToolException.new \"variable.deserialize: \" + ex.message\n\t\tend\n\t\treturn read_value\n\tend", "def read_record\n n_read = 0\n tu = @file.read INT_SIZE\n return nil if tu.nil? || tu.bytesize < INT_SIZE\n if (tu == (ZERO_BYTE_ASCII_8BIT * INT_SIZE))\n # empty record. skip this page.\n @file.seek(PAGE_SIZE - INT_SIZE, IO::SEEK_CUR)\n return nil\n end\n n_read += tu.bytesize\n t = tu.unpack(PACK_UINT).first\n\n return nil if @file.eof?\n lu = @file.read INT_SIZE\n return nil if lu.nil? || lu.bytesize < INT_SIZE\n n_read += lu.bytesize\n l = lu.unpack(PACK_UINT).first\n\n if false # l == 7016996765293437281\n puts \"*************** #{__FILE__} #{__LINE__} *************\"\n puts \"at: #{@file.tell}\"\n end\n\n if l > MAX_VALUE_SIZE\n raise ParseError.new \"Read size that exceeds the maximum size for a value.\"\n end\n\n k = nil\n begin\n k = @file.read l\n rescue NoMemoryError => e\n # puts \"*************** #{__FILE__} #{__LINE__} *************\"\n # puts \"#{e.message} at #{l}\"\n raise\n end\n\n return nil if k.nil? || k.bytesize < l\n n_read += k.bytesize\n d = if t != WRITE_TYPE_INDEXES[:array]\n [t, k]\n else\n asu = @file.read INT_SIZE\n return nil if asu.nil? || asu.bytesize < INT_SIZE\n n_read += asu.bytesize\n as = asu.unpack(PACK_UINT).first\n [t, k, as]\n end\n return nil if d.nil?\n\n v = nil\n\n raw_v = nil\n case d[0]\n when WRITE_TYPE_INDEXES[:array]\n a = []\n d[2].times do |i|\n raw_v, b_read = read_value_s\n n_read += b_read\n break if raw_v.nil?\n a.push(raw_v)\n end\n v = a\n when WRITE_TYPE_INDEXES[:hash], WRITE_TYPE_INDEXES[:set]\n raw_v, b_read = read_value_s\n return nil if raw_v.nil?\n n_read += b_read\n v = MultiJson.decode(raw_v)\n when WRITE_TYPE_INDEXES[:string]\n v, b_read = read_value_s\n return nil if v.nil?\n n_read += b_read\n when WRITE_TYPE_INDEXES[:counter]\n v, b_read = read_value_i\n return nil if v.nil?\n n_read += b_read\n end\n\n pages_read = n_read / PAGE_SIZE\n remainder = (n_read % PAGE_SIZE)\n if remainder > 0\n @file.seek((PAGE_SIZE - remainder), IO::SEEK_CUR)\n pages_read += 1\n end\n\n [d, v, pages_read]\n end", "def read\n Typelib.to_ruby(raw_read)\n end", "def data\n read_attribute(binary ? :binary_data : :data)\n end", "def read_value_s\n b_read = 0\n lu = @file.read INT_SIZE\n return nil if lu.nil? || lu.bytesize < INT_SIZE\n b_read += lu.bytesize\n\n l = lu.unpack(PACK_UINT).first\n s = @file.read l\n return nil if s.nil? || s.bytesize < l\n b_read += s.bytesize\n\n [s, b_read]\n end", "def read_object_array(cls, io_offset, length)\n @io.seek io_offset\n array = []\n length.times do\n # All object arrays only contain java object refs\n id = @io.read_id\n array << @snapshot.resolve_object_ref(id)\n end\n array\n end", "def data; Marshal.load(Base64.decode64(read_attribute(:data))); end", "def array_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"a\", val.value.size) # a is 1010, type indicator for arrays\n\n val.value.each do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self));\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def unpack(binary)\n end", "def read_bit_array(num_bits)\n size = (num_bits + 7) / 8\n data = read_and_advance(size)\n bit_array = BinData::Array.new(type: :bit1, initial_length: size * 8)\n bit_array.read(data).to_ary\n end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def read_data\n unpacker.read\n end", "def get_data\n return @data.unpack(\"S>*\")\n end", "def read_value_i\n b_read = 0\n ie = @file.read INT_SIZE\n return nil if ie.nil? || ie.bytesize < INT_SIZE\n b_read += ie.bytesize\n\n i = ie.unpack(PACK_INT).first\n [i, b_read]\n end", "def deserialize()\n mem_buf = File.new('test/basic_complex_test/ruby_test/bin.babel.rb').binmode\n end", "def marshal_load(array)\n initialize array[0]\n end", "def read\n return nil if FileTest.exist?(@fname)==false\n\n open(@fname,\"rb\") do |file| #Read & Binary mode\n @data = Marshal.load(file)\n end\n @data\n end", "def read\n if sample = raw_read\n return Typelib.to_ruby(sample)\n end\n end", "def read\n if sample = raw_read\n Typelib.to_ruby(sample)\n end\n end", "def read_array_fields(cls, io_offset, length, signature)\n @io.seek io_offset # Move to the field data\n @io.read_bytes TYPE_SIZES_MAP[signature] * length\n end", "def read_binary_object_at(fname,fd,pos)\n position = @offsets[pos]\n fd.seek(position,IO::SEEK_SET)\n return read_binary_object(fname,fd)\n end", "def marshal_load array\n initialize array[0]\n end", "def read_data_byte(offset) [offset + 1, get_byte(offset)] end", "def parse_raw_data\n data_slices.to_a\n end", "def read_from_current_object(bytes)\n bytes_left = current_object.size - @current_object_offset\n\n if bytes_left > bytes\n data = current_object.value.slice(@current_object_offset, bytes)\n @current_object_offset += bytes\n elsif bytes_left <= bytes\n data = current_object.value.slice(@current_object_offset, bytes_left)\n @current_object_idx += 1\n @current_object_offset = 0\n end\n return data\n end", "def read_struct_data(bytes)\n self.class.set_values_from_byte_to_object(bytes, self)\n end", "def get_b\n n = self.get_i32\n OSC::Blob.new(self.get_data(n))\n end", "def binread(*args, **kwd); end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 2\n data << @data[0]\n data << (@data[1] ? 1 : 0)\n end", "def test_array\n x = [1, \"two\", 3.0]\n assert_equal x, Marshal.load(Marshal.dump(x))\n end", "def get_data(format = :indexed)\n if format == :indexed\n return @data.unpack(\"C*\")\n elsif format == :nonindexed\n return @data.unpack(\"S>*\")\n else\n raise ArgumentError, \"Unexpected format #{format}\"\n end\n end", "def get_data\n return @data.unpack(\"C*\")\n end", "def decode(binary); ::BSON.deserialize(binary); end", "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def read_binary_data(fname,fd,length)\n buff = \"\";\n buff = fd.read(length) if length > 0\n return CFData.new(buff,CFData::DATA_RAW)\n end", "def to_a\n return @array if @array\n decoded = decode_format ? string.unpack(decode_format)[0] : string\n if string.size == 0\n []\n else\n uncompressed = @compressed ? Zlib::Inflate.inflate(decoded) : decoded\n uncompressed.unpack(unpack_format)\n end\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 4\n data << @data[0]\n data << @data[1]\n data << @data[2]\n data << @data[3]\n end", "def read_bignum; end", "def read_array(data: nil, stream: nil, offset: 0)\n count, len = read_varint(data: data, stream: stream, offset: offset)\n return [nil, len] if !count\n (0...count).map do |i|\n yield\n end\n end", "def test_decode_streaming_array_1\n assert_decode(\"9f018202039f0405ffff\", [1, [2, 3], [4, 5]])\n end", "def read_binary_file(path)\n File.open(path, 'rb') {|f| f.read }\n end", "def test_decode_streaming_array_3\n assert_decode(\"83018202039f0405ff\", [1, [2, 3], [4, 5]])\n end", "def read_int64; end", "def read_property_binary f, type, index_type=false, element_type=false\n # print \"reading one #{type}: \"\n # pick String#unpack specifiers based on our endian-ness\n case @format\n when \"binary_big_endian\"\n e, f32, f64 = \">\", \"g\", \"G\"\n when \"binary_little_endian\"\n e, f32, f64 = \"<\", \"e\", \"E\"\n end\n case type\n when \"char\", \"int8\"\n f.read(1).unpack(\"c\").first\n when \"uchar\", \"uint8\"\n f.read(1).unpack(\"C\").first\n when \"short\", \"int16\"\n f.read(2).unpack(\"s#{e}\").first\n when \"ushort\", \"uint16\"\n f.read(2).unpack(\"S#{e}\").first\n when \"int\", \"int32\"\n f.read(4).unpack(\"l#{e}\").first\n when \"uint\", \"uint32\"\n f.read(4).unpack(\"L#{e}\").first\n when \"float\", \"float32\"\n f.read(4).unpack(f32).first\n when \"double\", \"float64\"\n f.read(8).unpack(f64).first\n when \"list\"\n count = read_property_binary(f, index_type)\n count.times.collect { read_property_binary(f, element_type) }\n end\n end", "def read_byte; end", "def data_as_bytes\n raise \"subclass responsibility\"\n end", "def test_decode_bit_binary()\n input = [131, 77, 0, 0, 0, 4, 4, 195, 139, 30, 64]\n expected = Erlang::BitBinary.new(4, \"\\303\\213\\036@\")\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def add_bytes(tag, value)\n value = value.to_s\n write_tag(tag, Type::BYTE_ARRAY)\n Varint.serialize(@io, value.bytesize)\n @io << value\n\n self\n end", "def unpack\n @data.unpack('A4cN') \n end", "def demarshal_object(blob)\n Marshal.load(blob)\n end", "def test_decode_streaming_array_2\n assert_decode(\"9f01820203820405ff\", [1, [2, 3], [4, 5]])\n end", "def test_decode_binary()\n input = [\n 131, 109, 0, 0, 0, 24, 110, 111, 119, 32, 103, 101, 116, 32, 121,\n 111, 117, 114, 32, 97, 115, 115, 32, 116, 111, 32, 109, 97, 114,\n 115]\n expected = Erlang::Binary.new('now get your ass to mars')\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def read_all_bytes\n # 1. Open file with option \"r\" (reading) and \"b\" (binary, useful for window system)\n open_file\n \n # 2. Read all bytes\n begin\n bytes = @file_handle.read(self.size).unpack(\"C*\")\n return bytes\n rescue\n # re-raise system the excepiton\n raise\n return nil\n ensure\n # 3. Close the file\n close_file\n end\n end", "def read_all_bytes\n # 1. Open file with option \"r\" (reading) and \"b\" (binary, useful for window system)\n open_file\n \n # 2. Read all bytes\n begin\n bytes = @file_handle.read(self.size).unpack(\"C*\")\n return bytes\n rescue\n # re-raise system the excepiton\n raise\n return nil\n ensure\n # 3. Close the file\n close_file\n end\n end", "def data\n @buffer.string\n end", "def read_binary_int(fname,fd,length)\n raise CFFormatError.new(\"Integer greater than 8 bytes: #{length}\") if length > 3\n\n nbytes = 1 << length\n\n val = nil\n buff = fd.read(nbytes)\n\n case length\n when 0 then\n val = buff.unpack(\"C\")\n val = val[0]\n when 1 then\n val = buff.unpack(\"n\")\n val = val[0]\n when 2 then\n val = buff.unpack(\"N\")\n val = val[0]\n when 3\n hiword,loword = buff.unpack(\"NN\")\n val = hiword << 32 | loword\n end\n\n return CFInteger.new(val);\n end", "def test_decode_streaming_array_4\n assert_decode(\"83019f0203ff820405\", [1, [2, 3], [4, 5]])\n end", "def deserialize binary\n data = binary.unpack(BINARY_FORMAT)\n if data[0].zero? && data[1].zero? && data[3] == 1 && data[5] == 2\n TraceContextData.new data[2], data[4], data[6]\n else\n nil\n end\n end", "def load_dataE(filename)\r\n Log.ger.debug('Read '+filename)\r\n File.open(filename, \"rb\") { |f|\r\n obj = Marshal.load(f)\r\n }\r\nend", "def deserialize()\n mem_buf = File.new('test/ipv6_test/ruby_test/bin.babel.rb').binmode\n end", "def data\n self.data_pointer.read_string(self.data_size)\n end", "def binread(fname)\n File.open(fname, 'rb'){ |f|\n return f.read\n }\n end", "def parse_array_elements_from_buffer(array, buffer, **options)\n while (type = buffer.get_byte) != NULL_BYTE\n buffer.get_cstring\n cls = BSON::Registry.get(type)\n value = if options.empty?\n cls.from_bson(buffer)\n else\n cls.from_bson(buffer, **options)\n end\n array << value\n end\n end", "def read(cursor, field_length)\n cursor.name(@data_type.name) { cursor.read_bytes(field_length) }\n end", "def raw_bytes\n @raw_bytes ||= read_raw_bytes\n end", "def read_keyblob(type); end", "def data\n raise RuntimeError, 'No raw data set' unless @raw\n\n header, @chunk_id, @chunk_count, crc32, b = Payload.decode(@raw).unpack('a4LLLa*')\n\n raise FormatError unless header == HEADER\n raise ChecksumError unless Zlib.crc32(b) == crc32\n\n b\n end", "def data\n data = 0\n shift_out_with_index do |bit, i|\n return undefined if bit.is_a?(Origen::UndefinedClass)\n\n data |= bit.data << i\n end\n data\n end", "def getData\n return Marshal.load(@Data)\n end", "def read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend", "def to_primitive\n data\n end", "def value_type\n 'BINARY'\n end", "def parse_binary_data(binary_data)\n chunk_size = DATA_ELEMENTS + 1 # plus header\n data_elements = binary_data.length / DATA_FORMAT.length\n data_format = binary_format data_elements\n unpacked = binary_data.unpack(data_format)\n buffer = unpacked[HEADER_FORMAT.length..-1]\n data = {}\n data_elements.times do |element_index|\n offset = element_index * chunk_size\n chunk = buffer[offset..offset + chunk_size]\n element_id = chunk[0]\n map = Xplane::XPLANE_DATA_MAPPER[element_id]\n if map\n map.each_with_index do |key, i|\n data[key] = chunk[i + 1] # plus header\n end\n end\n end\n return data\n end", "def from_array(array)\n array.pack('U*')\n end", "def deserialize(value = Order.new)\n if (buffer.offset + @_model.fbe_offset - 4) > buffer.size\n [Order.new, 0]\n end\n\n fbe_full_size = read_uint32(@_model.fbe_offset - 4)\n if fbe_full_size < @_model.fbe_size\n [Order.new, 0]\n end\n\n @_model.get(value)\n [value, fbe_full_size]\n end", "def to_a \n return @data\n end", "def read(input)\n input = StringIO.new(input) if input.kind_of? ::String\n @offset = input.pos\n\n if @until\n loop {\n @values << field = @type.new(endian: @endian, parent: @parent)\n field.read_io input\n break if field.send(@until)\n }\n else\n @values ||= ::Array.new(length) { @type.new(endian: @endian, parent: @parent) }\n @values.each {|field|\n field.read_io input\n }\n end\n\n @size = input.pos - @offset\n end", "def bytes\n\t\tbin.unpack('C*')\n\tend", "def read\n @fileobj.seek @data_offset\n @data = @fileobj.read @data_size\n end", "def read(bits=nil)\n bits ||= word_size\n binary = []\n\n bits.times do |i|\n block_index, bit_index = @pointer.divmod(8)\n data = @blocks[block_index] || 0\n binary << (((data >> (7 - bit_index)) & 1) == 1)\n @pointer += 1\n end\n\n binary.map{|b| b ? '1' : '0' }.join.to_i(2)\n end", "def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend", "def binary(array)\n @reactor.schedule { @driver.binary(array.to_a) }\n end", "def to_binary()\n return self.unpack('B*').join\n end", "def read(length = nil)\n #This is a stub, used for indexing\n end", "def bytes(*args); data(1, *args); end", "def deserialize(value = Order.new)\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n [Order.new, 0]\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) || (fbe_struct_type != fbe_type)\n [Order.new, 8]\n end\n\n fbe_result = @_model.get(value)\n [fbe_result[0], (8 + fbe_result[1])]\n end", "def bdecode\n @index = 0\n data = []\n while @index < self.length\n data << case self[@index]\n when /\\d/\n decode_str\n when 'l'\n decode_list\n when 'i'\n decode_int\n when 'd'\n decode_dict\n else\n raise ArgumentError, \"Cannot bdecode invalid string.\"\n end\n @index += 1\n end\n @index = 0\n data.length > 1 ? data : data[0]\n end", "def convert_binary\n end", "def getvalue\n dt = @datatype || String\n case dt.to_s\n when \"String\"\n return @buffer\n when \"Integer\"\n return @buffer.to_i\n when \"Float\"\n return @buffer.to_f\n else\n return @buffer.to_s\n end\n end", "def getvalue\n dt = @datatype || String\n case dt.to_s\n when \"String\"\n return @buffer\n when \"Integer\"\n return @buffer.to_i\n when \"Float\"\n return @buffer.to_f\n else\n return @buffer.to_s\n end\n end", "def byte_arr_to_string arr\n arr.pack(\"c*\")\nend", "def to_blob\n File.binread(path)\n end", "def decode_val( encoding, size, io )\n # plain string\n if encoding == Protocol::ENCODINGS[:plain]\n io.read_unpacked size, 'a' + size.to_s\n # number\n elsif encoding == Protocol::ENCODINGS[:number]\n io.read_unpacked size, size == 4 ? 'l<' : 'q<'\n else\n raise 'Unknown data encoding.'\n end\n end", "def readbyte\n end", "def peek\n @b.each_byte {|b| return b }\n end", "def data\n if @path\n File.open(@path, \"rb\"){|f| f.read} rescue nil\n else\n @memory_io.string.clone\n end\n end" ]
[ "0.70284456", "0.69862336", "0.68214107", "0.6640798", "0.6626206", "0.65283865", "0.6451477", "0.64165217", "0.63352776", "0.6239434", "0.6229584", "0.62125087", "0.6182966", "0.61515546", "0.6077128", "0.6076064", "0.6062472", "0.6019979", "0.59944135", "0.59940684", "0.5983267", "0.59790343", "0.5952432", "0.5941107", "0.59405327", "0.5930247", "0.5922436", "0.59194016", "0.5891426", "0.5857323", "0.58477616", "0.58373415", "0.58361906", "0.5832097", "0.5823684", "0.5816863", "0.58007634", "0.5798647", "0.5795362", "0.5759185", "0.57444775", "0.57294625", "0.5713132", "0.57120895", "0.56871384", "0.5658108", "0.5657968", "0.565558", "0.56461257", "0.5634605", "0.5621537", "0.5617002", "0.56132746", "0.56114787", "0.5606308", "0.5601523", "0.55965555", "0.55965555", "0.5586587", "0.55843246", "0.55831367", "0.5574695", "0.55653983", "0.5562272", "0.5559038", "0.5555776", "0.5554604", "0.5552454", "0.5547247", "0.5544759", "0.5542868", "0.55322033", "0.5526772", "0.55138105", "0.5512088", "0.55054843", "0.55033267", "0.5499925", "0.54815596", "0.5474134", "0.54634994", "0.5458762", "0.5452852", "0.54519534", "0.5449416", "0.5447486", "0.54376066", "0.54351753", "0.543001", "0.5423359", "0.541515", "0.5413332", "0.54127455", "0.54127455", "0.5411727", "0.5411469", "0.54109496", "0.5409931", "0.5403465", "0.5391477" ]
0.71458286
0
Read a dictionary value, including contained objects
def read_binary_dict(fname,fd,length) dict = {} # first: read keys if(length != 0) then buff = fd.read(length * @object_ref_size) keys = buff.unpack(@object_ref_size == 1 ? "C*" : "n*") # second: read object refs buff = fd.read(length * @object_ref_size) objects = buff.unpack(@object_ref_size == 1 ? "C*" : "n*") # read real keys and objects 0.upto(length-1) do |i| key = read_binary_object_at(fname,fd,keys[i]) object = read_binary_object_at(fname,fd,objects[i]) dict[key.value] = object end end return CFDictionary.new(dict) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read\n value = super\n value = value.to_hash if value.respond_to?(:to_hash)\n value\n end", "def extract_data(object)\n if object.is_a?(Hash) && object.size == 1\n return object.values.first\n else\n return object\n end\n end", "def read_entry(key, **options)\n deserialize_entry(read_serialized_entry(key, **options), **options)\n end", "def read_value(from, key)\n return from if key.nil? or key == \"\"\n\n key.split(/\\./).reduce({}) do |acc, x|\n unless acc.nil?\n if acc.empty?\n # Initial run\n acc = from[x]\n else\n if acc.has_key?(x)\n acc = acc[x]\n else\n # Some intermediate key does not exist\n return nil\n end\n end\n else\n # Some intermediate key returned a null value\n # This indicates a malformed entry\n return nil\n end\n end\n end", "def read\n tryR(\"read\")\n hash = {}\n @db.each do |k, v|\n v or kyoto_error!(\"each(%s): \" % k)\n hash[k] = decode(v)\n end\n return hash\n end", "def read\n @storage = {}\n scan\n apply_overrides\n\n OpenStruct.new(@storage)\n end", "def read_from_hash(hash, key)\n # return the correct value using the hash and key parameters\n hash[key]\nend", "def custom_reader(key); end", "def read_entry(key, **options)\n deserialize_entry(read_serialized_entry(key, **options), **options)\n end", "def underbang_reader(key); end", "def read\n @_cache ||= (value = read_value) ? serializer_class.load(read_value) : {}\n end", "def read(uid)\n object = bucket.objects[uid]\n data = object.read\n meta = Serializer.json_decode(object.metadata[:json])\n [\n data, # can be a String, File, Pathname, Tempfile\n meta # the same meta Hash that was stored with write\n ]\n end", "def read_entry(key, options)\n @hash[key]\n end", "def read_entry(key, options) # :nodoc:\n Marshal.load(@data.get(key))\n rescue => e\n logger.error(\"KyotoTycoonError (#{e}): #{e.message}\") if logger\n nil\n end", "def extract_data(object)\n if object.is_a?(Hash)&&object.keys.include?('data')\n return object['data']\n else\n return object\n end\n end", "def read_value(key)\n keys = key.split('.')\n result = @context\n keys.each do |k|\n return nil unless result\n result = result[k]\n end\n return result\n end", "def read\n num_kv = @kinvars.length\n unpck = String.new\n num_kv.times{unpck += 'd'}\n vals = @file.read(num_kv*8).unpack(unpck)\n vals_hash = Hash.new\n num_kv.times{|kv| vals_hash[@kinvars[kv].name] = vals[kv]}\n vals_hash\n end", "def read_object\n\t\t\t\tJSON.parse @input.readline\n\t\t\tend", "def read(_ = nil)\n as_hash(read_lines)[base_name]\n end", "def read(entry); end", "def read_entry(key, options) # :nodoc:\n deserialize_entry(@data.where(key: key).get(:value))\n rescue Sequel::Error => e\n logger.error(\"Sequel::Error (#{e}): #{e.message}\") if logger\n nil\n end", "def _read_attribute(key); end", "def read(key)\n raw = @redis.get(prefixed_key(key))\n raw && JSON.parse(raw)\n end", "def deserialize_value(value)\r\n value\r\n end", "def read(key)\n exists?(key) ? @data[key] : nil\n end", "def read(name)\n @dump.fetch(name)\n end", "def read_file(path, key)\n file = IO.read(path)\n JSON.parse(file)[key]\n end", "def object_for_hash(given_hash)\n @opener.open(name, \"r\") do |fp|\n given_hash.force_encoding(\"ASCII-8BIT\") if given_hash.respond_to?(:force_encoding)\n entry = nil\n if index\n starting_at = index.offset_for_hash(given_hash)\n return PackFileEntry.at(starting_at, fp).to_raw_object\n else\n starting_at = cached_offset(given_hash) || DATA_START_OFFSET\n fp.seek(starting_at, IO::SEEK_SET)\n while fp.tell < @end_of_data\n entry = PackFileEntry.read(fp)\n cache_entry(entry)\n return entry.to_raw_object if entry.hash_id == given_hash\n end\n end\n end\n nil\n end", "def read_entry(key, options)\n query = Google::Cloud::Datastore::Key.new @datastore_kind_name, key\n entities = dataset.lookup query\n return nil unless entities.any?\n entity = entities.first\n entry = deserialize_entry( entity[:_value], entity[:_format] )\n return entry\n end", "def [](key)\n key = convert_key(key)\n regular_reader(key)\n end", "def read\n read_object(read_byte)\n end", "def get_object_value(object, fieldname)\n # first, attempt to split the fieldname based on the '.' character\n # (if it exists in the string)\n dot_split = fieldname.split('.')\n if dot_split.size > 1\n # if it's a dot-separated form, then drill down until we find the\n # value that the dot-separated form refers to and return that value\n value = object\n prev_key = dot_split[0]\n dot_split.each { |keyname|\n # throw an error if the 'value' is not a hash (before attempting to retrieve the next 'value')\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{prev_key}' is not a Hash value\" unless value.is_a?(Hash)\n # if get here, then just retrieve the next element from nested hash maps referred\n # to in the dot-separated form (note that for top-level fields the keys will be\n # prefixed with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n value = value[\"@#{keyname}\"] || value[keyname]\n # throw an error if a field with the key 'keyname' was not found (it's an illegal reference in that case)\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{keyname}' cannot be found\" unless value\n # otherwise, save this keyname for the next time through the loop and continue\n prev_key = keyname\n }\n return value\n end\n # otherwise, retrieve the field referred to by the fieldname and return\n # that value (note that for top-level fields the keys will be prefixed\n # with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n object[\"@#{fieldname}\"] || object[fieldname]\n end", "def read(key)\n unimplemented\n end", "def dictionary\n @dictionary\n end", "def fetch_value( oid, key )\n\t\toid = normalize_oid( oid )\n\t\tkey = normalize_key( key )\n\t\tdata = @storage[ oid ] or return nil\n\n\t\treturn data[ key ]\n\tend", "def read(key)\n filepath = realpath(key)\n return unless File.file?(filepath)\n\n Marshal.load(IO.binread(filepath))\n rescue TypeError, ArgumentError\n nil # handle if file content is invalid\n end", "def _mapping_data(object_type, key_obj, object_opts, value)\n value_mapping = object_opts.rh_get(:value_mapping, key_obj.fpath)\n if value_mapping && !value.nil?\n value_mapping.each do |map_key, map_value|\n next unless value == map_value\n Lorj.debug(5, \"Object '%s' value mapped '%s': '%s' => '%s'\",\n object_type, key_obj.tree,\n value, map_value)\n return map_key\n end\n PrcLib.runtime_fail(\"'%s.%s': No controller value mapping for '%s'.\",\n object_type, key_obj.tree, value)\n end\n\n Lorj.debug(5, \"Object '%s' value '%s' extracted: '%s'\",\n object_type, key_obj.tree, value)\n value\n end", "def value_read; end", "def getJsonValue(key)\n return $jsonObjectMain[key]\nend", "def get(key)\n return @data[key.to_s]\n end", "def read(key)\n perform_read(:read, key)\n end", "def read\n value = record.send(\"#{name}_data\")\n value unless value.nil? || value.empty?\n end", "def read(key, options = nil)\n if options\n get(key, options[:raw])\n else\n get(key)\n end\n rescue NotFound\n rescue Error => e\n log_exception e\n end", "def restoreSerialised( handle, key )\n obj = nil\n data = handle[ key ];\n obj = Marshal.load( data )\n return obj\nend", "def slice_object\n object_name = @value.keys.first\n values = @value.values.first\n items = @selector.scan(/['|\"](\\w+)['|\"]/).flatten\n return {object_name => {}} if items.empty?\n if items.size == 1\n items[0] = items[0].to_s if items[0].is_a?(Symbol)\n ObjectRepresentation[object_name, Hash[values.select {|key, value| key.to_s.match(items.first) }]]\n else\n ObjectRepresentation[object_name, Hash[values.select {|key, value| items.include?(key)}]]\n end\n end", "def object_value_from_dynamo_data(dynamo_record)\n dynamo_record[dynamo_attribute_key]\n end", "def bob_the_builder\n people = {\"name\" => \"bob\", :job => \"builder\", 21 => \"current_age\"}\n puts people[\"name\"]\n puts people.values\n puts\nend", "def decode_kval( io, size )\n count = io.read_unpacked 4, 'L<'\n obj = {}\n\n count.times do |i|\n klen = io.read_unpacked 4, 'L<' \n key = io.read_unpacked klen, 'a' + klen.to_s\n enc = io.read_unpacked 1, 'c'\n vsize = io.read_unpacked 4, 'L<'\n\n obj[key] = decode Protocol::REPLIES[:val], enc, vsize, io\n end\n\n obj\n end", "def read_key; end", "def dictionary\n @dictionary ||= File.open('dictionary.txt', 'r').read\n end", "def read(path)\n entries[self.class.path(path)]\n end", "def extract_value(element)\n # Read value as CouchDB value for that key:\n cdbvalue = element.value\n # Convert encoding to UTF-8 with Ruby 1.9 'encode' method\n cdbvalue = cdbvalue.encode('utf-8', 'iso-8859-1') if cdbvalue.class == String\n return cdbvalue\nend", "def read key = nil\n parse_json_allowing_quirks_mode s3_object(key).read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end", "def raw_properties\n parse_raw_map descriptor.values\n end", "def deserialize(value)\n value\n end", "def read_attribute(key)\n @hash[key.to_s]\n end", "def get_data(key) \n return @data[key]\n end", "def extract_hash\n\n value = @array.extract_hash if @array\n value = @valueItem.extract_hash if @valueItem\n value = @map.extract_hash if @map\n\n @text = value\n\n return if @type == 'index'\n return if @type == 'hidden'\n return if @type == 'version'\n return if @type == 'class'\n return if @type == 'method'\n return if @type == 'import'\n return if @type == 'allow'\n return if @type == 'expect'\n\n formatted_key = Substitutions.process UnicodeEscapes.process @key\n {formatted_key => @text}\n end", "def read_keyblob(type); end", "def read_parsed_data(data)\n if data.is_a?(Array) && data.length == 2 && data[0] == \"proxyobj\"\n id = data[1].to_i\n\n if (proxy_obj = @objects_handler.find_by_id(id))\n $stderr.print \"Reuse proxy-obj!\\n\" if @debug\n return proxy_obj\n else\n return @objects_handler.spawn_by_id(id)\n end\n elsif data.is_a?(Hash)\n newdata = {}\n data.each do |key, val|\n newdata[key] = read_parsed_data(val)\n end\n\n return newdata\n else\n return data\n end\n end", "def nested_hash_value(obj,key)\n if obj.respond_to?(:key?) && obj.key?(key)\n obj[key]\n elsif obj.respond_to?(:each)\n r = nil\n obj.find{ |*a| r=nested_hash_value(a.last,key) }\n r\n end\n end", "def value_for_data(key, item, value_key = :value)\n if item and item[:data] and item[:data][key]\n return item[:data][key][value_key]\n end\n return nil\n end", "def read_multi(*names)\n options = names.extract_options!\n options = merged_options(options)\n keys_to_names = Hash[names.map{|name| [namespaced_key(name, options), name]}]\n raw_values = @data.mget(keys_to_names.keys)\n values = {}\n raw_values.each do |key, value|\n entry = deserialize_entry(value)\n values[keys_to_names[key]] = entry.value unless entry.expired?\n end\n values\n end", "def read(name)\n Oj.load(@redis.get(name))\n end", "def fetch_entry(dict, key)\n if dict.has_key?(key) == true\n print dict[key], \"\\n\"\n else\n print \"Value not found.\\n\"\n end\n end", "def data\n self[:data].with_indifferent_access\n end", "def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets)\n file.close()\n return object\nend", "def dict?; @storage.is_a?(Dict); end", "def read_completed()\n from_hash({})\n end", "def read_entry(key, options) # :nodoc:\n @data.get(key, options)\n rescue ::Couchbase::Error::Base => e\n logger.error(\"#{e.class}: #{e.message}\") if logger\n raise if @raise_errors\n nil\n end", "def read_file_level_data\n cdjf = corresponding_data_json_file\n return {} if cdjf.nil?\n cdjf.read_data\n end", "def get(key)\n self.data[key] && self.data[key][:value]\n end", "def read(io)\n data = self.new\n data.read(io)\n data.single_value? ? data.value : data\n end", "def convert_after_read(value)\n sequel_json_column? ? value.to_hash : super\n end", "def data; @doc[key] end", "def read(key, options = {})\n synchronize_block do\n set_key_access_strategy(key)\n return @data[key] ? dup_value(@data[key]) : nil\n end\n end", "def read\n object.content\n end", "def meterpreter_registry_getvalinfo(key, valname, view)\n value = {}\n begin\n root_key, base_key = session.sys.registry.splitkey(key)\n perms = meterpreter_registry_perms(KEY_READ, view)\n open_key = session.sys.registry.open_key(root_key, base_key, perms)\n v = open_key.query_value(valname)\n value[\"Data\"] = v.data\n value[\"Type\"] = v.type\n open_key.close\n rescue Rex::Post::Meterpreter::RequestError => e\n return nil\n end\n return value\n end", "def read_info(uid)\n response = object(\"#{uid}.info\").get\n JSON.parse(response.body.string)\n rescue Aws::S3::Errors::NoSuchKey\n raise Tus::NotFound\n end", "def open_dictionary\n if File.exists?(@dictionarylocation)\n file = File.new(@dictionarylocation, 'rb').read\n @depth = file[0].to_i\n @dictionary = MessagePack.unpack(file[1..-1])\n else\n @dictionary = {}\n end\n end", "def data\r\n @obj.read_var(@name)\r\n end", "def value\n YAML::load(self[:value])\n end", "def value\n YAML::load(self[:value])\n end", "def getRubyData(key)\n @data[key]\n end", "def read\n object = bucket.objects.find(@path)\n object.content\n end", "def get(key)\n response = request(:get, uri(key))\n if response.status == 200\n data = MultiJson.load(response.body)\n if data.is_a?(Array)\n data.each_with_object({}) do |e, acc|\n acc[e[S_KEY]] = e[S_VALUE]\n end\n else\n data[S_VALUE]\n end\n else\n nil\n end\n end", "def deserialize(value)\n Marshal.restore(value) rescue value\n end", "def deserialize(value)\n Marshal.restore(value) rescue value\n end", "def custom_reader(key)\n value = regular_reader(convert_key(key))\n yield value if block_given?\n value\n end", "def []( key )\n hash = load_hash\n hash[key]\n end", "def indifferent_value(value)\n value\n end", "def read(name)\n @memonized ||= {}\n @memonized.fetch(name) do\n @memonized[name]=read_nocache(name)\n end\n end", "def object_data_get(object, *key)\n key = key.flatten\n\n return nil unless object.is_a?(Lorj::Data)\n\n # Return ObjectData Element if asked. Ignore additional keys.\n return @params[key[0]] if key[1] == :ObjectData\n\n # Return attributes if asked\n return object[:attrs, key[2..-1]] if key[1] == :attrs\n\n # params are retrieved in process context\n # By default, if key is detected as a framework object, return its\n # data.\n return object[:attrs, key[1..-1]] if @internal\n\n # params are retrieved in controller context\n # By default, if key is detected as a controller object, return its\n # data.\n return object[:object, key[1..-1]] unless @internal\n end", "def read(key)\n @cache[key]\n end", "def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n if(object_type != \"0\" && object_length == 15) then\n object_length = read_binary_object(fname,fd)\n object_length = object_length.value\n end\n\n retval = nil\n case object_type\n when '0' then # null, false, true, fillbyte\n retval = read_binary_null_type(object_length)\n when '1' then # integer\n retval = read_binary_int(fname,fd,object_length)\n when '2' then # real\n retval = read_binary_real(fname,fd,object_length)\n when '3' then # date\n retval = read_binary_date(fname,fd,object_length)\n when '4' then # data\n retval = read_binary_data(fname,fd,object_length)\n when '5' then # byte string, usually utf8 encoded\n retval = read_binary_string(fname,fd,object_length)\n when '6' then # unicode string (utf16be)\n retval = read_binary_unicode_string(fname,fd,object_length)\n when 'a' then # array\n retval = read_binary_array(fname,fd,object_length)\n when 'd' then # dictionary\n retval = read_binary_dict(fname,fd,object_length)\n end\n\n return retval\n end", "def read\n if File.exist? path\n File.open(path) do |file|\n Marshal.load(file)\n end\n else\n self.write({})\n self.read\n end\n end", "def read_attribute(key)\n @attributes[key]\n end", "def read_attribute(key)\n @attributes[key]\n end", "def read(key)\n bucket.objects[key].read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end", "def read_entry(key, options) # :nodoc:\n entry = with { |c| c.get(key, options) }\n # NB Backwards data compatibility, to be removed at some point\n entry.is_a?(ActiveSupport::Cache::Entry) ? entry.value : entry\n rescue Dalli::DalliError => e\n log_dalli_error(e)\n instrument_error(e) if instrument_errors?\n raise if raise_errors?\n nil\n end" ]
[ "0.6401827", "0.62023777", "0.60165054", "0.60061866", "0.59796745", "0.59665734", "0.5922959", "0.5887369", "0.5864625", "0.5849955", "0.5823342", "0.5818345", "0.58171487", "0.5755363", "0.5720155", "0.5680275", "0.5632676", "0.5576335", "0.5573226", "0.55635834", "0.5548812", "0.55342364", "0.5521503", "0.5521446", "0.54997754", "0.5489526", "0.5450224", "0.5441709", "0.5413156", "0.53987384", "0.5385326", "0.53795296", "0.5377868", "0.53695893", "0.5364197", "0.53457206", "0.5341485", "0.53337854", "0.53043056", "0.5299228", "0.52818316", "0.5275936", "0.5266699", "0.52569485", "0.52445686", "0.5242952", "0.523255", "0.52299935", "0.52162516", "0.52061224", "0.5205216", "0.52047133", "0.5191269", "0.5186965", "0.51805484", "0.5171569", "0.5162958", "0.51451826", "0.5121667", "0.5120409", "0.51191264", "0.51135075", "0.51066625", "0.51026344", "0.5096023", "0.5091028", "0.5083007", "0.50701505", "0.50565714", "0.5046502", "0.50431633", "0.50427157", "0.5039017", "0.50379926", "0.5035435", "0.502458", "0.5020925", "0.50188994", "0.5016768", "0.5015898", "0.50117046", "0.5005948", "0.5005948", "0.50040007", "0.500391", "0.4992953", "0.49926496", "0.49926496", "0.49922994", "0.49867365", "0.49806762", "0.49780208", "0.4971881", "0.49708274", "0.49693075", "0.49657133", "0.49591187", "0.49591187", "0.49566746", "0.49543855" ]
0.59418935
6
Read an object type byte, decode it and delegate to the correct reader function
def read_binary_object(fname,fd) # first: read the marker byte buff = fd.read(1) object_length = buff.unpack("C*") object_length = object_length[0] & 0xF buff = buff.unpack("H*") object_type = buff[0][0].chr if(object_type != "0" && object_length == 15) then object_length = read_binary_object(fname,fd) object_length = object_length.value end retval = nil case object_type when '0' then # null, false, true, fillbyte retval = read_binary_null_type(object_length) when '1' then # integer retval = read_binary_int(fname,fd,object_length) when '2' then # real retval = read_binary_real(fname,fd,object_length) when '3' then # date retval = read_binary_date(fname,fd,object_length) when '4' then # data retval = read_binary_data(fname,fd,object_length) when '5' then # byte string, usually utf8 encoded retval = read_binary_string(fname,fd,object_length) when '6' then # unicode string (utf16be) retval = read_binary_unicode_string(fname,fd,object_length) when 'a' then # array retval = read_binary_array(fname,fd,object_length) when 'd' then # dictionary retval = read_binary_dict(fname,fd,object_length) end return retval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read\n read_object(read_byte)\n end", "def recover_object\n # Up to the tab is the amount of bytes to read\n demarshal_bytes = @io.gets(\"\\t\").to_i\n \n # When at end of IO return nil\n raise NothingToRecover if demarshal_bytes.zero?\n \n blob = @io.read(demarshal_bytes)\n demarshal_object(blob)\n end", "def readObject\n raise NotImplementedError, <<-STR\n\n \\e[91m\n I'm afraid this might not work.\n > you need access to the original class definitions (and a)\n > Java runtime to load them into) to turn the stream data back\n > something approaching the original objects.\n \\e[0m\n STR\n end", "def read\n Typelib.to_ruby(raw_read)\n end", "def demarshal_object(blob)\n Marshal.load(blob)\n end", "def read_byte; end", "def read_binary\n raise NotImplementedError\n end", "def read\n if sample = raw_read\n Typelib.to_ruby(sample)\n end\n end", "def decode(binary); ::BSON.deserialize(binary); end", "def read(io)\n @record_class.read(io)\n end", "def parse(type, io, shb)\n block = guess_block_type(type).new(endian: shb.endian)\n classify_block shb, block\n block.read(io)\n end", "def load_marshal_data object # :nodoc:\n object.load\n rescue NameError, ArgumentError => e\n DRb::DRbUnknown.new e, object.stream\n end", "def read(io)\n begin\n while object = Marshal.load(io)\n type, id, attrs = object\n feed type, id, attrs\n end\n rescue EOFError\n end\n end", "def read\n if sample = raw_read\n return Typelib.to_ruby(sample)\n end\n end", "def read_object\n # Incrementally parse next object.\n begin\n while not @object\n @sock.readpartial(MAX_READ_CHUNK, @inbuf)\n @parser << @inbuf\n PennJSON_Conversation.do_clear(@inbuf)\n end\n rescue Yajl::ParseError\n PennJSON.panic 'Malformed protocol message.'\n rescue EOFError\n raise SystemExit, 'Remote closed connection.'\n end\n\n # Fetch parsed object. Could make this a queue, I suppose.\n result = @object\n @object = nil\n return result\n end", "def read_object\n if @version == 0\n return amf0_deserialize\n else\n return amf3_deserialize\n end\n end", "def load(blob)\n internal = decrypt(blob)\n ::Riak::Serializers.deserialize(content_type, internal)\n end", "def decode; end", "def decode; end", "def decode(payload)\n Oj.load payload\n end", "def decode\n raise NotImplementedError\n end", "def read() end", "def load_dataE(filename)\r\n Log.ger.debug('Read '+filename)\r\n File.open(filename, \"rb\") { |f|\r\n obj = Marshal.load(f)\r\n }\r\nend", "def read_from_current_object(bytes)\n bytes_left = current_object.size - @current_object_offset\n\n if bytes_left > bytes\n data = current_object.value.slice(@current_object_offset, bytes)\n @current_object_offset += bytes\n elsif bytes_left <= bytes\n data = current_object.value.slice(@current_object_offset, bytes_left)\n @current_object_idx += 1\n @current_object_offset = 0\n end\n return data\n end", "def decode_with_type(s, type)\n s = StringIO.new(s) if s.is_a?(String)\n if type == Integer\n item = s.read(1)\n if item.nil?\n raise InvalidError.new \"invalid Integer value nil\"\n elsif item == \"\\x80\".b || item.empty?\n 0\n elsif item.ord < 0x80\n item.ord\n else\n size = item[0].ord - 0x80\n Ciri::Utils.big_endian_decode(s.read(size))\n end\n elsif type == Bool\n item = s.read(1)\n if item == Bool::ENCODED_TRUE\n true\n elsif item == Bool::ENCODED_FALSE\n false\n else\n raise InvalidError.new \"invalid bool value #{item}\"\n end\n elsif type.is_a?(Class) && type.respond_to?(:rlp_decode)\n type.rlp_decode(s)\n elsif type.is_a?(Array)\n decode_list(s) do |list, s2|\n i = 0\n until s2.eof?\n t = type.size > i ? type[i] : type[-1]\n list << decode_with_type(s2, t)\n i += 1\n end\n end\n elsif type == Bytes\n str = decode_stream(s)\n raise RLP::InvalidError.new \"decode #{str.class} from Bytes\" unless str.is_a?(String)\n str\n elsif type == List\n list = decode_stream(s)\n raise RLP::InvalidError.new \"decode #{list.class} from List\" unless list.is_a?(Array)\n list\n elsif type == Raw\n decode_stream(s)\n else\n raise RLP::InvalidError.new \"unknown type #{type}\"\n end\n rescue\n error \"when decoding #{s} into #{type}\"\n raise\n end", "def _read_type(length, typename)\n bytes = @io.read(length)\n\n raise EOFError, \"Unexpected EOF reading #{typename}\" \\\n if bytes.nil? || bytes.length != length\n\n bytes\n end", "def get_obj(type_tag)\n if id = OBJECT_READER_MAP[type_tag]\n return self.send(id)\n end\n raise OSC::ParseError, \"invalid type tag\"\n end", "def read()\n size_a = @stream.read 2\n size = Common.decode_u16(size_a)\n data = @stream.read size\n\n data = MessagePack.unpack data\n class_ = Common.packet_from_id data[0]\n class_.new *data[1][0]\n end", "def deserialize(istream)\n raise BioInterchange::Exceptions::ImplementationReaderError, 'You must implement this method, which reads data from an input stream and returns an object model instance.'\n end", "def unpack(binary)\n end", "def read_object\n\t\t\t\tJSON.parse @input.readline\n\t\t\tend", "def read(opaque)\n if reader\n return reader.call(opaque)\n end\n\n if opaque.is_a?(String)\n return opaque\n end\n raise \"can't turn #{opaque.inspect} into string\"\n end", "def read(type = :byte, opt = { signed: false, mutation: :STD, order: :BIG })\n return unless RuneRb::Network::Message.validate(self, :read, opt)\n\n case type\n when *RW_TYPES[:byte] then read_byte(opt[:signed] || false, opt[:mutation] || :STD)\n when *RW_TYPES[:short] then read_short(opt[:signed] || false, opt[:mutation] || :STD, opt[:order] || :BIG)\n when *RW_TYPES[:medium] then read_medium(opt[:signed] || false, opt[:mutation] || :STD, opt[:order] || :BIG)\n when *RW_TYPES[:int] then read_int(opt[:signed] || false, opt[:mutation] || :STD, opt[:order] || :BIG)\n when *RW_TYPES[:long] then read_long(opt[:signed] || false, opt[:mutation] || :STD, opt[:order] || :BIG)\n when *RW_TYPES[:string] then read_string\n when :bytes then read_bytes(opt[:amount], opt[:mutation])\n when :reverse_bytes, :negative_bytes, :reverse, :negatives then read_bytes_reverse(opt[:amount] || opt[:length], opt[:mutation])\n when :io, :socket then read_from(opt[:io] || opt[:source] || opt[:socket], opt[:length])\n when :header then read_header(opt[:source])\n else raise \"Unrecognized read type! #{type}\"\n end\n end", "def decode(bytes)\n decode_from(::StringIO.new(bytes))\n end", "def reader; end", "def load(object)\n # try the v1 way first\n begin\n internal = decrypt(object)\n return ::Riak::Serializers.deserialize('application/json', internal)\n # if that doesn't work, try the v2 way\n rescue OpenSSL::Cipher::CipherError, MultiJson::DecodeError\n return EncryptedJsonDocument.new(@config, object).decrypt\n end\n end", "def read(record, cursor)\n return :NULL if null?(record)\n cursor.name(type.name) { type.reader.read(record, cursor, length(record)) }\n end", "def readbyte\n end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def deserialize(bytes)\n raise \"Invalid byte count: #{bytes}. Expected length of #{length}\" if bytes.length != length\n deserialize_implementation(bytes)\n end", "def decode(bytes)\n bytes.force_encoding(Encoding::BINARY)\n input = StringIO.new(bytes)\n version = has_version_tag ? input.read(1).ord : 0\n schema = schema_versions[version]\n raise ClientError, \"no registered schema for version #{version}\" unless schema\n read(input, schema)\n end", "def read(str_or_io)\n io = to_io(str_or_io)\n return self if io.eof?\n\n self[:type].read io.read(4)\n self[:block_len].read io.read(4)\n self[:orig_len].read io.read(4)\n data_len = compute_data_len\n self[:data].read io.read(data_len)\n remove_padding(io, data_len)\n read_blocklen2_and_check(io)\n\n self.type ||= PcapNG::IDB_TYPE.to_i\n self\n end", "def read_data(file_name)\r\n file = File.open(file_name,\"r\")\r\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace))\r\n file.close()\r\n return object\r\nend", "def read_struct_data(bytes)\n self.class.set_values_from_byte_to_object(bytes, self)\n end", "def read_keyblob(type); end", "def get_object(id)\n return nil unless (blob = find_blob(id)) && (obj = blob.read_object(id))\n deserialize(obj)\n end", "def read_object\n if @read_object\n @read_object\n else\n warn \"No read_object info has been defined for this reader.\"\n end\n end", "def read(str_or_io)\n if str_or_io.respond_to? :read\n io = str_or_io\n else\n io = StringIO.new(force_binary(str_or_io.to_s))\n end\n return self if io.eof?\n\n self[:type].read io.read(4)\n self[:block_len].read io.read(4)\n self[:interface_id].read io.read(4)\n self[:tsh].read io.read(4)\n self[:tsl].read io.read(4)\n self[:cap_len].read io.read(4)\n self[:orig_len].read io.read(4)\n self[:data].read io.read(self[:cap_len].to_i)\n data_pad_len = (4 - (self[:cap_len].to_i % 4)) % 4\n io.read data_pad_len\n options_len = self[:block_len].to_i - self[:cap_len].to_i - data_pad_len\n options_len -= MIN_SIZE\n self[:options].read io.read(options_len)\n self[:block_len2].read io.read(4)\n\n unless self[:block_len].to_i == self[:block_len2].to_i\n raise InvalidFileError, 'Incoherency in Extended Packet Block'\n end\n \n self\n end", "def marshal_load(serialised); end", "def get_object(id)\n path = object_path(id)\n\n if File.exists?(path)\n buf = open(path, \"rb\") { |f| f.read }\n\n raise \"not a loose object: #{id}\" if not legacy_loose_object?(buf)\n\n header, content = Zlib::Inflate.inflate(buf).split(/\\0/, 2)\n type, size = header.split(/ /, 2)\n\n raise \"bad object: #{id}\" if content.length != size.to_i\n else\n content, type = get_object_from_pack(id)\n end\n\n return type, content\n end", "def bdecode\n @index = 0\n data = []\n while @index < self.length\n data << case self[@index]\n when /\\d/\n decode_str\n when 'l'\n decode_list\n when 'i'\n decode_int\n when 'd'\n decode_dict\n else\n raise ArgumentError, \"Cannot bdecode invalid string.\"\n end\n @index += 1\n end\n @index = 0\n data.length > 1 ? data : data[0]\n end", "def decode(bytes)\n raise NotImplementedError, \"#{self.class.name}\\#decode\"\n end", "def decode_val( encoding, size, io )\n # plain string\n if encoding == Protocol::ENCODINGS[:plain]\n io.read_unpacked size, 'a' + size.to_s\n # number\n elsif encoding == Protocol::ENCODINGS[:number]\n io.read_unpacked size, size == 4 ? 'l<' : 'q<'\n else\n raise 'Unknown data encoding.'\n end\n end", "def read(object, attribute, ivar = T.unsafe(nil)); end", "def decode(object)\n Resque.decode(object)\n end", "def decode!(data)\n @value, @types, @rest = self.decode(data)\n end", "def read(bytes)\n raise \"read(bytes) must be overridden\"\n end", "def read_binary(file); end", "def convert_to_native_type(data_type, s)\r\n return kb_nil if s == KB_NIL\r\n\r\n # I added this line to keep KBTable#import_csv working after I made\r\n # the kb_nil changes.\r\n return nil if s.nil?\r\n\r\n case data_type\r\n when :String\r\n if s =~ UNENCODE_RE\r\n return s.gsub('&linefeed;', \"\\n\").gsub('&carriage_return;',\r\n \"\\r\").gsub('&substitute;', \"\\032\").gsub('&pipe;', \"|\"\r\n ).gsub('&amp;', \"&\")\r\n else\r\n return s\r\n end\r\n when :Integer\r\n return s.to_i\r\n when :Float\r\n return s.to_f\r\n when :Boolean\r\n if ['false', 'False', nil, false].include?(s)\r\n return false\r\n else\r\n return true\r\n end\r\n when :Time\r\n return Time.parse(s) \r\n when :Date\r\n return Date.parse(s)\r\n when :DateTime\r\n return DateTime.parse(s)\r\n when :YAML\r\n # This code is here in case the YAML field is the last\r\n # field in the record. Because YAML normally defines a\r\n # nil value as \"--- \", but KirbyBase strips trailing\r\n # spaces off the end of the record, so if this is the\r\n # last field in the record, KirbyBase will strip the\r\n # trailing space off and make it \"---\". When KirbyBase\r\n # attempts to convert this value back using to_yaml,\r\n # you get an exception.\r\n if s == \"---\"\r\n return nil\r\n elsif s =~ UNENCODE_RE\r\n y = s.gsub('&linefeed;', \"\\n\").gsub('&carriage_return;',\r\n \"\\r\").gsub('&substitute;', \"\\032\").gsub('&pipe;', \"|\"\r\n ).gsub('&amp;', \"&\")\r\n return YAML.load(y)\r\n else\r\n return YAML.load(s)\r\n end\r\n when :Memo\r\n memo = KBMemo.new(@tbl.db, s)\r\n memo.read_from_file\r\n return memo\r\n when :Blob\r\n blob = KBBlob.new(@tbl.db, s)\r\n blob.read_from_file\r\n return blob\r\n else\r\n raise \"Invalid field type: %s\" % data_type\r\n end\r\n end", "def decode(input, type = Raw)\n decode_with_type(input, type)\n end", "def from data\n obj = new\n obj.decode data\n obj\n end", "def deserialize(arg)\n raise NotImplementedError\n end", "def deserialize binary\n data = binary.unpack(BINARY_FORMAT)\n if data[0].zero? && data[1].zero? && data[3] == 1 && data[5] == 2\n TraceContextData.new data[2], data[4], data[6]\n else\n nil\n end\n end", "def read(str)\n if self.class == Browser\n return self if str.nil?\n\n PacketGen.force_binary str\n self[:opcode].read str[0]\n\n opcode_klass = Browser.const_get(self[:opcode].to_human) if Browser.const_defined?(self[:opcode].to_human)\n if opcode_klass\n opcode_klass.new.read str\n else\n private_read str\n end\n else\n private_read str\n end\n end", "def decode\n transform :decode\n end", "def bdecode\n BEncode.load(self)\n end", "def read_objects(file, objects)\n objects.each do |data_type|\n num = DataNumber.new.read(file).data\n\n # use i to indentify the type of object.\n num.times do ||\n _obj = data_type.new.read(file)\n end\n end\n end", "def read(str)\n parse(str, ber: true)\n self\n end", "def decode(object)\n return unless object\n\n begin\n JSON.load object\n rescue JSON::ParserError => e\n raise DecodeException, e.message, e.backtrace\n end\n end", "def read_binary_object_at(fname,fd,pos)\n position = @offsets[pos]\n fd.seek(position,IO::SEEK_SET)\n return read_binary_object(fname,fd)\n end", "def unpack(data); end", "def read(str)\n if self.instance_of?(DUID)\n super\n case type\n when 1\n DUID_LLT.new.read(str)\n when 2\n DUID_EN.new.read(str)\n when 3\n DUID_LL.new.read(str)\n else\n self\n end\n else\n private_read str\n end\n end", "def read(cursor, field_length)\n cursor.name(@data_type.name) { cursor.read_bytes(field_length) }\n end", "def parse_ber_object(syntax, id, data)\n # Find the object type from either the provided syntax lookup table or\n # the built-in syntax lookup table.\n #\n # This exceptionally clever bit of code is verrrry slow.\n object_type = (syntax && syntax[id]) || BuiltinSyntax[id]\n\n # == is expensive so sort this so the common cases are at the top.\n if object_type == :string\n s = Net::BER::BerIdentifiedString.new(data || \"\")\n s.ber_identifier = id\n s\n elsif object_type == :integer\n neg = !(data.unpack(\"C\").first & 0x80).zero?\n int = 0\n\n data.each_byte do |b|\n int = (int << 8) + (neg ? 255 - b : b)\n end\n\n if neg\n (int + 1) * -1\n else\n int\n end\n elsif object_type == :oid\n # See X.690 pgh 8.19 for an explanation of this algorithm.\n # This is potentially not good enough. We may need a\n # BerIdentifiedOid as a subclass of BerIdentifiedArray, to\n # get the ber identifier and also a to_s method that produces\n # the familiar dotted notation.\n oid = data.unpack(\"w*\")\n f = oid.shift\n g = if f < 40\n [0, f]\n elsif f < 80\n [1, f - 40]\n else\n # f - 80 can easily be > 80. What a weird optimization.\n [2, f - 80]\n end\n oid.unshift g.last\n oid.unshift g.first\n # Net::BER::BerIdentifiedOid.new(oid)\n oid\n elsif object_type == :array\n seq = Net::BER::BerIdentifiedArray.new\n seq.ber_identifier = id\n sio = StringIO.new(data || \"\")\n # Interpret the subobject, but note how the loop is built:\n # nil ends the loop, but false (a valid BER value) does not!\n while (e = sio.read_ber(syntax)) != nil\n seq << e\n end\n seq\n elsif object_type == :boolean\n data != \"\\000\"\n elsif object_type == :null\n n = Net::BER::BerIdentifiedNull.new\n n.ber_identifier = id\n n\n else\n raise Net::BER::BerError, \"Unsupported object type: id=#{id}\"\n end\n end", "def read_data\n unpacker.read\n end", "def read(net_record)\n # Detects the type of record received from AC based on the size\n case net_record[:bytesize]\n when 408\n handle_handshake_response(net_record)\n when 328\n handle_rtcarinfo(net_record)\n when 212\n handle_rtlap(net_record)\n else\n nil\n end\n end", "def read_type(field_info)\n # if field_info is a Fixnum, assume it is a Thrift::Types constant\n # convert it into a field_info Hash for backwards compatibility\n if field_info.is_a? Fixnum\n field_info = {:type => field_info}\n end\n\n case field_info[:type]\n when Types::BOOL\n read_bool\n when Types::BYTE\n read_byte\n when Types::DOUBLE\n read_double\n when Types::I16\n read_i16\n when Types::I32\n read_i32\n when Types::I64\n read_i64\n when Types::STRING\n if field_info[:binary]\n read_binary\n else\n read_string\n end\n else\n raise NotImplementedError\n end\n end", "def parse_item stream, encoding = nil\n decode read_item(stream)[:payload], encoding\n end", "def decode_blob blob\n if not String === blob\n raise ArgumentError, 'Blob should be a string'\n end\n\n if blob[0, 4] != 'TFBB'\n raise ArgumentError, 'Blob doesn\\'t seem to be base64 encoded'\n end\n\n decode_base64 blob\n end", "def load(data)\n code, hash = MessagePack.unpack(data)\n CODE_TO_CLASS[code].new(decode_hash(hash).symbolize_keys)\n rescue MessagePack::UnpackError => e\n _log.warn { \"Failed to decode message\" }\n _log_exception(e)\n Models::Message::Garbled.new\n end", "def read\nend", "def get_next_raw( object )\n sys_mem( object.get_type , 1)\n end", "def read(io)\n data = self.new\n data.read(io)\n data.single_value? ? data.value : data\n end", "def load_rb(filename); end", "def deserialize(message, stream)\n raise NotImplementedError\n end", "def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend", "def read(str)\n return unless str\n force_binary(str)\n self[:timestamp].read str[0,8]\n self[:incl_len].read str[8,4]\n self[:orig_len].read str[12,4]\n self[:data].read str[16,self[:incl_len].to_i]\n self\n end", "def decode(object)\n return unless object\n\n begin\n ::MultiJson.decode(object)\n rescue ::MultiJson::DecodeError => e\n raise DecodeException, e.message, e.backtrace\n end\n end", "def decoded\n if @stream\n if @str.respond_to?(:rewind)\n @str.rewind\n end\n @str.read\n else\n @str\n end\n end", "def data; Marshal.load(Base64.decode64(read_attribute(:data))); end", "def read(str_or_io)\n io = to_io(str_or_io)\n return self if io.eof?\n\n self[:type].read io.read(4)\n self[:block_len].read io.read(4)\n self[:interface_id].read io.read(4)\n self[:tsh].read io.read(4)\n self[:tsl].read io.read(4)\n self[:cap_len].read io.read(4)\n self[:orig_len].read io.read(4)\n self[:data].read io.read(self.cap_len)\n data_pad_len = (4 - (self[:cap_len].to_i % 4)) % 4\n io.read data_pad_len\n options_len = self.block_len - self.cap_len - data_pad_len\n options_len -= MIN_SIZE\n self[:options].read io.read(options_len)\n self[:block_len2].read io.read(4)\n\n check_len_coherency\n self\n end", "def deserialize(value)\n cast(value)\n end", "def read(str)\n PacketGen.force_binary(str)\n io = StringIO.new(str)\n parse_section(io)\n self\n end", "def read_external(in_stream)\n # fieldNumber = in.readShort ();\n # value = in.readUTF();\n end" ]
[ "0.7598876", "0.6863633", "0.6685689", "0.66833586", "0.65031505", "0.64321953", "0.64161086", "0.63541293", "0.6300766", "0.6239332", "0.62110823", "0.6168578", "0.61405313", "0.6116484", "0.60989505", "0.6098249", "0.6062003", "0.5992228", "0.5992228", "0.59890467", "0.5972392", "0.59612966", "0.59597653", "0.5956444", "0.5954355", "0.59375125", "0.5933331", "0.5919769", "0.59141344", "0.59060776", "0.5883749", "0.5877743", "0.58660984", "0.585684", "0.58397955", "0.58347386", "0.5834281", "0.58140403", "0.58117676", "0.58117676", "0.58117676", "0.58117676", "0.58117676", "0.58117676", "0.58117676", "0.5806992", "0.57940525", "0.5792542", "0.57763857", "0.576098", "0.576065", "0.5747117", "0.5736571", "0.57207286", "0.57186496", "0.56987643", "0.56877154", "0.5668167", "0.5666963", "0.5666462", "0.56587046", "0.56529033", "0.56485325", "0.56481475", "0.56433624", "0.5633137", "0.56312805", "0.56280714", "0.56125826", "0.5598328", "0.55924296", "0.5584523", "0.55825603", "0.55821097", "0.5576514", "0.5574297", "0.55693597", "0.556382", "0.5562257", "0.55597824", "0.5558661", "0.5557738", "0.5555081", "0.55370647", "0.5536089", "0.5534827", "0.5513905", "0.5496675", "0.54962647", "0.54955584", "0.54879504", "0.548528", "0.5483141", "0.54769975", "0.5473064", "0.5466466", "0.54541445", "0.54512477", "0.54288906", "0.5427396" ]
0.7098113
1
Read an object type byte at position $pos, decode it and delegate to the correct reader function
def read_binary_object_at(fname,fd,pos) position = @offsets[pos] fd.seek(position,IO::SEEK_SET) return read_binary_object(fname,fd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read\n read_object(read_byte)\n end", "def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n if(object_type != \"0\" && object_length == 15) then\n object_length = read_binary_object(fname,fd)\n object_length = object_length.value\n end\n\n retval = nil\n case object_type\n when '0' then # null, false, true, fillbyte\n retval = read_binary_null_type(object_length)\n when '1' then # integer\n retval = read_binary_int(fname,fd,object_length)\n when '2' then # real\n retval = read_binary_real(fname,fd,object_length)\n when '3' then # date\n retval = read_binary_date(fname,fd,object_length)\n when '4' then # data\n retval = read_binary_data(fname,fd,object_length)\n when '5' then # byte string, usually utf8 encoded\n retval = read_binary_string(fname,fd,object_length)\n when '6' then # unicode string (utf16be)\n retval = read_binary_unicode_string(fname,fd,object_length)\n when 'a' then # array\n retval = read_binary_array(fname,fd,object_length)\n when 'd' then # dictionary\n retval = read_binary_dict(fname,fd,object_length)\n end\n\n return retval\n end", "def read\n Typelib.to_ruby(raw_read)\n end", "def read(pos)\n end", "def readObject\n raise NotImplementedError, <<-STR\n\n \\e[91m\n I'm afraid this might not work.\n > you need access to the original class definitions (and a)\n > Java runtime to load them into) to turn the stream data back\n > something approaching the original objects.\n \\e[0m\n STR\n end", "def read_byte; end", "def recover_object\n # Up to the tab is the amount of bytes to read\n demarshal_bytes = @io.gets(\"\\t\").to_i\n \n # When at end of IO return nil\n raise NothingToRecover if demarshal_bytes.zero?\n \n blob = @io.read(demarshal_bytes)\n demarshal_object(blob)\n end", "def parse(type, io, shb)\n block = guess_block_type(type).new(endian: shb.endian)\n classify_block shb, block\n block.read(io)\n end", "def read\n if sample = raw_read\n Typelib.to_ruby(sample)\n end\n end", "def read_from_current_object(bytes)\n bytes_left = current_object.size - @current_object_offset\n\n if bytes_left > bytes\n data = current_object.value.slice(@current_object_offset, bytes)\n @current_object_offset += bytes\n elsif bytes_left <= bytes\n data = current_object.value.slice(@current_object_offset, bytes_left)\n @current_object_idx += 1\n @current_object_offset = 0\n end\n return data\n end", "def read(record, cursor)\n return :NULL if null?(record)\n cursor.name(type.name) { type.reader.read(record, cursor, length(record)) }\n end", "def _read_type(length, typename)\n bytes = @io.read(length)\n\n raise EOFError, \"Unexpected EOF reading #{typename}\" \\\n if bytes.nil? || bytes.length != length\n\n bytes\n end", "def read_binary\n raise NotImplementedError\n end", "def read\n if sample = raw_read\n return Typelib.to_ruby(sample)\n end\n end", "def read(io)\n begin\n while object = Marshal.load(io)\n type, id, attrs = object\n feed type, id, attrs\n end\n rescue EOFError\n end\n end", "def get_obj(type_tag)\n if id = OBJECT_READER_MAP[type_tag]\n return self.send(id)\n end\n raise OSC::ParseError, \"invalid type tag\"\n end", "def read(io)\n @record_class.read(io)\n end", "def read_at (pos)\r\n @data[pos]\r\n end", "def read() end", "def read_data(type, position, buffer = nil)\n if buffer.nil?\n buffer = memread(position, sizeof_type(type))\n position = 0\n end\n\n # If we're asked to read a data structure, deligate to read_struct\n if is_struct_type?(type)\n return read_struct(type, buffer, position)\n end\n\n # If the type is an array with a given size...\n # BYTE[3] for example or BYTE[ENCRYPTED_PWLEN] or even PDWORD[23]\n if is_array_type?(type)\n # Separate the element type from the size of the array\n element_type, length = split_array_type(type)\n\n # Have read_array take care of the rest\n return read_array(element_type, length, position, buffer)\n end\n\n size = sizeof_type(type)\n raw = memread(position, size, buffer)\n\n # read/unpack data for the types we have hard-coded support for\n case type\n when :LPWSTR\n # null-terminated string of 16-bit Unicode characters\n return read_wstring(read_pointer(raw))\n when :DWORD\n # Both on x86 and x64, DWORD is 32 bits\n return raw.unpack('V').first\n when :BOOL\n return raw.unpack('V').first == 1\n when :LONG\n return raw.unpack('V').first\n end\n\n #If nothing worked thus far, return it raw\n return raw\n end", "def read_object\n # Incrementally parse next object.\n begin\n while not @object\n @sock.readpartial(MAX_READ_CHUNK, @inbuf)\n @parser << @inbuf\n PennJSON_Conversation.do_clear(@inbuf)\n end\n rescue Yajl::ParseError\n PennJSON.panic 'Malformed protocol message.'\n rescue EOFError\n raise SystemExit, 'Remote closed connection.'\n end\n\n # Fetch parsed object. Could make this a queue, I suppose.\n result = @object\n @object = nil\n return result\n end", "def read(type = :byte, opt = { signed: false, mutation: :STD, order: :BIG })\n return unless RuneRb::Network::Message.validate(self, :read, opt)\n\n case type\n when *RW_TYPES[:byte] then read_byte(opt[:signed] || false, opt[:mutation] || :STD)\n when *RW_TYPES[:short] then read_short(opt[:signed] || false, opt[:mutation] || :STD, opt[:order] || :BIG)\n when *RW_TYPES[:medium] then read_medium(opt[:signed] || false, opt[:mutation] || :STD, opt[:order] || :BIG)\n when *RW_TYPES[:int] then read_int(opt[:signed] || false, opt[:mutation] || :STD, opt[:order] || :BIG)\n when *RW_TYPES[:long] then read_long(opt[:signed] || false, opt[:mutation] || :STD, opt[:order] || :BIG)\n when *RW_TYPES[:string] then read_string\n when :bytes then read_bytes(opt[:amount], opt[:mutation])\n when :reverse_bytes, :negative_bytes, :reverse, :negatives then read_bytes_reverse(opt[:amount] || opt[:length], opt[:mutation])\n when :io, :socket then read_from(opt[:io] || opt[:source] || opt[:socket], opt[:length])\n when :header then read_header(opt[:source])\n else raise \"Unrecognized read type! #{type}\"\n end\n end", "def read()\n size_a = @stream.read 2\n size = Common.decode_u16(size_a)\n data = @stream.read size\n\n data = MessagePack.unpack data\n class_ = Common.packet_from_id data[0]\n class_.new *data[1][0]\n end", "def read(cursor, field_length)\n cursor.name(@data_type.name) { cursor.read_bytes(field_length) }\n end", "def readbyte\n end", "def read(sz)\n raise NotImplementedError\n end", "def decode_with_type(s, type)\n s = StringIO.new(s) if s.is_a?(String)\n if type == Integer\n item = s.read(1)\n if item.nil?\n raise InvalidError.new \"invalid Integer value nil\"\n elsif item == \"\\x80\".b || item.empty?\n 0\n elsif item.ord < 0x80\n item.ord\n else\n size = item[0].ord - 0x80\n Ciri::Utils.big_endian_decode(s.read(size))\n end\n elsif type == Bool\n item = s.read(1)\n if item == Bool::ENCODED_TRUE\n true\n elsif item == Bool::ENCODED_FALSE\n false\n else\n raise InvalidError.new \"invalid bool value #{item}\"\n end\n elsif type.is_a?(Class) && type.respond_to?(:rlp_decode)\n type.rlp_decode(s)\n elsif type.is_a?(Array)\n decode_list(s) do |list, s2|\n i = 0\n until s2.eof?\n t = type.size > i ? type[i] : type[-1]\n list << decode_with_type(s2, t)\n i += 1\n end\n end\n elsif type == Bytes\n str = decode_stream(s)\n raise RLP::InvalidError.new \"decode #{str.class} from Bytes\" unless str.is_a?(String)\n str\n elsif type == List\n list = decode_stream(s)\n raise RLP::InvalidError.new \"decode #{list.class} from List\" unless list.is_a?(Array)\n list\n elsif type == Raw\n decode_stream(s)\n else\n raise RLP::InvalidError.new \"unknown type #{type}\"\n end\n rescue\n error \"when decoding #{s} into #{type}\"\n raise\n end", "def get_next_raw( object )\n sys_mem( object.get_type , 1)\n end", "def read(str_or_io)\n io = to_io(str_or_io)\n return self if io.eof?\n\n self[:type].read io.read(4)\n self[:block_len].read io.read(4)\n self[:orig_len].read io.read(4)\n data_len = compute_data_len\n self[:data].read io.read(data_len)\n remove_padding(io, data_len)\n read_blocklen2_and_check(io)\n\n self.type ||= PcapNG::IDB_TYPE.to_i\n self\n end", "def read_object\n if @version == 0\n return amf0_deserialize\n else\n return amf3_deserialize\n end\n end", "def decode(binary); ::BSON.deserialize(binary); end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def demarshal_object(blob)\n Marshal.load(blob)\n end", "def read_struct_data(bytes)\n self.class.set_values_from_byte_to_object(bytes, self)\n end", "def read(str_or_io)\n if str_or_io.respond_to? :read\n io = str_or_io\n else\n io = StringIO.new(force_binary(str_or_io.to_s))\n end\n return self if io.eof?\n\n self[:type].read io.read(4)\n self[:block_len].read io.read(4)\n self[:interface_id].read io.read(4)\n self[:tsh].read io.read(4)\n self[:tsl].read io.read(4)\n self[:cap_len].read io.read(4)\n self[:orig_len].read io.read(4)\n self[:data].read io.read(self[:cap_len].to_i)\n data_pad_len = (4 - (self[:cap_len].to_i % 4)) % 4\n io.read data_pad_len\n options_len = self[:block_len].to_i - self[:cap_len].to_i - data_pad_len\n options_len -= MIN_SIZE\n self[:options].read io.read(options_len)\n self[:block_len2].read io.read(4)\n\n unless self[:block_len].to_i == self[:block_len2].to_i\n raise InvalidFileError, 'Incoherency in Extended Packet Block'\n end\n \n self\n end", "def read_and_unpack(length, format)\n if @io.pos + length - 1 < @io.length\n return @io.read(length).unpack(format)\n end\n\n nil\n end", "def read(bytes = @length)\n return nil if @pos >= @length\n bytes = @length - @pos if bytes.nil?\n bytes = @length - @pos if @pos + bytes > @length\n\n out = @data[@pos, bytes] if @data.kind_of?(String)\n out = @data.read(bytes) if @data.kind_of?(NTFS::DataRun)\n\n @pos += out.size\n out\n end", "def read_type(field_info)\n # if field_info is a Fixnum, assume it is a Thrift::Types constant\n # convert it into a field_info Hash for backwards compatibility\n if field_info.is_a? Fixnum\n field_info = {:type => field_info}\n end\n\n case field_info[:type]\n when Types::BOOL\n read_bool\n when Types::BYTE\n read_byte\n when Types::DOUBLE\n read_double\n when Types::I16\n read_i16\n when Types::I32\n read_i32\n when Types::I64\n read_i64\n when Types::STRING\n if field_info[:binary]\n read_binary\n else\n read_string\n end\n else\n raise NotImplementedError\n end\n end", "def read(object, attribute, ivar = T.unsafe(nil)); end", "def read_from_pos(position, length)\n self.old_seek(position)\n data = self.old_read(length)\n self.old_seek(position)\n\n data\n end", "def read(position)\n @file.seek(position)\n size = @file.readbytes(4).unpack('N').first\n @file.readbytes(size)\n end", "def decode_val( encoding, size, io )\n # plain string\n if encoding == Protocol::ENCODINGS[:plain]\n io.read_unpacked size, 'a' + size.to_s\n # number\n elsif encoding == Protocol::ENCODINGS[:number]\n io.read_unpacked size, size == 4 ? 'l<' : 'q<'\n else\n raise 'Unknown data encoding.'\n end\n end", "def read_object\n if @read_object\n @read_object\n else\n warn \"No read_object info has been defined for this reader.\"\n end\n end", "def object (ref, save_pos = true)\n return ref unless ref.kind_of?(Reference)\n pos = @buffer.pos_without_buf if save_pos\n obj = Parser.new(@buffer.seek(offset_for(ref)), self).object(ref.id, ref.gen)\n @buffer.seek(pos) if save_pos\n return obj\n end", "def read(input)\n input = StringIO.new(input) if input.kind_of? ::String\n @offset = input.pos\n\n if @until\n loop {\n @values << field = @type.new(endian: @endian, parent: @parent)\n field.read_io input\n break if field.send(@until)\n }\n else\n @values ||= ::Array.new(length) { @type.new(endian: @endian, parent: @parent) }\n @values.each {|field|\n field.read_io input\n }\n end\n\n @size = input.pos - @offset\n end", "def read(bytes)\n raise \"read(bytes) must be overridden\"\n end", "def decode(payload)\n Oj.load payload\n end", "def load_marshal_data object # :nodoc:\n object.load\n rescue NameError, ArgumentError => e\n DRb::DRbUnknown.new e, object.stream\n end", "def get_object(offset)\n io = to_shm_io\n io.seek(offset)\n Marshal.load(io)\n end", "def reader; end", "def read_property_binary f, type, index_type=false, element_type=false\n # print \"reading one #{type}: \"\n # pick String#unpack specifiers based on our endian-ness\n case @format\n when \"binary_big_endian\"\n e, f32, f64 = \">\", \"g\", \"G\"\n when \"binary_little_endian\"\n e, f32, f64 = \"<\", \"e\", \"E\"\n end\n case type\n when \"char\", \"int8\"\n f.read(1).unpack(\"c\").first\n when \"uchar\", \"uint8\"\n f.read(1).unpack(\"C\").first\n when \"short\", \"int16\"\n f.read(2).unpack(\"s#{e}\").first\n when \"ushort\", \"uint16\"\n f.read(2).unpack(\"S#{e}\").first\n when \"int\", \"int32\"\n f.read(4).unpack(\"l#{e}\").first\n when \"uint\", \"uint32\"\n f.read(4).unpack(\"L#{e}\").first\n when \"float\", \"float32\"\n f.read(4).unpack(f32).first\n when \"double\", \"float64\"\n f.read(8).unpack(f64).first\n when \"list\"\n count = read_property_binary(f, index_type)\n count.times.collect { read_property_binary(f, element_type) }\n end\n end", "def read(io, proc = nil)\t# :yields: track, num_tracks, index\n reader = @reader_class.new(self, block_given?() ? Proc.new() : proc)\n reader.read_from(io)\n end", "def unpack(binary)\n end", "def read_abs(size, pos)\n @data.byteslice(pos, size)\n end", "def read\n @fileobj.seek @data_offset\n @data = @fileobj.read @data_size\n end", "def decode\n raise NotImplementedError\n end", "def read_keyblob(type); end", "def read_packet; end", "def read\n raise NotImplementedError\n end", "def read(str)\n if self.instance_of?(DUID)\n super\n case type\n when 1\n DUID_LLT.new.read(str)\n when 2\n DUID_EN.new.read(str)\n when 3\n DUID_LL.new.read(str)\n else\n self\n end\n else\n private_read str\n end\n end", "def deserialize(bytes)\n raise \"Invalid byte count: #{bytes}. Expected length of #{length}\" if bytes.length != length\n deserialize_implementation(bytes)\n end", "def read\nend", "def read\n @storage = {}\n scan\n apply_overrides\n\n OpenStruct.new(@storage)\n end", "def get_object(id)\n path = object_path(id)\n\n if File.exists?(path)\n buf = open(path, \"rb\") { |f| f.read }\n\n raise \"not a loose object: #{id}\" if not legacy_loose_object?(buf)\n\n header, content = Zlib::Inflate.inflate(buf).split(/\\0/, 2)\n type, size = header.split(/ /, 2)\n\n raise \"bad object: #{id}\" if content.length != size.to_i\n else\n content, type = get_object_from_pack(id)\n end\n\n return type, content\n end", "def read(str_or_io)\n io = to_io(str_or_io)\n return self if io.eof?\n\n self[:type].read io.read(4)\n self[:block_len].read io.read(4)\n self[:interface_id].read io.read(4)\n self[:tsh].read io.read(4)\n self[:tsl].read io.read(4)\n self[:cap_len].read io.read(4)\n self[:orig_len].read io.read(4)\n self[:data].read io.read(self.cap_len)\n data_pad_len = (4 - (self[:cap_len].to_i % 4)) % 4\n io.read data_pad_len\n options_len = self.block_len - self.cap_len - data_pad_len\n options_len -= MIN_SIZE\n self[:options].read io.read(options_len)\n self[:block_len2].read io.read(4)\n\n check_len_coherency\n self\n end", "def read(offset, len)\n _isource.read(offset, len)\n end", "def read_objects(file, objects)\n objects.each do |data_type|\n num = DataNumber.new.read(file).data\n\n # use i to indentify the type of object.\n num.times do ||\n _obj = data_type.new.read(file)\n end\n end\n end", "def read_attr(anno, res, col, offset = 0)\n if anno[:class].ancestor? Integer\n self.class.parse_int(res[col + offset])\n elsif anno[:class].ancestor? Float\n self.class.parse_float(res[col + offset])\n elsif anno[:class].ancestor? String\n res[col + offset]\n elsif anno[:class].ancestor? Time\n self.class.parse_timestamp(res[col+ offset])\n elsif anno[:class].ancestor? Date\n self.class.parse_date(res[col + offset])\n elsif anno[:class].ancestor? TrueClass\n self.class.parse_boolean(res[col + offset])\n elsif anno[:class].ancestor? Og::Blob\n self.class.parse_blob(res[col + offset])\n else\n if res[col+offset].nil? or res[col+offset].empty?\n return nil\n else\n return YAML::load(res[col + offset])\n end\n end\n end", "def load_dataE(filename)\r\n Log.ger.debug('Read '+filename)\r\n File.open(filename, \"rb\") { |f|\r\n obj = Marshal.load(f)\r\n }\r\nend", "def read(str)\n if self.class == Browser\n return self if str.nil?\n\n PacketGen.force_binary str\n self[:opcode].read str[0]\n\n opcode_klass = Browser.const_get(self[:opcode].to_human) if Browser.const_defined?(self[:opcode].to_human)\n if opcode_klass\n opcode_klass.new.read str\n else\n private_read str\n end\n else\n private_read str\n end\n end", "def read_packed(io, options)\n if method_defined? :read_packed\n mandatory = instance_method(:initialize).arity\n mandatory = -1-mandatory if mandatory < 0\n obj = new(*[nil]*mandatory)\n obj.read_packed(io, options)\n obj\n else\n len = options[:bytes]\n s = len ? io.read_exactly(len) : io.read\n unpack_string(s, options) unless s.nil?\n end\n end", "def parse_data(raw_str, data_type, byte_size=nil)\n\n $test_logger.log(\"Parse data\")\n\n data_value = nil\n #d \"Parse \\nraw=#{raw_str}\\ntype=#{data_type}\\nsize=#{byte_size}\"\n\n #Hex data\n if data_type == DataType::HEX\n data_value = get_byte_str raw_str\n\n #String (ASCII) data\n elsif data_type == DataType::STR || data_type == DataType::STR_WITH_NULL\n #Removed strip as null character at the end of string is OK to have in XML\n data_value = raw_str\n\n #Decimal data (Little endian)\n elsif data_type == DataType::DEC\n case byte_size\n when 1\n data_value = raw_str.bytes.first\n when 2\n #v=little-endian\n data_value = raw_str.unpack(\"v\").first\n when 3..4\n #Changed to V from N on 21Jan13\n data_value = raw_str.unpack(\"V\").first\n else\n data_value = raw_str.unpack(\"Q\").first\n end\n\n #Decimal data (Big endian)\n elsif data_type == DataType::DEC_BIG\n case byte_size\n when 1\n data_value = raw_str.bytes.first\n when 2\n #n=big-endian\n data_value = raw_str.unpack(\"n\").first\n when 3..4\n #Changed to V from N on 21Jan13\n data_value = raw_str.unpack(\"N\").first\n else\n data_value = raw_str.unpack(\"Q\").first\n end\n #Not matching with any data types then get hex\n else\n data_value = get_byte_str(raw_str)\n end\n\n data_value\n end", "def _do_read(io)\n instantiate_all\n @field_objs.each { |f| f.do_read(io) }\n end", "def object_wrapper(name, object_class, schema, hooks = {})\n if hooks[:new]\n read_body = \"r = #{name}_newhook(#{name}_class);\"\n else\n read_body = \"r = #{name}_class.new;\"\n end \n\n to_body = \"r = [];\"\n to_body << \"value = #{name}_tohook(value);\" if hooks[:to]\n \n readlen_body = \"old_offset = offset;\"\n \n 0.upto schema.length / 2 - 1 do |i|\n abi_type = schema[i * 2]\n type_mapping = schema[i * 2 + 1]\n \n # Set up the translation table.\n if type_mapping.nil?\n type_mapping = {}\n components = @target.send :\"#{abi_type}_components\"\n components.each { |c| type_mapping[c] = c }\n end\n \n # Set up the read_ and read_name_length methods.\n if abi_type.kind_of? Symbol\n read_body << \"v = read_#{abi_type}(array,offset);\"\n else\n read_body << \"v = #{abi_type.inspect};\"\n end \n case type_mapping\n when Symbol\n read_body << \"r.#{type_mapping} = v;\"\n when Hash, nil \n type_mapping.each do |k, v|\n read_body << \"r.#{v} = v[:#{k}];\"\n end\n end\n if abi_type.kind_of? Symbol\n if @target.respond_to? :\"#{abi_type}_length\"\n read_body << \"offset += #{@target.send :\"#{abi_type}_length\"};\"\n readlen_body << \"offset += #{@target.send :\"#{abi_type}_length\"};\"\n elsif @target.respond_to? :\"read_#{abi_type}_length\"\n read_body << \"offset += read_#{abi_type}_length(array,offset);\" \n readlen_body << \"offset += read_#{abi_type}_length(array,offset);\" \n else\n raise \"#{abi_type} doesn't support _length or read_#{abi_type}_length\"\n end\n end\n \n # Set up the to_ method.\n next unless abi_type.kind_of? Symbol\n to_body << \"r += to_#{abi_type}(\"\n case type_mapping\n when Symbol\n to_body << \"value.#{type_mapping}\"\n when Hash\n to_body << type_mapping.map { |k, v| \":#{k} => value.#{v}\" }.join(', ')\n end\n to_body << \");\"\n end\n read_body << \"r = self.#{name}_readhook(r);\" if hooks[:read]\n read_body << \"r;\"\n to_body << \"r;\"\n readlen_body << \"offset - old_offset;\"\n\n define_str = \"def read_#{name}(array,offset);#{read_body}end;\"\n define_str << \"def read_#{name}_length(array,offset);#{readlen_body}end;\"\n define_str << \"def to_#{name}(value);#{to_body}end;\"\n \n defines = Proc.new do \n define_method(:\"#{name}_class\") { object_class }\n define_method(:\"#{name}_newhook\", &hooks[:new]) if hooks[:new] \n define_method(:\"#{name}_readhook\", &hooks[:read]) if hooks[:read]\n define_method(:\"#{name}_tohook\", &hooks[:to]) if hooks[:to] \n end\n \n @target.class_eval(&defines)\n @target.class_eval define_str\n (class << @target; self; end).module_eval(&defines)\n (class << @target; self; end).module_eval define_str\n end", "def read_byte(data, offset)\n out = data[offset,1].unpack('C').first rescue 0\n return out\n end", "def read(str)\n return unless str\n force_binary(str)\n self[:timestamp].read str[0,8]\n self[:incl_len].read str[8,4]\n self[:orig_len].read str[12,4]\n self[:data].read str[16,self[:incl_len].to_i]\n self\n end", "def bdecode\n @index = 0\n data = []\n while @index < self.length\n data << case self[@index]\n when /\\d/\n decode_str\n when 'l'\n decode_list\n when 'i'\n decode_int\n when 'd'\n decode_dict\n else\n raise ArgumentError, \"Cannot bdecode invalid string.\"\n end\n @index += 1\n end\n @index = 0\n data.length > 1 ? data : data[0]\n end", "def readbyte\n getbyte || raise(EOFError)\n end", "def deserialize(istream)\n raise BioInterchange::Exceptions::ImplementationReaderError, 'You must implement this method, which reads data from an input stream and returns an object model instance.'\n end", "def deserialize binary\n data = binary.unpack(BINARY_FORMAT)\n if data[0].zero? && data[1].zero? && data[3] == 1 && data[5] == 2\n TraceContextData.new data[2], data[4], data[6]\n else\n nil\n end\n end", "def read_object\n\t\t\t\tJSON.parse @input.readline\n\t\t\tend", "def read\n end", "def read\n end", "def read\n end", "def read\n end", "def read(io)\n data = self.new\n data.read(io)\n data.single_value? ? data.value : data\n end", "def read\n @io.rewind\n @io.read\n end", "def read(str_or_io)\n io = to_io(str_or_io)\n return self if io.eof?\n\n self[:type].read io.read(4)\n self[:block_len].read io.read(4)\n self[:body].read io.read(self[:block_len].to_i - MIN_SIZE)\n read_blocklen2_and_check(io)\n\n self\n end", "def convert_to_native_type(data_type, s)\r\n return kb_nil if s == KB_NIL\r\n\r\n # I added this line to keep KBTable#import_csv working after I made\r\n # the kb_nil changes.\r\n return nil if s.nil?\r\n\r\n case data_type\r\n when :String\r\n if s =~ UNENCODE_RE\r\n return s.gsub('&linefeed;', \"\\n\").gsub('&carriage_return;',\r\n \"\\r\").gsub('&substitute;', \"\\032\").gsub('&pipe;', \"|\"\r\n ).gsub('&amp;', \"&\")\r\n else\r\n return s\r\n end\r\n when :Integer\r\n return s.to_i\r\n when :Float\r\n return s.to_f\r\n when :Boolean\r\n if ['false', 'False', nil, false].include?(s)\r\n return false\r\n else\r\n return true\r\n end\r\n when :Time\r\n return Time.parse(s) \r\n when :Date\r\n return Date.parse(s)\r\n when :DateTime\r\n return DateTime.parse(s)\r\n when :YAML\r\n # This code is here in case the YAML field is the last\r\n # field in the record. Because YAML normally defines a\r\n # nil value as \"--- \", but KirbyBase strips trailing\r\n # spaces off the end of the record, so if this is the\r\n # last field in the record, KirbyBase will strip the\r\n # trailing space off and make it \"---\". When KirbyBase\r\n # attempts to convert this value back using to_yaml,\r\n # you get an exception.\r\n if s == \"---\"\r\n return nil\r\n elsif s =~ UNENCODE_RE\r\n y = s.gsub('&linefeed;', \"\\n\").gsub('&carriage_return;',\r\n \"\\r\").gsub('&substitute;', \"\\032\").gsub('&pipe;', \"|\"\r\n ).gsub('&amp;', \"&\")\r\n return YAML.load(y)\r\n else\r\n return YAML.load(s)\r\n end\r\n when :Memo\r\n memo = KBMemo.new(@tbl.db, s)\r\n memo.read_from_file\r\n return memo\r\n when :Blob\r\n blob = KBBlob.new(@tbl.db, s)\r\n blob.read_from_file\r\n return blob\r\n else\r\n raise \"Invalid field type: %s\" % data_type\r\n end\r\n end", "def decode; end", "def decode; end", "def read_data_byte(offset) [offset + 1, get_byte(offset)] end", "def read(str)\n read_type = str[0].unpack('C').first\n if read_type.zero?\n Pad.new.read(str)\n elsif read_type == 255\n End.new.read(str)\n elsif DHCP_OPTIONS.key?(read_type)\n Option.new(DHCP_OPTIONS[read_type][1] || {}).private_read(str)\n else\n super\n end\n end", "def read(offset, how_much)\n @stream.read(how_much)\n end" ]
[ "0.7311331", "0.6798551", "0.6503346", "0.6390284", "0.6339939", "0.6306967", "0.62698436", "0.61795175", "0.61770576", "0.6116316", "0.60945594", "0.60597056", "0.600354", "0.6000059", "0.5911306", "0.59051025", "0.58754176", "0.58548117", "0.5845684", "0.5837417", "0.5829765", "0.5819732", "0.58148247", "0.5794237", "0.57661283", "0.5730472", "0.5705962", "0.5703518", "0.5693473", "0.56340265", "0.5630777", "0.56111956", "0.56111956", "0.56111956", "0.56111956", "0.56111956", "0.56111956", "0.56111956", "0.5599824", "0.5549413", "0.5525442", "0.5522156", "0.5516178", "0.55148077", "0.55025417", "0.5499491", "0.54927325", "0.54922754", "0.54914004", "0.5465526", "0.54465264", "0.5403881", "0.54017895", "0.54004174", "0.53806883", "0.53738284", "0.537019", "0.53491175", "0.5343337", "0.5336584", "0.533391", "0.53303456", "0.5325363", "0.53213024", "0.5307337", "0.5305655", "0.5297311", "0.52949286", "0.52902067", "0.528335", "0.52769816", "0.52712905", "0.5269047", "0.52632177", "0.5260613", "0.52603656", "0.52556723", "0.5254776", "0.52532995", "0.524703", "0.52447534", "0.5240391", "0.5239652", "0.5238354", "0.5235371", "0.5228773", "0.5228768", "0.5220207", "0.5220207", "0.5220207", "0.5220207", "0.5217743", "0.5216748", "0.5203915", "0.51954955", "0.5189254", "0.5189254", "0.518377", "0.5177583", "0.5157914" ]
0.6630583
2
Uniques and transforms a string value to binary format and adds it to the object table
def string_to_binary(val) saved_object_count = -1 unless(@unique_table.has_key?(val)) then saved_object_count = @written_object_count @written_object_count += 1 @unique_table[val] = saved_object_count utf16 = false val.each_byte do |b| if(b > 127) then utf16 = true break end end if(utf16) then bdata = Binary.type_bytes("6",Binary.charset_strlen(val,"UTF-8")) # 6 is 0110, unicode string (utf16be) val = Binary.charset_convert(val,"UTF-8","UTF-16BE") val.force_encoding("ASCII-8BIT") if val.respond_to?("encode") @object_table[saved_object_count] = bdata + val else bdata = Binary.type_bytes("5",val.bytesize) # 5 is 0101 which is an ASCII string (seems to be ASCII encoded) @object_table[saved_object_count] = bdata + val end else saved_object_count = @unique_table[val] end return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def cast(value)\n if value.is_a?(MySQLBinUUID::Type::Data)\n # It could be a Data object, in which case we should add dashes to the\n # string value from there.\n add_dashes(value.to_s)\n elsif value.is_a?(String) && value.encoding == Encoding::ASCII_8BIT && strip_dashes(value).length != 32\n # We cannot unpack something that looks like a UUID, with or without\n # dashes. Not entirely sure why ActiveRecord does a weird combination of\n # cast and serialize before anything needs to be saved..\n undashed_uuid = value.unpack1('H*')\n add_dashes(undashed_uuid.to_s)\n else\n super\n end\n end", "def serialize(value)\n return if value.nil?\n undashed_uuid = strip_dashes(value)\n\n # To avoid SQL injection, verify that it looks like a UUID. ActiveRecord\n # does not explicity escape the Binary data type. escaping is implicit as\n # the Binary data type always converts its value to a hex string.\n unless valid_undashed_uuid?(undashed_uuid)\n raise MySQLBinUUID::InvalidUUID, \"#{value} is not a valid UUID\"\n end\n\n Data.new(undashed_uuid)\n end", "def string_to_binary(value)\n # Escape data prior to insert into a bytea column\n if value\n res = ''\n value.each_byte { |b| res << sprintf('\\\\\\\\%03o', b) }\n res\n end\n end", "def uniqable_uid(field)\n loop do\n uniq_code = Nanoid.generate(size: 16)\n if uniq_code =~ /\\D+/\n send(\"#{field}=\", uniq_code)\n break unless self.class.where(field => uniq_code).exists?\n end\n end\n end", "def op_add_unique!(field, objects)\n operate_field! field, { __op: :AddUnique, objects: objects }\n end", "def dict_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"d\",val.value.size) # d=1101, type indicator for dictionary\n\n val.value.each_key do |k|\n str = CFString.new(k)\n key = str.to_binary(self)\n bdata += Binary.pack_it_with_size(@object_ref_size,key)\n end\n\n val.value.each_value do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size,v.to_binary(self))\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def binary_string; end", "def string_to_binary(value)\n self.class.string_to_binary(value)\n end", "def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end", "def unique_add(str)\n tmp = str.dup\n tmp[0] |= 0x80\n return tmp\nend", "def uniqueness_generate\n self.uniqueness_options.each do |field, options|\n value = send(field)\n unless value.present?\n value = Uniqueness.generate(options)\n self.send(\"#{field}=\", value)\n end\n end\n end", "def to_s\n send( self.class.unique_string_field )\n end", "def unique=(val)\n self['unique'] = val\n end", "def map_data_to_uuids\n\t\[email protected]\n\tend", "def to_str(opts={})\n @unique_table = {}\n @count_objects = 0\n @string_size = 0\n @int_size = 0\n @misc_size = 0\n @object_refs = 0\n\n @written_object_count = 0\n @object_table = []\n @object_ref_size = 0\n\n @offsets = []\n\n binary_str = \"bplist00\"\n unique_and_count_values(opts[:root])\n\n @count_objects += @unique_table.size\n @object_ref_size = Binary.bytes_needed(@count_objects)\n\n file_size = @string_size + @int_size + @misc_size + @object_refs * @object_ref_size + 40\n offset_size = Binary.bytes_needed(file_size)\n table_offset = file_size - 32\n\n @object_table = []\n @written_object_count = 0\n @unique_table = {} # we needed it to calculate several values, but now we need an empty table\n\n opts[:root].to_binary(self)\n\n object_offset = 8\n offsets = []\n\n 0.upto(@object_table.size-1) do |i|\n binary_str += @object_table[i]\n offsets[i] = object_offset\n object_offset += @object_table[i].bytesize\n end\n\n offsets.each do |offset|\n binary_str += Binary.pack_it_with_size(offset_size,offset)\n end\n\n binary_str += [offset_size, @object_ref_size].pack(\"x6CC\")\n binary_str += [@count_objects].pack(\"x4N\")\n binary_str += [0].pack(\"x4N\")\n binary_str += [table_offset].pack(\"x4N\")\n\n return binary_str\n end", "def value_type\n 'BINARY'\n end", "def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end", "def encode_object(object)\n scramble_encode(\"#{object.class}-#{object.id}\")\n end", "def encode(object)\n ''.force_encoding(Encoding::BINARY).tap do |bytes|\n newest_version = schema_versions.keys.max\n schema = schema_versions[newest_version]\n bytes << newest_version.chr if has_version_tag\n write(object, bytes, schema)\n end\n end", "def create_sha1_id\n self.sha1_id = Digest::SHA1.hexdigest(\"#{self.id}-#{self.contactable_type}-#{self.contactable_id}\")\n end", "def generate_uid\n def tri vals\n \"#{vals.sample}#{vals.sample}#{vals.sample}\"\n end\n chars = (\"A\"..\"Z\").to_a\n numbers = (\"0\"..\"9\").to_a\n self.uid = loop do\n uid = \"#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}-#{tri(numbers)}-#{tri(chars)}\"\n break uid unless Ticket.where(uid: uid).exists?\n end\n end", "def write(obj, str, tag)\n obj[tag] = str\n if obj.save\n return true\n else\n return false\n end\nend", "def sha1\n Digest::SHA1.hexdigest self.record\n end", "def binary_to_string(value)\n # TODO: Figure out what Cassandra's blobs look like\n value\n end", "def Unique(string)\n\n # assumes alphabet of size 128\n return false if string.length > 128\n \n hash={}\n \n for i in 0..string.length-1\n return false if hash[string[i]] \n hash[string[i]]=true\n end\n \n \nreturn true\n\nend", "def set_Unique(value)\n set_input(\"Unique\", value)\n end", "def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false\n return saved_object_count\n end", "def unique_string(string)\n object = {}\n string.each_with_index do |el, i|\n if object[el]\n return false\n else\n object[el] = i\n end\n end\n true\nend", "def hashFromString(str)\n\t\tstr = str[2..-1] if str.start_with?(\"0x\")\n\t\tstr = str.to_s[0..maxStringLength-1]\n\t\thash = Integer(\"0x\" + str)\n\tend", "def hash\n \tcustom_unique_id.hash\n end", "def array_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"a\", val.value.size) # a is 1010, type indicator for arrays\n\n val.value.each do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self));\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def convert_binary\n end", "def generate_unique_field_value(params)\n\n # extract any numeric suffix from existing value\n if params[:style] == :sep_words\n prefix = send(params[:field]).gsub(/( \\d+)?$/, '')\n else\n prefix = send(params[:field]).gsub(/(\\d+)?$/, '')\n end\n\n # keep track of whether we found the exact name\n found_exact = false\n\n # build a relation to get existing objs\n existing = self.class.for_mission(params[:mission])\n\n # if the dest_obj has an ID (is not a new record),\n # be sure to exclude that when looking for conflicting objects\n existing = existing.where('id != ?', params[:dest_obj]) unless params[:dest_obj].new_record?\n\n # get the number suffixes of all existing objects\n # e.g. if there are My Form, Other Form, My Form 4, My Form 3, TheForm return [1, 4, 3]\n existing_nums = existing.map do |obj|\n\n # for the current match, check if it's an exact match and take note\n if obj.send(params[:field]).downcase.strip == send(params[:field]).downcase.strip\n found_exact = true\n end\n\n # check if the current existing object's name matches the name we're looking for\n if params[:style] == :sep_words\n m = obj.send(params[:field]).match(/^#{prefix}\\s*( (\\d+))?\\s*$/i)\n else\n m = obj.send(params[:field]).match(/^#{prefix}((\\d+))?\\s*$/i)\n end\n\n # if there was no match, return nil (this will be compacted out of the array at the end)\n if m.nil?\n nil\n\n # else if we got a match then we must examine what matched\n # if it was just the prefix, the number is 1\n elsif $2.nil?\n 1\n\n # otherwise we matched a digit so use that\n else\n $2.to_i\n end\n end.compact\n\n # if we didn't find the exact match or any prefix matches, then no need to add any new suffix\n # just return the name as is\n return send(params[:field]) if existing_nums.empty? || !found_exact\n\n # copy num is max of existing plus 1\n copy_num = existing_nums.max + 1\n\n # suffix string depends on style\n if params[:style] == :sep_words\n suffix = \" #{copy_num}\"\n else\n suffix = copy_num.to_s\n end\n\n # now build the new value and return\n \"#{prefix}#{suffix}\"\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def to_hash() end", "def parse obj\nstr = obj.to_s.sub %r/\\Aurn:uuid:/, ''\nstr.gsub! %r/[^0-9A-Fa-f]/, ''\n# raw = str[0..31].lines.to_a.pack 'H*'\n# lines not supported before ruby 1.8.7, and that's not there on heroku\nraw = str[0..31].split(/\\n/).pack 'H*'\nret = new raw\nret.freeze\nret\nend", "def to_binary; ''; end", "def hexists(key, field); end", "def hexists(key, field); end", "def convert_data_field_codes_to_id_strings!\n self.data = convert_data_field_codes_to_id_strings(self.data)\n end", "def convert_data_field_codes_to_id_strings!\n self.data = convert_data_field_codes_to_id_strings(self.data)\n end", "def prepare_value(value)\n {uuid => value}\n end", "def encode(obj); end", "def generate_id(str); end", "def uniqueness_dictionary\n [*(:A..:Z), *(:a..:z), *(0..9)].map(&:to_s)\n end", "def to_object_id(value)\n Plucky.to_object_id(value)\n end", "def create_sha1 str, namespace\nsha1 = Digest::SHA1.new\nsha1.update namespace.raw_bytes\nsha1.update str\nsum = sha1.digest\nraw = mask 5, sum[0..15]\nret = new raw\nret.freeze\nret\nend", "def save_bin(bin)\n begin\n bin.save\n rescue ActiveRecord::RecordNotUnique\n bin.errors.add :base, :not_unique, message:\n \"A bin with the name \\\"#{bin.name}\\\" already exists for this city.\"\n end\n\n return bin.errors.empty?\n end", "def sha1=(_); end", "def find_bin obj\n find_bin_by_key(key_for_string(obj.to_s))\n end", "def to_binary\n Formatters::Binary.new.serialize self\n end", "def isUnique(string) \n if (string.length > 128) \n return false \n end\n hash = {}\n i = 0\n while (i < string.length)\n if(hash[string[i]] === true) \n return false\n else \n hash[string[i]] = true\n end\n i+=1\n end\n return true\nend", "def to_bin\n @id\n end", "def is_unique?(str)\n\nend", "def unique_id\n object_id.abs.to_s(16)\n end", "def date_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT\n\n bdata = Binary.type_bytes(\"3\", 3) # 3 is 0011, type indicator for date\n @object_table[saved_object_count] = bdata + [val].pack(\"d\").reverse\n\n return saved_object_count\n end", "def convert_to_binary\n @input.class == String ? @input : @input.to_s(2)\n end", "def unique_id(slug)\n Zlib.crc32 slug\n end", "def hash_record_low_mem! set, rec, duplicate_type\n key = make_key rec, duplicate_type\n\n set << key\nend", "def simple( value )\n @seq_map = false\n self << value.to_s\n\t\tend", "def convert_to_object_value(dynamo_value); dynamo_value; end", "def uniqify_fields\n begin\n self.uniq_title = self.title.to_uniq\n self.uniq_position = self.position.to_uniq\n self.uniq_playbacks_count = self.playbacks_count.to_uniq\n self.uniq_likes_count = self.likes_count.to_uniq\n self.uuid = UUIDTools::UUID.timestamp_create().to_s if self.uuid.nil?\n rescue\n end\n end", "def unique_with_hash?(str)\n chars_hash = Hash.new(0)\n chars = str.split(\"\")\n chars.each do |char|\n chars_hash[char] += 1\n end\n chars_hash.values.each do |value|\n if value > 1\n return false\n end\n return true\n end\nend", "def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end", "def save\n\t\titemtemp1 = Institutehandler.find(institutehandler_id)\n\t\titemtemp = itemtemp1.name+level+course+stream\n\t\titem = itemtemp.gsub(/[^0-9A-Za-z]/, '')\n \tself.uniquenesscheck = item.delete(' ')\n \tsuper # calls the rails save function to store our object to the database\n \tend", "def gen_keys(str)\n split7(str).map{ |str7|\n bits = split7(str7.unpack(\"B*\")[0]).inject('')\\\n {|ret, tkn| ret += tkn + (tkn.gsub('1', '').size % 2).to_s }\n [bits].pack(\"B*\")\n }\n end", "def fix(value)\n puts \"initial object #{value.object_id}\"\n value = value.upcase\n puts \"upcased object #{value.object_id}\"\n value.concat('!')\nend", "def is_unique_with_hash?(str)\n hash = {}\n str.each_char do |ch|\n if hash[ch]\n return false\n else \n hash[ch] = true\n end \n end \n true\nend", "def encode_by(tag, string)\n Tags[tag][0][1] = string\n end", "def __rubyrel_from_physical_value(physical_value)\n return physical_value if Sequel::Schema::Generator::GENERIC_TYPES.include?(self)\n Marshal.load(Base64.decode64(physical_value))\n end", "def key_maker(hash, key, value)\n case\n when value.include?(\"true\")\n value = true\n when value.include?(\"false\")\n value = false\n when value.to_i > 0 && value.length < 4\n value = value.to_i\n when value == \"0\"\n value = value.to_i\n else\n value\n end\n hash.store(key.to_sym, value)\nend", "def unique_b?(string)\n # O(N)\n string = string.split('')\n characters = {}\n\n # O(N)\n string.each do |character|\n return false if characters[character]\n characters[character] = true\n end\n\n return true\nend", "def from_string(string)\n raise Errors::InvalidObjectId.new(string) unless legal?(string)\n from_data [string].pack(\"H*\")\n end", "def to_s_id(obj)\n \"0x%x\" % [obj.object_id*2]\n end", "def attach_to_obj(obj)\n\t\tobj.instance_variable_set(\"@ext_\" + encode_string(@name[1..-2]).uncapitalize.gsub(\" \",\"_\").gsub(\".\",\"_\").gsub(\"-\",\"_\").gsub(\"/\",\"_\"), encode_string(@nominalValue) )\n\tend", "def save(obj)\n self.delete(obj, true)\n values = values(obj)\n return true if values[:hash_value].blank? || (!values[:range_value].nil? && values[:range_value].blank?)\n while true\n existing = Dynamoid::Adapter.read(self.table_name, values[:hash_value], { :range_key => values[:range_value] })\n ids = ((existing and existing[:ids]) or Set.new)\n new_ids = ids + Set[obj.id]\n\n if unique? && new_ids.length > 1\n raise Dynamoid::Errors::UniqueIndexError.new \"Uniqueness failure on index #{table_name}.\"\n end\n\n if existing\n if existing[:ids]\n options = {:if => {:ids => existing[:ids]}}\n else\n options = {:unless_exists => \"ids\"}\n end\n end\n begin\n return Dynamoid::Adapter.write(self.table_name, {:id => values[:hash_value], :ids => new_ids, :range => values[:range_value]}, options)\n rescue Dynamoid::Errors::ConditionalCheckFailedException\n end\n end\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def id_for_string( table_sym, string )\r\n @db[table_sym][(table_sym.to_s[0..-2].to_sym)=>string][:id]\r\n rescue\r\n @db[table_sym].insert((table_sym.to_s[0..-2].to_sym)=>string)\r\n end", "def in_binary\n Bases.val(self).in_binary\n end", "def basic_generate_id(str); end", "def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end", "def set_unique\n @unique = Unique.find(params[:id])\n end", "def change(str)\n if str.class == String\n array = str.split(//)\n binary = Array.new(26, 0)\n array.uniq.sort!\n base = \"a\".ord\n base_upcase = \"A\".ord\n array.each do |x|\n if (65..90).include?(x.ord)\n binary[x.ord - base_upcase] = 1\n elsif (97..122).include?(x.ord)\n binary[x.ord - base] = 1\n end\n end\n end\n binary.join('')\nend", "def gen_key(record)\n return Digest::SHA2.hexdigest(record.to_s)\n end", "def namegen desired = UUID.new.to_s, realuniq = false\n a = @desired2names.fetch desired, Array.new\n return a.first if not realuniq and not a.empty?\n n = nil\n cand0 = as_tr_cpp desired.to_s\n cand1 = cand0\n while @barenames.has_key? cand1\n n ||= 1\n n += 1\n cand1 = cand0 + n.to_s\n end\n if cand1.length <= @limit\n # OK, take this\n name = old_new @prefix + cand1\n a.push name\n @desired2names.store desired, a\n @barenames.store cand1, name\n return name\n elsif @phasechange\n # name too long, use UUID#to_s\n u = UUIDNS.new_sha1 desired.to_s\n return new u.to_s, realuniq\n else\n # yet too long, now use Integer#to_s\n u = UUIDNS.new_sha1 desired.to_s\n v = u.to_i.to_s @radix\n return new v, realuniq\n end\n end", "def make_code\n self.code = UUID.new\n end", "def _hash(obj)\n obj.transform_values { |v| _renc(v) }\n end", "def unique_id\n return generate_checksum([external_id]) if external_id.present?\n\n fields = [title]\n\n first_address = addresses.first\n address_keys = %i[street zip city kind]\n address_fields = address_keys.map { |a| first_address.try(:send, a) }\n\n date = dates.first\n date_keys = %i[date_start time_start]\n date_fields = date_keys.map { |d| date.try(:send, d) }\n\n generate_checksum(fields + address_fields + date_fields)\n end", "def attr_set_binary(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def register_uniqueness(field_sym)\n \n @__fields_to_validate_uniqueness ||= {}\n @__fields_to_validate_uniqueness[field_sym] = true\n \n # puts @__fields_to_validate_uniqueness.inspect\n end", "def serialize(value)\n # expects same behavior as ActiveRecord::Type::String other than encryption\n # https://github.com/rails/rails/blob/5-0-stable/activemodel/lib/active_model/type/immutable_string.rb\n v = super(value)\n v.present? ? encryptor.encrypt_and_sign(v) : v\n end", "def uniq\n :identity\n end", "def repair!(data)\n if data.is_a?(Array) && data.size == 12\n self.data = data.pack(\"C*\")\n elsif data.is_a?(String) && data.size == 12\n self.data = data\n else\n raise TypeError, \"Could not convert #{data.inspect} into an ObjectId\"\n end\n end" ]
[ "0.6002326", "0.5797143", "0.5793277", "0.56514406", "0.561846", "0.5611824", "0.5598785", "0.55561554", "0.55302864", "0.55093014", "0.5441502", "0.54117167", "0.5360556", "0.5351907", "0.53468585", "0.5341088", "0.5316499", "0.53156316", "0.5307022", "0.5254363", "0.52340287", "0.5226957", "0.5211669", "0.5202989", "0.5194029", "0.51747227", "0.5157807", "0.5130728", "0.509795", "0.5094381", "0.5093015", "0.5077392", "0.50704634", "0.50679755", "0.50657296", "0.50657296", "0.50657296", "0.50657296", "0.50657296", "0.50657296", "0.50657296", "0.50636244", "0.5053012", "0.5040215", "0.502773", "0.502773", "0.50157195", "0.50157195", "0.5006214", "0.50043297", "0.49961874", "0.49933183", "0.49679166", "0.4962247", "0.49505493", "0.4949981", "0.4947204", "0.49384132", "0.49379036", "0.4916611", "0.49144158", "0.48886672", "0.48860273", "0.48855394", "0.4883953", "0.4882985", "0.48803174", "0.4879582", "0.48793182", "0.48766378", "0.48648676", "0.48629028", "0.48458776", "0.48422983", "0.4840284", "0.48390687", "0.48307407", "0.48222676", "0.4817503", "0.48123443", "0.48097572", "0.4794886", "0.47933334", "0.4792085", "0.4779396", "0.47776565", "0.4775949", "0.4773372", "0.4764465", "0.4762944", "0.4758816", "0.47567633", "0.47539547", "0.4753648", "0.4746087", "0.47443756", "0.47400558", "0.4733577", "0.4733402", "0.4732581" ]
0.7459094
0
Codes an integer to binary format
def int_to_binary(value) nbytes = 0 nbytes = 1 if value > 0xFF # 1 byte integer nbytes += 1 if value > 0xFFFF # 4 byte integer nbytes += 1 if value > 0xFFFFFFFF # 8 byte integer nbytes = 3 if value < 0 # 8 byte integer, since signed bdata = Binary.type_bytes("1", nbytes) # 1 is 0001, type indicator for integer buff = "" if(nbytes < 3) then fmt = "N" if(nbytes == 0) then fmt = "C" elsif(nbytes == 1) fmt = "n" end buff = [value].pack(fmt) else # 64 bit signed integer; we need the higher and the lower 32 bit of the value high_word = value >> 32 low_word = value & 0xFFFFFFFF buff = [high_word,low_word].pack("NN") end return bdata + buff end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_to_binary_string(number)\n number.to_s(2)\nend", "def to_bin(number)\n number = Integer(number);\n if(number == 0)\n return 0;\n end\n ret_bin = \"\";\n ## Untill val is zero, convert it into binary format\n while(number != 0)\n ret_bin = String(number % 2) + ret_bin;\n number = number / 2;\n end\n return ret_bin;\n end", "def int_to_varint int_val\n result = []\n loop do\n bits = int_val & 0x7F\n int_val >>= 7\n if int_val.zero?\n result << bits\n break\n else\n result << (0x80 | bits)\n end\n end\n result.pack \"C*\"\n end", "def to_binary(num)\n num_bin = ''\n current_power_of_2 = 1\n \n loop do\n num_bin.prepend ((num % (current_power_of_2 * 2)) / current_power_of_2).to_s\n \n break if num < current_power_of_2 * 2\n current_power_of_2 *= 2\n end\n \n num_bin.to_i\n end", "def binary(integer)\n\nend", "def binary(integer)\n\nend", "def binary\n decimal.to_s(2).rjust(8, '0')\n end", "def to_binary_string(min_length = 0)\n BitMapping.number_to_binary_string(number, min_length)\n end", "def convert_int(int)\n [int].pack('s>')\n end", "def write_varint(int)\n int = int << 1\n int = ~int | 1 if int < 0\n\n chunks = []\n while int >> 7 != 0\n chunks << (int & 0x7f | 0x80)\n int >>= 7\n end\n chunks << int\n write(chunks.pack(\"C*\"))\n end", "def bin(x)\n x.to_s(16).chars.to_a.map{|d| d.to_i(16).to_s(2).rjust(4, '0')}.join(' ')\nend", "def input_to_bitstring( value )\r\n value\r\n end", "def symbol_to_bin\n if symbol.to_i.is_a? Integer\n symbol.to_i.to_s(2).rjust(16, '0')\n else\n\n end\n end", "def binary(digits)\n string(BINARY_DIGITS, digits)\n end", "def BinaryConverter(str)\r\n return str.to_i(2)\r\nend", "def dec2bin(n)\n case n\n when 0 then '0000'\n when 1 then '0001'\n when 2 then '0010'\n when 3 then '0011'\n when 4 then '0100'\n when 5 then '0101'\n when 6 then '0110'\n when 7 then '0111'\n when 8 then '1000'\n when 9 then '1001'\n when 10 then '1010'\n when 11 then '1011'\n when 12 then '1100'\n when 13 then '1101'\n else nil\n end\n end", "def number_to_binary_string(number, min_length = 0)\n assert_non_negative(number)\n binary_string = ''.force_encoding(Encoding::ASCII_8BIT)\n\n while number > 0\n byte_value = number & 0xFF\n binary_string << byte_value\n number >>= 8\n end\n\n binary_string.reverse.rjust(min_length, \"\\x00\")\n end", "def to_i\n\t\tbits.map(&:to_s).join.to_i(2)\n\tend", "def write_int8(int)\n write([int].pack(\"C\"))\n end", "def encode_uint8(int); [int].pack(PACK_FORMAT_UINT8); end", "def encode_mpint(value)\n value.to_s(0)\n end", "def symbol_to_bin\n symbol.to_i.to_s(2).rjust(16, '0')\n end", "def dec_to_binary(num)\r\n bin = []\r\n quot = Math.floor(num / 2)\r\n bin.push(num % 2)\r\n while (quot > 1) \r\n bin.unshift(quot % 2)\r\n quot = Math.floor(quot / 2)\r\n end\r\n bin.unshift(quot)\r\n return bin.join('')\r\nend", "def to_bin(num_string)\n digits = convert_to_base10(num_string)\n digits.map!{|char| to_bits(char)}\n digits.join\n end", "def encode_bits(bits)\n [bits.map { |b| b ? '1' : '0' }.join].pack('b*')\n end", "def encode_varint(i)\n raise ArgumentError, \"int must be present\" if !i\n raise ArgumentError, \"int must be non-negative\" if i < 0\n\n buf = if i < 0xfd\n [i].pack(\"C\")\n elsif i <= 0xffff\n [0xfd, i].pack(\"Cv\")\n elsif i <= 0xffffffff\n [0xfe, i].pack(\"CV\")\n elsif i <= 0xffffffffffffffff\n [0xff, i].pack(\"CQ<\")\n else\n raise ArgumentError, \"Does not support integers larger 0xffffffffffffffff (i = 0x#{i.to_s(16)})\"\n end\n\n buf\n end", "def to_s\n \"%0#{size}b\" % number\n end", "def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end", "def _to_bit_string(i, min_width=0)\n hexed = i.to_s(16)\n padded = true if hexed.length % 2 == 1 # prepend 0\n bitstring = [(padded ? \"0#{hexed}\" : hexed)].pack(\"H*\").unpack(\"B*\").first\n bitstring = bitstring[4,bitstring.length - 4] if padded\n (\"0\" * [min_width - bitstring.length, 0].max) + bitstring\n end", "def getBinary(number)\n binary = \"\"\n while (number > 0 && binary.size < 16) do\n binary << (number % 2).to_s\n number = number / 2\n end\n # might add condition for case where binary.size < 16, to add extra zero-es\n return binary.reverse\nend", "def encode(int)\n masked_int = int & @mask\n result = 0\n @mapping.each_with_index do |b, i|\n result |= (1 << b) if (masked_int & (1 << i)) != 0\n end\n\n return (int & ~@mask) | result\n end", "def n_to_binary number\n bin_array = []\n until number == 0\n if number % 2 == 0\n bin_array << 0\n else \n bin_array << 1\n end\n number = number / 2\n end\n bin_array.join\nend", "def convert_to_base_8(n)\n n.to_s(8).to_i\nend", "def convert_to_base_8(n)\n n.to_s(8).to_i\nend", "def add_binary(a,b)\n #your code here\n binary = a + b\n binary.to_s(2) # Convert um inteiro para string na base 2(base binária)\nend", "def encode integer_array\n integer_array = integer_array.clone\n bits = BitArray.new\n integer_array.each do |x|\n q = x/@M\n q.times {bits.push 1}\n bits.push 0\n r = x % @M\n (@b-1).downto(0){|i| bits.push r[i]}\n end\n bits\n end", "def _int2b(data)\n data.unpack('v').first\n end", "def to_binary()\n return self.unpack('B*').join\n end", "def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end", "def binary(digits: 4)\n bin = ''\n digits.times { bin += rand(2).to_s(2) }\n bin\n end", "def to_s\r\n @bitstring.reverse.scan(/.{1,8}/).map {|s| s.reverse}.reverse.map {|bin| \"\" << bin.to_i(2)}.join\r\n end", "def to_bits(base10_num)\n bits = @bit_vals.map do |b|\n if base10_num >= b\n base10_num -= b\n '1'\n else\n '0'\n end\n end\n bits.join\n end", "def write_int(value) \n write_bytecode_to(INTEGER, @temp_bytecode)\n write_4B_to(value, @temp_bytecode)\n end", "def stringy number, count = 1\n binary_string = ''\n\n if count == 1\n (number / 2).times {binary_string << '10'}\n binary_string << '1' if number % 2 == 1\n elsif count == 0\n (number / 2).times {binary_string << '01'}\n binary_string << '0' if number % 2 == 1\n end\n\n binary_string\n end", "def encode_uint8(value)\n [value].pack(\"C\")\n end", "def reverse_bits(n)\n bin = n.to_s(2)\n while bin.length < 32\n bin = \"0\" + bin\n end \n bin.reverse.to_i(2)\nend", "def toBinary (x)\n if (x>1)\n toBinary(x/2) + (x%2).to_s\n elsif x==1\n return x.to_s\n end\nend", "def reverse_bits(num)\n num.to_s(2).rjust(32, '0').reverse.to_i(2)\nend", "def pack_int64_bigendian(value)\n (0..7).map { |index| (value >> (index * 8)) & 0xFF }.reverse.map(&:chr).join\n end", "def convert_to_binary\n @input.class == String ? @input : @input.to_s(2)\n end", "def stringy(num, bit = 1)\n bin_arr = []\n num.times { |n| n.even? ? bin_arr << (0 + bit) : bin_arr << (1 - bit) }\n bin_arr.join\nend", "def write_int32(int)\n write([int].pack(\"l>\"))\n end", "def convert_to_base_8(n)\n n.to_s(8).to_i # replace these two method calls\nend", "def integer_to_bytes(integer, length)\n length.times.map { |i| (integer >> (i * 8)) & 0xFF }\n end", "def decimal_to_binary(number)\n if number == 0\n 0\n else\n number % 2 + 10 * decimal_to_binary(number/2)\n end \nend", "def encode_number(num)\r\n encode_string = \"\"\r\n while num >= 0x20\r\n next_value = (0x20 | (num & 0x1f)) + 63\r\n encode_string << next_value.chr\r\n num >>= 5\r\n end\r\n final_value = num + 63\r\n encode_string << final_value.chr\r\n return encode_string\r\n end", "def serialize_value(value)\n [value.to_i].pack('N')\n end", "def to_i\n bitmask\n end", "def reverse_bits(num, size)\n # To make the input number into binary of 16 or 32 bit format\n binary = \"%0#{size}d\" % num.to_s(2) #convert decimal to string of base 2 number\n puts binary\n puts binary.reverse!\n # puts binary.to_i(2) # convert string of base 2 number to decimal\nend", "def flip_bit(integer)\n binary = integer.to_s(2)\n max = 0\n current = 0\n prev = 0\n gap = 0\n\n binary.each_char do |char|\n if char == '1'\n current += 1\n gap = 0\n elsif char == '0'\n prev = current unless gap > 1\n current = 0\n gap += 1\n end\n max = [prev + current + 1, max].max\n end\n\n max\nend", "def i4( num ) ## integer (4 byte / 32bit) to binary (in little endian)\r\n [num].pack( 'V' )\r\n end", "def _int1b(data)\n data.unpack('C').first\n end", "def binarify(base_ten_num)\n raise 'input must be an integer' if base_ten_num.is_a?(String)\n base_ten_num.to_s(2)\nend", "def vlb_encode(n)\n # on = n\n n = Integer(n)\n fail ArgumentError, \"Can't encode negative number #{n}\" if n < 0\n v = empty_buffer\n while n > 0\n v << (n & 0xFF)\n n >>= 8\n end\n v.reverse!\n # warn \"Encoded #{on} as #{v.inspect}\"\n v\n end", "def bijective_encode(id)\n code = ''\n\n while id > 0\n code << CHARS[id.modulo(BASE)]\n id /= BASE\n end\n\n code.reverse\n end", "def to_bit_array\n BitMapping.number_to_bit_array(number)\n end", "def to_binary(input)\n binary = []\n input.each_char do |char|\n result = char.hex.to_s(2).rjust(char.size*4, '0')\n binary << result\n end\n binary.join()\nend", "def integer(i, n)\n limit = 2**n - 1\n return [i].pack('C') if i < limit\n\n bytes = []\n bytes.push limit unless n.zero?\n\n i -= limit\n while (i >= 128)\n bytes.push((i % 128) + 128)\n i /= 128\n end\n\n bytes.push i\n bytes.pack('C*')\n end", "def encode_uint32(value)\n [value].pack(\"L>\")\n end", "def replace_binary(str)\n str.gsub(/[01]+/) { |bin| bin.to_i(2).to_s(10) }\n end", "def replace_binary(str)\n str.gsub(/[01]+/) { |bin| bin.to_i(2).to_s(10) }\n end", "def handle_bit (num)\n num2str=''\n num2str+=NUM_MAP[num]\n return num2str\nend", "def write_int(value) \n @codegen.write_int(value)\n end", "def show_binstring()\n @values.values.map do |v|\n v ? \"1\" : \"0\"\n end.join\n end", "def real_to_binary(val)\n bdata = Binary.type_bytes(\"2\",3) # 2 is 0010, type indicator for reals\n buff = [val].pack(\"d\")\n return bdata + buff.reverse\n end", "def bin2str(binary)\n str = [binary].pack(\"B*\")\n return str\nend", "def binary(num)\n result = []\n\n until num == 0\n result.unshift(num % 2)\n num /= 2\n end\n\n result.empty? ? \"0\" : result.join\nend", "def binary(digits: T.unsafe(nil)); end", "def string\n binary.map { |i| i.to_i.to_s(16) }.join('')\n end", "def convert_binary\n end", "def net_pack_int(int)\n net_error \"#{__method__}: '#{int}' is too low allowed range #{NET_MIN_INT}-#{NET_MAX_INT}\" if int < NET_MIN_INT\n net_error \"#{__method__}: '#{int}' is too high allowed range #{NET_MIN_INT}-#{NET_MAX_INT}\" if int > NET_MAX_INT\n int += NET_INT_OFFSET\n int.chr\nend", "def integer(i, n)\n limit = 2**n - 1\n return [i].pack('C') if (i < limit)\n\n bytes = []\n bytes.push limit if !n.zero?\n\n i -= limit\n while (i >= 128) do\n bytes.push((i % 128) + 128)\n i = i / 128\n end\n\n bytes.push i\n bytes.pack('C*')\n end", "def fake_bin(s)\n s.tr('1-9', '00001')\nend", "def decToBin(inputNum, padLen = 4)\n binStr = \"\"\n tempNum = inputNum\n \n while tempNum > 0 do\n binStr.concat((tempNum % 2).to_s)\n tempNum = tempNum / 2 \n end\n \n return binStr.reverse.rjust(padLen, '0')\nend", "def translate_to_binary(array_of_hex)\n array_of_binary = []\n array_of_hex.each do |num|\n array_of_binary << sprintf(\"%b\", num).rjust(32, '0')\n end\n array_of_binary\n end", "def write_int(value, stream = @index)\n stream.write([value].pack('L'))\n end", "def to_hex_code(num)\n num.to_s(16)[-4, 4]\n end", "def _sint2b(data)\n data.unpack('s').first\n end", "def int2str(dw)\n (dw & 0xff).chr + ((dw >> 8) & 0xff).chr + ((dw >> 16) & 0xff).chr + ((dw >> 24) & 0xff).chr\nend", "def bits\n super.to_i\n end", "def binary_to_int(n)\n bitset = Array.new()\n while (n > 0) do\n x = largest_power_of_2(n)\n if (x != nil)\n bitset[x] = 1\n n -= BASE ** x\n end\n end\n bitset.map! { |x| \n if (x == nil) \n x = 0\n else\n x = 1\n end\n }\n return bitset\nend", "def stringy(num)\n binary = ''\n loop do\n binary << '1'\n break if binary.length == num\n binary << '0'\n break if binary.length == num\n end\n binary\nend", "def to_s\n @bits.to_s(2)\n end", "def b(value)\n (value & 0x0000ff00) >> 8\n end", "def b(value)\n (value & 0x0000ff00) >> 8\n end", "def reverse_bits(integer)\n\t#convert integer into 32-bit number, reverse bits, convert back into an integer\n\t[integer].pack('l').reverse.unpack('l')\nend", "def encode_unsigned_varint(value, appender)\n while value > 0x1F\n pos = (value & 0x1F) | 0x20\n appender.call(ENCODING_TABLE[pos])\n value >>= 5\n end\n appender.call(ENCODING_TABLE[value])\n end", "def convert(value)\n byteshift = (value+3)/8\n bitshift = value-byteshift*8\n# printf(\"%d --> %d,%d\\n\", value,byteshift,bitshift)\n if bitshift<0\n bitshift *= -1\n bitshift += 0x08\n end\n ret = byteshift*16+bitshift\n return ret\nend", "def to_bin\n @id\n end", "def toBinary(n)\n\ttop = Math.log2(n).to_int\n\tlist = []\n\twhile top >= 0\n\t\tn >= 2 ** top ? (list << 1 and n -= 2 ** top) : (list << 0)\n\t\ttop -= 1\n\tend\n\tlist.join\nend" ]
[ "0.8118605", "0.7725005", "0.7348912", "0.7309225", "0.7218738", "0.7218738", "0.7111606", "0.7067939", "0.6997278", "0.6994265", "0.69752103", "0.6933819", "0.6928739", "0.69271845", "0.692328", "0.6913677", "0.6881685", "0.68341064", "0.68309563", "0.68174404", "0.6761772", "0.67573446", "0.6756417", "0.6748995", "0.67454195", "0.6729274", "0.6680962", "0.66586775", "0.6655707", "0.66374147", "0.6634663", "0.65939426", "0.65924037", "0.65924037", "0.65900457", "0.6536604", "0.6524596", "0.65129715", "0.649478", "0.64714056", "0.6448304", "0.64442784", "0.64377415", "0.6432827", "0.64233196", "0.6410872", "0.63984317", "0.6378029", "0.6351238", "0.6339986", "0.63257235", "0.6322685", "0.6312263", "0.62988335", "0.6293937", "0.6287431", "0.62788767", "0.6268651", "0.6263301", "0.6259219", "0.62583864", "0.6257419", "0.62516785", "0.6250843", "0.6249742", "0.6248373", "0.6232188", "0.623009", "0.62290806", "0.62229633", "0.62229633", "0.62210345", "0.6213813", "0.6213432", "0.6207705", "0.6205857", "0.62047", "0.6199581", "0.6191638", "0.6185223", "0.6164654", "0.6162403", "0.6137367", "0.6131326", "0.6121797", "0.6113291", "0.6108848", "0.60917753", "0.60776937", "0.6053683", "0.60498", "0.6033646", "0.6031801", "0.60277706", "0.60277706", "0.6021329", "0.6017911", "0.60059637", "0.6004882", "0.59986526" ]
0.7988794
1
Codes a real value to binary format
def real_to_binary(val) bdata = Binary.type_bytes("2",3) # 2 is 0010, type indicator for reals buff = [val].pack("d") return bdata + buff.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end", "def input_to_bitstring( value )\r\n value\r\n end", "def to_binary()\n return self.unpack('B*').join\n end", "def show_binstring()\n @values.values.map do |v|\n v ? \"1\" : \"0\"\n end.join\n end", "def binary\n decimal.to_s(2).rjust(8, '0')\n end", "def convert_binary\n end", "def int_to_binary_string(number)\n number.to_s(2)\nend", "def int_to_binary(value)\n nbytes = 0\n nbytes = 1 if value > 0xFF # 1 byte integer\n nbytes += 1 if value > 0xFFFF # 4 byte integer\n nbytes += 1 if value > 0xFFFFFFFF # 8 byte integer\n nbytes = 3 if value < 0 # 8 byte integer, since signed\n\n bdata = Binary.type_bytes(\"1\", nbytes) # 1 is 0001, type indicator for integer\n buff = \"\"\n\n if(nbytes < 3) then\n fmt = \"N\"\n\n if(nbytes == 0) then\n fmt = \"C\"\n elsif(nbytes == 1)\n fmt = \"n\"\n end\n\n buff = [value].pack(fmt)\n else\n # 64 bit signed integer; we need the higher and the lower 32 bit of the value\n high_word = value >> 32\n low_word = value & 0xFFFFFFFF\n buff = [high_word,low_word].pack(\"NN\")\n end\n\n return bdata + buff\n end", "def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end", "def serialize_value(value)\n [value.to_i].pack('N')\n end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def binary_to_string(value)\n # TODO: Figure out what Cassandra's blobs look like\n value\n end", "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def binary(digits)\n string(BINARY_DIGITS, digits)\n end", "def to_bin(number)\n number = Integer(number);\n if(number == 0)\n return 0;\n end\n ret_bin = \"\";\n ## Untill val is zero, convert it into binary format\n while(number != 0)\n ret_bin = String(number % 2) + ret_bin;\n number = number / 2;\n end\n return ret_bin;\n end", "def binary(integer)\n\nend", "def binary(integer)\n\nend", "def binary_representation(allow_z = true, allow_m = true) #:nodoc:\n bin_rep = [@x.to_f, @y.to_f].pack('EE')\n bin_rep += [@z.to_f].pack('E') if @with_z && allow_z # Default value so no crash\n bin_rep += [@m.to_f].pack('E') if @with_m && allow_m # idem\n bin_rep\n end", "def symbol_to_bin\n if symbol.to_i.is_a? Integer\n symbol.to_i.to_s(2).rjust(16, '0')\n else\n\n end\n end", "def to_binary\n Formatters::Binary.new.serialize self\n end", "def to_s\n bits=\"\"\n @fields.each {|f| \n if f.kind_of? Fields::Field\n bits << f.bitstring\n else\n bits << f.to_bitstring\n end\n }\n [bits].pack('B*')\n end", "def symbol_to_bin\n symbol.to_i.to_s(2).rjust(16, '0')\n end", "def convert_to_binary\n @input.class == String ? @input : @input.to_s(2)\n end", "def value_type\n 'BINARY'\n end", "def binary_representation(allow_z=true,allow_m=true) #:nodoc:\r\n bin_rep = [@x,@y].pack(\"EE\")\r\n bin_rep += [@z].pack(\"E\") if @with_z and allow_z #Default value so no crash\r\n bin_rep += [@m].pack(\"E\") if @with_m and allow_m #idem\r\n bin_rep\r\n end", "def to_binary_string(min_length = 0)\n BitMapping.number_to_binary_string(number, min_length)\n end", "def string_to_binary(value)\n # Escape data prior to insert into a bytea column\n if value\n res = ''\n value.each_byte { |b| res << sprintf('\\\\\\\\%03o', b) }\n res\n end\n end", "def value_to_zero_one_string\n to_binary_s.unpack(\"C*\").map { |e| e.to_s(2).rjust(8, \"0\") }.join(\"\")\n end", "def to_s\n @bits.to_s(2)\n end", "def add_binary(a,b)\n #your code here\n binary = a + b\n binary.to_s(2) # Convert um inteiro para string na base 2(base binária)\nend", "def binary_string; end", "def string_to_binary(value)\n self.class.string_to_binary(value)\n end", "def encode_bits(bits)\n [bits.map { |b| b ? '1' : '0' }.join].pack('b*')\n end", "def binary(digits: T.unsafe(nil)); end", "def b(value)\n (value & 0x0000ff00) >> 8\n end", "def b(value)\n (value & 0x0000ff00) >> 8\n end", "def encode(value)\n value.to_s(BASE)\n end", "def to_s\n \"%0#{size}b\" % number\n end", "def bin(x)\n x.to_s(16).chars.to_a.map{|d| d.to_i(16).to_s(2).rjust(4, '0')}.join(' ')\nend", "def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false\n return saved_object_count\n end", "def to_s\n value.unpack('B*').first[0...size]\n end", "def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end", "def pack_data value\r\n [value].pack('l>').split('').map(&:ord)\r\nend", "def to_s\r\n @bitstring.reverse.scan(/.{1,8}/).map {|s| s.reverse}.reverse.map {|bin| \"\" << bin.to_i(2)}.join\r\n end", "def encode_mpint(value)\n value.to_s(0)\n end", "def to_binary\n return '' unless @ready\n\n @mode == :r ? to_a.pack('Cc') : to_a.pack('C*')\n end", "def encode\n s = \"#{@value}\\000\"\n\n n = 0\n @lengths.each do |l|\n s << [@types[n]].pack(\"#{punpack_string(l)}\")\n n += 1\n end\n s\n end", "def value\n @bytes.pack('C*')\n end", "def bin2str(binary)\n str = [binary].pack(\"B*\")\n return str\nend", "def bytea(value)\n \"'\\\\x#{value.unpack1('H*')}'::bytea\"\n end", "def encode_uint64(value)\n [value].pack(\"Q>\")\n end", "def in_binary\n Bases.val(self).in_binary\n end", "def handle_bit (num)\n num2str=''\n num2str+=NUM_MAP[num]\n return num2str\nend", "def binary_to_text(b)\n [b].pack(\"B*\")\nend", "def to_binary(num)\n num_bin = ''\n current_power_of_2 = 1\n \n loop do\n num_bin.prepend ((num % (current_power_of_2 * 2)) / current_power_of_2).to_s\n \n break if num < current_power_of_2 * 2\n current_power_of_2 *= 2\n end\n \n num_bin.to_i\n end", "def binary_representation(allow_z=true,allow_m=true)\r\n rep = [length].pack(\"V\")\r\n each {|linear_ring| rep << linear_ring.binary_representation(allow_z,allow_m)}\r\n rep\r\n end", "def to_b\n return self.to_s(2)\n end", "def get_value\r\n @bitstring\r\n end", "def encode_uint8(value)\n [value].pack(\"C\")\n end", "def string\n binary.map { |i| i.to_i.to_s(16) }.join('')\n end", "def encode_uleb128(value)\n raise ArgumentError, \"Signed integers are not supported\" if value < 0\n return \"\\x00\" if value == 0\n bytes = []\n while value != 0\n byte = value & 0b01111111 # 0x7f\n value >>= 7\n if value != 0\n byte |= 0b10000000 # 0x80\n end\n bytes << byte\n end\n return BTC::Data.data_from_bytes(bytes)\n end", "def blob(val)\n val.gsub(/[\\000-\\037\\047\\134\\177-\\377]/) do |b|\n \"\\\\#{ b[0].to_s(8).rjust(3, '0') }\"\n end\n end", "def to_binary\n return '' unless @ready\n\n to_a.pack('C*') rescue binding.pry\n end", "def binary(digits: 4)\n bin = ''\n digits.times { bin += rand(2).to_s(2) }\n bin\n end", "def translate_to_binary(array_of_hex)\n array_of_binary = []\n array_of_hex.each do |num|\n array_of_binary << sprintf(\"%b\", num).rjust(32, '0')\n end\n array_of_binary\n end", "def binary!\n @binary = true\n end", "def field_to_binary(field_type, field_value)\n case field_type\n when \"boolean\"\n if field_value == \"true\"\n \"\\x01\".b\n elsif field_value == \"false\"\n \"\\x00\".b\n else\n raise \"Expected true/false, got #{field_value}\"\n end\n when \"float\"\n # Works with any of: \"123\", \"123.4\", \"123,4\"\n [field_value.gsub('\"', '').sub(\",\", \".\").to_f].pack(\"f\")\n when \"int\"\n [field_value.gsub('\"', '').to_i].pack(\"l\")\n when \"short\"\n [field_value.gsub('\"', '').to_i].pack(\"v\")\n when \"string\"\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n [str.size].pack(\"v\") + str.pack(\"v*\")\n when \"optstring\"\n # this is really stupid\n if field_value == \"nil\"\n \"\\x00\"\n else\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n \"\\x01\" + [str.size].pack(\"v\") + str.pack(\"v*\")\n end\n when /\\Ablob:(\\d+)/\n bloblen = $1.to_i\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value)\n else\n str = eval('\"' + field_value + '\"')\n end\n raise \"Blob expected to have #{bloblen} bytes, had #{str.size}\" unless str.size == bloblen\n str\n else\n warn \"Unknown ft/fv #{field_type} #{field_value}\"\n \"x\"\n end\n end", "def to_sxp_bin\n self\n end", "def to_binary; ''; end", "def dec_to_binary(num)\r\n bin = []\r\n quot = Math.floor(num / 2)\r\n bin.push(num % 2)\r\n while (quot > 1) \r\n bin.unshift(quot % 2)\r\n quot = Math.floor(quot / 2)\r\n end\r\n bin.unshift(quot)\r\n return bin.join('')\r\nend", "def to_f\n @bits.to_f\n end", "def pack_db value\r\n pack_data(\r\n if value > -10\r\n value * 10000\r\n else\r\n (-1 * Math.log10((value / 10).abs) * 200000) - 100000\r\n end\r\n )\r\nend", "def to_i\n\t\tbits.map(&:to_s).join.to_i(2)\n\tend", "def evidence_to_binary(e)\n\tb = Hash.new(\"0\")\n\te.each_char do |i|\n\t\tb[i] = \"1\"\n\tend\n\n\tbinary = \"0000\"\n\tbinary[0] = b['N']\n\tbinary[1] = b['S']\n\tbinary[2] = b['W']\n\tbinary[3] = b['E']\n\tbinary\nend", "def bits\n super.to_i\n end", "def to_hex\n @value.unpack(\"H*\").join\n end", "def number_to_binary_string(number, min_length = 0)\n assert_non_negative(number)\n binary_string = ''.force_encoding(Encoding::ASCII_8BIT)\n\n while number > 0\n byte_value = number & 0xFF\n binary_string << byte_value\n number >>= 8\n end\n\n binary_string.reverse.rjust(min_length, \"\\x00\")\n end", "def _sint2b(data)\n data.unpack('s').first\n end", "def toBinary (x)\n if (x>1)\n toBinary(x/2) + (x%2).to_s\n elsif x==1\n return x.to_s\n end\nend", "def to_binary\n link unless @linked\n [@linked[0].ls_byte, @linked[0].ms_byte].pack('CC') + binary_pass\n end", "def binmode() end", "def binmode() end", "def binmode() end", "def convert(value)\n byteshift = (value+3)/8\n bitshift = value-byteshift*8\n# printf(\"%d --> %d,%d\\n\", value,byteshift,bitshift)\n if bitshift<0\n bitshift *= -1\n bitshift += 0x08\n end\n ret = byteshift*16+bitshift\n return ret\nend", "def literal_blob(v)\n blob = '0x'\n v.each_byte{|x| blob << sprintf('%02x', x)}\n blob\n end", "def to_bencode\n BEncode.dump(self)\n end", "def array_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"a\", val.value.size) # a is 1010, type indicator for arrays\n\n val.value.each do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self));\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def hex_from_float(v)\n Numerals::Format[:hexbin].write(v)\nend", "def to_b\n !zero?\n end", "def getBinary(number)\n binary = \"\"\n while (number > 0 && binary.size < 16) do\n binary << (number % 2).to_s\n number = number / 2\n end\n # might add condition for case where binary.size < 16, to add extra zero-es\n return binary.reverse\nend", "def BinaryConverter(str)\r\n return str.to_i(2)\r\nend", "def encode_uint32(value)\n [value].pack(\"L>\")\n end", "def to_s(addr: nil)\n value = to_i(addr: addr)\n # TODO: don't fix the length at 64\n length = 64\n bits = (\"%0#{length}b\" % value).gsub(/(\\d)(?=(\\d\\d\\d\\d\\d\\d\\d\\d)+(?!\\d))/, '\\\\1_')\n comments = ''\n @instruction_specs.each do |_field_name, spec|\n comments += \"#{spec} \"\n end\n \"#{bits} // #{comments.strip}\"\n end", "def to_s\n [(self.v || self.d)].pack(\"C\")\n end", "def decimal_to_binary (decimal)\r\n\t\t# ruby inbuilt method - see other files\r\n\t # divide number by 2 and log remainders?\r\n\r\n\t# get length of number\r\n\t# determine biggest power of 2 that fits into number\r\n\t# see keefer and thom solutions - built with remainders maths\r\n\r\n\r\n\r\nend", "def term_to_binary(term)\n input = TERM_TO_BINARY % [term]\n # puts input\n output = `echo -e '#{input}' | erl`\n # puts output\n out = []\n output[/\\n\\n(.*)\\n\\n/m, 1].scan(/\\d+/){|d| out << [d.to_i].pack('C') }\n out\n end", "def old_boolean_to_binary(arr)\n binary = \"\"\n\n arr.each do |boolean|\n if boolean\n binary += \"1\"\n else\n binary += \"0\"\n end\n end\n\n binary\nend", "def to_bits(base10_num)\n bits = @bit_vals.map do |b|\n if base10_num >= b\n base10_num -= b\n '1'\n else\n '0'\n end\n end\n bits.join\n end", "def add_binary(a,b)\n (a+b).to_s(2)\n\n # \"%b\" % (a+b)\nend", "def encode_string(value)\n [value.bytesize, value].pack(\"L>A*\")\n end" ]
[ "0.76387566", "0.73857784", "0.70741576", "0.69966084", "0.69353193", "0.6870486", "0.686756", "0.6860697", "0.68493295", "0.6845571", "0.68288904", "0.6777516", "0.6741485", "0.67203945", "0.6716213", "0.6709726", "0.6709726", "0.6681656", "0.66692364", "0.6667497", "0.66251034", "0.6615802", "0.6611474", "0.66069293", "0.6604301", "0.6599433", "0.6599135", "0.65957725", "0.6594034", "0.6577981", "0.65722144", "0.65583354", "0.6546344", "0.65055984", "0.6479775", "0.6479775", "0.6476224", "0.6447515", "0.6436917", "0.6429597", "0.6413905", "0.64076334", "0.6304157", "0.63032037", "0.6287686", "0.6287317", "0.62772834", "0.62763363", "0.62719053", "0.62616956", "0.6260439", "0.62369174", "0.6233417", "0.6220526", "0.62194675", "0.6213425", "0.6213145", "0.61841816", "0.61689466", "0.615216", "0.61418885", "0.61343014", "0.6119299", "0.61066335", "0.610455", "0.6104422", "0.6080137", "0.6074994", "0.6074884", "0.6069466", "0.6059132", "0.6055996", "0.6053518", "0.60376495", "0.6037029", "0.6022522", "0.6020948", "0.60201", "0.60193557", "0.60132635", "0.6011404", "0.6011404", "0.6011404", "0.5989038", "0.5985244", "0.5969381", "0.5961603", "0.59472156", "0.59050417", "0.5902054", "0.58960503", "0.5886638", "0.5883098", "0.5881541", "0.5879733", "0.5876683", "0.58757675", "0.58687675", "0.5859937", "0.5858342" ]
0.8134485
0
Converts a numeric value to binary and adds it to the object table
def num_to_binary(value) saved_object_count = @written_object_count @written_object_count += 1 val = "" if(value.is_a?(CFInteger)) then val = int_to_binary(value.value) else val = real_to_binary(value.value) end @object_table[saved_object_count] = val return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def dict_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"d\",val.value.size) # d=1101, type indicator for dictionary\n\n val.value.each_key do |k|\n str = CFString.new(k)\n key = str.to_binary(self)\n bdata += Binary.pack_it_with_size(@object_ref_size,key)\n end\n\n val.value.each_value do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size,v.to_binary(self))\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def binary(integer)\n\nend", "def binary(integer)\n\nend", "def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false\n return saved_object_count\n end", "def string_to_binary(val)\n saved_object_count = -1\n\n unless(@unique_table.has_key?(val)) then\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @unique_table[val] = saved_object_count\n utf16 = false\n\n val.each_byte do |b|\n if(b > 127) then\n utf16 = true\n break\n end\n end\n\n if(utf16) then\n bdata = Binary.type_bytes(\"6\",Binary.charset_strlen(val,\"UTF-8\")) # 6 is 0110, unicode string (utf16be)\n val = Binary.charset_convert(val,\"UTF-8\",\"UTF-16BE\")\n\n val.force_encoding(\"ASCII-8BIT\") if val.respond_to?(\"encode\")\n @object_table[saved_object_count] = bdata + val\n else\n bdata = Binary.type_bytes(\"5\",val.bytesize) # 5 is 0101 which is an ASCII string (seems to be ASCII encoded)\n @object_table[saved_object_count] = bdata + val\n end\n else\n saved_object_count = @unique_table[val]\n end\n\n return saved_object_count\n end", "def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end", "def convert_binary\n end", "def real_to_binary(val)\n bdata = Binary.type_bytes(\"2\",3) # 2 is 0010, type indicator for reals\n buff = [val].pack(\"d\")\n return bdata + buff.reverse\n end", "def add_binary(a,b)\n #your code here\n binary = a + b\n binary.to_s(2) # Convert um inteiro para string na base 2(base binária)\nend", "def value_type\n 'BINARY'\n end", "def array_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"a\", val.value.size) # a is 1010, type indicator for arrays\n\n val.value.each do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self));\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def show_binstring()\n @values.values.map do |v|\n v ? \"1\" : \"0\"\n end.join\n end", "def binary(digits: T.unsafe(nil)); end", "def binary(digits)\n string(BINARY_DIGITS, digits)\n end", "def string_to_binary(value)\n # Escape data prior to insert into a bytea column\n if value\n res = ''\n value.each_byte { |b| res << sprintf('\\\\\\\\%03o', b) }\n res\n end\n end", "def date_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT\n\n bdata = Binary.type_bytes(\"3\", 3) # 3 is 0011, type indicator for date\n @object_table[saved_object_count] = bdata + [val].pack(\"d\").reverse\n\n return saved_object_count\n end", "def pack_db value\r\n pack_data(\r\n if value > -10\r\n value * 10000\r\n else\r\n (-1 * Math.log10((value / 10).abs) * 200000) - 100000\r\n end\r\n )\r\nend", "def binary\n decimal.to_s(2).rjust(8, '0')\n end", "def serialize_value(value)\n [value.to_i].pack('N')\n end", "def init_ary(ary)\n (1..100).each do |num|\n ary.push( { decimal: num, binary: num.to_s(2).rjust(7,\"0\")} )\n end\n ary\nend", "def in_binary\n Bases.val(self).in_binary\n end", "def string_to_binary(value)\n self.class.string_to_binary(value)\n end", "def to_binary\n Formatters::Binary.new.serialize self\n end", "def to_bin(number)\n number = Integer(number);\n if(number == 0)\n return 0;\n end\n ret_bin = \"\";\n ## Untill val is zero, convert it into binary format\n while(number != 0)\n ret_bin = String(number % 2) + ret_bin;\n number = number / 2;\n end\n return ret_bin;\n end", "def int_to_binary_string(number)\n number.to_s(2)\nend", "def int_to_binary(value)\n nbytes = 0\n nbytes = 1 if value > 0xFF # 1 byte integer\n nbytes += 1 if value > 0xFFFF # 4 byte integer\n nbytes += 1 if value > 0xFFFFFFFF # 8 byte integer\n nbytes = 3 if value < 0 # 8 byte integer, since signed\n\n bdata = Binary.type_bytes(\"1\", nbytes) # 1 is 0001, type indicator for integer\n buff = \"\"\n\n if(nbytes < 3) then\n fmt = \"N\"\n\n if(nbytes == 0) then\n fmt = \"C\"\n elsif(nbytes == 1)\n fmt = \"n\"\n end\n\n buff = [value].pack(fmt)\n else\n # 64 bit signed integer; we need the higher and the lower 32 bit of the value\n high_word = value >> 32\n low_word = value & 0xFFFFFFFF\n buff = [high_word,low_word].pack(\"NN\")\n end\n\n return bdata + buff\n end", "def convert_to_binary\n @input.class == String ? @input : @input.to_s(2)\n end", "def field_to_binary(field_type, field_value)\n case field_type\n when \"boolean\"\n if field_value == \"true\"\n \"\\x01\".b\n elsif field_value == \"false\"\n \"\\x00\".b\n else\n raise \"Expected true/false, got #{field_value}\"\n end\n when \"float\"\n # Works with any of: \"123\", \"123.4\", \"123,4\"\n [field_value.gsub('\"', '').sub(\",\", \".\").to_f].pack(\"f\")\n when \"int\"\n [field_value.gsub('\"', '').to_i].pack(\"l\")\n when \"short\"\n [field_value.gsub('\"', '').to_i].pack(\"v\")\n when \"string\"\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n [str.size].pack(\"v\") + str.pack(\"v*\")\n when \"optstring\"\n # this is really stupid\n if field_value == \"nil\"\n \"\\x00\"\n else\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n \"\\x01\" + [str.size].pack(\"v\") + str.pack(\"v*\")\n end\n when /\\Ablob:(\\d+)/\n bloblen = $1.to_i\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value)\n else\n str = eval('\"' + field_value + '\"')\n end\n raise \"Blob expected to have #{bloblen} bytes, had #{str.size}\" unless str.size == bloblen\n str\n else\n warn \"Unknown ft/fv #{field_type} #{field_value}\"\n \"x\"\n end\n end", "def binary_to_string(value)\n # TODO: Figure out what Cassandra's blobs look like\n value\n end", "def base_converter(num, b)\n\nend", "def to_binary()\n return self.unpack('B*').join\n end", "def from_bits(bin_num)\n base10_value = 0\n @bit_vals.each_with_index do |val,i|\n base10_value += val if bin_num[i] == '1'\n end\n base10_value\n end", "def type_literal_generic_bignum(column)\n column[:serial] ? :bigserial : super\n end", "def add_ins(obj)\n self.first.value = self.first.value + obj.first.value\n obj.type = 'int'\n self.type = 'int'\n end", "def binary_representation(allow_z = true, allow_m = true) #:nodoc:\n bin_rep = [@x.to_f, @y.to_f].pack('EE')\n bin_rep += [@z.to_f].pack('E') if @with_z && allow_z # Default value so no crash\n bin_rep += [@m.to_f].pack('E') if @with_m && allow_m # idem\n bin_rep\n end", "def type_literal_generic_bignum_symbol(column)\n column[:serial] ? :bigserial : super\n end", "def symbol_to_bin\n if symbol.to_i.is_a? Integer\n symbol.to_i.to_s(2).rjust(16, '0')\n else\n\n end\n end", "def to_binary_string(min_length = 0)\n BitMapping.number_to_binary_string(number, min_length)\n end", "def tobeint(obj)\n\t\tif obj \n\t\t\treturn obj.to_s.gsub(/\\D/,'').to_i\n\t\tend\n\t\treturn obj\n\tend", "def nodes_binary_value\n binary = '0' * @nodes.map(&:id).max\n\n @nodes.each do |node|\n binary[@nodes.count - node.id] = '1'\n end\n\n binary\n end", "def to_binary(num)\n num_bin = ''\n current_power_of_2 = 1\n \n loop do\n num_bin.prepend ((num % (current_power_of_2 * 2)) / current_power_of_2).to_s\n \n break if num < current_power_of_2 * 2\n current_power_of_2 *= 2\n end\n \n num_bin.to_i\n end", "def initialize(bin_rep_length, values_table)\n @bin_rep_length = bin_rep_length\n @bit_vals = set_bit_vals\n @to_base10 = create_to_base10(values_table)\n @from_base10 = create_from_base10\n end", "def binary_string; end", "def to_bson(buffer = ByteBuffer.new)\n buffer.put_int32(value)\n end", "def convert(value) value end", "def to_bits(base10_num)\n bits = @bit_vals.map do |b|\n if base10_num >= b\n base10_num -= b\n '1'\n else\n '0'\n end\n end\n bits.join\n end", "def add_binary(a,b)\n total = a+b\n total.to_s(2)\nend", "def to_bytes v\n HBase.import_java_classes!\n\n case v\n when Array\n v.to_java(Java::byte)\n when String, ByteArray\n v.to_java_bytes\n when Fixnum\n Bytes.java_send :toBytes, [Java::long], v\n when Symbol\n v.to_s.to_java_bytes\n when Float\n Bytes.java_send :toBytes, [Java::double], v\n when true, false, ByteBuffer\n Bytes.to_bytes v\n when nil\n ''.to_java_bytes\n when Bignum\n raise ArgumentError, \"Integer too large. Consider storing it as a BigDecimal.\"\n when BigDecimal\n Bytes.java_send :toBytes, [java.math.BigDecimal], v.to_java\n when java.math.BigDecimal\n Bytes.java_send :toBytes, [java.math.BigDecimal], v\n when Hash\n len = v.length\n raise ArgumentError, \"Unknown value format\" unless len == 1\n\n val = v.values.first\n raise ArgumentError, \"Unknown value format\" unless val.is_a?(Numeric)\n\n case v.keys.first\n when :byte\n [val].to_java(Java::byte)\n when :int\n Bytes.java_send :toBytes, [Java::int], val\n when :short\n Bytes.java_send :toBytes, [Java::short], val\n when :long, :fixnum\n Bytes.java_send :toBytes, [Java::long], val\n when :float\n Bytes.java_send :toBytes, [Java::float], val\n when :double\n Bytes.java_send :toBytes, [Java::double], val\n else\n raise ArgumentError, \"Invalid value format\"\n end\n else\n if java_bytes?(v)\n v\n else\n raise ArgumentError.new(\"Don't know how to convert #{v.class} into Java bytes\")\n end\n end\n end", "def binary!\n @binary = true\n end", "def binary_representation(allow_z=true,allow_m=true)\r\n rep = [length].pack(\"V\")\r\n each {|linear_ring| rep << linear_ring.binary_representation(allow_z,allow_m)}\r\n rep\r\n end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def evidence_to_binary(e)\n\tb = Hash.new(\"0\")\n\te.each_char do |i|\n\t\tb[i] = \"1\"\n\tend\n\n\tbinary = \"0000\"\n\tbinary[0] = b['N']\n\tbinary[1] = b['S']\n\tbinary[2] = b['W']\n\tbinary[3] = b['E']\n\tbinary\nend", "def decimal_to_binary(decimal)\n binary = 0\n power = 0\n\n if decimal.class == Integer\n until decimal == 0\n binary_digit = decimal % 2\n binary += binary_digit * (10 ** power)\n\n decimal /= 2\n power += 1\n end\n\n return binary\n elsif decimal.class == Float\n decimal_before_dot = decimal - (decimal % 1)\n binary_before_dot = 0\n\n\n until decimal_before_dot == 0\n binary_digit = decimal_before_dot % 2\n binary_before_dot += binary_digit * (10 ** power)\n\n\n decimal_before_dot = (decimal_before_dot / 2)\n decimal_before_dot = decimal_before_dot - (decimal_before_dot % 1)\n\n power += 1\n end\n\n\n decimal_after_dot = (decimal % 1)\n binary_after_dot_string = \"0.\"\n\n until decimal_after_dot == 0\n binary_digit = (decimal_after_dot * 2) - ((decimal_after_dot * 2) % 1)\n\n if binary_digit == 0\n binary_after_dot_string << \"0\"\n elsif binary_digit == 1\n binary_after_dot_string << \"1\"\n end\n\n decimal_after_dot = (decimal_after_dot * 2) % 1\n end\n\n binary_after_dot = binary_after_dot_string.to_f\n\n\n binary = binary_before_dot + binary_after_dot\n\n return binary\n else # if decimal input is not an integer or float\n raise ArgumentError, \"Not a number.\"\n end\n\nend", "def binary_representation(allow_z=true,allow_m=true) #:nodoc:\r\n bin_rep = [@x,@y].pack(\"EE\")\r\n bin_rep += [@z].pack(\"E\") if @with_z and allow_z #Default value so no crash\r\n bin_rep += [@m].pack(\"E\") if @with_m and allow_m #idem\r\n bin_rep\r\n end", "def numObj(arr)\n output_info = []\n arr.each {|num| output_info << {num.to_s => num.ord.to_s}}\n output_info\nend", "def getBin\n case @binDataType\n when 'B'\n bin = Bin.new('information', BytesValue.new(randString(@binDataSize)))\n when 'S'\n bin = Bin.new('information', StringValue.new(randString(@binDataSize)))\n else\n bin = Bin.new('information', IntegerValue.new(2**63))\n end\n\n bin\nend", "def decimal_to_binary(number)\n if number == 0\n 0\n else\n number % 2 + 10 * decimal_to_binary(number/2)\n end \nend", "def binarify(base_ten_num)\n raise 'input must be an integer' if base_ten_num.is_a?(String)\n base_ten_num.to_s(2)\nend", "def fake_bin(s)\n s.tr('1-9', '00001')\nend", "def handle_bit (num)\n num2str=''\n num2str+=NUM_MAP[num]\n return num2str\nend", "def append(value)\n table.previsous = value\n @digits << value\n value\n end", "def value; super.to_i; end", "def bits\n super.to_i\n end", "def bsb_number; end", "def add_binary(a,b)\n (a+b).to_s(2)\n\n # \"%b\" % (a+b)\nend", "def stringify_numbers(obj)\n\n obj.update(obj) do |key, value|\n if value.class == Hash\n stringify_numbers(value)\n elsif value.class == Integer\n value = value.to_s\n end\n end\nend", "def write_number(numeric)\n\t\twrite_byte(0)\n\t\twrite_double(numeric)\n\tend", "def BinaryConverter(str)\r\n return str.to_i(2)\r\nend", "def type_literal_generic_bignum_symbol(column)\n :bigint\n end", "def initialize(value)\n if value.is_a?(self.class)\n @value = value.value\n return\n end\n\n unless value.bson_int32?\n raise RangeError.new(\"#{value} cannot be stored in 32 bits\")\n end\n @value = value.freeze\n end", "def to_b\n return self.to_s(2)\n end", "def add_binary(a, b)\n (a + b).to_s(2)\nend", "def set_integer!(value)\n @objects = nil\n @memory = nil\n\n if value < 0\n self[:type] = :negative_integer\n self[:values][:i64] = value\n else\n self[:type] = :positive_integer\n self[:values][:u64] = value\n end\n end", "def symbol_to_bin\n symbol.to_i.to_s(2).rjust(16, '0')\n end", "def number_to_binary_string(number, min_length = 0)\n assert_non_negative(number)\n binary_string = ''.force_encoding(Encoding::ASCII_8BIT)\n\n while number > 0\n byte_value = number & 0xFF\n binary_string << byte_value\n number >>= 8\n end\n\n binary_string.reverse.rjust(min_length, \"\\x00\")\n end", "def convert(decimal, type)\t\n\t\t# arrays of hashes for conversion to binary\n\t\tnavigate_to = [\n\t\t\tHash[\"binary\" => \"00\", \"navigate\" => \"N/A\"],\n\t\t\tHash[\"binary\" => \"01\", \"navigate\" => \"Application\"],\n\t\t\tHash[\"binary\" => \"10\", \"navigate\" => \"Completed Application\"]\n\t\t]\n\t\taction_verb = [\n\t\t\tHash[\"binary\" => \"0\", \"action\" => \"N/A\"],\n\t\t\tHash[\"binary\" => \"1\", \"action\" => \"Waive\"]\n\t\t]\n\t\tlocation_india = [\n\t\t\tHash[\"binary\" => \"00\", \"india\" => \"N/A\"],\n\t\t\tHash[\"binary\" => \"01\", \"india\" => \"true\"],\n\t\t\tHash[\"binary\" => \"10\", \"india\" => \"false\"]\n\t\t]\n\t\tcoverage_action = [\n\t\t\tHash[\"binary\" => \"00\", \"coverage\" => \"N/A\"],\n\t\t\tHash[\"binary\" => \"01\", \"coverage\" => \"Waive\"],\n\t\t\tHash[\"binary\" => \"10\", \"coverage\" => \"Accept\"]\n\t\t]\n\t\tquestion_object = [\n\t\t\tHash[\"binary\" => \"00000\", \"object\" => \"N/A\"],\n\t\t\tHash[\"binary\" => \"00001\", \"object\" => \"Direct Deposit\"],\n\t\t\tHash[\"binary\" => \"00010\", \"object\" => \"Benefits\"],\n\t\t\tHash[\"binary\" => \"00011\", \"object\" => \"Coverage\"],\n\t\t\tHash[\"binary\" => \"00100\", \"object\" => \"Upload\"],\n\t\t\tHash[\"binary\" => \"00101\", \"object\" => \"Fill\"],\n\t\t\tHash[\"binary\" => \"00110\", \"object\" => \"Information\"],\n\t\t\tHash[\"binary\" => \"00111\", \"object\" => \"Equipment\"],\n\t\t\tHash[\"binary\" => \"01000\", \"object\" => \"Certificate Holder\"],\n\t\t\tHash[\"binary\" => \"01001\", \"object\" => \"Cancel EFT\"],\n\t\t\tHash[\"binary\" => \"01010\", \"object\" => \"New EFT Account\"],\n\t\t\tHash[\"binary\" => \"01011\", \"object\" => \"Advertise\"],\n\t\t\tHash[\"binary\" => \"01100\", \"object\" => \"Eligible\"],\n\t\t\tHash[\"binary\" => \"01101\", \"object\" => \"Sick Leaave Benefits\"],\n\t\t\tHash[\"binary\" => \"01110\", \"object\" => \"Supporting Document\"],\n\t\t\tHash[\"binary\" => \"01111\", \"object\" => \"Page\"],\n\t\t\tHash[\"binary\" => \"10000\", \"object\" => \"Form\"],\n\t\t\tHash[\"binary\" => \"10001\", \"object\" => \"Employment Gap\"],\n\t\t\tHash[\"binary\" => \"10010\", \"object\" => \"It\"],\n\t\t\tHash[\"binary\" => \"10011\", \"object\" => \"Myself\"],\n\t\t\tHash[\"binary\" => \"10100\", \"object\" => \"Someone\"],\n\t\t\tHash[\"binary\" => \"10101\", \"object\" => \"Representative\"],\n\t\t\tHash[\"binary\" => \"10110\", \"object\" => \"Coverage\"],\n\t\t\tHash[\"binary\" => \"10111\", \"object\" => \"Typed Letter\"],\n\t\t\tHash[\"binary\" => \"11000\", \"object\" => \"Written Letter\"],\n\t\t\tHash[\"binary\" => \"11001\", \"object\" => \"Letter\"]\n\t\t]\n\t\tquesiton_type = [\n\t\t\tHash[\"binary\" => \"0000\", \"qtype\" => \"NA\"],\n\t\t\tHash[\"binary\" => \"0001\", \"qtype\" => \"Where\"],\n\t\t\tHash[\"binary\" => \"0010\", \"qtype\" => \"Does\"],\n\t\t\tHash[\"binary\" => \"0011\", \"qtype\" => \"Can\"],\n\t\t\tHash[\"binary\" => \"0100\", \"qtype\" => \"Who\"],\n\t\t\tHash[\"binary\" => \"0101\", \"qtype\" => \"When\"],\n\t\t\tHash[\"binary\" => \"0110\", \"qtype\" => \"Should\"],\n\t\t\tHash[\"binary\" => \"0111\", \"qtype\" => \"Why\"],\n\t\t\tHash[\"binary\" => \"1000\", \"qtype\" => \"Which\"],\n\t\t\tHash[\"binary\" => \"1001\", \"qtype\" => \"What\"],\n\t\t\tHash[\"binary\" => \"1010\", \"qtype\" => \"How\"]\n\t\t]\n\t\t\n\t\tquestion_content = [\n\t\t\tHash[\"binary\" => \"00000\", \"qcontent\" => \"N/A\"],\n\t\t\tHash[\"binary\" => \"00001\", \"qcontent\" => \"Can't Fill\"],\n\t\t\tHash[\"binary\" => \"00010\", \"qcontent\" => \"Form in Queue\"],\n\t\t\tHash[\"binary\" => \"00011\", \"qcontent\" => \"Necessary\"],\n\t\t\tHash[\"binary\" => \"00100\", \"qcontent\" => \"Click\"],\n\t\t\tHash[\"binary\" => \"00101\", \"qcontent\" => \"In Queue\"],\n\t\t\tHash[\"binary\" => \"00110\", \"qcontent\" => \"Provide\"],\n\t\t\tHash[\"binary\" => \"00111\", \"qcontent\" => \"Side\"],\n\t\t\tHash[\"binary\" => \"01000\", \"qcontent\" => \"Provide\"],\n\t\t\tHash[\"binary\" => \"01001\", \"qcontent\" => \"Purpose\"],\n\t\t\tHash[\"binary\" => \"01010\", \"qcontent\" => \"Required\"],\n\t\t\tHash[\"binary\" => \"01011\", \"qcontent\" => \"Upload\"],\n\t\t\tHash[\"binary\" => \"01100\", \"qcontent\" => \"Options\"],\n\t\t\tHash[\"binary\" => \"01101\", \"qcontent\" => \"Mean\"],\n\t\t\tHash[\"binary\" => \"01110\", \"qcontent\" => \"Not-Posses\"],\n\t\t\tHash[\"binary\" => \"01111\", \"qcontent\" => \"Code\"],\n\t\t\tHash[\"binary\" => \"10000\", \"qcontent\" => \"Result\"],\n\t\t\tHash[\"binary\" => \"10001\", \"qcontent\" => \"Action\"],\n\t\t\tHash[\"binary\" => \"10010\", \"qcontent\" => \"Waived\"],\n\t\t\tHash[\"binary\" => \"10011\", \"qcontent\" => \"Fill\"],\n\t\t\tHash[\"binary\" => \"10100\", \"qcontent\" => \"Related\"],\n\t\t\tHash[\"binary\" => \"10101\", \"qcontent\" => \"Logon\"],\n\t\t\tHash[\"binary\" => \"10110\", \"qcontent\" => \"Years\"],\n\t\t\tHash[\"binary\" => \"10111\", \"qcontent\" => \"Obtain\"],\n\t\t\tHash[\"binary\" => \"11000\", \"qcontent\" => \"Age\"],\n\t\t\tHash[\"binary\" => \"11001\", \"qcontent\" => \"Know\"],\n\t\t\tHash[\"binary\" => \"11010\", \"qcontent\" => \"Navigate\"],\n\t\t\tHash[\"binary\" => \"11011\", \"qcontent\" => \"Fill\"],\n\t\t\tHash[\"binary\" => \"11100\", \"qcontent\" => \"Acts\"]\n\t\t]\n\t\t\n\t\t# return binary data\n\t\tif(type == \"quesiton_type\")\n\t\t\treturn quesiton_type[decimal][\"binary\"]\n\t\telsif(type == \"question_content\")\n\t\t\treturn question_content[decimal][\"binary\"]\n\t\telsif(type == \"question_object\")\n\t\t\treturn question_object[decimal][\"binary\"]\n\t\telsif(type == \"coverage_action\")\n\t\t\treturn coverage_action[decimal][\"binary\"]\n\t\telsif(type == \"location_india\")\n\t\t\treturn location_india[decimal][\"binary\"]\n\t\telsif(type == \"action_verb\")\n\t\t\treturn action_verb[decimal][\"binary\"]\n\t\telsif(type == \"navigate_to\")\n\t\t\treturn navigate_to[decimal][\"binary\"]\n\t\tend\n\tend", "def to_sxp_bin\n self\n end", "def attr_set_binary(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def convert_to_base_8(n)\r\n #n.method_name.method_name # replace these two method calls\r\n n.to_s(8).to_i\r\nend", "def from_bin(num_string)\n bin_vals = num_string.scan(eval(\"/.{#{@bin_rep_length}}/\"))\n base10_vals = bin_vals.map{|bin_val| from_bits(bin_val)}\n convert_from_base10(base10_vals).join\n end", "def put(ob)\n case ob\n when Fixnum, Bignum\n if ob < 0\n whdr TYPE_NINT, -ob\n else\n whdr TYPE_INT, ob\n end\n when String, Symbol\n ob = ob.to_s unless ob.is_a?(String)\n if notCached(ob)\n if ob.encoding == Encoding::BINARY\n whdr TYPE_BIN, ob.length\n wbin ob\n else\n whdr TYPE_TEXT, ob.bytesize\n wbin ob.dup.encode(Encoding::UTF_8)\n end\n end\n when Array\n if notCached(ob)\n whdr TYPE_LIST, ob.length\n ob.each { |x| put(x) }\n end\n when Hash\n if notCached(ob)\n whdr TYPE_DICT, ob.length\n ob.each { |k, v| self << k << v }\n end\n when Float\n case ob\n when 0\n whdr TYPE_EXTRA, DZERO\n when -1.0\n whdr TYPE_EXTRA, DMINUSONE\n when +1.0\n whdr TYPE_EXTRA, DONE\n else\n whdr TYPE_EXTRA, TDOUBLE\n wdouble ob\n end\n when TrueClass, FalseClass\n whdr TYPE_EXTRA, ob ? TTRUE : TFALSE\n when nil\n whdr TYPE_CREF, 0\n when Time\n whdr TYPE_EXTRA, TTIME\n wrenc ob.to_i\n else\n error = \"error: not supported object: #{ob}, #{ob.class}\"\n raise NotSupportedException, error\n end\n self\n end", "def to_s\n \"%0#{size}b\" % number\n end", "def decimal_to_binary(num)\n binary_array = []\n until num == 0\n # prepend will add the new value to the front, instead of the end\n binary_array.prepend(num % 2)\n num /= 2\n end\n return binary_array\nend", "def input_to_bitstring( value )\r\n value\r\n end", "def type_literal_generic_bigdecimal(column)\n type_literal_generic_numeric(column)\n end", "def convert_to_base_8(n)\n n.to_s(8).to_i # replace these two method calls\nend", "def add_binary(a,b)\n sum = (a+b).to_s(2)\nend", "def toBinary (x)\n if (x>1)\n toBinary(x/2) + (x%2).to_s\n elsif x==1\n return x.to_s\n end\nend", "def add_binary(a,b)\n #your code here\n sum = a + b\n return sum.to_s(2)\nend", "def convert_to_object_value(dynamo_value); dynamo_value; end", "def convert_data(v, opts = {})\n v.is_a?(BSON::Binary) ? v : BSON::Binary.new(to_hex(v['$hex'], opts), :generic)\n end", "def to_i() end", "def to_i() end", "def to_i() end", "def to_i() end", "def to_i() end", "def to_bin(num_string)\n digits = convert_to_base10(num_string)\n digits.map!{|char| to_bits(char)}\n digits.join\n end", "def decimal_to_binary (decimal)\r\n\t\t# ruby inbuilt method - see other files\r\n\t # divide number by 2 and log remainders?\r\n\r\n\t# get length of number\r\n\t# determine biggest power of 2 that fits into number\r\n\t# see keefer and thom solutions - built with remainders maths\r\n\r\n\r\n\r\nend", "def dec_to_binary(num)\r\n bin = []\r\n quot = Math.floor(num / 2)\r\n bin.push(num % 2)\r\n while (quot > 1) \r\n bin.unshift(quot % 2)\r\n quot = Math.floor(quot / 2)\r\n end\r\n bin.unshift(quot)\r\n return bin.join('')\r\nend" ]
[ "0.7372401", "0.6532221", "0.6515368", "0.6515368", "0.64618844", "0.6447378", "0.63010615", "0.6284817", "0.6267158", "0.6241623", "0.6154173", "0.60950464", "0.60596514", "0.60448486", "0.603212", "0.60292953", "0.60069513", "0.5987567", "0.589815", "0.58818686", "0.5877616", "0.5837042", "0.581212", "0.58042777", "0.5790436", "0.5787243", "0.5776894", "0.56926847", "0.56856585", "0.5670309", "0.564615", "0.56217027", "0.561058", "0.5597041", "0.5595157", "0.5574099", "0.55697376", "0.55633533", "0.5555503", "0.55305374", "0.5514742", "0.55083656", "0.5491942", "0.54776764", "0.5477502", "0.5470192", "0.546766", "0.5467633", "0.54523396", "0.5444482", "0.54439", "0.5443019", "0.54320806", "0.5427082", "0.542518", "0.5397608", "0.5379706", "0.53760827", "0.5371664", "0.5370236", "0.5365438", "0.53632736", "0.5356215", "0.53487706", "0.53464", "0.53369606", "0.53347266", "0.5334261", "0.531548", "0.5314635", "0.53113943", "0.53029996", "0.5298058", "0.5296286", "0.52901334", "0.5288883", "0.52761614", "0.52757114", "0.52723837", "0.5272376", "0.52647644", "0.52616644", "0.5252358", "0.5250645", "0.52452207", "0.52437514", "0.5239982", "0.52357", "0.52247775", "0.5210348", "0.52013737", "0.51948845", "0.51913446", "0.51913446", "0.51913446", "0.51913446", "0.51913446", "0.5188825", "0.51714164", "0.5170903" ]
0.7999949
0
Convert date value (apple format) to binary and adds it to the object table
def date_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT bdata = Binary.type_bytes("3", 3) # 3 is 0011, type indicator for date @object_table[saved_object_count] = bdata + [val].pack("d").reverse return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_date()\n #This is a stub, used for indexing\n end", "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end", "def to_binary_dos_time; end", "def to_date string\n \n end", "def date1904() @@date1904; end", "def to_datetime()\n #This is a stub, used for indexing\n end", "def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end", "def typecast_hash_to_date(value)\n Date.new(*extract_time(value)[0, 3].map(&:to_i))\n end", "def date\n (birthday.to_time + 10**9).to_date\n end", "def typecast_value_date(value)\n case value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when Date\n value\n when String\n Sequel.string_to_date(value)\n when Hash\n Date.new(*[:year, :month, :day].map{|x| (value[x] || value[x.to_s]).to_i})\n else\n raise InvalidValue, \"invalid value for Date: #{value.inspect}\"\n end\n end", "def typecast_hash_to_date(value)\n ::Date.new(*extract_time(value)[0, 3])\n end", "def dict_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"d\",val.value.size) # d=1101, type indicator for dictionary\n\n val.value.each_key do |k|\n str = CFString.new(k)\n key = str.to_binary(self)\n bdata += Binary.pack_it_with_size(@object_ref_size,key)\n end\n\n val.value.each_value do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size,v.to_binary(self))\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def generate_object_date\n lambda do |record, accumulator, _context|\n object_date = record[OBJECT_BEGIN_DATE] unless record[OBJECT_BEGIN_DATE].to_s.empty?\n object_date = \"#{object_date} - #{record[OBJECT_END_DATE]}\" unless record[OBJECT_END_DATE].to_s.empty?\n accumulator << object_date\n end\n end", "def ruby_value\n to_datetime\n end", "def reg_binary_to_date(str)\n\t\tbegin\n\t\tcut=str.scan(/..../)\n\t\tyear=(cut[0][2,4]+cut[0][0,2]).hex.to_i\n\t\tmonth=(cut[1][2,4]+cut[1][0,2]).hex.to_i\n\t\tweekday=(cut[2][2,4]+cut[2][0,2]).hex.to_i\n\t\tdate=(cut[3][2,4]+cut[3][0,2]).hex.to_i\n\t\thour=(cut[4][2,4]+cut[4][0,2]).hex.to_i\n\t\tmin=(cut[5][2,4]+cut[5][0,2]).hex.to_i\n\t\tif min < 10 then\n\t\t\tmin=\"0#{min}\"\n\t\tend\n\t\tt = Time.gm(year,month,date,hour,min)\n\t\tmonth = t.strftime(\"%B\")\n\t\tweekday = t.strftime(\"%A\")\n\t\treturn \"#{weekday}, #{date} #{month} #{year} #{hour}:#{min}\"\n\t\trescue\n\t\t\treturn 'Error resolving last connected date'\n\t\tend\n\tend", "def typecast_to_primitive(value)\n if value.respond_to?(:to_date)\n value.to_date\n elsif value.is_a?(::Hash) || value.respond_to?(:to_mash)\n typecast_hash_to_date(value)\n else\n ::Date.parse(value.to_s)\n end\n rescue ArgumentError\n value\n end", "def date=(date)\n @table[:date] = date\n end", "def clean(blob)\n blob[:isbn].gsub!(/[=\"]/,'')\n blob[:isbn13].gsub!(/[=\"]/,'')\n blob[:date_read] = Time.parse(blob[:date_read]).strftime(\"%F\") if blob[:date_read]\n blob[:date_added] = Time.parse(blob[:date_added]).strftime(\"%F\") if blob[:date_added]\n return blob\nend", "def to_date(value)\n # return(date($this->DateFormat,value))\n end", "def convert_binary\n end", "def quote_date_with_to_date(value)\n value = value.to_s(:db) if value.acts_like?(:date) || value.acts_like?(:time)\n \"TO_DATE('#{value}','YYYY-MM-DD HH24:MI:SS')\"\n end", "def value\n self.class.get_date(@bits)\n end", "def insert(date, value)\n date_time = DateTime.parse(date)\n # Create necessary fields if they do not exist\n @content[date_time.year] ||= {}\n @content[date_time.year][date_time.month] ||= {}\n @content[date_time.year][date_time.month][date_time.day] ||= {}\n @content[date_time.year][date_time.month][date_time.day][date_time.hour] ||= {}\n @content[date_time.year][date_time.month][date_time.day][date_time.hour][date_time.min] ||= {}\n @content[date_time.year][date_time.month][date_time.day][date_time.hour][date_time.min][date_time.sec] ||= []\n @content[date_time.year][date_time.month][date_time.day][date_time.hour][date_time.min][date_time.sec] << value\n end", "def to_db(value)\n value = value.new_offset(0) if value.respond_to?(:new_offset)\n\n args = [value.year, value.month, value.day]\n args += (value.class == Date ? [0, 0, 0] : [value.hour, value.min, value.sec])\n\n Time.utc(*args).to_i\n end", "def date_to_string(date, type = T.unsafe(nil), style = T.unsafe(nil)); end", "def params_to_date(params,key)\r\n date = Date.civil(params[key][:year].to_i, params[key][:month].to_i, params[key][:day].to_i)\r\n end", "def to_date\n find\n end", "def to_binary\n Formatters::Binary.new.serialize self\n end", "def initialize data\n super\n self['date'] = Time.at date / 1_000\n end", "def statement_to_date\n end", "def statement_to_date\n end", "def statement_to_date\n end", "def to_sql\n self.to_datetime.to_sql\n \tend", "def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end", "def string_to_binary(value)\n # Escape data prior to insert into a bytea column\n if value\n res = ''\n value.each_byte { |b| res << sprintf('\\\\\\\\%03o', b) }\n res\n end\n end", "def type_literal_generic_date(column)\n :date\n end", "def convert_string_to_datetime(record)\n record['sf_lastmodifieddate'] = record['sf_lastmodifieddate'].to_datetime if record['sf_lastmodifieddate']\n record['sf_createddate'] = record['sf_createddate'].to_datetime if record['sf_createddate']\n record['sf_lastactivitydate'] = record['sf_lastactivitydate'].to_date if record['sf_lastactivitydate']\n record\n end", "def typecast_to_date(value)\n if value.kind_of?(Hash)\n typecast_hash_to_date(value)\n else\n Date.parse(value.to_s)\n end\n end", "def easy_date; date; end", "def string_to_binary(val)\n saved_object_count = -1\n\n unless(@unique_table.has_key?(val)) then\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @unique_table[val] = saved_object_count\n utf16 = false\n\n val.each_byte do |b|\n if(b > 127) then\n utf16 = true\n break\n end\n end\n\n if(utf16) then\n bdata = Binary.type_bytes(\"6\",Binary.charset_strlen(val,\"UTF-8\")) # 6 is 0110, unicode string (utf16be)\n val = Binary.charset_convert(val,\"UTF-8\",\"UTF-16BE\")\n\n val.force_encoding(\"ASCII-8BIT\") if val.respond_to?(\"encode\")\n @object_table[saved_object_count] = bdata + val\n else\n bdata = Binary.type_bytes(\"5\",val.bytesize) # 5 is 0101 which is an ASCII string (seems to be ASCII encoded)\n @object_table[saved_object_count] = bdata + val\n end\n else\n saved_object_count = @unique_table[val]\n end\n\n return saved_object_count\n end", "def read_binary_date(fname,fd,length)\n raise CFFormatError.new(\"Date greater than 8 bytes: #{length}\") if length > 3\n\n nbytes = 1 << length\n val = nil\n buff = fd.read(nbytes)\n\n case length\n when 0 then # 1 byte CFDate is an error\n raise CFFormatError.new(\"#{length+1} byte CFDate, error\")\n when 1 then # 2 byte CFDate is an error\n raise CFFormatError.new(\"#{length+1} byte CFDate, error\")\n when 2 then\n val = buff.reverse.unpack(\"f\")\n val = val[0]\n when 3 then\n val = buff.reverse.unpack(\"d\")\n val = val[0]\n end\n\n return CFDate.new(val,CFDate::TIMESTAMP_APPLE)\n end", "def date; end", "def date; end", "def date; end", "def date; end", "def convert(object); end", "def to_date\n if latest?\n Date.new(10_000, 1, 1)\n elsif timestamp?\n to_time.to_date\n else\n fail \"Version tag #{self} cannot be converted to a date!\"\n end\n end", "def ruby_value\n ::Date.parse(@date_time_value.strftime(\"%Y%m%d\"))\n end", "def date() self[:date]; end", "def test_it_can_be_converted_to_a_ruby_date_object\n assert_equal ::Date.new(2016, 1, 1), CarbonDate::Date.new(2016, precision: :year).to_date\n assert_equal ::Date.new(2016, 12, 1), CarbonDate::Date.new(2016, 12, precision: :month).to_date\n assert_equal ::Date.new(2016, 12, 12), CarbonDate::Date.new(2016, 12, 12, precision: :day).to_date\n assert_equal ::Date.new(-44, 3, 15), CarbonDate::Date.new(-44, 3, 15, precision: :day).to_date\n end", "def typecast_value_datetime(value)\n Sequel.typecast_to_application_timestamp(value)\n end", "def to_date\n ::Date.new(year, month, day)\n end", "def convert_to_dynamo_value(object_value); object_value; end", "def encode(object)\n ''.force_encoding(Encoding::BINARY).tap do |bytes|\n newest_version = schema_versions.keys.max\n schema = schema_versions[newest_version]\n bytes << newest_version.chr if has_version_tag\n write(object, bytes, schema)\n end\n end", "def date_string_to_readable(db_date)\n\n # Parse string (db date) to DateTime\n date = date_string_to_object(db_date)\n\n # Format it to a more readable string\n string = \"#{date.day}/#{date.month}/#{date.year}\"\n string << \" #{date.hour}:#{date.minute}\"\n\n return string\nend", "def date_string_to_object(db_date)\n\n # Current time to get the proper zone\n now = DateTime.now\n\n # Get raw DateTime object\n raw_date = DateTime.strptime(db_date, '%Y-%m-%d %H:%M:%S')\n\n # Get all info needed for the new obj\n year = raw_date.year\n month = raw_date.month\n day = raw_date.day\n hour = raw_date.hour\n min = raw_date.minute\n sec = raw_date.second\n zone = now.zone\n\n # Return the processed date\n date = DateTime.new(year, month, day, hour, min, sec, zone)\n return date\nend", "def read_date; end", "def key_by_date\n self.strftime('%Y-%m-%d')\n end", "def convert_to_object_value(dynamo_value); dynamo_value; end", "def date(date)\n @datee = Date.new(date[:year],date[:month],date[:day])\n end", "def to_date\n @to_date ||= begin\n Date.parse(@data['toDate']) if @data['toDate']\n end\n end", "def date\n object.date.strftime(\"%m/%d/%Y\")\n end", "def format_table_date(date)\n date.strftime('%Y%m%d')\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_datetime\n ))\n end", "def value_to_date(value)\n return value.strftime(NW_DATE_FORMAT) if value.respond_to? :strftime\n # Force the resulting string into 8 characters otherwise\n value = value.to_s\n value << ' ' until value.size == 8 if value.size < 8\n value = value[0..7] if value.size > 8\n value\n end", "def normalize_date( object, attribute, params )\n value = params[object][attribute]\n if value.match('\\d\\d\\d\\d-\\d\\d-\\d\\d')\n # all fine - iso format used\n return\n elsif value.size == 4\n # only year given\n params[object][attribute] = value + \"-01-01\"\n elsif value.match('\\d\\d?\\.\\d\\d?\\.\\d\\d$')\n # wrong format, probably something like 20.10.84\n date = value.split('.')\n year = (date[2].to_i < 10) ? date[2].to_i + 2000 : date[2].to_i + 1900\n date = Date.new( year, date[1].to_i, date[0].to_i ) \n params[object][attribute] = date.to_s\n elsif value.match('\\d?\\d\\.\\d?\\d\\.\\d\\d\\d\\d')\n # wrong format\n date = value.split('.')\n params[object][attribute] = date[2] + \"-\" + date[1] + \"-\" + date[0]\n else\n date = ParseDate.parsedate( value, true )\n params[object][attribute] = date[0].to_s + \"-\" + date[1].to_s + \"-\" + date[2].to_s\n end\n end", "def get_1904\n @date_1904\n end", "def convertDate(date)\n dateHash = date\n dateFormat = Date.parse dateHash\n dateString = dateFormat.strftime('%A, %b %d')\n return dateString \nend", "def isoify_dates!(hash)\n hash.replace isoify_dates hash\n end", "def date_to_bin(date) \n diff = (date.min>30) ? 60-date.min : 30-date.min\n d = date + diff.minutes\n min = (d.min<10) ? \"0#{d.min}\" : d.min.to_s\n hour = (d.hour>12) ? d.hour-12 : d.hour\n hour = 12 if hour == 0\n hour = (hour<10) ? \"0#{hour}\" : hour.to_s\n m = d.strftime(\"%p\").downcase\n return \"#{hour}:#{min}#{m}\"\n end", "def array_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"a\", val.value.size) # a is 1010, type indicator for arrays\n\n val.value.each do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self));\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def marshal_save\n donnee_totale.merge!(updated_at: Time.now.to_i)\n # log \"DATA FILM ENREGISTRÉES (film#donnee_totale) :#{RC}#{donnee_totale.inspect}\"\n File.open(marshal_file,'wb'){|f| f.write Marshal.dump(donnee_totale)}\n end", "def to_date\n @to_date ||= begin\n Date.parse(@data['toDate']) if @data['toDate']\n end\n end", "def convert_to_ruby_types(hash) \n hash.keys.each do |key|\n value = hash[key]\n next unless value # Leave nils as nils\n case key\n when 'uid', 'aid'; hash[key] = value.to_i\n when 'created_at'; hash[key] = DateTime.parse(value)\n when 'deleted'; hash[key] = value == 't'\n when 'value'; hash[key] = BigDecimal.new(value)\n when 'count'; hash[key] = value.to_i\n when 'period'\n value =~ /\"(.*?)\",\"(.*?)\"/\n hash[key] = [DateTime.parse($1), DateTime.parse($2)]\n end\n end\n hash\nend", "def date()\n\t\t(@start_date.to_time + (10**9)).to_date\n\tend", "def convert_data(v, opts = {})\n v.is_a?(BSON::Binary) ? v : BSON::Binary.new(to_hex(v['$hex'], opts), :generic)\n end", "def mongoize\n ::Date.mongoize(self)\n end", "def date_field(object_name, method, options = T.unsafe(nil)); end", "def read_date=(_); end", "def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end", "def stringify_date(date, month_type, type = T.unsafe(nil), style = T.unsafe(nil)); end", "def typecast_value_date(value)\n if convert_infinite_timestamps\n case value\n when *INFINITE_DATETIME_VALUES\n value\n else\n super\n end\n else\n super\n end\n end", "def claim_to_date\n unless eob.claim_to_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_to_date = \"00000000\"\n else\n claim_to_date = eob.claim_to_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '233'\n claim_date_elements << claim_to_date\n claim_date_elements.join(@element_seperator)\n end\n end", "def from_formotion!(data)\n self.returnable_columns.each{|column|\n if data[column] && column_type(column) == :date || column_type(column) == :time\n data[column] = Time.at(data[column]) unless data[column].nil?\n end\n value = self.send(\"#{column}=\", data[column])\n }\n end", "def date\n (@birth_date.to_time + 1_000_000_000).to_date\n end", "def to_date(date)\n date ? date : (' ' * 10) # '00/00/0000'.length\n end", "def to_date(date)\n date ? date : (' ' * 10) # '00/00/0000'.length\n end", "def value_for(value)\n return value.to_s(:db) if value.kind_of?(Time) \n return value.to_s(:db) if value.kind_of?(Date)\n return value.to_s\n end", "def convert\n end", "def convert\n end", "def datetime_data(object)\n return object unless object.present?\n\n DateTime.strptime(object, '%Y-%m-%d').to_s\n rescue ArgumentError => e\n rescue_and_retry_datetime(object, e)\n end", "def manufacture_date\n bf = data['ManufactureDate']\n day = bf & ((2**5)-1)\n month = (bf & (((2**4)-1) << 5)) >> 5\n year = ((bf & (((2**7)-1) << 9)) >> 9) + 1980\n\n # Ruby 1.8 lacks Time#strptime\n Time.parse Date.new(year, month, day).to_s\n end", "def add_date\n @bib.date.each do |d|\n case d.type\n when \"published\"\n @item.year = d.on :year\n month = d.on :month\n @item.month = month if month\n when \"accessed\" then @item.urldate = d.on.to_s\n end\n end\n end", "def literal_date(v)\n v.strftime(\"DATE '%Y-%m-%d'\") \n end", "def type_cast_for_schema(value) # :nodoc:\n case value\n when 'toDate(now()', 'CAST(now() AS Date)'\n 'now()'.inspect\n else\n value.inspect\n end\n end", "def born_date\n super.to_s(:long)\n end", "def add_date(date_val = '')\n header['date'] = date_val\n end", "def shortDate(obj)\n obj.strftime(\"%m/%d/%Y\")\n end", "def to(value)\n merge(culto: value.iso8601)\n end" ]
[ "0.62352306", "0.6061859", "0.5925008", "0.59146583", "0.5899505", "0.58940595", "0.5834136", "0.5696109", "0.56730443", "0.5643133", "0.56275725", "0.5623474", "0.56228405", "0.56044054", "0.5595214", "0.55874425", "0.55853236", "0.55780107", "0.55737776", "0.5545583", "0.5544006", "0.5528534", "0.5527256", "0.5500029", "0.5481531", "0.5471101", "0.54313254", "0.54200405", "0.54153025", "0.5407679", "0.537997", "0.537997", "0.537997", "0.53768855", "0.53484905", "0.53474915", "0.5346115", "0.53456557", "0.5330957", "0.5323648", "0.5322297", "0.5307454", "0.5295656", "0.5295656", "0.5295656", "0.5295656", "0.5294863", "0.528305", "0.5278004", "0.5265465", "0.52605027", "0.5259235", "0.5259223", "0.525516", "0.5253291", "0.52441573", "0.5233435", "0.5227504", "0.522327", "0.52196443", "0.5209629", "0.5209421", "0.5204748", "0.52035594", "0.51999736", "0.51927966", "0.5190637", "0.5187745", "0.5184353", "0.5178792", "0.51715696", "0.51710516", "0.516364", "0.51594007", "0.51582265", "0.5155837", "0.5149958", "0.5129955", "0.51198465", "0.51185113", "0.5118145", "0.51157016", "0.5115001", "0.5106758", "0.5106342", "0.51040417", "0.5097669", "0.5097669", "0.5090335", "0.50885355", "0.50885355", "0.5068316", "0.5056527", "0.5051183", "0.5047365", "0.50464666", "0.50410694", "0.50370616", "0.50351745", "0.5029199" ]
0.80985737
0
Convert a bool value to binary and add it to the object table
def bool_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 @object_table[saved_object_count] = val ? "\x9" : "\x8" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_boo string\n\t\tActiveRecord::Type::Boolean.new.cast(string)\n\tend", "def old_boolean_to_binary(arr)\n binary = \"\"\n\n arr.each do |boolean|\n if boolean\n binary += \"1\"\n else\n binary += \"0\"\n end\n end\n\n binary\nend", "def boolean_to_binary(array)\nend", "def write_bool(*b); end", "def boolean_to_binary(arr)\r\n\r\n binary = \"\"\r\n\r\n # iteration each method\r\n arr.each {|bool|\r\n if bool == true\r\n\r\n # bool true to binary 1\r\n binary << \"1\"\r\n else\r\n\r\n # bool false to binary 0\r\n binary << \"0\"\r\n end }\r\n\r\n binary\r\nend", "def boolean\n Util.from_bytes :boolean, value\n end", "def boolean_to_string(b)\n return b.to_s\nend", "def boolify(val)\n\nend", "def to_bool str\r\n ActiveRecord::Type::Boolean.new.type_cast_from_user(str)\r\n end", "def set_boolean!(value)\n @objects = nil\n @memory = nil\n\n self[:type] = :boolean\n self[:values][:boolean] = if value\n 1\n else\n 0\n end\n end", "def binary!\n @binary = true\n end", "def cast_to_boolean(input)\n ActiveRecord::Type::Boolean.new.type_cast_from_user(input)\n end", "def bool_sheet(bool)\n \nend", "def <<(obj)\n raise Error::TypeError unless obj.is_a?(De::Boolean::Bn)\n super(obj)\n end", "def convert_boolean(key)\n @params[key] = _boolinze(@params[key]) if _is_bool?(get_default(key))\n end", "def to_bool() true end", "def boolean_to_binary(arr)\n result = ''\n i = 0\n while i < arr.length\n result << '1' if arr[i]\n result << '0' if !arr[i]\n i += 1\n end\n return result\nend", "def to_b\n self != \"false\"\n end", "def bool_conv(value)\n value == HEX_FALSE ? false : true\n end", "def boolean_to_string(b)\n if true\n \"true\"\n else\n \"false\"\n end\nend", "def write_booleanr(bool)\n\t\twrite_byte(1)\n\t\twrite_boolean(bool)\n\tend", "def boolean cols\n decode_values :boolean, cols\n end", "def to_sba()\n return SBAStore::SBABoolean.new(nil, self.VAR_OBJECT())\n end", "def to_b\n true\n end", "def write_boolean(boolean)\n boolean ? write_int8(1) : write_int8(0)\n end", "def boolean_to_string(b)\n if b \n \"true\"\n else\n \"false\"\n end\nend", "def type_literal_generic_boolean(column)\n :boolean\n end", "def value_to_boolean(value)\n value = get_param(value) if value.is_a?(Symbol)\n ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)\n end", "def convert_to_bool_valued_hash(params)\n params = if (params.is_a?(String)) then\n convert_to_truthy_hash(params)\n else\n convert_values_to_int(params)\n end\n\n format_hash(params)\n end", "def booleans cols\n decode_values :boolean, cols, true\n end", "def convert_string_to_bool(value)\n case value\n when \"true\"\n true\n when \"false\"\n false\n when Array\n value.map { |elem| convert_string_to_bool(elem) }\n when Hash\n value.each do |key, elem|\n value[key] = convert_string_to_bool(elem)\n end\n value\n else\n value\n end\n end", "def boolean\n map ->(primitive) { primitive.to_bool }\n end", "def toggle_param_binary(obj)\n if obj.value.to_s == \"1\"\n obj.value = nil\n else\n obj.value = \"1\"\n end\n return obj\n end", "def to_bool(value)\n ActiveModel::Type::Boolean.new.cast(value.to_s.strip)\n end", "def to_boolean(value)\n case value\n when :true, 'true'\n true\n else\n false\n end\n end", "def to_bool(value)\n value.to_s.downcase == 'true' ? true : false\n end", "def convert_tinyint_to_bool=(v)\n @conversion_procs[1] = v ? TYPE_TRANSLATOR_BOOLEAN : TYPE_TRANSLATOR_INTEGER\n @convert_tinyint_to_bool = v\n end", "def with_convert_smallint_to_bool(v)\n clone(:convert_smallint_to_bool=>v)\n end", "def attr_bool_writer *symbols\n attr_writer *symbols\n end", "def coerce_str_to_bool(*keys)\n coerce(*keys){ |str_bool| (str_bool == 'on' || str_bool == 'true')}\n end", "def munge_boolean(value)\n case value\n when true, 'true', :true\n 'true'\n when false, 'false', :false\n 'false'\n else\n raise \"Invalid value for munge_boolean #{value}\"\n end\n end", "def boolean_type\n 'Boolean'\n end", "def to_bool; self; end", "def to_bool; self; end", "def db_boolean(val)\n if adapter == :postgres\n val ? 'TRUE' : 'FALSE'\n else\n val ? '1' : '0'\n end\n end", "def convert_binary\n end", "def set_boolean_value\n @values = [Value.new(@context, true)]\n end", "def has_booleans(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n\n attr_reader attr\n define_reader_with_options(attr,options) \n define_method(\"#{attr.to_s}=\") do |val|\n instance_variable_set(\"@#{attr}\", val.to_s.to_b)\n attributes[attr] = val\n val\n\n end\n\n define_method (\"#{attr.to_s}?\") do\n send(\"#{attr.to_s}\".to_sym).to_s.to_b\n end\n end\n end", "def typecast_value_boolean(opts={});true;end", "def bool_value(value)\n value = @filters[value] if value.is_a? Symbol\n ActiveRecord::Type::Boolean.new.cast(value)\n end", "def register_boolean_fields(*names)\n names.each do |name|\n boolean_fields[name.to_s] = {}\n boolean_fields[name.to_s][\"label\"] = name.to_s\n boolean_fields[name.to_s][\"value\"] = BOOLEAN_VALUE_FOR_ALL\n end\n end", "def writeBoolEntry(section, key, value)\n writeIntEntry(section, key, value ? 1 : 0)\n end", "def coerce_booleans(val)\n return 1 if [true, \"TRUE\", \"1\", \"true\", \"YES\", \"yes\"].include?(val)\n return 0 if [false, \"FALSE\", \"0\", \"false\", \"NO\", \"no\"].include?(val)\n\n val\n end", "def map_boolean(ident, &block) ; map_primitive(:boolean, ident, &block) ; end", "def to_bool() false end", "def in_binary\n Bases.val(self).in_binary\n end", "def type_literal_generic_trueclass(column)\n :boolean\n end", "def column_value_boolean\n case Utilities.adapter\n when 'mysql2', 'postgresql'\n column_value ? \"true\" : \"false\"\n when 'sqlite3', 'sqlserver'\n column_value ? \"1\" : \"0\"\n end\n end", "def get_boolean_value\n\t\tend", "def type_literal_generic_trueclass(column)\n :bit\n end", "def bool(val)\n raise ArgumentError, \"bool() requires a boolean argument\" \\\n unless val == true || val == false\n\n self.int32(val ? 1 : 0)\n end", "def object_to_boolean(value)\n return [true, 'true', 1, '1', 'T', 't'].include?(value.class == String ? value.downcase : value)\n end", "def binary?\n @binary\n end", "def show_binstring()\n @values.values.map do |v|\n v ? \"1\" : \"0\"\n end.join\n end", "def boolean_attributes\n @boolean_attributes\n end", "def field_to_binary(field_type, field_value)\n case field_type\n when \"boolean\"\n if field_value == \"true\"\n \"\\x01\".b\n elsif field_value == \"false\"\n \"\\x00\".b\n else\n raise \"Expected true/false, got #{field_value}\"\n end\n when \"float\"\n # Works with any of: \"123\", \"123.4\", \"123,4\"\n [field_value.gsub('\"', '').sub(\",\", \".\").to_f].pack(\"f\")\n when \"int\"\n [field_value.gsub('\"', '').to_i].pack(\"l\")\n when \"short\"\n [field_value.gsub('\"', '').to_i].pack(\"v\")\n when \"string\"\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n [str.size].pack(\"v\") + str.pack(\"v*\")\n when \"optstring\"\n # this is really stupid\n if field_value == \"nil\"\n \"\\x00\"\n else\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n \"\\x01\" + [str.size].pack(\"v\") + str.pack(\"v*\")\n end\n when /\\Ablob:(\\d+)/\n bloblen = $1.to_i\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value)\n else\n str = eval('\"' + field_value + '\"')\n end\n raise \"Blob expected to have #{bloblen} bytes, had #{str.size}\" unless str.size == bloblen\n str\n else\n warn \"Unknown ft/fv #{field_type} #{field_value}\"\n \"x\"\n end\n end", "def binary?\n false\n end", "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def toread\n Types::Boolean.deserialize(@toread)\n end", "def to_cli_boolean(value)\n case value\n when true\n :true\n else\n :false\n end\n end", "def create_boolean_collection(options) #:nodoc:\n options[:true] ||= ::Formtastic::I18n.t(:yes)\n options[:false] ||= ::Formtastic::I18n.t(:no)\n options[:value_as_class] = true unless options.key?(:value_as_class)\n\n [ [ options.delete(:true), true], [ options.delete(:false), false ] ]\n end", "def to_bool\n if (self.to_bool == 1)\n puts \"TRUE\"\n elsif (self.to_bool == 0)\n puts \"FALSE\"\n elsif (self.to_bool == -1)\n puts \"NaN\"\n end\nend", "def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end", "def add_bool(tag, value)\n write_tag(tag, value ? Type::BOOL_TRUE : Type::BOOL_FALSE)\n\n self\n end", "def to_b(value)\n [0,false,nil].include?(value) ? false : true\n end", "def binary?\n @binary\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_bool\n ))\n end", "def attr_set_boolean(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def boolString(value)\n if value == \"0\"\n return \"false\"\n else\n return \"true\"\n end\n end", "def to_enable(value)\n value == :true ? 'Yes' : 'No'\n end", "def bool_to_sym(bool)\n bool == true ? :true : :false\n end", "def bool_to_sym(bool)\n bool == true ? :true : :false\n end", "def bool_to_word bool\n if bool == \"true\"\n \"Yes\"\n else\n \"No\"\n end\nend", "def type_bool!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n\n\n type = TYPE_BOOL\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 213:12: 'bool'\n match( \"bool\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 37 )\n\n\n end", "def schema_column_type(db_type)\n convert_tinyint_to_bool && db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end", "def create_boolean_collection(options) #:nodoc:\n options[:true] ||= ::I18n.t(:yes)\n options[:false] ||= ::I18n.t(:no)\n options[:value_as_class] = true unless options.key?(:value_as_class)\n\n [ [ options.delete(:true), true], [ options.delete(:false), false ] ]\n end", "def typecast_value_boolean(value)\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i, /\\Ano?\\z/i\n false\n else\n blank_object?(value) ? nil : true\n end\n end", "def quote_boolean(value)\n value.to_s.upcase\n end", "def convert_smallint_to_bool\n opts.has_key?(:convert_smallint_to_bool) ? opts[:convert_smallint_to_bool] : db.convert_smallint_to_bool\n end", "def convert_booleans(value)\n if [\"true\", \"false\"].include?(value)\n value = (value == \"true\")\n else\n value\n end\n end", "def string_to_binary(value)\n # Escape data prior to insert into a bytea column\n if value\n res = ''\n value.each_byte { |b| res << sprintf('\\\\\\\\%03o', b) }\n res\n end\n end", "def value_type\n 'BINARY'\n end", "def csv_format_boolean(object, attr)\n if object.send(attr) then \"Yes\" else \"No\" end\n end", "def schema_column_type(db_type)\n Sequel::Mysql2.convert_tinyint_to_bool && db_type == 'tinyint(1)' ? :boolean : super\n end", "def to_bool\n true\n end", "def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end", "def format_boolean(val, istruct)\n return istruct.nil_text if val.nil?\n\n val ? istruct.true_text : istruct.false_text\n end", "def boolean_to_word(bol)\n if bol \n return \"Yes\"\n else\n return \"No\"\n end\n end", "def boolean_to_word(bol)\n if bol \n return \"Yes\"\n else\n return \"No\"\n end\n end", "def booleanize_hash(node)\n # leaf: convert to boolean and return\n # hash: iterate over leaves\n return node == 'true' unless node.is_a?(ActionController::Parameters)\n\n newnode = {}\n node.each do |key, value|\n newnode[key] = booleanize_hash(value)\n end\n newnode\n end" ]
[ "0.72672784", "0.7210135", "0.7078653", "0.6999839", "0.699487", "0.66359603", "0.6601401", "0.6562944", "0.6548674", "0.65412736", "0.65098464", "0.640848", "0.6400983", "0.6390524", "0.63897985", "0.63661003", "0.63559127", "0.6315174", "0.6306795", "0.629747", "0.62785494", "0.62567073", "0.62369657", "0.62194276", "0.62052286", "0.6188091", "0.61805284", "0.61766833", "0.61524963", "0.6143362", "0.6139652", "0.6128708", "0.61165124", "0.61069566", "0.6089192", "0.60801226", "0.60781264", "0.60746956", "0.6056314", "0.6054431", "0.6037758", "0.6033493", "0.6016097", "0.6016097", "0.60089815", "0.59935284", "0.59922516", "0.5989073", "0.59828997", "0.5981151", "0.59650713", "0.5957488", "0.59325", "0.59105045", "0.5897213", "0.58954823", "0.5895046", "0.5886308", "0.58812064", "0.58791494", "0.58759147", "0.58702743", "0.5864797", "0.5864672", "0.5838881", "0.5822645", "0.5817009", "0.58144957", "0.57731557", "0.57655835", "0.5758971", "0.5758637", "0.57565296", "0.57479244", "0.5747858", "0.5741765", "0.5741309", "0.5739281", "0.57360494", "0.5734649", "0.5729973", "0.5729973", "0.5727405", "0.5722881", "0.5722161", "0.57106096", "0.5705902", "0.5701265", "0.57006174", "0.5691776", "0.56891483", "0.5685724", "0.5681664", "0.5681217", "0.5680471", "0.5678568", "0.5678568", "0.56746733", "0.56746733", "0.5671586" ]
0.8388247
0
Convert data value to binary format and add it to the object table
def data_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 bdata = Binary.type_bytes("4", val.bytesize) # a is 1000, type indicator for data @object_table[saved_object_count] = bdata + val return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_binary\n Formatters::Binary.new.serialize self\n end", "def dict_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"d\",val.value.size) # d=1101, type indicator for dictionary\n\n val.value.each_key do |k|\n str = CFString.new(k)\n key = str.to_binary(self)\n bdata += Binary.pack_it_with_size(@object_ref_size,key)\n end\n\n val.value.each_value do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size,v.to_binary(self))\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def string_to_binary(value)\n # Escape data prior to insert into a bytea column\n if value\n res = ''\n value.each_byte { |b| res << sprintf('\\\\\\\\%03o', b) }\n res\n end\n end", "def convert_binary\n end", "def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end", "def value_type\n 'BINARY'\n end", "def string_to_binary(val)\n saved_object_count = -1\n\n unless(@unique_table.has_key?(val)) then\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @unique_table[val] = saved_object_count\n utf16 = false\n\n val.each_byte do |b|\n if(b > 127) then\n utf16 = true\n break\n end\n end\n\n if(utf16) then\n bdata = Binary.type_bytes(\"6\",Binary.charset_strlen(val,\"UTF-8\")) # 6 is 0110, unicode string (utf16be)\n val = Binary.charset_convert(val,\"UTF-8\",\"UTF-16BE\")\n\n val.force_encoding(\"ASCII-8BIT\") if val.respond_to?(\"encode\")\n @object_table[saved_object_count] = bdata + val\n else\n bdata = Binary.type_bytes(\"5\",val.bytesize) # 5 is 0101 which is an ASCII string (seems to be ASCII encoded)\n @object_table[saved_object_count] = bdata + val\n end\n else\n saved_object_count = @unique_table[val]\n end\n\n return saved_object_count\n end", "def array_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"a\", val.value.size) # a is 1010, type indicator for arrays\n\n val.value.each do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self));\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end", "def binary_to_string(value)\n # TODO: Figure out what Cassandra's blobs look like\n value\n end", "def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false\n return saved_object_count\n end", "def date_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT\n\n bdata = Binary.type_bytes(\"3\", 3) # 3 is 0011, type indicator for date\n @object_table[saved_object_count] = bdata + [val].pack(\"d\").reverse\n\n return saved_object_count\n end", "def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end", "def convert_data(v, opts = {})\n v.is_a?(BSON::Binary) ? v : BSON::Binary.new(to_hex(v['$hex'], opts), :generic)\n end", "def binary_string; end", "def build_binary_data(data={})\n buffer = [68, 65, 84, 65, 0] # D A T A\n elements_to_send = []\n keys_to_send = data.keys\n\n Xplane::XPLANE_DATA_MAPPER.each do |element_id, included_elements|\n element = nil\n included_elements.each_with_index do |element_name, index|\n if keys_to_send.include? element_name\n element ||= new_element(element_id)\n element[index + 1] = data[element_name]\n end\n end\n elements_to_send.push element unless element.nil?\n end\n\n elements_to_send.each do |element|\n buffer += element\n end\n buffer.pack binary_format(elements_to_send.length)\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 2\n data << @data[0]\n data << (@data[1] ? 1 : 0)\n end", "def to_binary()\n return self.unpack('B*').join\n end", "def convert_to_binary\n @input.class == String ? @input : @input.to_s(2)\n end", "def data=(data)\n data.each_pair do |key,val|\n case\n when val.class == Fixnum # 1\n setLong(key.to_s,val)\n when val.class == Float #1.1\n setDouble(key.to_s,val)\n when val.class == Bignum # 11111111111111111\n setLong(key.to_s,val)\n when (val.class == TrueClass) || (val.class == FalseClass)\n setBoolean(key.to_s,val)\n when val.class == NilClass\n setObject(key.to_s,val)\n else\n setString(key.to_s,val.to_s)\n end\n end\n end", "def real_to_binary(val)\n bdata = Binary.type_bytes(\"2\",3) # 2 is 0010, type indicator for reals\n buff = [val].pack(\"d\")\n return bdata + buff.reverse\n end", "def field_to_binary(field_type, field_value)\n case field_type\n when \"boolean\"\n if field_value == \"true\"\n \"\\x01\".b\n elsif field_value == \"false\"\n \"\\x00\".b\n else\n raise \"Expected true/false, got #{field_value}\"\n end\n when \"float\"\n # Works with any of: \"123\", \"123.4\", \"123,4\"\n [field_value.gsub('\"', '').sub(\",\", \".\").to_f].pack(\"f\")\n when \"int\"\n [field_value.gsub('\"', '').to_i].pack(\"l\")\n when \"short\"\n [field_value.gsub('\"', '').to_i].pack(\"v\")\n when \"string\"\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n [str.size].pack(\"v\") + str.pack(\"v*\")\n when \"optstring\"\n # this is really stupid\n if field_value == \"nil\"\n \"\\x00\"\n else\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n \"\\x01\" + [str.size].pack(\"v\") + str.pack(\"v*\")\n end\n when /\\Ablob:(\\d+)/\n bloblen = $1.to_i\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value)\n else\n str = eval('\"' + field_value + '\"')\n end\n raise \"Blob expected to have #{bloblen} bytes, had #{str.size}\" unless str.size == bloblen\n str\n else\n warn \"Unknown ft/fv #{field_type} #{field_value}\"\n \"x\"\n end\n end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_binary; ''; end", "def encode(object)\n ''.force_encoding(Encoding::BINARY).tap do |bytes|\n newest_version = schema_versions.keys.max\n schema = schema_versions[newest_version]\n bytes << newest_version.chr if has_version_tag\n write(object, bytes, schema)\n end\n end", "def string_to_binary(value)\n self.class.string_to_binary(value)\n end", "def process_data(type, data)\n case type\n when :boolean\n MuseekBindings::BinUtils.pack_boolean(data)\n when :uint32\n MuseekBindings::BinUtils.pack_uint32(data)\n when :string\n MuseekBindings::BinUtils.pack_string(data)\n end\n end", "def data= blob\n $postgres.exec_prepared('wsfile_update', [self.id, {value: blob, format: 1}])\n end", "def marshal\n Marshal.dump(data)\n end", "def to_data value\n @types.each { |type|\n if type.has_to_data?\n return type.to_data value\n end\n }\n \n raise NoMethodError, \"#to_data not defined\"\n end", "def to_data\n to_s\n end", "def to_bson\n data.bytesize.to_bson + SUBTYPES.fetch(type) + data\n end", "def pack_data value\r\n [value].pack('l>').split('').map(&:ord)\r\nend", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 4\n data << @data[0]\n data << @data[1]\n data << @data[2]\n data << @data[3]\n end", "def conv_to_write_ary ( orig_key, orig_val, orig_typ, orig_dat )\n\n reg_key = value_buffer(orig_key)\n reg_val = value_buffer(orig_val)\n reg_typ = self.class.reg_type_conv_pol_rev(orig_typ).encode('UTF-8')\n if reg_typ == \"\\u0001\"\n reg_dat = orig_dat.encode('UTF-8')\n else\n $log.debug \"Conv_to_write_ary (show conversion): #{orig_dat} : #{orig_dat.encoding.name}\" if $DEBUG\n if orig_dat[/\\H/]\n reg_dat = orig_dat\n else\n reg_dat = Integer(orig_dat).chr.force_encoding('UTF-8')\n end\n end\n reg_siz = value_reg_siz(reg_dat)\n reg_dat = value_buffer(reg_dat)\n write_ary = [ reg_key , reg_val ,reg_typ ,reg_siz, reg_dat ]\n write_ary\n end", "def marshal\n @data\n end", "def serialize(_object, data); end", "def serialize(_object, data); end", "def in_binary\n Bases.val(self).in_binary\n end", "def data_as_bytes\n raise \"subclass responsibility\"\n end", "def data\n read_attribute(binary ? :binary_data : :data)\n end", "def serialize(object, data); end", "def to_bencode\n BEncode.dump(self)\n end", "def <<(obj)\n if obj.is_a?(String) || obj.is_a?(Integer)\n td = Table::Row::Data.new(obj.to_s)\n super(td)\n else\n expect(obj, [Data, Header])\n end\n super(obj)\n end", "def encode\n type_byte + encode_data\n end", "def binwrite(data, *args, **kwd); end", "def typecast_value_blob(value)\n value.is_a?(Sequel::SQL::Blob) ? value : Sequel::SQL::Blob.new(value)\n end", "def encode\n ret = [ id & 0xff, id >> 8, data_type ]\n ret << Zigbee::ZCL::DataType.class_for(data_type).new(value).encode_data\n ret.flatten\n end", "def to_data(prog, offset, data)\n if data.is_a?(Hash)\n res = \"\\x0\"*@struct_size\n @members.each do |n, m|\n if data.key?(n.to_sym)\n items = Array(data[n.to_sym])\n item_offset = m.offset\n m.count.times do |index|\n s = member_item_to_data(prog, m, offset + item_offset, items[index])\n res[item_offset, size=s.bytesize] = s\n item_offset += size\n end\n end\n end\n elsif data.respond_to? :to_z80bin\n res = data.to_z80bin[0,@struct_size].ljust(@struct_size, \"\\x0\")\n elsif data.is_a?(String)\n res = data.dup.force_encoding(Encoding::ASCII_8BIT)[0,@struct_size].ljust(@struct_size, \"\\x0\")\n else\n data = Array(data)\n res = ''\n index = 0\n @members.reject {|_, m| m.alias}.each do |_, m|\n m.count.times do\n s = member_item_to_data(prog, m, offset, data[index])\n offset += s.bytesize\n index += 1\n res << s\n end\n end\n end\n res\n end", "def binary_representation(allow_z=true,allow_m=true) #:nodoc:\r\n bin_rep = [@x,@y].pack(\"EE\")\r\n bin_rep += [@z].pack(\"E\") if @with_z and allow_z #Default value so no crash\r\n bin_rep += [@m].pack(\"E\") if @with_m and allow_m #idem\r\n bin_rep\r\n end", "def pack_db value\r\n pack_data(\r\n if value > -10\r\n value * 10000\r\n else\r\n (-1 * Math.log10((value / 10).abs) * 200000) - 100000\r\n end\r\n )\r\nend", "def cast(value)\n if value.is_a?(MySQLBinUUID::Type::Data)\n # It could be a Data object, in which case we should add dashes to the\n # string value from there.\n add_dashes(value.to_s)\n elsif value.is_a?(String) && value.encoding == Encoding::ASCII_8BIT && strip_dashes(value).length != 32\n # We cannot unpack something that looks like a UUID, with or without\n # dashes. Not entirely sure why ActiveRecord does a weird combination of\n # cast and serialize before anything needs to be saved..\n undashed_uuid = value.unpack1('H*')\n add_dashes(undashed_uuid.to_s)\n else\n super\n end\n end", "def getBin\n case @binDataType\n when 'B'\n bin = Bin.new('information', BytesValue.new(randString(@binDataSize)))\n when 'S'\n bin = Bin.new('information', StringValue.new(randString(@binDataSize)))\n else\n bin = Bin.new('information', IntegerValue.new(2**63))\n end\n\n bin\nend", "def to_primitive\n data\n end", "def marshal_dump\n data\n end", "def binary_representation(allow_z = true, allow_m = true) #:nodoc:\n bin_rep = [@x.to_f, @y.to_f].pack('EE')\n bin_rep += [@z.to_f].pack('E') if @with_z && allow_z # Default value so no crash\n bin_rep += [@m.to_f].pack('E') if @with_m && allow_m # idem\n bin_rep\n end", "def serialize_value(column, v)\n return v if v.nil?\n case model.serialization_map[column] \n when :marshal\n [Marshal.dump(v)].pack('m')\n when :yaml\n v.to_yaml\n when :json\n JSON.generate v\n else\n raise Error, \"Bad serialization format (#{model.serialization_map[column].inspect}) for column #{column.inspect}\"\n end\n end", "def to_str(opts={})\n @unique_table = {}\n @count_objects = 0\n @string_size = 0\n @int_size = 0\n @misc_size = 0\n @object_refs = 0\n\n @written_object_count = 0\n @object_table = []\n @object_ref_size = 0\n\n @offsets = []\n\n binary_str = \"bplist00\"\n unique_and_count_values(opts[:root])\n\n @count_objects += @unique_table.size\n @object_ref_size = Binary.bytes_needed(@count_objects)\n\n file_size = @string_size + @int_size + @misc_size + @object_refs * @object_ref_size + 40\n offset_size = Binary.bytes_needed(file_size)\n table_offset = file_size - 32\n\n @object_table = []\n @written_object_count = 0\n @unique_table = {} # we needed it to calculate several values, but now we need an empty table\n\n opts[:root].to_binary(self)\n\n object_offset = 8\n offsets = []\n\n 0.upto(@object_table.size-1) do |i|\n binary_str += @object_table[i]\n offsets[i] = object_offset\n object_offset += @object_table[i].bytesize\n end\n\n offsets.each do |offset|\n binary_str += Binary.pack_it_with_size(offset_size,offset)\n end\n\n binary_str += [offset_size, @object_ref_size].pack(\"x6CC\")\n binary_str += [@count_objects].pack(\"x4N\")\n binary_str += [0].pack(\"x4N\")\n binary_str += [table_offset].pack(\"x4N\")\n\n return binary_str\n end", "def blob(val)\n val.gsub(/[\\000-\\037\\047\\134\\177-\\377]/) do |b|\n \"\\\\#{ b[0].to_s(8).rjust(3, '0') }\"\n end\n end", "def serialize_value(value)\n [value.to_i].pack('N')\n end", "def encode(obj); end", "def to_s\n bits=\"\"\n @fields.each {|f| \n if f.kind_of? Fields::Field\n bits << f.bitstring\n else\n bits << f.to_bitstring\n end\n }\n [bits].pack('B*')\n end", "def convert(value)\n @path = []\n @values = {}\n to_data(value)\n end", "def convert(value)\n @path = []\n @values = {}\n to_data(value)\n end", "def data_string\n Data.serialize(data)\n end", "def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end", "def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end", "def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end", "def serialize(value)\n fbe_begin = create_begin\n @_model.set(value)\n create_end(fbe_begin)\n end", "def serialize_column(data)\n activerecord_json_column? ? data : super\n end", "def to_ruby(data, columns = nil, buffer = \"\", options = {})\n require 'sbyc/type_system/ruby'\n buffer << \"[\"\n first = true\n data.each{|t| \n buffer << (first ? \"\\n \" : \",\\n \")\n buffer << SByC::TypeSystem::Ruby::to_literal(t)\n first = false\n }\n buffer << \"\\n]\"\n end", "def repair!(data)\n if data.is_a?(Array) && data.size == 12\n self.data = data.pack(\"C*\")\n elsif data.is_a?(String) && data.size == 12\n self.data = data\n else\n raise TypeError, \"Could not convert #{data.inspect} into an ObjectId\"\n end\n end", "def inspect\n \"<BSON::Binary:0x#{object_id} type=#{type} data=0x#{data[0, 8].unpack1('H*')}...>\"\n end", "def serialize(value)\n fbe_initial_size = buffer.size\n\n fbe_struct_type = fbe_type\n fbe_struct_size = 8 + @_model.fbe_allocation_size(value)\n fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset\n if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size\n return 0\n end\n\n fbe_struct_size = 8 + @_model.set(value)\n buffer.resize(fbe_initial_size + fbe_struct_size)\n\n write_uint32(@_model.fbe_offset - 8, fbe_struct_size)\n write_uint32(@_model.fbe_offset - 4, fbe_struct_type)\n\n fbe_struct_size\n end", "def serialize(value)\n fbe_initial_size = buffer.size\n\n fbe_struct_type = fbe_type\n fbe_struct_size = 8 + @_model.fbe_allocation_size(value)\n fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset\n if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size\n return 0\n end\n\n fbe_struct_size = 8 + @_model.set(value)\n buffer.resize(fbe_initial_size + fbe_struct_size)\n\n write_uint32(@_model.fbe_offset - 8, fbe_struct_size)\n write_uint32(@_model.fbe_offset - 4, fbe_struct_type)\n\n fbe_struct_size\n end", "def serialize(value)\n fbe_initial_size = buffer.size\n\n fbe_struct_type = fbe_type\n fbe_struct_size = 8 + @_model.fbe_allocation_size(value)\n fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset\n if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size\n return 0\n end\n\n fbe_struct_size = 8 + @_model.set(value)\n buffer.resize(fbe_initial_size + fbe_struct_size)\n\n write_uint32(@_model.fbe_offset - 8, fbe_struct_size)\n write_uint32(@_model.fbe_offset - 4, fbe_struct_type)\n\n fbe_struct_size\n end", "def serialize(value)\n fbe_initial_size = buffer.size\n\n fbe_struct_type = fbe_type\n fbe_struct_size = 8 + @_model.fbe_allocation_size(value)\n fbe_struct_offset = buffer.allocate(fbe_struct_size) - buffer.offset\n if (buffer.offset + fbe_struct_offset + fbe_struct_size) > buffer.size\n return 0\n end\n\n fbe_struct_size = 8 + @_model.set(value)\n buffer.resize(fbe_initial_size + fbe_struct_size)\n\n write_uint32(@_model.fbe_offset - 8, fbe_struct_size)\n write_uint32(@_model.fbe_offset - 4, fbe_struct_type)\n\n fbe_struct_size\n end", "def serialize(value)\n return if value.nil?\n undashed_uuid = strip_dashes(value)\n\n # To avoid SQL injection, verify that it looks like a UUID. ActiveRecord\n # does not explicity escape the Binary data type. escaping is implicit as\n # the Binary data type always converts its value to a hex string.\n unless valid_undashed_uuid?(undashed_uuid)\n raise MySQLBinUUID::InvalidUUID, \"#{value} is not a valid UUID\"\n end\n\n Data.new(undashed_uuid)\n end", "def binary!\n @binary = true\n end", "def concat(value)\n @data.concat(value.dup.force_encoding(Encoding::BINARY))\n self\n end", "def type_literal_generic_file(column)\n :bytea\n end", "def convert_to_encoded_string(data_type, value)\r\n return KB_NIL if value.nil?\r\n\r\n case data_type\r\n when :YAML\r\n y = value.to_yaml\r\n if y =~ ENCODE_RE\r\n return y.gsub(\"&\", '&amp;').gsub(\"\\n\", '&linefeed;').gsub(\r\n \"\\r\", '&carriage_return;').gsub(\"\\032\", '&substitute;'\r\n ).gsub(\"|\", '&pipe;')\r\n else\r\n return y\r\n end\r\n when :String\r\n if value =~ ENCODE_RE\r\n return value.gsub(\"&\", '&amp;').gsub(\"\\n\", '&linefeed;'\r\n ).gsub(\"\\r\", '&carriage_return;').gsub(\"\\032\",\r\n '&substitute;').gsub(\"|\", '&pipe;')\r\n else\r\n return value\r\n end \r\n when :Memo\r\n return value.filepath\r\n when :Blob\r\n return value.filepath\r\n else\r\n return value.to_s\r\n end\r\n end", "def to_bin\n [\n \"data\",\n [body.size].pack(\"V\"),\n body\n ].join\n end", "def encode_data(fdf); end", "def serialize\n @raw_data\n end", "def to_data value\n if @to_data.nil?\n raise NoMethodError, \"#to_data not defined\"\n end\n \n @to_data.call value\n end", "def serialize_value\n # Returning nil will prevent the row from being saved, to save some time since the EavHash that manages this\n # entry will have marked it for deletion.\n raise \"Tried to save with a nil value!\" if @value.nil? or @value.is_a? NilPlaceholder\n\n update_value_type\n if value_type == SUPPORTED_TYPES[:Object]\n write_attribute :value, YAML::dump(@value)\n else\n write_attribute :value, @value.to_s\n end\n\n read_attribute :value\n end", "def marshal_dump\n @table\n end", "def set_raw!(value)\n value = value.to_s\n\n @objects = nil\n @memory = FFI::MemoryPointer.new(:uchar, value.length) \n @memory.write_bytes(value)\n\n self[:type] = :raw\n\n raw = self[:values][:raw]\n raw[:size] = value.length\n raw[:ptr] = @memory\n end", "def to_binary\n return '' unless @ready\n\n to_a.pack('C*') rescue binding.pry\n end", "def save_data_to_db(encoded_data)\n return unless encoded_data\n decoded_data = Base64.decode64(encoded_data)\n csv = parse_csv(decoded_data)\n\n csv.each do |data_chunk|\n create(data_chunk.slice(*attribute_names).symbolize_keys)\n end\n end", "def __convert_data(data, mode = nil)\n if mode != :converted\n JsonRpcObjects::Utils::Hash.keys_to_sym(data)\n else\n data\n end\n end", "def to_bin\n @id\n end", "def insert_bytea(column, value = :no_value)\n @columns << column\n @values << Translate.escape_bytea(value, @connection.pgconn) unless value == :no_value\n end", "def serialized_data\n\t\tdata = strip_hash( @data )\t\t\t\n\t\treturn Marshal.dump( data )\n\tend" ]
[ "0.6759858", "0.67387134", "0.6717039", "0.66537166", "0.66537064", "0.66328", "0.66024834", "0.6579127", "0.62942713", "0.61972284", "0.61822", "0.6161647", "0.6134418", "0.6081542", "0.60703397", "0.6036884", "0.59574085", "0.5957148", "0.5904086", "0.5901617", "0.5884673", "0.58817023", "0.5849811", "0.5849811", "0.5849811", "0.5849811", "0.5849811", "0.5849811", "0.5838086", "0.5828973", "0.5827777", "0.58274394", "0.5816704", "0.5810238", "0.5807188", "0.57968974", "0.5793555", "0.57806814", "0.5744515", "0.5732619", "0.5730898", "0.57257646", "0.57257646", "0.57223094", "0.56832385", "0.5669988", "0.56658226", "0.56656975", "0.5589337", "0.5588283", "0.5587237", "0.5572518", "0.55556625", "0.5532256", "0.551393", "0.55063754", "0.54985267", "0.5496499", "0.5489756", "0.5479861", "0.5477547", "0.5476806", "0.5472821", "0.54687816", "0.5460437", "0.5459687", "0.5457338", "0.54571635", "0.54571635", "0.5442659", "0.54400957", "0.54400957", "0.54400957", "0.54400957", "0.5434717", "0.54324096", "0.5429242", "0.5428942", "0.5414181", "0.5414181", "0.5414181", "0.5414181", "0.54131955", "0.5406585", "0.54011023", "0.540076", "0.53969365", "0.539033", "0.5389209", "0.5389063", "0.5381703", "0.5377543", "0.5375683", "0.53668326", "0.53643227", "0.535908", "0.53543794", "0.53468657", "0.53456014", "0.53421026" ]
0.80280674
0
Convert array to binary format and add it to the object table
def array_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 bdata = Binary.type_bytes("a", val.value.size) # a is 1010, type indicator for arrays val.value.each do |v| bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self)); end @object_table[saved_object_count] = bdata return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def to_binary\n Formatters::Binary.new.serialize self\n end", "def from_array(array)\n array.pack('U*')\n end", "def array_to_binary(arr)\n node = Node.new(arr[0])\n arr.slice(1..-1).each {|el| insert_into_tree(node, el) }\n node\nend", "def translate_to_binary(array_of_hex)\n array_of_binary = []\n array_of_hex.each do |num|\n array_of_binary << sprintf(\"%b\", num).rjust(32, '0')\n end\n array_of_binary\n end", "def dict_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"d\",val.value.size) # d=1101, type indicator for dictionary\n\n val.value.each_key do |k|\n str = CFString.new(k)\n key = str.to_binary(self)\n bdata += Binary.pack_it_with_size(@object_ref_size,key)\n end\n\n val.value.each_value do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size,v.to_binary(self))\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def convert_binary\n end", "def binary(array)\n @reactor.schedule { @driver.binary(array.to_a) }\n end", "def to_binary()\n return self.unpack('B*').join\n end", "def init_ary(ary)\n (1..100).each do |num|\n ary.push( { decimal: num, binary: num.to_s(2).rjust(7,\"0\")} )\n end\n ary\nend", "def txt2bin(array)\n text = array.to_s.strip.unpack('B*').to_s\n i = 4\n while i <= text.length\n text.insert(i, ' ')\n i += 5\n end\n self.say \"Binary: #{text}\"\n end", "def to_str(opts={})\n @unique_table = {}\n @count_objects = 0\n @string_size = 0\n @int_size = 0\n @misc_size = 0\n @object_refs = 0\n\n @written_object_count = 0\n @object_table = []\n @object_ref_size = 0\n\n @offsets = []\n\n binary_str = \"bplist00\"\n unique_and_count_values(opts[:root])\n\n @count_objects += @unique_table.size\n @object_ref_size = Binary.bytes_needed(@count_objects)\n\n file_size = @string_size + @int_size + @misc_size + @object_refs * @object_ref_size + 40\n offset_size = Binary.bytes_needed(file_size)\n table_offset = file_size - 32\n\n @object_table = []\n @written_object_count = 0\n @unique_table = {} # we needed it to calculate several values, but now we need an empty table\n\n opts[:root].to_binary(self)\n\n object_offset = 8\n offsets = []\n\n 0.upto(@object_table.size-1) do |i|\n binary_str += @object_table[i]\n offsets[i] = object_offset\n object_offset += @object_table[i].bytesize\n end\n\n offsets.each do |offset|\n binary_str += Binary.pack_it_with_size(offset_size,offset)\n end\n\n binary_str += [offset_size, @object_ref_size].pack(\"x6CC\")\n binary_str += [@count_objects].pack(\"x4N\")\n binary_str += [0].pack(\"x4N\")\n binary_str += [table_offset].pack(\"x4N\")\n\n return binary_str\n end", "def marshal_load array\n initialize array[0]\n end", "def boolean_to_binary(array)\nend", "def write_array(array)\n\t\twrite_byte(10)\n\t\twrite_word32_network(array.length)\n\t\tarray.each do |el| \n\t\t\twrite(el)\n\t\tend\n\tend", "def converted_arrays; end", "def to_ary() end", "def build_binary_data(data={})\n buffer = [68, 65, 84, 65, 0] # D A T A\n elements_to_send = []\n keys_to_send = data.keys\n\n Xplane::XPLANE_DATA_MAPPER.each do |element_id, included_elements|\n element = nil\n included_elements.each_with_index do |element_name, index|\n if keys_to_send.include? element_name\n element ||= new_element(element_id)\n element[index + 1] = data[element_name]\n end\n end\n elements_to_send.push element unless element.nil?\n end\n\n elements_to_send.each do |element|\n buffer += element\n end\n buffer.pack binary_format(elements_to_send.length)\n end", "def marshal_load(array)\n initialize array[0]\n end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def thrift_cell_from_native_array(array)\n cell = Hypertable::ThriftGen::Cell.new\n cell.row_key = array[0]\n cell.column_family = array[1]\n cell.column_qualifier = array[2] if !array[2].blank?\n cell.value = array[3] if array[3]\n cell.timestamp = array[4] if array[4]\n cell\n end", "def to_bencode\n BEncode.dump(self)\n end", "def convert(record)\n\t\t\tarrays_2 = Array.new\n\t\t\ttmp = hash_to_array(record)\n\t\t\tarrays_2.push(tmp)\n\t\tend", "def add_column_types obj\n FbArray.new(obj)\n end", "def to_bson(buffer = ByteBuffer.new)\n if buffer.respond_to?(:put_array)\n buffer.put_array(self)\n else\n position = buffer.length\n buffer.put_int32(0)\n each_with_index do |value, index|\n unless value.respond_to?(:bson_type)\n raise Error::UnserializableClass,\n \"Array element at position #{index} does not define its BSON serialized type: #{value}\"\n end\n\n buffer.put_byte(value.bson_type)\n buffer.put_cstring(index.to_s)\n value.to_bson(buffer)\n end\n buffer.put_byte(NULL_BYTE)\n buffer.replace_int32(position, buffer.length - position)\n end\n end", "def marshal_load(array)\n\t\t@lines, @columns, @stack = array\n\t\treturn self\n\tend", "def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end", "def encode(object)\n ''.force_encoding(Encoding::BINARY).tap do |bytes|\n newest_version = schema_versions.keys.max\n schema = schema_versions[newest_version]\n bytes << newest_version.chr if has_version_tag\n write(object, bytes, schema)\n end\n end", "def marshal_dump\n @table\n end", "def converter( array)\n #define hash to convert binary to pixel \n pixels = { \"1\" => \"*\", \"0\" => \" \" }\n output = Array.new\n #iterate to input array \n for i in array\n #populate output array with converted hex to binary values\n #use string hex function to convert input array of hex characters to binary\n output.push(array.to_s[i].hex.to_s(2)) \n end\n #iterate to output array\n for i in output\n # use puts to ouput each element of the output array on a new line\n #use gsub function to replaces binary representation of hex input to pixel hash representation \n puts output.to_s[i].gsub(/[01]/, '1' => '*', '0' => ' ')\n end\nend", "def to_ruby(data, columns = nil, buffer = \"\", options = {})\n require 'sbyc/type_system/ruby'\n buffer << \"[\"\n first = true\n data.each{|t| \n buffer << (first ? \"\\n \" : \",\\n \")\n buffer << SByC::TypeSystem::Ruby::to_literal(t)\n first = false\n }\n buffer << \"\\n]\"\n end", "def conv_to_write_ary ( orig_key, orig_val, orig_typ, orig_dat )\n\n reg_key = value_buffer(orig_key)\n reg_val = value_buffer(orig_val)\n reg_typ = self.class.reg_type_conv_pol_rev(orig_typ).encode('UTF-8')\n if reg_typ == \"\\u0001\"\n reg_dat = orig_dat.encode('UTF-8')\n else\n $log.debug \"Conv_to_write_ary (show conversion): #{orig_dat} : #{orig_dat.encoding.name}\" if $DEBUG\n if orig_dat[/\\H/]\n reg_dat = orig_dat\n else\n reg_dat = Integer(orig_dat).chr.force_encoding('UTF-8')\n end\n end\n reg_siz = value_reg_siz(reg_dat)\n reg_dat = value_buffer(reg_dat)\n write_ary = [ reg_key , reg_val ,reg_typ ,reg_siz, reg_dat ]\n write_ary\n end", "def convert\n unless should_convert?\n return { _existing_object_id: array.object_id }\n end\n\n dumped_ids << array.object_id\n\n result = array.map do |item|\n UniversalDumper.convert(item, dumped_ids)\n end\n\n {\n _old_object_id: array.object_id,\n _object_data: result\n }\n end", "def binary_representation(allow_z=true,allow_m=true)\r\n rep = [length].pack(\"V\")\r\n each {|linear_ring| rep << linear_ring.binary_representation(allow_z,allow_m)}\r\n rep\r\n end", "def string_to_binary(val)\n saved_object_count = -1\n\n unless(@unique_table.has_key?(val)) then\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @unique_table[val] = saved_object_count\n utf16 = false\n\n val.each_byte do |b|\n if(b > 127) then\n utf16 = true\n break\n end\n end\n\n if(utf16) then\n bdata = Binary.type_bytes(\"6\",Binary.charset_strlen(val,\"UTF-8\")) # 6 is 0110, unicode string (utf16be)\n val = Binary.charset_convert(val,\"UTF-8\",\"UTF-16BE\")\n\n val.force_encoding(\"ASCII-8BIT\") if val.respond_to?(\"encode\")\n @object_table[saved_object_count] = bdata + val\n else\n bdata = Binary.type_bytes(\"5\",val.bytesize) # 5 is 0101 which is an ASCII string (seems to be ASCII encoded)\n @object_table[saved_object_count] = bdata + val\n end\n else\n saved_object_count = @unique_table[val]\n end\n\n return saved_object_count\n end", "def table_array\r\n @table_array\r\n end", "def test_array\n x = [1, \"two\", 3.0]\n assert_equal x, Marshal.load(Marshal.dump(x))\n end", "def boolean_to_binary(arr)\r\n\r\n binary = \"\"\r\n\r\n # iteration each method\r\n arr.each {|bool|\r\n if bool == true\r\n\r\n # bool true to binary 1\r\n binary << \"1\"\r\n else\r\n\r\n # bool false to binary 0\r\n binary << \"0\"\r\n end }\r\n\r\n binary\r\nend", "def to_binary\n # single pass over params for speed\n pack_code = nil\n compression = nil\n each_accessionable_param do |param|\n acc = param.accession\n if !pack_code && (code=ACC_TO_UNPACK_CODE[acc])\n pack_code = code\n end\n if compression.nil?\n compression = \n case acc\n when COMPRESSION_ACC then true\n when NO_COMPRESSION_ACC then false\n end\n end\n end\n # can speed these up:\n unless pack_code\n describe! DEFAULT_DTYPE_ACC\n pack_code = ACC_TO_UNPACK_CODE[DEFAULT_DTYPE_ACC]\n end\n if compression.nil?\n describe! DEFAULT_COMPRESSION_ACC\n compression = \n case DEFAULT_COMPRESSION_ACC\n when COMPRESSION_ACC then true\n when NO_COMPRESSION_ACC then false\n end\n end\n\n # TODO: support faster pack method with nmatrix or narray\n string = self.pack(pack_code) \n string = Zlib::Deflate.deflate(string) if compression\n Base64.strict_encode64(string)\n end", "def to_bin\n [\n \"data\",\n [body.size].pack(\"V\"),\n body\n ].join\n end", "def old_boolean_to_binary(arr)\n binary = \"\"\n\n arr.each do |boolean|\n if boolean\n binary += \"1\"\n else\n binary += \"0\"\n end\n end\n\n binary\nend", "def to_binary; ''; end", "def string_to_binary(value)\n # Escape data prior to insert into a bytea column\n if value\n res = ''\n value.each_byte { |b| res << sprintf('\\\\\\\\%03o', b) }\n res\n end\n end", "def binary_representation(allow_z=true,allow_m=true) #:nodoc:\r\n bin_rep = [@x,@y].pack(\"EE\")\r\n bin_rep += [@z].pack(\"E\") if @with_z and allow_z #Default value so no crash\r\n bin_rep += [@m].pack(\"E\") if @with_m and allow_m #idem\r\n bin_rep\r\n end", "def set_array!(values)\n @objects = []\n @memory = FFI::MemoryPointer.new(MsgObject,values.length)\n\n values.each_with_index do |value,index|\n @objects << MsgObject.new_object(value,@memory[index])\n end\n\n self[:type] = :array\n\n array = self[:values][:array]\n array[:size] = values.length\n array[:ptr] = @memory\n end", "def value_type\n 'BINARY'\n end", "def _array(obj)\n obj.map { |v| _renc(v) }\n end", "def to_s\n bits=\"\"\n @fields.each {|f| \n if f.kind_of? Fields::Field\n bits << f.bitstring\n else\n bits << f.to_bitstring\n end\n }\n [bits].pack('B*')\n end", "def byte_arr_to_string arr\n arr.pack(\"c*\")\nend", "def encode_to_array\n components = []\n components << [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32)\n components << self.class.encoded_payload(@payload)\n components << FINAL_OCTET\n components\n end", "def to_ary\n end", "def marshal_load array\n @x, @y, @grid, @generator_pointer = array\n end", "def numObj(arr)\n output_info = []\n arr.each {|num| output_info << {num.to_s => num.ord.to_s}}\n output_info\nend", "def to_array(array=nil)\n if array\n array.start = 0\n array.total = @size\n else\n array = Array.new @size\n end\n\n i = 0\n while i < @capacity\n array[@table[i+2]] = @table[i+1] if @table[i]\n i += 4\n end\n\n unless @spill.empty?\n i = @spill.to_iter 3\n while i.next\n array[i.at(2)] = i.at(1) if i.item\n end\n end\n\n array\n end", "def to_binary\n return '' unless @ready\n\n to_a.pack('C*') rescue binding.pry\n end", "def package_array(array, opts = {})\n if array && array.size > 0\n serializer = \"#{array.first.class.name}Serializer\".safe_constantize\n opts[:meta] = { total: array.size }\n hash = serializer.new(array, opts).serializable_hash if serializer\n else\n {data: []}\n end\n end", "def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false\n return saved_object_count\n end", "def date_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT\n\n bdata = Binary.type_bytes(\"3\", 3) # 3 is 0011, type indicator for date\n @object_table[saved_object_count] = bdata + [val].pack(\"d\").reverse\n\n return saved_object_count\n end", "def binary_representation(allow_z = true, allow_m = true) #:nodoc:\n bin_rep = [@x.to_f, @y.to_f].pack('EE')\n bin_rep += [@z.to_f].pack('E') if @with_z && allow_z # Default value so no crash\n bin_rep += [@m.to_f].pack('E') if @with_m && allow_m # idem\n bin_rep\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 2\n data << @data[0]\n data << (@data[1] ? 1 : 0)\n end", "def to_s\n to_ary\n end", "def to_bytes\n data = items_to_bytes\n all_data = [@data_size, @next_page, @max, @min, @id, 0] + data\n $logger.logs [:data_size, @data_size, :next_page , @next_page, :max, @max, :min, @min, :id, @id].join(\",\")\n $logger.logs \"data: #{data.join(\",\")}\"\n all_data.pack('L*')\n end", "def to_ary\n [\"#{id}: #{description}\", @raw_data]\n end", "def to_bi_a\n self.chars.map {|c| c.ord.to_s(2)}\n end", "def to_narray\n require 'mxnet/narray_helper'\n self.to_narray\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 4\n data << @data[0]\n data << @data[1]\n data << @data[2]\n data << @data[3]\n end", "def binary_string; end", "def to_ary; self.to_a; end", "def serialize_array\n `self.serializeArray()`.map { |e| Hash.new(e) }\n end", "def to_a; Array(force) end", "def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end", "def binary_representation(allow_z=true,allow_m=true) #:nodoc:\r\n rep = [length].pack(\"V\")\r\n #output the list of geometries without outputting the SRID first and with the same setting regarding Z and M\r\n each {|geometry| rep << geometry.as_ewkb(false,allow_z,allow_m) }\r\n rep\r\n end", "def to_bson\n [ self ].pack(bson_pack_directive)\n end", "def items_to_bytes\n bytes = []\n @items.each do |item|\n bytes << item.key\n bytes << item.value\n end\n bytes\n end", "def to_a() end", "def to_a() end", "def to_a() end", "def to_a() end", "def to_a() end", "def to_a() end", "def build(array)\n array.map { |record| Restforce::SObject.new(record, @client) }\n end", "def convert_to_binary\n @input.class == String ? @input : @input.to_s(2)\n end", "def to_bson\n data.bytesize.to_bson + SUBTYPES.fetch(type) + data\n end", "def _serializable_array\n if @options[:single_record]\n super.first\n else\n super\n end\n end", "def to_ary\n self.to_a\n end", "def binary\n BinaryCollection.new(self)\n end", "def marshal\n Marshal.dump(data)\n end", "def array2str(type, arr)\n case type\n when :char, :int8\n arr.pack('c*')\n when :uchar, :uint8\n arr.pack('C*')\n when :short, :int16\n arr.pack('s*')\n when :ushort, :uint16\n arr.pack('S*')\n when :int32\n arr.pack('l*')\n when :uint32\n arr.pack('L*')\n when :int\n arr.pack('i!*')\n when :uint\n arr.pack('I!*')\n when :bool\n [arr ? 1 : 0].pack('i!*')\n when :long\n arr.pack('l!*')\n when :ulong\n arr.pack('L!*')\n when :long_long, :int64\n arr.pack('q*')\n when :ulong_long, :uint64\n arr.pack('Q*')\n when :size_t\n arr.pack(SIZET_FORMAT)\n when :float\n arr.pack('f*')\n when :double\n arr.pack('d*')\n when :string, :pointer\n arr.pack('p*')\n else\n raise \"unknown type #{type}\"\n end\n end", "def to_a\n docnumb = self.number\n docdate = self.date ? self.date.oris_format : Date.today.oris_format\n currency = self.currency ? self.currency : 'GEL'\n project = self.project ? self.project.to_geo : ' მთ.წიგნი'.to_geo\n sysdate = self.sysdate ? self.sysdate.oris_format : Date.today.oris_format\n unit = self.unit ? self.unit.to_geo : 'ერთეული'.to_geo\n quant = self.quantity || 0\n quant2 = self.quantity_normal || quant\n user = self.user ? self.user.to_geo : ''\n ['', '', '', docnumb, '0', docdate, ORIS.oris_acc_code(self.acc_debit), ORIS.oris_acc_code(self.acc_credit),\n '0', self.calc_amount, currency, self.description, '0', '1', unit, quant, quant2, project, user,\n '0', '9', '0', '', '0', sysdate, self.related_to, '0', '1', '3', '', '0', '', '']\n end", "def Array(p0) end", "def encode integer_array\n integer_array = integer_array.clone\n bits = BitArray.new\n integer_array.each do |x|\n q = x/@M\n q.times {bits.push 1}\n bits.push 0\n r = x % @M\n (@b-1).downto(0){|i| bits.push r[i]}\n end\n bits\n end", "def to_b\r\n return self\r\n end", "def to_sxp_bin\n [self.class.const_get(:NAME)] +\n (id ? [[:id, id]] : []) +\n (operands || []).map(&:to_sxp_bin)\n end", "def write_varint_array(array, &block)\n if array.nil?\n write_varint(-1)\n else\n write_varint(array.size)\n array.each(&block)\n end\n end", "def to_ary\n @cells.to_ary\n end" ]
[ "0.6767909", "0.64879626", "0.6384719", "0.6267628", "0.62673205", "0.6246435", "0.61951655", "0.6126787", "0.60429925", "0.6011801", "0.5992629", "0.5983729", "0.59797907", "0.59782565", "0.59502876", "0.58508396", "0.5833801", "0.5829443", "0.5804415", "0.5770621", "0.5770621", "0.5770621", "0.5770621", "0.5770621", "0.5770621", "0.5733613", "0.57042325", "0.56852525", "0.5637887", "0.5618996", "0.56031126", "0.5596523", "0.5572232", "0.5566953", "0.5564088", "0.5555393", "0.55145127", "0.55023247", "0.5486714", "0.54757416", "0.54654056", "0.5463006", "0.5458015", "0.54494125", "0.54421854", "0.54383487", "0.543542", "0.5430738", "0.5429349", "0.5417751", "0.54031926", "0.5396293", "0.53943634", "0.5393885", "0.53936344", "0.53922516", "0.5386366", "0.5377832", "0.53778046", "0.5370022", "0.5365148", "0.53615457", "0.53607804", "0.5357025", "0.5354421", "0.5354249", "0.5350581", "0.5340787", "0.53345305", "0.5331111", "0.5302433", "0.5269873", "0.5266944", "0.5256719", "0.5255699", "0.5232152", "0.52299774", "0.5229652", "0.52240616", "0.5218673", "0.5218673", "0.52185714", "0.52185714", "0.52185714", "0.52185714", "0.5201447", "0.51991236", "0.51949155", "0.51946115", "0.51880556", "0.517808", "0.5176758", "0.5170064", "0.5168104", "0.51575524", "0.5155373", "0.5134925", "0.5129429", "0.5128329", "0.5126662" ]
0.7604434
0
Convert dictionary to binary format and add it to the object table
def dict_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 bdata = Binary.type_bytes("d",val.value.size) # d=1101, type indicator for dictionary val.value.each_key do |k| str = CFString.new(k) key = str.to_binary(self) bdata += Binary.pack_it_with_size(@object_ref_size,key) end val.value.each_value do |v| bdata += Binary.pack_it_with_size(@object_ref_size,v.to_binary(self)) end @object_table[saved_object_count] = bdata return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marshal_dump\n @table\n end", "def to_binary\n Formatters::Binary.new.serialize self\n end", "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def dump\n object.map do |key, value|\n dumped_key = self.class.dump(key, context)\n dumped_key = \"!#{dumped_key.to_json}\" unless dumped_key.is_a?(String)\n [dumped_key, self.class.dump(value, context)]\n end.to_h\n end", "def to_h\n data = super\n data[:convert] = data.delete(:converter)\n data.stringify_keys\n end", "def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end", "def encode(obj); end", "def to_str(opts={})\n @unique_table = {}\n @count_objects = 0\n @string_size = 0\n @int_size = 0\n @misc_size = 0\n @object_refs = 0\n\n @written_object_count = 0\n @object_table = []\n @object_ref_size = 0\n\n @offsets = []\n\n binary_str = \"bplist00\"\n unique_and_count_values(opts[:root])\n\n @count_objects += @unique_table.size\n @object_ref_size = Binary.bytes_needed(@count_objects)\n\n file_size = @string_size + @int_size + @misc_size + @object_refs * @object_ref_size + 40\n offset_size = Binary.bytes_needed(file_size)\n table_offset = file_size - 32\n\n @object_table = []\n @written_object_count = 0\n @unique_table = {} # we needed it to calculate several values, but now we need an empty table\n\n opts[:root].to_binary(self)\n\n object_offset = 8\n offsets = []\n\n 0.upto(@object_table.size-1) do |i|\n binary_str += @object_table[i]\n offsets[i] = object_offset\n object_offset += @object_table[i].bytesize\n end\n\n offsets.each do |offset|\n binary_str += Binary.pack_it_with_size(offset_size,offset)\n end\n\n binary_str += [offset_size, @object_ref_size].pack(\"x6CC\")\n binary_str += [@count_objects].pack(\"x4N\")\n binary_str += [0].pack(\"x4N\")\n binary_str += [table_offset].pack(\"x4N\")\n\n return binary_str\n end", "def encode(object)\n ''.force_encoding(Encoding::BINARY).tap do |bytes|\n newest_version = schema_versions.keys.max\n schema = schema_versions[newest_version]\n bytes << newest_version.chr if has_version_tag\n write(object, bytes, schema)\n end\n end", "def __bson_dump__(io, key)\n io << Types::OBJECT_ID\n io << key.to_bson_cstring\n io << data\n end", "def string_to_binary(val)\n saved_object_count = -1\n\n unless(@unique_table.has_key?(val)) then\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @unique_table[val] = saved_object_count\n utf16 = false\n\n val.each_byte do |b|\n if(b > 127) then\n utf16 = true\n break\n end\n end\n\n if(utf16) then\n bdata = Binary.type_bytes(\"6\",Binary.charset_strlen(val,\"UTF-8\")) # 6 is 0110, unicode string (utf16be)\n val = Binary.charset_convert(val,\"UTF-8\",\"UTF-16BE\")\n\n val.force_encoding(\"ASCII-8BIT\") if val.respond_to?(\"encode\")\n @object_table[saved_object_count] = bdata + val\n else\n bdata = Binary.type_bytes(\"5\",val.bytesize) # 5 is 0101 which is an ASCII string (seems to be ASCII encoded)\n @object_table[saved_object_count] = bdata + val\n end\n else\n saved_object_count = @unique_table[val]\n end\n\n return saved_object_count\n end", "def serializable_hash\n collection? ? @object.map(&converter) : converter.call(@object)\n end", "def serialize(object) end", "def dump\n output = ''\n @objects_table.keys.sort.each do |key|\n object_entry = @objects_table[key]\n name = object_entry.__name__\n type = object_entry.__type__\n #\n # use the inspect to make ruby 1.8.7 and 1.9.3 compatible\n #\n object = lookup(type, name).to_hash.inspect\n output << \"#{type}(#{name}) = #{object}\\n\"\n end\n output\n end", "def array_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"a\", val.value.size) # a is 1010, type indicator for arrays\n\n val.value.each do |v|\n bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self));\n end\n\n @object_table[saved_object_count] = bdata\n return saved_object_count\n end", "def write_hash(hash)\n\t\twrite_byte(3)\n\t\thash.each do |key, value|\n\t\t\twrite_utf(key.to_s)\n\t\t\twrite(value)\n\t\tend\n\n\t\t# write the end object flag 0x00, 0x00, 0x09\n\t\twrite_int16_network(0)\n\t\twrite_byte(9)\n\tend", "def conv_to_write_ary ( orig_key, orig_val, orig_typ, orig_dat )\n\n reg_key = value_buffer(orig_key)\n reg_val = value_buffer(orig_val)\n reg_typ = self.class.reg_type_conv_pol_rev(orig_typ).encode('UTF-8')\n if reg_typ == \"\\u0001\"\n reg_dat = orig_dat.encode('UTF-8')\n else\n $log.debug \"Conv_to_write_ary (show conversion): #{orig_dat} : #{orig_dat.encoding.name}\" if $DEBUG\n if orig_dat[/\\H/]\n reg_dat = orig_dat\n else\n reg_dat = Integer(orig_dat).chr.force_encoding('UTF-8')\n end\n end\n reg_siz = value_reg_siz(reg_dat)\n reg_dat = value_buffer(reg_dat)\n write_ary = [ reg_key , reg_val ,reg_typ ,reg_siz, reg_dat ]\n write_ary\n end", "def dump(table) # :nodoc:\n Marshal::dump(table)\n end", "def convert_binary\n end", "def serializable_hash\n collection? ? serializable_hash_for_collection : converter.call(@object)\n end", "def serialize(_object, data); end", "def serialize(_object, data); end", "def storeSerialised( handle, key, klass )\n s = Marshal.dump( klass )\n handle[ key ] = s;\nend", "def serialize(object, data); end", "def dissect_to_record_hashes\n end", "def to_bencode\n BEncode.dump(self)\n end", "def marshal_load(x)\n @table = x\n end", "def num_to_binary(value)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = \"\"\n if(value.is_a?(CFInteger)) then\n val = int_to_binary(value.value)\n else\n val = real_to_binary(value.value)\n end\n\n @object_table[saved_object_count] = val\n return saved_object_count\n end", "def __convert(h); end", "def to_json_hbase\r\n JSON.generate({:secure_hash_key => @secure_hash_key,\r\n :create_date => @create_date,\r\n :max_age => @max_age,\r\n :modify_time => @modify_time,\r\n :last_used => @last_used,\r\n :status=> @status}) \r\n end", "def build_binary_data(data={})\n buffer = [68, 65, 84, 65, 0] # D A T A\n elements_to_send = []\n keys_to_send = data.keys\n\n Xplane::XPLANE_DATA_MAPPER.each do |element_id, included_elements|\n element = nil\n included_elements.each_with_index do |element_name, index|\n if keys_to_send.include? element_name\n element ||= new_element(element_id)\n element[index + 1] = data[element_name]\n end\n end\n elements_to_send.push element unless element.nil?\n end\n\n elements_to_send.each do |element|\n buffer += element\n end\n buffer.pack binary_format(elements_to_send.length)\n end", "def marshal_dump; end", "def to_db_hash\n db_hsh = {}\n to_hash.each{|k,v| db_hsh[k.to_s] = v.to_s unless v.nil? }\n db_hsh\n end", "def bson_debinarize(bson_doc)\n raise ArgumentError, \"bson_doc must be a BSON::OrderedHash\" unless bson_doc.is_a?(BSON::OrderedHash)\n \n # each key and value is passed by reference and is modified in-place\n bson_doc.each do |k,v|\n if v.is_a?(BSON::Binary)\n bson_doc[k] = Base64.encode64(v.to_s)\n elsif v.is_a?(BSON::OrderedHash)\n bson_doc[k] = bson_debinarize(v)\n end\n end\n \n bson_doc \nend", "def marshall_dump\n end", "def to_bson\n [ self ].pack(bson_pack_directive)\n end", "def date_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT\n\n bdata = Binary.type_bytes(\"3\", 3) # 3 is 0011, type indicator for date\n @object_table[saved_object_count] = bdata + [val].pack(\"d\").reverse\n\n return saved_object_count\n end", "def serialized_data\n\t\tdata = strip_hash( @data )\t\t\t\n\t\treturn Marshal.dump( data )\n\tend", "def export\n to_h.stringify_keys\n end", "def format(hash)\n hash.inject({}) do |memo, (key, value)|\n if key.to_s.eql? 'iterations'\n value = value.to_i\n else\n value = convert_to_blob value\n end\n memo[key.to_s] = value\n memo\n end\n end", "def save_hashes_for_write\n \n end", "def items_to_bytes\n bytes = []\n @items.each do |item|\n bytes << item.key\n bytes << item.value\n end\n bytes\n end", "def serialize; end", "def serialize; end", "def data_for_hyacinth_ds\n data = super\n data[DIGITAL_OBJECT_DATA_KEY] = Marshal.load(Marshal.dump(@publish_target_data))\n data\n end", "def to_bson\n to_h.to_bson\n end", "def to_bson\n data.bytesize.to_bson + SUBTYPES.fetch(type) + data\n end", "def to_sdb(options={})\n out = {}\n \n self.each_pair_with_index do |key, value, index|\n out[\"Attribute.#{index}.Name\"] = sdb_key_escape(key)\n out[\"Attribute.#{index}.Value\"] = sdb_value_escape(value)\n \n if options.key?(:replace) && (options[:replace] == :all || [*options[:replace]].find {|x| x.to_s == key })\n out[\"Attribute.#{index}.Replace\"] = \"true\"\n end\n end\n\n out\n end", "def bencode_info_entry(info)\n root = BDictionary.new\n\n if info[FILES].blank? # single file mode\n root[LENGTH] = BNumber.new(info[LENGTH])\n else\n files_list = BList.new\n info[FILES].each do |info_file|\n file = BDictionary.new\n file[LENGTH] = BNumber.new(info_file[LENGTH])\n file_path_list = BList.new\n info_file[PATH].each {|info_file_path| file_path_list << BString.new(info_file_path) }\n file[PATH] = file_path_list\n files_list << file\n end\n root[FILES] = files_list\n end\n root[NAME] = BString.new(info[NAME])\n root[PIECE_LENGTH] = BNumber.new(info[PIECE_LENGTH])\n root[PIECES] = BString.new(info[PIECES])\n root[PRIVATE] = BNumber.new(info[PRIVATE]) if info[PRIVATE]\n root.out\n end", "def to_ruby\n case @storage\n when Dict\n items = @storage.inject([]) do |ary, (k, v)| \n ary << k << Rusty::DX.to_ruby(v) \n end\n Hash[*items]\n when List\n @storage.map { |v| Rusty::DX.to_ruby(v) }\n end\n end", "def kv_encode(h); h.map {|k,v| k.to_s + \":\" + v.to_s + 10.chr }.join end", "def to_ruby\n [key,fields]\n end", "def __to_json_map__\n result = {}\n key = 'byte0'\n value = (byte0.nil? ? nil : byte0.__to_json_map__)\n result.store(key, value)\n key = 'byte1'\n value = (byte1.nil? ? nil : byte1.__to_json_map__)\n result.store(key, value)\n key = 'byte2'\n value = (byte2.nil? ? nil : byte2.__to_json_map__)\n result.store(key, value)\n key = 'byte3'\n value = (byte3.nil? ? nil : byte3.__to_json_map__)\n result.store(key, value)\n key = 'byte4'\n value = (byte4.nil? ? nil : byte4.__to_json_map__)\n result.store(key, value)\n key = 'byte5'\n value = (byte5.nil? ? nil : byte5.__to_json_map__)\n result.store(key, value)\n key = 'char0'\n value = (char0.nil? ? nil : char0.__to_json_map__)\n result.store(key, value)\n key = 'char1'\n value = (char1.nil? ? nil : char1.__to_json_map__)\n result.store(key, value)\n key = 'char2'\n value = (char2.nil? ? nil : char2.__to_json_map__)\n result.store(key, value)\n key = 'char3'\n value = (char3.nil? ? nil : char3.__to_json_map__)\n result.store(key, value)\n key = 'char4'\n value = (char4.nil? ? nil : char4.__to_json_map__)\n result.store(key, value)\n key = 'char5'\n value = (char5.nil? ? nil : char5.__to_json_map__)\n result.store(key, value)\n key = 'wchar0'\n value = (wchar0.nil? ? nil : wchar0.__to_json_map__)\n result.store(key, value)\n key = 'wchar1'\n value = (wchar1.nil? ? nil : wchar1.__to_json_map__)\n result.store(key, value)\n key = 'wchar2'\n value = (wchar2.nil? ? nil : wchar2.__to_json_map__)\n result.store(key, value)\n key = 'wchar3'\n value = (wchar3.nil? ? nil : wchar3.__to_json_map__)\n result.store(key, value)\n key = 'wchar4'\n value = (wchar4.nil? ? nil : wchar4.__to_json_map__)\n result.store(key, value)\n key = 'wchar5'\n value = (wchar5.nil? ? nil : wchar5.__to_json_map__)\n result.store(key, value)\n key = 'int8b0'\n value = (int8b0.nil? ? nil : int8b0.__to_json_map__)\n result.store(key, value)\n key = 'int8b1'\n value = (int8b1.nil? ? nil : int8b1.__to_json_map__)\n result.store(key, value)\n key = 'int8b2'\n value = (int8b2.nil? ? nil : int8b2.__to_json_map__)\n result.store(key, value)\n key = 'int8b3'\n value = (int8b3.nil? ? nil : int8b3.__to_json_map__)\n result.store(key, value)\n key = 'int8b4'\n value = (int8b4.nil? ? nil : int8b4.__to_json_map__)\n result.store(key, value)\n key = 'int8b5'\n value = (int8b5.nil? ? nil : int8b5.__to_json_map__)\n result.store(key, value)\n key = 'uint8b0'\n value = (uint8b0.nil? ? nil : uint8b0.__to_json_map__)\n result.store(key, value)\n key = 'uint8b1'\n value = (uint8b1.nil? ? nil : uint8b1.__to_json_map__)\n result.store(key, value)\n key = 'uint8b2'\n value = (uint8b2.nil? ? nil : uint8b2.__to_json_map__)\n result.store(key, value)\n key = 'uint8b3'\n value = (uint8b3.nil? ? nil : uint8b3.__to_json_map__)\n result.store(key, value)\n key = 'uint8b4'\n value = (uint8b4.nil? ? nil : uint8b4.__to_json_map__)\n result.store(key, value)\n key = 'uint8b5'\n value = (uint8b5.nil? ? nil : uint8b5.__to_json_map__)\n result.store(key, value)\n key = 'int16b0'\n value = (int16b0.nil? ? nil : int16b0.__to_json_map__)\n result.store(key, value)\n key = 'int16b1'\n value = (int16b1.nil? ? nil : int16b1.__to_json_map__)\n result.store(key, value)\n key = 'int16b2'\n value = (int16b2.nil? ? nil : int16b2.__to_json_map__)\n result.store(key, value)\n key = 'int16b3'\n value = (int16b3.nil? ? nil : int16b3.__to_json_map__)\n result.store(key, value)\n key = 'int16b4'\n value = (int16b4.nil? ? nil : int16b4.__to_json_map__)\n result.store(key, value)\n key = 'int16b5'\n value = (int16b5.nil? ? nil : int16b5.__to_json_map__)\n result.store(key, value)\n key = 'uint16b0'\n value = (uint16b0.nil? ? nil : uint16b0.__to_json_map__)\n result.store(key, value)\n key = 'uint16b1'\n value = (uint16b1.nil? ? nil : uint16b1.__to_json_map__)\n result.store(key, value)\n key = 'uint16b2'\n value = (uint16b2.nil? ? nil : uint16b2.__to_json_map__)\n result.store(key, value)\n key = 'uint16b3'\n value = (uint16b3.nil? ? nil : uint16b3.__to_json_map__)\n result.store(key, value)\n key = 'uint16b4'\n value = (uint16b4.nil? ? nil : uint16b4.__to_json_map__)\n result.store(key, value)\n key = 'uint16b5'\n value = (uint16b5.nil? ? nil : uint16b5.__to_json_map__)\n result.store(key, value)\n key = 'int32b0'\n value = (int32b0.nil? ? nil : int32b0.__to_json_map__)\n result.store(key, value)\n key = 'int32b1'\n value = (int32b1.nil? ? nil : int32b1.__to_json_map__)\n result.store(key, value)\n key = 'int32b2'\n value = (int32b2.nil? ? nil : int32b2.__to_json_map__)\n result.store(key, value)\n key = 'int32b3'\n value = (int32b3.nil? ? nil : int32b3.__to_json_map__)\n result.store(key, value)\n key = 'int32b4'\n value = (int32b4.nil? ? nil : int32b4.__to_json_map__)\n result.store(key, value)\n key = 'int32b5'\n value = (int32b5.nil? ? nil : int32b5.__to_json_map__)\n result.store(key, value)\n key = 'uint32b0'\n value = (uint32b0.nil? ? nil : uint32b0.__to_json_map__)\n result.store(key, value)\n key = 'uint32b1'\n value = (uint32b1.nil? ? nil : uint32b1.__to_json_map__)\n result.store(key, value)\n key = 'uint32b2'\n value = (uint32b2.nil? ? nil : uint32b2.__to_json_map__)\n result.store(key, value)\n key = 'uint32b3'\n value = (uint32b3.nil? ? nil : uint32b3.__to_json_map__)\n result.store(key, value)\n key = 'uint32b4'\n value = (uint32b4.nil? ? nil : uint32b4.__to_json_map__)\n result.store(key, value)\n key = 'uint32b5'\n value = (uint32b5.nil? ? nil : uint32b5.__to_json_map__)\n result.store(key, value)\n key = 'int64b0'\n value = (int64b0.nil? ? nil : int64b0.__to_json_map__)\n result.store(key, value)\n key = 'int64b1'\n value = (int64b1.nil? ? nil : int64b1.__to_json_map__)\n result.store(key, value)\n key = 'int64b2'\n value = (int64b2.nil? ? nil : int64b2.__to_json_map__)\n result.store(key, value)\n key = 'int64b3'\n value = (int64b3.nil? ? nil : int64b3.__to_json_map__)\n result.store(key, value)\n key = 'int64b4'\n value = (int64b4.nil? ? nil : int64b4.__to_json_map__)\n result.store(key, value)\n key = 'int64b5'\n value = (int64b5.nil? ? nil : int64b5.__to_json_map__)\n result.store(key, value)\n key = 'uint64b0'\n value = (uint64b0.nil? ? nil : uint64b0.__to_json_map__)\n result.store(key, value)\n key = 'uint64b1'\n value = (uint64b1.nil? ? nil : uint64b1.__to_json_map__)\n result.store(key, value)\n key = 'uint64b2'\n value = (uint64b2.nil? ? nil : uint64b2.__to_json_map__)\n result.store(key, value)\n key = 'uint64b3'\n value = (uint64b3.nil? ? nil : uint64b3.__to_json_map__)\n result.store(key, value)\n key = 'uint64b4'\n value = (uint64b4.nil? ? nil : uint64b4.__to_json_map__)\n result.store(key, value)\n key = 'uint64b5'\n value = (uint64b5.nil? ? nil : uint64b5.__to_json_map__)\n result.store(key, value)\n result\n end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def marshall_dump\n end", "def marshal_dump#:nodoc:\n fields_to_serialize.map{|field| instance_variable_value(field)}\n end", "def force_convert_to_tnetstring\n ::TNetstring.dump(self.to_hash)\n end", "def structure_dump() end", "def to_json\r\n hash = self.key_map()\r\n hash.to_json\r\n end", "def payleven_encoded(h)\n\t\t\tencoded_string = \"\"\n\t\t\tordered_hash = ActiveSupport::OrderedHash.new\n\t\t\t\n\t\t\th.each do |field, key|\n\t\t\t\tnew_field = \"entity[\"+field.to_s+\"]\"\n\t\t\t\tencoded_string+= field.to_s + \":\" \n\t\t\t\tif key.is_a? DateTime\n\t\t\t\t\tencoded_string+= key.to_s.gsub(\"T\", \" \")[0,19]\n\t\t\t\t\tordered_hash[new_field.to_sym] = key.to_s.gsub(\"T\", \" \")[0,19]\n\t\t\t\t\n\t\t\t\telsif not key.is_a? String\n\t\t\t\t\tencoded_string+= key.to_s \n\t\t\t\t\tordered_hash[new_field.to_sym] = key\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tencoded_string+= key\n\t\t\t\t\tordered_hash[new_field.to_sym] = key\n\t\t\t\tend\n\t\t\t\tencoded_string+= \",\"\n\n\t\t\tend\n\t\t\t{payleven_string: encoded_string[0, encoded_string.length-1], ordered_hash: ordered_hash}\n\t\tend", "def jsonify(hash)\n deep_reduce(hash) do |k, v, h|\n if v.is_a?(String)\n if v.encoding == ::Encoding::ASCII_8BIT\n # Only keep binary values less than a certain size. Sizes larger than this\n # are almost always file uploads and data we do not want to log.\n if v.length < BINARY_LIMIT_THRESHOLD\n # Attempt to safely encode the data to UTF-8\n encoded_value = encode_string(v)\n if !encoded_value.nil?\n h[k] = encoded_value\n end\n end\n elsif v.encoding != ::Encoding::UTF_8\n h[k] = encode_string(v)\n else\n h[k] = v\n end\n elsif is_a_primitive_type?(v)\n # Keep all other primitive types\n h[k] = v\n end\n end\n end", "def serialize\n \n end", "def encode_bound_fields\n @bound_fields.map do |(name,value)|\n WordField[name].encode(value)\n end.inject do |memo,encoded_value|\n memo | encoded_value\n end\n end", "def to_binary\n # single pass over params for speed\n pack_code = nil\n compression = nil\n each_accessionable_param do |param|\n acc = param.accession\n if !pack_code && (code=ACC_TO_UNPACK_CODE[acc])\n pack_code = code\n end\n if compression.nil?\n compression = \n case acc\n when COMPRESSION_ACC then true\n when NO_COMPRESSION_ACC then false\n end\n end\n end\n # can speed these up:\n unless pack_code\n describe! DEFAULT_DTYPE_ACC\n pack_code = ACC_TO_UNPACK_CODE[DEFAULT_DTYPE_ACC]\n end\n if compression.nil?\n describe! DEFAULT_COMPRESSION_ACC\n compression = \n case DEFAULT_COMPRESSION_ACC\n when COMPRESSION_ACC then true\n when NO_COMPRESSION_ACC then false\n end\n end\n\n # TODO: support faster pack method with nmatrix or narray\n string = self.pack(pack_code) \n string = Zlib::Deflate.deflate(string) if compression\n Base64.strict_encode64(string)\n end", "def to_binary; ''; end", "def marshal_dump\n [@lsi_vector, @lsi_norm, @raw_vector, @raw_norm, @categories, @word_hash]\n end", "def init_ary(ary)\n (1..100).each do |num|\n ary.push( { decimal: num, binary: num.to_s(2).rjust(7,\"0\")} )\n end\n ary\nend", "def tableConvert(tableName, table)\n dbTableH = Hash.new\n records = Array.new\n i = 0\n \n table.each do\n |row|\n records[i] = row\n i += 1\n end\n dbTableH[tableName] = records\n \n return dbTableH\nend", "def marshal_load(serialised); end", "def to_h\n self.dictionary\n end", "def store_obj_chart(obj_id) #:nodoc:\n record = 0x005D # Record identifier\n length = 0x001A # Bytes to follow\n\n obj_type = 0x0005 # Object type (chart).\n data = '' # Record data.\n\n sub_record = 0x0000 # Sub-record identifier.\n sub_length = 0x0000 # Length of sub-record.\n sub_data = '' # Data of sub-record.\n options = 0x6011\n reserved = 0x0000\n\n # Add ftCmo (common object data) subobject\n sub_record = 0x0015 # ftCmo\n sub_length = 0x0012\n sub_data = [obj_type, obj_id, options, reserved, reserved, reserved].pack('vvvVVV')\n data = [sub_record, sub_length].pack('vv') + sub_data\n\n # Add ftEnd (end of object) subobject\n sub_record = 0x0000 # ftNts\n sub_length = 0x0000\n data = data + [sub_record, sub_length].pack('vv')\n\n # Pack the record.\n header = [record, length].pack('vv')\n\n append(header, data)\n\n end", "def __convert hash #:nodoc:\n instance = self.class.new\n hash.each do |k, v|\n k = k.to_s if !k.respond_to?(:to_sym) && k.respond_to?(:to_s)\n instance.new_ostruct_member k\n if v.is_a?(Hash)\n v = v[\"type\"] == \"hash\" ? v[\"contents\"] : __convert(v)\n elsif v.is_a?(Array)\n v = v.map{|e| e.instance_of?(Hash) ? __convert(e) : e}\n end\n instance.send \"#{k}=\".to_sym, v\n end\n instance\n end", "def marshal_dump\n data\n end", "def to_object\n doc = {}\n\n doc['isbn'] = record_to_array('020.a')\n doc['issn'] = record_to_array('022.b')\n doc['author'] = record_to_array('100.a')\n doc['edition'] = record_to_array('250.a')\n doc['scale'] = record_to_array('255.a')\n doc['num_pages'] = record_to_array('300.a')\n doc['cite_as'] = record_to_array('524.a')\n doc['add_entry'] = record_to_array('700.a')\n doc['url'] = record_to_array('856.u')\n\n # Publisher, title, series could have multiple fields\n # So just join the arrays together\n\n doc['pub_place'] = record_to_array('260.a') +\n record_to_array('264.a')\n doc['publisher'] = record_to_array('260.b') +\n record_to_array('264.b')\n doc['pub_date'] = record_to_array('260.c') +\n record_to_array('264.c')\n doc['title'] = record_to_array('245.a') +\n record_to_array('245.b')\n doc['series'] = record_to_array('440.a') +\n record_to_array('490.a')\n\n doc\n end", "def to_data\n data = {}\n @keys.each do |k|\n attr = select_child_attr(send(k))\n ext_key = @attr_table.ext_of(k)\n data[ext_key] = attr\n end\n data['_diff_state_'] = @diff_state.to_data unless @diff_state.empty?\n data\n end", "def add_hash(obj, hash)\n return unless hash\n\n hash.each do |key, value|\n if value.class == Hash\n eval \"obj.#{key} = OpenStruct.new\"\n add_hash(eval(\"obj.#{key}\"), value)\n else\n eval \"obj.#{key.downcase} = value\"\n end\n end\n end", "def dbrow_serialization\n dbrow = super[\"dbrow\"]\n dbrow[:xml] = self.xml\n dbrow.delete(:_xml_entity_created_by)\n dbrow.delete(:_xml_entity_created_at)\n dbrow.delete(:_xml_entity_modified_by)\n dbrow.delete(:_xml_entity_modified_at)\n\n {\n \"dbrow\" => dbrow\n }\n end", "def to_h; end", "def to_h; end", "def to_h; end", "def to_h; end", "def convert_hash_to_csv(hash_obj)\r\n\t\t\ttemp_columns = []\r\n\t\t\thash_obj.keys.each { |key| temp_columns.push(key.to_s) }\r\n\r\n\t\t\tcsv_string = CSV.generate do |csv|\r\n\t\t\t\tcsv << temp_columns\t\t# Add the column names\r\n\t\t\t\tcsv << hash_obj.values\r\n\t\t\tend\r\n\t\t\treturn CSV.parse(csv_string, :encoding => 'bom|utf-8')\r\n\t\tend", "def save_dataE(obj, filename) \r\n File.open(filename, \"wb\") { |f|\r\n Marshal.dump(obj, f)\r\n }\r\nend", "def to_binary(metadata: {})\n io = StringIO.new ''.b\n write_to io, metadata: metadata\n io.string\n end", "def set_map!(values)\n @objects = {}\n @memory = FFI::MemoryPointer.new(MsgKeyValue,values.length)\n\n values.each_with_index do |(key,value),index|\n pair = MsgKeyValue.new(@memory[index])\n\n key_obj = MsgObject.new_object(key,pair[:key].to_ptr)\n value_obj = MsgObject.new_object(value,pair[:value].to_ptr)\n\n @objects[key_obj] = value_obj\n end\n\n self[:type] = :map\n\n map = self[:values][:map]\n map[:size] = values.length\n map[:ptr] = @memory\n end", "def serialize(object)\n object.serializable_hash\n end", "def hash\n @table.hash\n end", "def convert ( aobj, aclass )\n hash = {}\n aobj.attributes.each { | key, value | \n hash[key] = value if aclass.column_names.include?(key)\n }\n hash\n end", "def to_h\n t = {}\n @table.each do |k,v|\n if v.respond_to?(:to_h)\n t[k] = v.to_h\n else\n t[k] = v\n end\n end\n t\n end", "def encoder; end", "def encoder; end", "def dump\n _dump do |row|\n codec.encode( row.values, io ) unless dry_run?\n end\n ensure\n io.flush\n end", "def dump(obj, max_bytes: 2**12, max_depth: 3)\n bytesize = 0\n\n hash = obj.each_with_object({}) do |(k, v), acc|\n str = (k.to_json + v.to_json)\n items = acc.keys.size - 1\n\n if bytesize + str.bytesize + items + ELLIPSIS.bytesize > max_bytes\n acc[k] = ELLIPSIS\n break acc\n else\n bytesize += str.bytesize\n acc[k] = dump_val(v, max_depth)\n end\n end\n ::JSON.generate(hash)\n end", "def serialize \n Base64.encode64(@data.to_yaml) \n end", "def to_json\n hash = self.key_map()\n hash.to_json\n end" ]
[ "0.6019073", "0.6013988", "0.59561574", "0.58213556", "0.5737301", "0.5699765", "0.56747013", "0.5618138", "0.5615141", "0.55964977", "0.55716604", "0.5534259", "0.55316526", "0.5496958", "0.54798055", "0.54774326", "0.5458964", "0.54547024", "0.5425382", "0.54219854", "0.53343856", "0.53343856", "0.53101456", "0.52953416", "0.52792996", "0.5253082", "0.5250505", "0.524158", "0.5229043", "0.52284324", "0.52217746", "0.52158946", "0.5215154", "0.52121776", "0.5210825", "0.5206802", "0.5202718", "0.5186957", "0.5184263", "0.51761675", "0.5168525", "0.51613367", "0.5158582", "0.5158582", "0.5156566", "0.51539385", "0.51446086", "0.51436144", "0.5139601", "0.5137103", "0.51341593", "0.51328105", "0.5128621", "0.5127268", "0.5127268", "0.5127268", "0.5127268", "0.5127268", "0.5127268", "0.5115384", "0.5110924", "0.5110283", "0.5102907", "0.5097097", "0.5096632", "0.50946385", "0.50861156", "0.5082828", "0.5076684", "0.50764966", "0.5066658", "0.50507", "0.50488544", "0.5021883", "0.5020364", "0.5017244", "0.5010524", "0.5008321", "0.5005896", "0.5004529", "0.50039345", "0.50014055", "0.49962553", "0.49962553", "0.49962553", "0.49962553", "0.49957263", "0.49937117", "0.49923807", "0.49917668", "0.49863404", "0.49789926", "0.49784657", "0.49769926", "0.4968366", "0.4968366", "0.49659577", "0.49565732", "0.49561128", "0.49554718" ]
0.7461467
0
Create a static hop BFD peer Creates a BFD peer for static route. The required parameters includes peer IP address.
def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {}) data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def create(destination, nexthop, opts = {})\n cmd = \"ip route #{destination} #{nexthop}\"\n cmd << \" #{opts[:router_ip]}\" if opts[:router_ip]\n cmd << \" #{opts[:distance]}\" if opts[:distance]\n cmd << \" tag #{opts[:tag]}\" if opts[:tag]\n cmd << \" name #{opts[:name]}\" if opts[:name]\n configure cmd\n end", "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_static_hop_bfd_peers(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)\n data\n end", "def new_peer(peer, io)\n peer = Peer.new(protocol_manage: self, peer: peer, io: io)\n peer.handshake(1, chain.total_difficulty, chain.head.get_hash, chain.genesis_hash)\n @peers[peer] = true\n\n # register peer to synchronizer\n synchronizer << [:register_peer, peer]\n # start handle peer messages\n executor.post {handle_peer(peer)}\n end", "def read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#read_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_peer(port)\r\n name = Faraday.get(\"#{URL}:#{port}/peer_name\").body.to_s.chomp\r\n key_public = Faraday.get(\"#{URL}:#{port}/peer_key_public\").body.to_s.chomp\r\n key_public = key_public.split(\",\")\r\n node_type = Faraday.get(\"#{URL}:#{port}/peer_type\").body.chomp.to_i\r\n new_peer = Peers.new(port.to_i, name, key_public, node_type, 0.0)\r\n $peers << new_peer\r\n puts \"Added peer #{port}\".light_blue\r\n $status = \"Added peer #{port}\"\r\nend", "def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def aws_subnet_route_table_route_to_nat_create(opts)\n AWS::EC2.new.subnets[opts[:subnet_id]].route_table.create_route(\"0.0.0.0/0\", { instance: opts[:instance_id] } )\n end", "def addPeer(options, peerId, clusterKey, tableCfs=nil, endpointClass=nil, isTemporary=\"false\")\n unless peerId !~ /\\D/\n raise 'peerId should be Integer ID for peer cluster'\n end\n replAdm = ReplicationAdmin.new(getConfiguration())\n replPeerConfig = ReplicationPeerConfig.new()\n replPeerConfig.setClusterKey(clusterKey)\n printf \"Ading Peer Id %s with ClusterKey %s\\n\", peerId, clusterKey\n #replPeerConfig.getConfiguration().put(\"IS_TEMPORARY\", cluster.isTemporary)\n if endpointClass\n replPeerConfig.setReplicationEndpointImpl(endpointClass)\n peerId.gsub!(\"-\", \"*\") # odr TenantReplicationEndpoint expects hyphens to be escaped to astericks\n end\n replPeerConfig.getConfiguration().put(\"IS_TEMPORARY\", isTemporary)\n\n replAdm.addPeer(peerId, replPeerConfig, tableCfs)\nend", "def list_static_hop_bfd_peers_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeerListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#list_static_hop_bfd_peers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def peeraddr(*) end", "def peeraddr(*) end", "def peerip=(_arg0); end", "def add_peer(peer)\n @link_table.store_peer(peer)\n end", "def addPeer(cluster, args={})\n raise(ArgumentError, \"Clustername cannot be empty\") if cluster.to_s.empty?\n raise(ArgumentError, \"Arguments cannot be empty\") if args.empty?\n name = args[NAME] if args[NAME]\n raise(ArgumentError, \"Name of the peer should be specified\") if name.empty?\n address = args[ADDRESS] if args[ADDRESS]\n raise(ArgumentError, \"Address of the peer should be specified\") if address.empty?\n peerCluster = Pair.new(name, address)\n @crosssiteadmin.addPeer(cluster, peerCluster)\n end", "def peer2peer(&remote_init)\n\t\tstart_peers(&remote_init)\n\t\tsetup_connection\n\t end", "def tpl\n connection_name = 'PrivateConnection'\n local_vpc_id_ref, remote_vpc_id_ref = %W(#{connection_name}VpcId #{connection_name}PeerVpcId)\n\n def validate_params(*params)\n params.each do |param|\n fail \"Unable to find required parameter #{param}\" unless @parameters.key?(param)\n end\n rescue RuntimeError => e\n puts e\n exit 1\n end\n\n validate_params(*[remote_vpc_id_ref])\n\n local_vpc, remote_vpc = [vpc, vpc(id: @parameters[remote_vpc_id_ref])]\n\n description 'Stack to create peering connection between two VPCs'\n\n parameter_vpc_id(local_vpc_id_ref,\n 'VpcId from where connection gets created',\n local_vpc.id)\n\n parameter_vpc_id(remote_vpc_id_ref,\n 'VpcId where peering connection should go',\n remote_vpc.id)\n\n # Initialize Peering connection\n vpc_peering_init(connection_name,\n tags: [\n {\n Key: 'Name',\n Value: connection_name\n }\n ])\n\n def read_vpc_route_tables(vpc)\n routes = []\n vpc.route_tables.each do |rt|\n routes << rt\n end\n routes\n end\n\n # Add rules to local VPC routing table\n read_vpc_route_tables(local_vpc).map(&:id).each_with_index do |rt_id, i|\n local_vpc_route_rule = \"LocalVPCPeeringRoute#{i + 1}\"\n resource local_vpc_route_rule,\n Type: 'AWS::EC2::Route',\n Properties: {\n RouteTableId: rt_id,\n DestinationCidrBlock: remote_vpc.cidr_block,\n VpcPeeringConnectionId: ref(connection_name)\n }\n\n output local_vpc_route_rule,\n Description: \"Local VPC Peering connection for #{rt_id}\",\n Value: ref(local_vpc_route_rule)\n end\n\n # Add rules to remote VPC routing table\n read_vpc_route_tables(remote_vpc).map(&:id).each_with_index do |rt_id, i|\n remote_vpc_route_rule = \"RemoteVPCPeeringRoute#{i + 1}\"\n resource remote_vpc_route_rule,\n Type: 'AWS::EC2::Route',\n Properties: {\n RouteTableId: rt_id,\n DestinationCidrBlock: local_vpc.cidr_block,\n VpcPeeringConnectionId: ref(connection_name)\n }\n\n output remote_vpc_route_rule,\n Description: \"Remote VPC Peering connection for #{rt_id}\",\n Value: ref(remote_vpc_route_rule)\n end\n end", "def create_host(host, args = {})\n raise ArgumentError, \"Must specify ip and port\" unless \\\n args.include? :ip and args.include? :port\n\n modify_host(host, args, 'create')\n end", "def make_trip (guest)\n Trip.new(self, guest)\n end", "def tunnel_peer\n\tend", "def tunnel_peer\n\tend", "def set_routes(my_port, name, node_type, keys)\r\n # Give Access To This Node's Name\r\n get \"/peer_name\" do\r\n return name\r\n end\r\n # Give Access To This Node's Type (Client/Miner)\r\n get \"/peer_type\" do\r\n return node_type.to_s\r\n end\r\n # Give Access To This Node's Public Key For Validation & Handshake\r\n get \"/peer_key_public\" do\r\n return \"#{keys[0]},#{keys[2]}\"\r\n end\r\n # Give Access To This Node's Discovered Peers\r\n get \"/peer_peers\" do\r\n peer_ports = \"\"\r\n $peers.length.times do |i|\r\n peer_ports += \",\" if (i != 0)\r\n peer_ports += $peers[i].port.to_s\r\n end\r\n return peer_ports\r\n end\r\n # Another Peer Requests Handshake\r\n post \"/peer_handshake\" do\r\n port = params[\"port\"].chomp.to_i\r\n signature = params[\"signature\"].chomp.to_i\r\n timestamp = params[\"timestamp\"].chomp.to_i\r\n # Handshake Only With Undiscovered Peers\r\n if (search_peers_by_port(port) == -1)\r\n key_public = Faraday.get(\"#{URL}:#{port}/peer_key_public\").body\r\n key_public = key_public.split(\",\") # Convert String To Array\r\n # Validate Node's Authenticity Using RSA Decryption\r\n if (validate_signature(key_public, signature, timestamp))\r\n add_peer(port)\r\n handshake_peer(my_port, port, [keys[1], keys[2]])\r\n end\r\n end\r\n end\r\n # Request To Mine A Block\r\n post \"/mine_block\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = my_port.to_s\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n mine(amount, payer, payee, miner, timestamp, signature, prev_hash)\r\n else\r\n puts \"Denied mining request from rogue node\".red\r\n $status = \"Denied mining request from rogue node\"\r\n end\r\n end\r\n # Recieve A Mined Block\r\n post \"/block_mined\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = params[\"miner\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n # Add Block If Not Already Mined\r\n block_exists = check_if_block_exists(miner.to_i, timestamp.chomp.to_i)\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, true) if (!block_exists)\r\n end\r\n # Peer Sent A Mined Block\r\n post \"/broadcast_block\" do\r\n amount = params[\"amount\"].to_f\r\n signature = params[\"signature\"].to_s\r\n timestamp = params[\"timestamp\"].to_i\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n hash = params[\"hash\"].to_s\r\n payer = params[\"payer\"].to_i\r\n payee = params[\"payee\"].to_i\r\n miner = params[\"miner\"].to_i\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (prev_hash == \"0000000000000000000000000000000000000000000000000000000000000000\" && $blockchain.length > 0)\r\n # Genesis Node is being shared with everyone, this node does not require as it already has a chain. Ignore.\r\n else\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n is_valid = validate_block(amount, signature, timestamp, prev_hash, nonce, hash, payer, payee, miner)\r\n if (is_valid)\r\n puts \"VALIDATED OK\".green\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, false)\r\n end\r\n else\r\n puts \"Denied block broadcast from rogue node\".red\r\n $status = \"Denied block broadcast from rogue node\"\r\n end\r\n end\r\n end\r\n # Broadcast First Block (Genesis Block) To Peers\r\n post \"/genesis\" do\r\n broadcast_block($blockchain[0])\r\n end\r\nend", "def start_router opts ={}\n # Make sure p2ruby gem WAS indeed required...\n require 'p2ruby' unless defined? P2\n\n # Find any working router if no opts given\n router = opts.empty? ? P2::Router.find : nil\n\n unless router # is already found\n prepare_dirs\n router = P2::Router.new :dir => opts[:dir] || TEST_DIR,\n :path => opts[:path] || ROUTER_PATH,\n :ini => opts[:ini] || ROUTER_INI,\n :args => opts[:args], # usually, it's just /ini:,\n :title => opts[:title] || ROUTER_TITLE,\n :timeout => opts[:timeout] || 5\n\n puts \"Router started at #{ROUTER_PATH}, establishing uplink...\"\n sleep 0.7\n end\n\n if block_given?\n yield router\n else\n router\n end\n\nrescue => e\n puts \"Caught in start_router: #{e}\"\n raise e\nend", "def peer; end", "def peer\n @peer ||= { ip: socket.peer_ip, port: @port.to_i, host: @host, canonized: host_as_string }\n end", "def aws_instance_create_route_to_nat(instance)\n log \"AWS: creating Route for Subnet '#{self.subnet.driver_id}' to NAT Instance '#{self.driver_id}'\"\n self.scenario.subnets.select { |s| s.driver_id and !s.internet_accessible }.each do |subnet|\n aws_call('aws_subnet_route_table_route_to_nat_create', subnet_id: subnet.driver_id, instance_id: instance.id)\n end\n end", "def handshake_peer (port, to, key_private)\r\n timestamp = Time.now.to_i\r\n signature = sign_block(key_private, timestamp)\r\n Faraday.post(\"#{URL}:#{to}/peer_handshake\", port: port, signature: signature, timestamp: timestamp)\r\nend", "def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end", "def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end", "def create_address(addr, **opts)\n Address.create(@id, addr.to_s, node: node, address: subnet.subnet_addr(addr), **opts)\n end", "def peeraddr s\n peeraddrs[s]\n end", "def create(\n peering_group_peer,\n deadline: nil\n )\n req = V1::PeeringGroupPeerCreateRequest.new()\n\n req.peering_group_peer = Plumbing::convert_peering_group_peer_to_plumbing(peering_group_peer)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.create(req, metadata: @parent.get_metadata(\"PeeringGroupPeers.Create\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = PeeringGroupPeerCreateResponse.new()\n resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)\n resp.peering_group_peer = Plumbing::convert_peering_group_peer_to_porcelain(plumbing_response.peering_group_peer)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end", "def generate(opts={})\n ds = opts[:datastore] || datastore\n conf = {\n port: ds['LPORT'],\n host: ds['LHOST'],\n retry_count: ds['ReverseConnectRetries'],\n bind_port: ds['PayloadBindPort'],\n reliable: false\n }\n\n # Generate the advanced stager if we have space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = ds['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_reverse_tcp(conf)\n end", "def make_edge(source, destiny, weigth)\n @vertices[source][destiny] = weigth\n @vertices[destiny][source] = weigth\n end", "def create_address(wallet_id: default_wallet_id, chain: 0)\n call :post, '/wallet/' + wallet_id + '/address/' + chain\n end", "def tunnel_peer\n\t\tbegin\n\t\t\t@peer_info = rstream.peerinfo\n\t\trescue ::Exception\n\t\t\t@peer_info ||= '127.0.0.1'\n\t\tend\n\tend", "def sendto(gram, peerhost, peerport, flags = 0)\n\n # Catch unconnected IPv6 sockets talking to IPv4 addresses\n peer = Rex::Socket.resolv_nbo(peerhost)\n if (peer.length == 4 and self.ipv == 6)\n peerhost = Rex::Socket.getaddress(peerhost, true)\n if peerhost[0,7].downcase != '::ffff:'\n peerhost = '::ffff:' + peerhost\n end\n end\n\n begin\n send(gram, flags, Rex::Socket.to_sockaddr(peerhost, peerport))\n rescue ::Errno::EHOSTUNREACH,::Errno::ENETDOWN,::Errno::ENETUNREACH,::Errno::ENETRESET,::Errno::EHOSTDOWN,::Errno::EACCES,::Errno::EINVAL,::Errno::EADDRNOTAVAIL\n return nil\n end\n\n end", "def add(peer)\n raise \"Peer must have it's infoHash set.\" if ! peer.infoHash\n\n # Do not add if peer is already present by address\n if @peersByAddr.has_key?(byAddrKey(peer))\n @log.debug \"Not adding peer #{peer} since it already exists by #{@peersById.has_key?(peer.trackerPeer.id) ? \"id\" : \"addr\"}.\"\n return\n end\n\n if peer.trackerPeer.id\n @peersById.pushToList(peer.trackerPeer.id, peer)\n \n # If id is null, this is probably a peer received from the tracker that has no ID.\n end\n\n @peersByAddr[byAddrKey(peer)] = peer\n\n @peersByInfoHash.pushToList(peer.infoHash, peer)\n end", "def create_ip_sec_vpn_peer_end_point_with_http_info(ip_sec_vpn_peer_endpoint, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnIpsecPeerEndpointsApi.create_ip_sec_vpn_peer_end_point ...'\n end\n # verify the required parameter 'ip_sec_vpn_peer_endpoint' is set\n if @api_client.config.client_side_validation && ip_sec_vpn_peer_endpoint.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_sec_vpn_peer_endpoint' when calling ManagementPlaneApiVpnIpsecPeerEndpointsApi.create_ip_sec_vpn_peer_end_point\"\n end\n # resource path\n local_var_path = '/vpn/ipsec/peer-endpoints'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ip_sec_vpn_peer_endpoint)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IPSecVPNPeerEndpoint')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnIpsecPeerEndpointsApi#create_ip_sec_vpn_peer_end_point\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new_socket\n membership = IPAddr.new(@broadcast).hton + IPAddr.new('0.0.0.0').hton\n ttl = [@ttl].pack 'i'\n\n socket = UDPSocket.new\n\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, membership\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_LOOP, \"\\000\"\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_TTL, ttl\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_TTL, ttl\n\n socket.bind '0.0.0.0', @port\n\n socket\n end", "def generate\n conf = {\n port: datastore['LPORT'],\n host: datastore['LHOST'],\n retry_count: datastore['ReverseConnectRetries'],\n reliable: false\n }\n\n # Generate the advanced stager if we have space\n unless self.available_space.nil? || required_space > self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_reverse_udp(conf)\n end", "def init(ip_name, type)\n begin\n ret = esc 'show running-configuration bgp | display-xml'\n bgp = extract(ret, :stdout, 'rpc-reply', :data, :'bgp-router')\n\n if bgp\n @nbr = extract_peer(bgp, ip_name, type)\n\n if !@nbr\n # There is no neighbor with the given ipaddr/name\n debug \"no neighbor configuration with #{ip_name}\"\n return\n end\n\n # Fail if the asn differs at first place\n\n @property_hash[:asn] = extract(bgp, :vrf, :'local-as-number')\n if @property_hash[:asn] != resource[:asn]\n raise \"asn #{@property_hash[:asn]} differs from #{resource[:asn]}\"\n end\n\n @property_hash[:type] = resource[:type]\n @property_hash[:neighbor] = resource[:neighbor] # neighbor is Key\n @property_hash[:advertisement_interval] = extract(@nbr,\n :'advertisement-interval')\n @property_hash[:advertisement_start] = extract(@nbr,\n :'advertisement-start')\n @property_hash[:connection_retry_timer] = extract(@nbr,\n :'connection-retry-timer')\n @property_hash[:remote_as] = extract(@nbr,\n :'remote-as')\n @property_hash[:remove_private_as] = extract(@nbr,\n :'remove-private-as')\n @property_hash[:shutdown] = extract(@nbr,\n :'shutdown-status')\n @property_hash[:password] = extract(@nbr,\n :password)\n @property_hash[:send_community_standard] = extract(@nbr,\n :'send-community-standard')\n @property_hash[:send_community_extended] = extract(@nbr,\n :'send-community-extended')\n\n @property_hash[:peergroup] = extract(@nbr,\n :'associate-peer-group')\n\n val = extract(@nbr,\n :'ebgp-multihop-count')\n val = '' if !val\n @property_hash[:ebgp_multihop] = val\n\n @property_hash[:fall_over] = @nbr.has_key? :'fall-over'\n\n val = extract(@nbr,\n :'local-as', :'as-number')\n val = '' if !val\n @property_hash[:local_as] = val\n\n val = extract(@nbr,\n :'route-reflector-client')\n val = :absent if !val\n @property_hash[:route_reflector_client] = val\n\n val = extract(@nbr, :weight)\n val = '' if !val\n @property_hash[:weight] = val\n\n if @nbr.has_key? :'timers'\n @property_hash[:timers] = [\n extract(@nbr, :timers, :'config-keepalive'),\n extract(@nbr, :timers, :'config-hold-time')\n ]\n else\n @property_hash[:timers] = []\n end\n end\n rescue Exception => e\n err \"Exception in #{__method__}\"\n err e.message\n err e.backtrace[0]\n raise\n end\n end", "def peer_ip; end", "def create_host(data=nil)\n if (!data.blank? && data.is_a?(Hash))\n @host = Host.create(data)\n else\n @host = Host.create(:name => \"Test Host #{rand(1..1000)}\", :type => Host::TYPE_ROUTER, :address => \"192.168.0.#{rand(1..200)}\", :description => \"Test host description.\", :active => true)\n end\n end", "def initialize(peer, id); @peer, @id = peer, id end", "def aws_internet_gateway_create(opts)\n opts[:vpc].internet_gateway = AWS::EC2.new.internet_gateways.create\n end", "def create_peer_ship\n\t\tif self.replied == true\n\t\t\tuser_id = self.user_id\n\t\t\tuser2_id = self.to\t\t\t\n\t\t\tPeership.create(:user_id => user_id, :user2_id => user2_id) unless Peership.exists?(user_id, user2_id) \t\t\t\n\t\tend\n\t\t#Delete request object unless user did not make a selection \n\t\tPeerRequest.destroy(self.id) unless self.replied == nil \t\t\n\tend", "def nat_gateway_init(name, subnet_name, route_table_name, dest_cidr_block: '0.0.0.0/0', depends_on: [])\n nat_gateway_eip_name = \"#{name}EIP\"\n nat_gateway_eip = allocate_new_eip(nat_gateway_eip_name, depends_on: depends_on)\n nat_gateway_name = name\n nat_gateway_options = {\n Type: 'AWS::EC2::NatGateway'\n }\n nat_gateway_options[:DependsOn] = depends_on unless depends_on.blank?\n resource nat_gateway_name,\n nat_gateway_options.merge(\n Properties: {\n AllocationId: nat_gateway_eip,\n SubnetId: ref(subnet_name)\n })\n nat_route_rule_name = \"#{name}Route\"\n add_route_rule(nat_route_rule_name, route_table_name, nat_gateway_name, dest_cidr_block, depends_on: depends_on)\n\n output nat_gateway_name,\n Description: 'NAT Gateway',\n Value: ref(nat_gateway_name)\n\n nat_gateway_name\n end", "def makePacket(dest_ip, src_ip, type, seqNum, ackNum, data)\n\tpacket = Packet.new\n\n\tpacket.dest_ip = dest_ip\n\tpacket.src_ip = src_ip\n\tpacket.type = type\n\tpacket.seqNum = seqNum\n\tpacket.ackNum = ackNum\n\tpacket.data = data\n\n\treturn packet\nend", "def make_link blocks\n raise \"from block #{@from.block_name} not found\" unless blocks.has_key?(@from.block_name)\n raise \"to block #{@to.block_name} not found\" unless blocks.has_key?(@to.block_name)\n \n from_block = blocks[@from.block_name]\n to_block = blocks[@to.block_name]\n \n raise \"from port #{@from.port_name} not found\" unless from_block.out_ports.has_key?(@from.port_name)\n raise \"to port #{@to.port_name} not found\" unless to_block.in_ports.has_key?(@to.port_name)\n \n from_port = from_block.out_ports[@from.port_name]\n to_port = to_block.in_ports[@to.port_name]\n \n return Link.new(:from => from_port, :to => to_port)\n end", "def peer_from_hash(hash)\n\t\t\ttest_peer = Peer.new({})\n\t\t\tpeer_opts = {}\n\t\t\tpeer_keys.each{|k|\n\t\t\t\t if peer_method_map[k] && test_peer.respond_to?(peer_method_map[k])\n\t\t\t\t\tpeer_opts[peer_method_map[k]] = hash[k]\n\t\t\t\telsif test_peer.respond_to?(k)\n\t\t\t\t\tpeer_opts[k] = hash[k]\n\t\t\t\t# else nil\n\t\t\t\tend\n\t\t\t}\n\t\t\tPeer.new(peer_opts)\n\t\tend", "def create_host_only_network(options)\n end", "def handle_new_peer(peer)\n logger.debug \"connected new peer #{peer.addr}.\"\n mutex.synchronize do\n peer.id = allocate_peer_id\n unless peers.find(&:primary?)\n peer.primary = true\n peer.start_block_header_download\n end\n peers << peer\n end\n pending_peers.delete(peer)\n filter_load(peer) if node.wallet\n end", "def plug_peer\n paddr = get_peername\n peer = (@peers.find_peer(paddr) || @peers.add_peer(paddr) )\n end", "def create_recovery_link(opts = {})\n data, _status_code, _headers = create_recovery_link_with_http_info(opts)\n data\n end", "def peer_ip\n peername[0]\n end", "def segwit_addr\n hash160 = Bitcoin.hash160(pub)\n p2wpkh = [ [\"00\", \"14\", hash160].join ].pack(\"H*\").bth\n segwit_addr = Bech32::SegwitAddr.new\n segwit_addr.hrp = Bitcoin.chain_params.address_version == '00' ? 'bc' : 'tb'\n segwit_addr.script_pubkey = p2wpkh\n segwit_addr.addr\n end", "def peer_hash_defaults(phash)\n\t\t\tdata = phash.dup\n\t\t\tdata[:port] ||= 3333 # @todo Network;:DEFAULT_PORT\n\t\t\tdata[:name] ||= \"SwarmNode_#{data[:uuid]}\"\n\t\t\tdata[:hive_version] ||= hive_version\n\t\t\tdata[:handler] ||= handler_type\n\t\t\tdata[:protocol] ||= protocol_type\n\t\t\tdata[:ssl] ||= 1\n\t\t\tdata[:peers] ||= []\n\t\t\tif data[:peers].is_a?(Array)\n\t\t\t\tdata[:peers] = data[:peers].join(',')\n\t\t\tend\n#\t\t\tdata[:created_at] ||= DateTime.now.to_s\n#\t\t\tdata[:updated_at] ||= DateTime.now.to_s\n\t\t\tdata\n\t\tend", "def zonecreate_peerzone(fabrickey, zonename, **members)\n raise BrocadeAPIClient::UnsupportedVersion unless @peer_zone_support\n\n result = @zones.zonecreate_peerzone(fabrickey, zonename, **members)\n result[1]\n end", "def create(bgp_as, opts = {})\n if opts[:maximum_ecmp_paths] && !opts[:maximum_paths]\n message = 'maximum_paths must be set if maximum_ecmp_paths is set'\n raise ArgumentError, message\n end\n cmds = [\"router bgp #{bgp_as}\"]\n if opts.key?(:enable)\n cmds << (opts[:enable] == true ? 'no shutdown' : 'shutdown')\n end\n cmds << \"router-id #{opts[:router_id]}\" if opts.key?(:router_id)\n if opts.key?(:maximum_paths)\n cmd = \"maximum-paths #{opts[:maximum_paths]}\"\n if opts.key?(:maximum_ecmp_paths)\n cmd << \" ecmp #{opts[:maximum_ecmp_paths]}\"\n end\n cmds << cmd\n end\n configure(cmds)\n end", "def make_host\n unless self.host.host\n self.host.update(:host => true)\n end\n end", "def generate\n blake160_bin = [blake160[2..-1]].pack(\"H*\")\n type = [\"01\"].pack(\"H*\")\n bin_idx = [\"P2PH\".each_char.map { |c| c.ord.to_s(16) }.join].pack(\"H*\")\n payload = type + bin_idx + blake160_bin\n ConvertAddress.encode(@prefix, payload)\n end", "def create\n Feature.bgp_enable if platform == :nexus\n router_bgp\n wait_for_process_initialized\n end", "def create_address(params)\n EasyPost::Address.create(params)\n end", "def create_or_replace_segment_dhcp_static_binding_0_with_http_info(tier_1_id, segment_id, binding_id, dhcp_static_binding_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0\"\n end\n # verify the required parameter 'binding_id' is set\n if @api_client.config.client_side_validation && binding_id.nil?\n fail ArgumentError, \"Missing the required parameter 'binding_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0\"\n end\n # verify the required parameter 'dhcp_static_binding_config' is set\n if @api_client.config.client_side_validation && dhcp_static_binding_config.nil?\n fail ArgumentError, \"Missing the required parameter 'dhcp_static_binding_config' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/dhcp-static-binding-configs/{binding-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'binding-id' + '}', binding_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dhcp_static_binding_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DhcpStaticBindingConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi#create_or_replace_segment_dhcp_static_binding_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize(eth_type: nil, ipv4_destination: nil, ipv4_source: nil,\n ipv6_source: nil, ipv6_destination: nil, ipv6_flabel: nil,\n ipv6_ext_header: nil, ethernet_destination: nil, ethernet_source: nil,\n in_port: nil, in_physical_port: nil, ip_protocol_num: nil, ip_dscp: nil,\n ip_ecn: nil, tcp_source_port: nil, tcp_destination_port: nil,\n udp_source_port: nil, udp_destination_port: nil, icmpv4_type: nil,\n icmpv4_code: nil, icmpv6_type: nil, icmpv6_code: nil,\n arp_op_code: nil, arp_source_ipv4: nil, arp_target_ipv4: nil,\n arp_source_hardware_address: nil, arp_target_hardware_address: nil,\n vlan_id: nil, vlan_pcp: nil, sctp_destination: nil, sctp_source: nil,\n mpls_label: nil, mpls_tc: nil, mpls_bos: nil, tunnel_id: nil,\n metadata: nil, metadata_mask: nil)\n @eth_type = eth_type\n @ipv4_dst = ipv4_destination\n @ipv4_src = ipv4_source\n @ipv6_dst = ipv6_destination\n @ipv6_src = ipv6_source\n @ipv6_flabel = ipv6_flabel\n @ipv6_ext_hdr = ipv6_ext_header\n @ethernet_dst = ethernet_destination\n @ethernet_src = ethernet_source\n @in_port = in_port\n @in_phy_port = in_physical_port\n @ip_proto = ip_protocol_num\n @ip_dscp = ip_dscp\n @ip_ecn = ip_ecn\n @tcp_src_port = tcp_source_port\n @tcp_dst_port = tcp_destination_port\n @udp_dst_port = udp_destination_port\n @udp_src_port = udp_source_port\n @icmpv4_type = icmpv4_type\n @icmpv4_code = icmpv4_code\n @icmpv6_type = icmpv6_type\n @icmpv6_code = icmpv6_code\n @arp_op_code = arp_op_code\n @arp_src_ipv4 = arp_source_ipv4\n @arp_tgt_ipv4 = arp_target_ipv4\n @arp_src_hw_addr = arp_source_hardware_address\n @arp_tgt_hw_addr = arp_target_hardware_address\n @vlan_id = vlan_id\n @vlan_pcp = vlan_pcp\n @sctp_dst = sctp_destination\n @sctp_src = sctp_source\n @mpls_label = mpls_label\n @mpls_tc = mpls_tc\n @mpls_bos = mpls_bos\n @tunnel_id = tunnel_id\n @metdata = metadata\n @metadata_mask = metadata_mask\n end", "def create_address!(options = {})\n method_not_implemented\n end", "def show\n @link.clicks.create(ip_address: request.remote_ip)\n redirect_to @link.full_url\n end", "def initsock(params = nil)\n if (params)\n self.peerhost = params.peerhost\n self.peerhostname = params.peerhostname\n self.peerport = params.peerport\n self.localhost = params.localhost\n self.localport = params.localport\n self.context = params.context || {}\n self.ipv = params.v6 ? 6 : 4\n end\n end", "def peer\n @peer ||= begin\n addr = @socket.getpeername\n ip_address = Socket.getnameinfo(addr, Socket::NI_NUMERICHOST | Socket::NI_NUMERICSERV).first\n { :ip => ip_address, :port => @port.to_i, :host => @host }\n end\n end", "def create\n @participant = Participant.new(participant_params)\n @participant.session_id = session[:session_id]\n @participant.ip_address = request.ip\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to directions_path }\n format.json { render action: 'show', status: :created, location: @participant }\n else\n format.html { render action: 'new' }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_internet_address (contact_id, params)\n update_internet_address(contact_id, 0, params)\n end", "def init(nbr_ipname, nbr_type, ip_ver)\n begin\n ret = esc 'show running-configuration bgp | display-xml'\n bgp = extract(ret, :stdout, 'rpc-reply', :data, :'bgp-router')\n\n raise 'bgp configuration not present.' if !bgp\n\n # Fail if the asn differs at first place\n @property_hash[:asn] = extract(bgp, :vrf, :'local-as-number')\n if @property_hash[:asn] != resource[:asn]\n raise \"asn #{@property_hash[:asn]} differs from #{resource[:asn]}\"\n end\n\n # Fail if there is no neighbor configuration\n nbr = extract_peer(bgp, nbr_ipname, nbr_type)\n raise \"neighbor #{nbr_ipname} not configured.\" if !nbr\n\n @nbr_af = extract(nbr, (ip_ver.to_s + '-unicast').to_sym)\n if !@nbr_af\n # There is no af configuration for the given ip type\n return\n end\n\n @property_hash[:activate] = extract(@nbr_af, :'activate')\n @property_hash[:allowas_in] = extract(@nbr_af, :'allowas-in')\n @property_hash[:add_path] = extract_add_path(@nbr_af)\n\n val = extract(@nbr_af, :'next-hop-self')\n val = :false if !val\n @property_hash[:next_hop_self] = val\n\n val = extract(@nbr_af, :'sender-side-loop-detection')\n val = :true if !val\n @property_hash[:sender_side_loop_detection] = val\n\n val = @nbr_af.has_key? :'soft-reconfiguration-inbound'\n val = :false if !val\n @property_hash[:soft_reconfiguration] = val\n\n val = extract(@nbr_af, :'distribute-list-name-in')\n val = '' if !val\n @property_hash[:distribute_list] = [val]\n\n val = extract(@nbr_af, :'distribute-list-name-out')\n val = '' if !val\n @property_hash[:distribute_list].push(val)\n\n val = extract(@nbr_af, :'route-map-in')\n val = '' if !val\n @property_hash[:route_map] = [val]\n\n val = extract(@nbr_af, :'route-map-out')\n val = '' if !val\n @property_hash[:route_map].push(val)\n\n rescue Exception => e\n err \"Exception in #{__method__}\"\n err e.message\n err e.backtrace[0]\n raise\n end\n end", "def send_create\n msg = {:action => \"create\", :object => \"firewall\", :objectid => self.id, :accountid => self.account_id }.to_yaml\n sendMsg(msg)\n end", "def create_or_replace_segment_dhcp_static_binding_with_http_info(tier_1_id, segment_id, binding_id, dhcp_static_binding_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding\"\n end\n # verify the required parameter 'binding_id' is set\n if @api_client.config.client_side_validation && binding_id.nil?\n fail ArgumentError, \"Missing the required parameter 'binding_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding\"\n end\n # verify the required parameter 'dhcp_static_binding_config' is set\n if @api_client.config.client_side_validation && dhcp_static_binding_config.nil?\n fail ArgumentError, \"Missing the required parameter 'dhcp_static_binding_config' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/dhcp-static-binding-configs/{binding-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'binding-id' + '}', binding_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dhcp_static_binding_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DhcpStaticBindingConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi#create_or_replace_segment_dhcp_static_binding\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_ip_sec_vpn_peer_end_point(ip_sec_vpn_peer_endpoint, opts = {})\n data, _status_code, _headers = create_ip_sec_vpn_peer_end_point_with_http_info(ip_sec_vpn_peer_endpoint, opts)\n data\n end", "def initialize_server(aa, ephemeral = nil)\n validate_ephemeral(aa)\n @aa = aa\n @b = ephemeral || bigrand(32).hex\n end", "def create_dpg(one_vnet, dc, cluster, vi_client)\n begin\n # Get parameters needed to create the network\n pnics = one_vnet['TEMPLATE/PHYDEV']\n pg_name = one_vnet['TEMPLATE/BRIDGE']\n sw_name = one_vnet['TEMPLATE/VCENTER_SWITCH_NAME']\n mtu = one_vnet['TEMPLATE/MTU']\n vlan_id = one_vnet['VLAN_ID'] || 0\n\n if one_vnet['TEMPLATE/VCENTER_SWITCH_NPORTS']\n nports = one_vnet['TEMPLATE/VCENTER_SWITCH_NPORTS']\n else\n nports = 8\n end\n\n dc.lock\n net_folder = dc.network_folder\n net_folder.fetch!\n\n # Get distributed port group if it exists\n dpg = dc.dpg_exists(pg_name, net_folder)\n\n # Disallow changes of switch name for existing pg\n if dpg && dc.pg_changes_sw?(dpg, sw_name)\n err_msg = \"The port group's switch name can not be modified\"\\\n \" for OpenNebula's virtual network.\"\n raise CreateNetworkError, err_msg\n end\n\n if !dpg\n # Get distributed virtual switch if it exists\n dvs = dc.dvs_exists(sw_name, net_folder)\n\n if !dvs\n dvs = dc.create_dvs(sw_name, pnics, mtu)\n end\n # Creates distributed port group\n new_dpg = dc.create_dpg(dvs, pg_name, vlan_id, nports)\n # Attach dpg to esxi hosts\n cluster['host'].each do |host|\n begin\n esx_host = VCenterDriver::ESXHost\n .new_from_ref(host._ref, vi_client)\n esx_host.lock\n if dvs\n pnics_available = nil\n if pnics && !pnics.empty?\n pnics_available = esx_host.get_available_pnics\n end\n esx_host.assign_proxy_switch(dvs,\n sw_name,\n pnics,\n pnics_available)\n end\n rescue StandardError => e\n raise e\n ensure\n esx_host.unlock if esx_host\n end\n end\n else\n err_msg = \"Port group #{pg_name} already exists\"\n raise CreateNetworkError, err_msg\n end\n new_dpg\n ensure\n dc.unlock if dc\n end\nend", "def edgeb_network(cmd)\n node = $node_info.new \n $lock.synchronize{\n \n node.src = $hostname\n node.dst = cmd[1]\n node.cost = 1\n node.nexthop = cmd[1]\n $rt[cmd[1]] = node\n if $local_ip == nil then $local_ip = cmd[2] end\n\n $network.undir_connection($hostname, cmd[1], cmd[3].to_i, 1) \n }\n #puts \"THIS IS THE ROUTING TABLE: #{$rt}\"\nend", "def peer\n \"#{ssl ? 'https://' : 'http://' }#{rhost}:#{rport}\"\n end", "def create_packet\n lock = (@type == :ack ? true : false)\n payload = @pool.get_payload(@hwaddr,lock)\n return :noboot if payload[:netboot] == 'false'\n params = {\n\top: $DHCP_OP_REPLY,\n\txid: @msg.xid,\n\tchaddr: @msg.chaddr,\n\tyiaddr: payload[:ipaddr],\n\tsiaddr: IPAddr.new(payload[:dhcp_server].join('.')).to_i,\n\tfname: payload[:filename],\n\toptions: [\n\t REPLY_TYPES[@type],\n\t ServerIdentifierOption.new({payload: payload[:dhcp_server]}),\n\t DomainNameOption.new({payload: payload[:domainname]}),\n\t DomainNameServerOption.new({payload: payload[:dns_server]}),\n\t IPAddressLeaseTimeOption.new({payload: payload[:lease_time]}),\n\t SubnetMaskOption.new({payload: payload[:subnet_mask]}),\n\t RouterOption.new({payload: payload[:gateway]})\n\t]\n }\n Message.new(params).pack\n end", "def init(intface, victimIP)\n\n\t@interface = intface\n\t@victimIP = victimIP\n\t@routerIP = \"192.168.0.100\"\n\t@srcMAC = PacketFu::Utils.whoami?(:iface => @interface)\n\t@victimMAC = PacketFu::Utils.arp(@victimIP, :iface => @interface)\n\t@routerMAC = PacketFu::Utils.arp(@routerIP, :iface => @interface)\n\n\t# Construct the target's packet\n\t@arp_packet_target = PacketFu::ARPPacket.new()\n\t@arp_packet_target.eth_saddr = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_target.eth_daddr = @victimMAC \t\t# target's MAC address\n\t@arp_packet_target.arp_saddr_mac = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_target.arp_daddr_mac = @victimMAC \t\t# target's MAC address\n\t@arp_packet_target.arp_saddr_ip = @routerIP \t\t# router's IP\n\t@arp_packet_target.arp_daddr_ip = @victimIP \t\t# target's IP\n\t@arp_packet_target.arp_opcode = 2 \t# arp code 2 == ARP reply\n\t \n\t# Construct the router's packet\n\t@arp_packet_router = PacketFu::ARPPacket.new()\n\t@arp_packet_router.eth_saddr = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_router.eth_daddr = @routerMAC \t\t# router's MAC address\n\t@arp_packet_router.arp_saddr_mac = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_router.arp_daddr_mac = @routerMAC \t\t# router's MAC address\n\t@arp_packet_router.arp_saddr_ip = @victimIP \t\t# target's IP\n\t@arp_packet_router.arp_daddr_ip = @routerIP \t\t# router's IP\n\t@arp_packet_router.arp_opcode = 2 \t# arp code 2 == ARP reply\n\n\t# Initialize IP Forwarding\n\t`echo 1 > /proc/sys/net/ipv4/ip_forward`\n\n\t# Append Firewall rules to drop legitimate DNS Responses\n\t`iptables -A FORWARD -p UDP --dport 53 -j DROP`\n\t`iptables -A FORWARD -p TCP --dport 53 -j DROP`\n\nend", "def create_address!\n method_not_implemented\n end", "def create_or_replace_segment_dhcp_static_binding_0(tier_1_id, segment_id, binding_id, dhcp_static_binding_config, opts = {})\n data, _status_code, _headers = create_or_replace_segment_dhcp_static_binding_0_with_http_info(tier_1_id, segment_id, binding_id, dhcp_static_binding_config, opts)\n data\n end", "def peer_info\n peer_bytes = get_peername[2, 6].unpack(\"nC4\")\n port = peer_bytes.first.to_i\n ip = peer_bytes[1, 4].join(\".\")\n\n [ip, port]\n end", "def initialize(victim_ip, victim_mac, gateway, router_mac, iface = \"em1\")\n \n @ifconfig = PacketFu::Utils.whoami?(:iface => iface) \n @ifname = iface\n @v_packet = PacketFu::ARPPacket.new\n @r_packet = PacketFu::ARPPacket.new\n # Make the victim response packet\n \n #link layer components\n @v_packet.eth_saddr = @ifconfig[:eth_saddr] # attacker MAC address\n @v_packet.eth_daddr = victim_mac # the victim's MAC address\n #arp components\n \n @v_packet.arp_saddr_mac = @ifconfig[:eth_saddr]\n @v_packet.arp_daddr_mac = victim_mac\n @v_packet.arp_saddr_ip = gateway\n @v_packet.arp_daddr_ip = victim_ip\n @v_packet.arp_opcode = 2 \n \n #Make the router response packet\n \n #link layer components\n @r_packet.eth_saddr = @ifconfig[:eth_saddr]\n @r_packet.eth_daddr = router_mac\n #arp components\n @r_packet.arp_saddr_mac = @ifconfig[:eth_saddr]\n @r_packet.arp_daddr_mac = router_mac\n @r_packet.arp_saddr_ip = victim_ip\n @r_packet.arp_daddr_ip = gateway\n @r_packet.arp_opcode = 2\n\n\tend", "def new\n # @gossip = Gossip.new\n\n end", "def relay_request(session)\n peer_session = get_peer_session(session)\n if peer_session\n r = create_b2bua_request(session)\n peer_session.send(r)\n else\n @ilog.warn(\"No peer session found, cannot relay the request\") if @ilog.warn?\n raise \"Unable to relay the request\" \n end\n end", "def generate\n conf = {\n port: datastore['LPORT'],\n reliable: false\n }\n\n # Generate the more advanced stager if we have the space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_bind_tcp(conf)\n end", "def create_edge origin, destiny\n return GraphElements::EdgeDefault.new origin, destiny\n end", "def new\n @pathway = @team.ae_team_pathways.new\n end", "def create_forwarding_rule(body, opts = {})\n data, _status_code, _headers = create_forwarding_rule_with_http_info(body, opts)\n return data\n end", "def initialize\n if (@handle = ::Dnet.route_open()).address == 0\n raise H_ERR.new(\"unable to open route handle\")\n end\n _handle_opened!\n end", "def abs_adr(ip)\n Verneuil::Address.new(ip, self)\n end", "def peer\r\n \"#{ssl ? 'https://' : 'http://' }#{rhost}:#{rport}\"\r\n end", "def find_or_create_host(opts)\n host = get_host(opts.clone)\n return host unless host.nil?\n\n report_host(opts)\n end" ]
[ "0.6617239", "0.6229633", "0.60930145", "0.5871882", "0.57874286", "0.5786859", "0.5782089", "0.5502796", "0.5379553", "0.5352684", "0.534905", "0.5237958", "0.5224783", "0.5205536", "0.51922005", "0.51922005", "0.509461", "0.5091298", "0.50749326", "0.5036021", "0.4987679", "0.49698833", "0.49653167", "0.49304804", "0.49304804", "0.49109066", "0.48929784", "0.48874885", "0.48771393", "0.4873569", "0.48594657", "0.48592818", "0.48592818", "0.48573208", "0.48509791", "0.48207974", "0.4768914", "0.47659028", "0.47535965", "0.47496012", "0.4724938", "0.47241557", "0.46924677", "0.46910802", "0.4689892", "0.46835312", "0.46747255", "0.46639106", "0.4657856", "0.464806", "0.46334633", "0.46246397", "0.4623384", "0.46162874", "0.4613328", "0.46103373", "0.46096295", "0.45838174", "0.45796937", "0.45784417", "0.45730492", "0.45547876", "0.454772", "0.45476717", "0.45403996", "0.45330295", "0.4518938", "0.44866657", "0.4484641", "0.44752637", "0.44710693", "0.4459844", "0.4457119", "0.44570655", "0.44549596", "0.44525325", "0.44506603", "0.44474423", "0.44345126", "0.4434417", "0.44282424", "0.44264987", "0.44136506", "0.44129416", "0.44117454", "0.44094434", "0.4409128", "0.4408691", "0.4408237", "0.44071907", "0.44029516", "0.4399579", "0.43990648", "0.4397997", "0.43711618", "0.43668672", "0.43549696", "0.4352003", "0.43470597", "0.43462086" ]
0.79299843
0
Create a static hop BFD peer Creates a BFD peer for static route. The required parameters includes peer IP address.
def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer" end # verify the required parameter 'static_hop_bfd_peer' is set if @api_client.config.client_side_validation && static_hop_bfd_peer.nil? fail ArgumentError, "Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer" end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(static_hop_bfd_peer) auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'StaticHopBfdPeer') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def create(destination, nexthop, opts = {})\n cmd = \"ip route #{destination} #{nexthop}\"\n cmd << \" #{opts[:router_ip]}\" if opts[:router_ip]\n cmd << \" #{opts[:distance]}\" if opts[:distance]\n cmd << \" tag #{opts[:tag]}\" if opts[:tag]\n cmd << \" name #{opts[:name]}\" if opts[:name]\n configure cmd\n end", "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_static_hop_bfd_peers(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)\n data\n end", "def new_peer(peer, io)\n peer = Peer.new(protocol_manage: self, peer: peer, io: io)\n peer.handshake(1, chain.total_difficulty, chain.head.get_hash, chain.genesis_hash)\n @peers[peer] = true\n\n # register peer to synchronizer\n synchronizer << [:register_peer, peer]\n # start handle peer messages\n executor.post {handle_peer(peer)}\n end", "def read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#read_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_peer(port)\r\n name = Faraday.get(\"#{URL}:#{port}/peer_name\").body.to_s.chomp\r\n key_public = Faraday.get(\"#{URL}:#{port}/peer_key_public\").body.to_s.chomp\r\n key_public = key_public.split(\",\")\r\n node_type = Faraday.get(\"#{URL}:#{port}/peer_type\").body.chomp.to_i\r\n new_peer = Peers.new(port.to_i, name, key_public, node_type, 0.0)\r\n $peers << new_peer\r\n puts \"Added peer #{port}\".light_blue\r\n $status = \"Added peer #{port}\"\r\nend", "def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def aws_subnet_route_table_route_to_nat_create(opts)\n AWS::EC2.new.subnets[opts[:subnet_id]].route_table.create_route(\"0.0.0.0/0\", { instance: opts[:instance_id] } )\n end", "def addPeer(options, peerId, clusterKey, tableCfs=nil, endpointClass=nil, isTemporary=\"false\")\n unless peerId !~ /\\D/\n raise 'peerId should be Integer ID for peer cluster'\n end\n replAdm = ReplicationAdmin.new(getConfiguration())\n replPeerConfig = ReplicationPeerConfig.new()\n replPeerConfig.setClusterKey(clusterKey)\n printf \"Ading Peer Id %s with ClusterKey %s\\n\", peerId, clusterKey\n #replPeerConfig.getConfiguration().put(\"IS_TEMPORARY\", cluster.isTemporary)\n if endpointClass\n replPeerConfig.setReplicationEndpointImpl(endpointClass)\n peerId.gsub!(\"-\", \"*\") # odr TenantReplicationEndpoint expects hyphens to be escaped to astericks\n end\n replPeerConfig.getConfiguration().put(\"IS_TEMPORARY\", isTemporary)\n\n replAdm.addPeer(peerId, replPeerConfig, tableCfs)\nend", "def list_static_hop_bfd_peers_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeerListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#list_static_hop_bfd_peers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def peeraddr(*) end", "def peeraddr(*) end", "def peerip=(_arg0); end", "def add_peer(peer)\n @link_table.store_peer(peer)\n end", "def addPeer(cluster, args={})\n raise(ArgumentError, \"Clustername cannot be empty\") if cluster.to_s.empty?\n raise(ArgumentError, \"Arguments cannot be empty\") if args.empty?\n name = args[NAME] if args[NAME]\n raise(ArgumentError, \"Name of the peer should be specified\") if name.empty?\n address = args[ADDRESS] if args[ADDRESS]\n raise(ArgumentError, \"Address of the peer should be specified\") if address.empty?\n peerCluster = Pair.new(name, address)\n @crosssiteadmin.addPeer(cluster, peerCluster)\n end", "def peer2peer(&remote_init)\n\t\tstart_peers(&remote_init)\n\t\tsetup_connection\n\t end", "def tpl\n connection_name = 'PrivateConnection'\n local_vpc_id_ref, remote_vpc_id_ref = %W(#{connection_name}VpcId #{connection_name}PeerVpcId)\n\n def validate_params(*params)\n params.each do |param|\n fail \"Unable to find required parameter #{param}\" unless @parameters.key?(param)\n end\n rescue RuntimeError => e\n puts e\n exit 1\n end\n\n validate_params(*[remote_vpc_id_ref])\n\n local_vpc, remote_vpc = [vpc, vpc(id: @parameters[remote_vpc_id_ref])]\n\n description 'Stack to create peering connection between two VPCs'\n\n parameter_vpc_id(local_vpc_id_ref,\n 'VpcId from where connection gets created',\n local_vpc.id)\n\n parameter_vpc_id(remote_vpc_id_ref,\n 'VpcId where peering connection should go',\n remote_vpc.id)\n\n # Initialize Peering connection\n vpc_peering_init(connection_name,\n tags: [\n {\n Key: 'Name',\n Value: connection_name\n }\n ])\n\n def read_vpc_route_tables(vpc)\n routes = []\n vpc.route_tables.each do |rt|\n routes << rt\n end\n routes\n end\n\n # Add rules to local VPC routing table\n read_vpc_route_tables(local_vpc).map(&:id).each_with_index do |rt_id, i|\n local_vpc_route_rule = \"LocalVPCPeeringRoute#{i + 1}\"\n resource local_vpc_route_rule,\n Type: 'AWS::EC2::Route',\n Properties: {\n RouteTableId: rt_id,\n DestinationCidrBlock: remote_vpc.cidr_block,\n VpcPeeringConnectionId: ref(connection_name)\n }\n\n output local_vpc_route_rule,\n Description: \"Local VPC Peering connection for #{rt_id}\",\n Value: ref(local_vpc_route_rule)\n end\n\n # Add rules to remote VPC routing table\n read_vpc_route_tables(remote_vpc).map(&:id).each_with_index do |rt_id, i|\n remote_vpc_route_rule = \"RemoteVPCPeeringRoute#{i + 1}\"\n resource remote_vpc_route_rule,\n Type: 'AWS::EC2::Route',\n Properties: {\n RouteTableId: rt_id,\n DestinationCidrBlock: local_vpc.cidr_block,\n VpcPeeringConnectionId: ref(connection_name)\n }\n\n output remote_vpc_route_rule,\n Description: \"Remote VPC Peering connection for #{rt_id}\",\n Value: ref(remote_vpc_route_rule)\n end\n end", "def create_host(host, args = {})\n raise ArgumentError, \"Must specify ip and port\" unless \\\n args.include? :ip and args.include? :port\n\n modify_host(host, args, 'create')\n end", "def make_trip (guest)\n Trip.new(self, guest)\n end", "def tunnel_peer\n\tend", "def tunnel_peer\n\tend", "def set_routes(my_port, name, node_type, keys)\r\n # Give Access To This Node's Name\r\n get \"/peer_name\" do\r\n return name\r\n end\r\n # Give Access To This Node's Type (Client/Miner)\r\n get \"/peer_type\" do\r\n return node_type.to_s\r\n end\r\n # Give Access To This Node's Public Key For Validation & Handshake\r\n get \"/peer_key_public\" do\r\n return \"#{keys[0]},#{keys[2]}\"\r\n end\r\n # Give Access To This Node's Discovered Peers\r\n get \"/peer_peers\" do\r\n peer_ports = \"\"\r\n $peers.length.times do |i|\r\n peer_ports += \",\" if (i != 0)\r\n peer_ports += $peers[i].port.to_s\r\n end\r\n return peer_ports\r\n end\r\n # Another Peer Requests Handshake\r\n post \"/peer_handshake\" do\r\n port = params[\"port\"].chomp.to_i\r\n signature = params[\"signature\"].chomp.to_i\r\n timestamp = params[\"timestamp\"].chomp.to_i\r\n # Handshake Only With Undiscovered Peers\r\n if (search_peers_by_port(port) == -1)\r\n key_public = Faraday.get(\"#{URL}:#{port}/peer_key_public\").body\r\n key_public = key_public.split(\",\") # Convert String To Array\r\n # Validate Node's Authenticity Using RSA Decryption\r\n if (validate_signature(key_public, signature, timestamp))\r\n add_peer(port)\r\n handshake_peer(my_port, port, [keys[1], keys[2]])\r\n end\r\n end\r\n end\r\n # Request To Mine A Block\r\n post \"/mine_block\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = my_port.to_s\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n mine(amount, payer, payee, miner, timestamp, signature, prev_hash)\r\n else\r\n puts \"Denied mining request from rogue node\".red\r\n $status = \"Denied mining request from rogue node\"\r\n end\r\n end\r\n # Recieve A Mined Block\r\n post \"/block_mined\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = params[\"miner\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n # Add Block If Not Already Mined\r\n block_exists = check_if_block_exists(miner.to_i, timestamp.chomp.to_i)\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, true) if (!block_exists)\r\n end\r\n # Peer Sent A Mined Block\r\n post \"/broadcast_block\" do\r\n amount = params[\"amount\"].to_f\r\n signature = params[\"signature\"].to_s\r\n timestamp = params[\"timestamp\"].to_i\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n hash = params[\"hash\"].to_s\r\n payer = params[\"payer\"].to_i\r\n payee = params[\"payee\"].to_i\r\n miner = params[\"miner\"].to_i\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (prev_hash == \"0000000000000000000000000000000000000000000000000000000000000000\" && $blockchain.length > 0)\r\n # Genesis Node is being shared with everyone, this node does not require as it already has a chain. Ignore.\r\n else\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n is_valid = validate_block(amount, signature, timestamp, prev_hash, nonce, hash, payer, payee, miner)\r\n if (is_valid)\r\n puts \"VALIDATED OK\".green\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, false)\r\n end\r\n else\r\n puts \"Denied block broadcast from rogue node\".red\r\n $status = \"Denied block broadcast from rogue node\"\r\n end\r\n end\r\n end\r\n # Broadcast First Block (Genesis Block) To Peers\r\n post \"/genesis\" do\r\n broadcast_block($blockchain[0])\r\n end\r\nend", "def start_router opts ={}\n # Make sure p2ruby gem WAS indeed required...\n require 'p2ruby' unless defined? P2\n\n # Find any working router if no opts given\n router = opts.empty? ? P2::Router.find : nil\n\n unless router # is already found\n prepare_dirs\n router = P2::Router.new :dir => opts[:dir] || TEST_DIR,\n :path => opts[:path] || ROUTER_PATH,\n :ini => opts[:ini] || ROUTER_INI,\n :args => opts[:args], # usually, it's just /ini:,\n :title => opts[:title] || ROUTER_TITLE,\n :timeout => opts[:timeout] || 5\n\n puts \"Router started at #{ROUTER_PATH}, establishing uplink...\"\n sleep 0.7\n end\n\n if block_given?\n yield router\n else\n router\n end\n\nrescue => e\n puts \"Caught in start_router: #{e}\"\n raise e\nend", "def peer; end", "def peer\n @peer ||= { ip: socket.peer_ip, port: @port.to_i, host: @host, canonized: host_as_string }\n end", "def aws_instance_create_route_to_nat(instance)\n log \"AWS: creating Route for Subnet '#{self.subnet.driver_id}' to NAT Instance '#{self.driver_id}'\"\n self.scenario.subnets.select { |s| s.driver_id and !s.internet_accessible }.each do |subnet|\n aws_call('aws_subnet_route_table_route_to_nat_create', subnet_id: subnet.driver_id, instance_id: instance.id)\n end\n end", "def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end", "def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end", "def handshake_peer (port, to, key_private)\r\n timestamp = Time.now.to_i\r\n signature = sign_block(key_private, timestamp)\r\n Faraday.post(\"#{URL}:#{to}/peer_handshake\", port: port, signature: signature, timestamp: timestamp)\r\nend", "def create_address(addr, **opts)\n Address.create(@id, addr.to_s, node: node, address: subnet.subnet_addr(addr), **opts)\n end", "def peeraddr s\n peeraddrs[s]\n end", "def create(\n peering_group_peer,\n deadline: nil\n )\n req = V1::PeeringGroupPeerCreateRequest.new()\n\n req.peering_group_peer = Plumbing::convert_peering_group_peer_to_plumbing(peering_group_peer)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.create(req, metadata: @parent.get_metadata(\"PeeringGroupPeers.Create\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = PeeringGroupPeerCreateResponse.new()\n resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)\n resp.peering_group_peer = Plumbing::convert_peering_group_peer_to_porcelain(plumbing_response.peering_group_peer)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end", "def generate(opts={})\n ds = opts[:datastore] || datastore\n conf = {\n port: ds['LPORT'],\n host: ds['LHOST'],\n retry_count: ds['ReverseConnectRetries'],\n bind_port: ds['PayloadBindPort'],\n reliable: false\n }\n\n # Generate the advanced stager if we have space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = ds['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_reverse_tcp(conf)\n end", "def make_edge(source, destiny, weigth)\n @vertices[source][destiny] = weigth\n @vertices[destiny][source] = weigth\n end", "def create_address(wallet_id: default_wallet_id, chain: 0)\n call :post, '/wallet/' + wallet_id + '/address/' + chain\n end", "def tunnel_peer\n\t\tbegin\n\t\t\t@peer_info = rstream.peerinfo\n\t\trescue ::Exception\n\t\t\t@peer_info ||= '127.0.0.1'\n\t\tend\n\tend", "def sendto(gram, peerhost, peerport, flags = 0)\n\n # Catch unconnected IPv6 sockets talking to IPv4 addresses\n peer = Rex::Socket.resolv_nbo(peerhost)\n if (peer.length == 4 and self.ipv == 6)\n peerhost = Rex::Socket.getaddress(peerhost, true)\n if peerhost[0,7].downcase != '::ffff:'\n peerhost = '::ffff:' + peerhost\n end\n end\n\n begin\n send(gram, flags, Rex::Socket.to_sockaddr(peerhost, peerport))\n rescue ::Errno::EHOSTUNREACH,::Errno::ENETDOWN,::Errno::ENETUNREACH,::Errno::ENETRESET,::Errno::EHOSTDOWN,::Errno::EACCES,::Errno::EINVAL,::Errno::EADDRNOTAVAIL\n return nil\n end\n\n end", "def add(peer)\n raise \"Peer must have it's infoHash set.\" if ! peer.infoHash\n\n # Do not add if peer is already present by address\n if @peersByAddr.has_key?(byAddrKey(peer))\n @log.debug \"Not adding peer #{peer} since it already exists by #{@peersById.has_key?(peer.trackerPeer.id) ? \"id\" : \"addr\"}.\"\n return\n end\n\n if peer.trackerPeer.id\n @peersById.pushToList(peer.trackerPeer.id, peer)\n \n # If id is null, this is probably a peer received from the tracker that has no ID.\n end\n\n @peersByAddr[byAddrKey(peer)] = peer\n\n @peersByInfoHash.pushToList(peer.infoHash, peer)\n end", "def create_ip_sec_vpn_peer_end_point_with_http_info(ip_sec_vpn_peer_endpoint, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnIpsecPeerEndpointsApi.create_ip_sec_vpn_peer_end_point ...'\n end\n # verify the required parameter 'ip_sec_vpn_peer_endpoint' is set\n if @api_client.config.client_side_validation && ip_sec_vpn_peer_endpoint.nil?\n fail ArgumentError, \"Missing the required parameter 'ip_sec_vpn_peer_endpoint' when calling ManagementPlaneApiVpnIpsecPeerEndpointsApi.create_ip_sec_vpn_peer_end_point\"\n end\n # resource path\n local_var_path = '/vpn/ipsec/peer-endpoints'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ip_sec_vpn_peer_endpoint)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'IPSecVPNPeerEndpoint')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiVpnIpsecPeerEndpointsApi#create_ip_sec_vpn_peer_end_point\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new_socket\n membership = IPAddr.new(@broadcast).hton + IPAddr.new('0.0.0.0').hton\n ttl = [@ttl].pack 'i'\n\n socket = UDPSocket.new\n\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, membership\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_LOOP, \"\\000\"\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_MULTICAST_TTL, ttl\n socket.setsockopt Socket::IPPROTO_IP, Socket::IP_TTL, ttl\n\n socket.bind '0.0.0.0', @port\n\n socket\n end", "def generate\n conf = {\n port: datastore['LPORT'],\n host: datastore['LHOST'],\n retry_count: datastore['ReverseConnectRetries'],\n reliable: false\n }\n\n # Generate the advanced stager if we have space\n unless self.available_space.nil? || required_space > self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_reverse_udp(conf)\n end", "def init(ip_name, type)\n begin\n ret = esc 'show running-configuration bgp | display-xml'\n bgp = extract(ret, :stdout, 'rpc-reply', :data, :'bgp-router')\n\n if bgp\n @nbr = extract_peer(bgp, ip_name, type)\n\n if !@nbr\n # There is no neighbor with the given ipaddr/name\n debug \"no neighbor configuration with #{ip_name}\"\n return\n end\n\n # Fail if the asn differs at first place\n\n @property_hash[:asn] = extract(bgp, :vrf, :'local-as-number')\n if @property_hash[:asn] != resource[:asn]\n raise \"asn #{@property_hash[:asn]} differs from #{resource[:asn]}\"\n end\n\n @property_hash[:type] = resource[:type]\n @property_hash[:neighbor] = resource[:neighbor] # neighbor is Key\n @property_hash[:advertisement_interval] = extract(@nbr,\n :'advertisement-interval')\n @property_hash[:advertisement_start] = extract(@nbr,\n :'advertisement-start')\n @property_hash[:connection_retry_timer] = extract(@nbr,\n :'connection-retry-timer')\n @property_hash[:remote_as] = extract(@nbr,\n :'remote-as')\n @property_hash[:remove_private_as] = extract(@nbr,\n :'remove-private-as')\n @property_hash[:shutdown] = extract(@nbr,\n :'shutdown-status')\n @property_hash[:password] = extract(@nbr,\n :password)\n @property_hash[:send_community_standard] = extract(@nbr,\n :'send-community-standard')\n @property_hash[:send_community_extended] = extract(@nbr,\n :'send-community-extended')\n\n @property_hash[:peergroup] = extract(@nbr,\n :'associate-peer-group')\n\n val = extract(@nbr,\n :'ebgp-multihop-count')\n val = '' if !val\n @property_hash[:ebgp_multihop] = val\n\n @property_hash[:fall_over] = @nbr.has_key? :'fall-over'\n\n val = extract(@nbr,\n :'local-as', :'as-number')\n val = '' if !val\n @property_hash[:local_as] = val\n\n val = extract(@nbr,\n :'route-reflector-client')\n val = :absent if !val\n @property_hash[:route_reflector_client] = val\n\n val = extract(@nbr, :weight)\n val = '' if !val\n @property_hash[:weight] = val\n\n if @nbr.has_key? :'timers'\n @property_hash[:timers] = [\n extract(@nbr, :timers, :'config-keepalive'),\n extract(@nbr, :timers, :'config-hold-time')\n ]\n else\n @property_hash[:timers] = []\n end\n end\n rescue Exception => e\n err \"Exception in #{__method__}\"\n err e.message\n err e.backtrace[0]\n raise\n end\n end", "def peer_ip; end", "def create_host(data=nil)\n if (!data.blank? && data.is_a?(Hash))\n @host = Host.create(data)\n else\n @host = Host.create(:name => \"Test Host #{rand(1..1000)}\", :type => Host::TYPE_ROUTER, :address => \"192.168.0.#{rand(1..200)}\", :description => \"Test host description.\", :active => true)\n end\n end", "def initialize(peer, id); @peer, @id = peer, id end", "def aws_internet_gateway_create(opts)\n opts[:vpc].internet_gateway = AWS::EC2.new.internet_gateways.create\n end", "def create_peer_ship\n\t\tif self.replied == true\n\t\t\tuser_id = self.user_id\n\t\t\tuser2_id = self.to\t\t\t\n\t\t\tPeership.create(:user_id => user_id, :user2_id => user2_id) unless Peership.exists?(user_id, user2_id) \t\t\t\n\t\tend\n\t\t#Delete request object unless user did not make a selection \n\t\tPeerRequest.destroy(self.id) unless self.replied == nil \t\t\n\tend", "def nat_gateway_init(name, subnet_name, route_table_name, dest_cidr_block: '0.0.0.0/0', depends_on: [])\n nat_gateway_eip_name = \"#{name}EIP\"\n nat_gateway_eip = allocate_new_eip(nat_gateway_eip_name, depends_on: depends_on)\n nat_gateway_name = name\n nat_gateway_options = {\n Type: 'AWS::EC2::NatGateway'\n }\n nat_gateway_options[:DependsOn] = depends_on unless depends_on.blank?\n resource nat_gateway_name,\n nat_gateway_options.merge(\n Properties: {\n AllocationId: nat_gateway_eip,\n SubnetId: ref(subnet_name)\n })\n nat_route_rule_name = \"#{name}Route\"\n add_route_rule(nat_route_rule_name, route_table_name, nat_gateway_name, dest_cidr_block, depends_on: depends_on)\n\n output nat_gateway_name,\n Description: 'NAT Gateway',\n Value: ref(nat_gateway_name)\n\n nat_gateway_name\n end", "def makePacket(dest_ip, src_ip, type, seqNum, ackNum, data)\n\tpacket = Packet.new\n\n\tpacket.dest_ip = dest_ip\n\tpacket.src_ip = src_ip\n\tpacket.type = type\n\tpacket.seqNum = seqNum\n\tpacket.ackNum = ackNum\n\tpacket.data = data\n\n\treturn packet\nend", "def make_link blocks\n raise \"from block #{@from.block_name} not found\" unless blocks.has_key?(@from.block_name)\n raise \"to block #{@to.block_name} not found\" unless blocks.has_key?(@to.block_name)\n \n from_block = blocks[@from.block_name]\n to_block = blocks[@to.block_name]\n \n raise \"from port #{@from.port_name} not found\" unless from_block.out_ports.has_key?(@from.port_name)\n raise \"to port #{@to.port_name} not found\" unless to_block.in_ports.has_key?(@to.port_name)\n \n from_port = from_block.out_ports[@from.port_name]\n to_port = to_block.in_ports[@to.port_name]\n \n return Link.new(:from => from_port, :to => to_port)\n end", "def peer_from_hash(hash)\n\t\t\ttest_peer = Peer.new({})\n\t\t\tpeer_opts = {}\n\t\t\tpeer_keys.each{|k|\n\t\t\t\t if peer_method_map[k] && test_peer.respond_to?(peer_method_map[k])\n\t\t\t\t\tpeer_opts[peer_method_map[k]] = hash[k]\n\t\t\t\telsif test_peer.respond_to?(k)\n\t\t\t\t\tpeer_opts[k] = hash[k]\n\t\t\t\t# else nil\n\t\t\t\tend\n\t\t\t}\n\t\t\tPeer.new(peer_opts)\n\t\tend", "def handle_new_peer(peer)\n logger.debug \"connected new peer #{peer.addr}.\"\n mutex.synchronize do\n peer.id = allocate_peer_id\n unless peers.find(&:primary?)\n peer.primary = true\n peer.start_block_header_download\n end\n peers << peer\n end\n pending_peers.delete(peer)\n filter_load(peer) if node.wallet\n end", "def create_host_only_network(options)\n end", "def plug_peer\n paddr = get_peername\n peer = (@peers.find_peer(paddr) || @peers.add_peer(paddr) )\n end", "def peer_ip\n peername[0]\n end", "def create_recovery_link(opts = {})\n data, _status_code, _headers = create_recovery_link_with_http_info(opts)\n data\n end", "def segwit_addr\n hash160 = Bitcoin.hash160(pub)\n p2wpkh = [ [\"00\", \"14\", hash160].join ].pack(\"H*\").bth\n segwit_addr = Bech32::SegwitAddr.new\n segwit_addr.hrp = Bitcoin.chain_params.address_version == '00' ? 'bc' : 'tb'\n segwit_addr.script_pubkey = p2wpkh\n segwit_addr.addr\n end", "def peer_hash_defaults(phash)\n\t\t\tdata = phash.dup\n\t\t\tdata[:port] ||= 3333 # @todo Network;:DEFAULT_PORT\n\t\t\tdata[:name] ||= \"SwarmNode_#{data[:uuid]}\"\n\t\t\tdata[:hive_version] ||= hive_version\n\t\t\tdata[:handler] ||= handler_type\n\t\t\tdata[:protocol] ||= protocol_type\n\t\t\tdata[:ssl] ||= 1\n\t\t\tdata[:peers] ||= []\n\t\t\tif data[:peers].is_a?(Array)\n\t\t\t\tdata[:peers] = data[:peers].join(',')\n\t\t\tend\n#\t\t\tdata[:created_at] ||= DateTime.now.to_s\n#\t\t\tdata[:updated_at] ||= DateTime.now.to_s\n\t\t\tdata\n\t\tend", "def zonecreate_peerzone(fabrickey, zonename, **members)\n raise BrocadeAPIClient::UnsupportedVersion unless @peer_zone_support\n\n result = @zones.zonecreate_peerzone(fabrickey, zonename, **members)\n result[1]\n end", "def create(bgp_as, opts = {})\n if opts[:maximum_ecmp_paths] && !opts[:maximum_paths]\n message = 'maximum_paths must be set if maximum_ecmp_paths is set'\n raise ArgumentError, message\n end\n cmds = [\"router bgp #{bgp_as}\"]\n if opts.key?(:enable)\n cmds << (opts[:enable] == true ? 'no shutdown' : 'shutdown')\n end\n cmds << \"router-id #{opts[:router_id]}\" if opts.key?(:router_id)\n if opts.key?(:maximum_paths)\n cmd = \"maximum-paths #{opts[:maximum_paths]}\"\n if opts.key?(:maximum_ecmp_paths)\n cmd << \" ecmp #{opts[:maximum_ecmp_paths]}\"\n end\n cmds << cmd\n end\n configure(cmds)\n end", "def make_host\n unless self.host.host\n self.host.update(:host => true)\n end\n end", "def generate\n blake160_bin = [blake160[2..-1]].pack(\"H*\")\n type = [\"01\"].pack(\"H*\")\n bin_idx = [\"P2PH\".each_char.map { |c| c.ord.to_s(16) }.join].pack(\"H*\")\n payload = type + bin_idx + blake160_bin\n ConvertAddress.encode(@prefix, payload)\n end", "def create\n Feature.bgp_enable if platform == :nexus\n router_bgp\n wait_for_process_initialized\n end", "def create_address(params)\n EasyPost::Address.create(params)\n end", "def create_or_replace_segment_dhcp_static_binding_0_with_http_info(tier_1_id, segment_id, binding_id, dhcp_static_binding_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0\"\n end\n # verify the required parameter 'binding_id' is set\n if @api_client.config.client_side_validation && binding_id.nil?\n fail ArgumentError, \"Missing the required parameter 'binding_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0\"\n end\n # verify the required parameter 'dhcp_static_binding_config' is set\n if @api_client.config.client_side_validation && dhcp_static_binding_config.nil?\n fail ArgumentError, \"Missing the required parameter 'dhcp_static_binding_config' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/dhcp-static-binding-configs/{binding-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'binding-id' + '}', binding_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dhcp_static_binding_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DhcpStaticBindingConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi#create_or_replace_segment_dhcp_static_binding_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize(eth_type: nil, ipv4_destination: nil, ipv4_source: nil,\n ipv6_source: nil, ipv6_destination: nil, ipv6_flabel: nil,\n ipv6_ext_header: nil, ethernet_destination: nil, ethernet_source: nil,\n in_port: nil, in_physical_port: nil, ip_protocol_num: nil, ip_dscp: nil,\n ip_ecn: nil, tcp_source_port: nil, tcp_destination_port: nil,\n udp_source_port: nil, udp_destination_port: nil, icmpv4_type: nil,\n icmpv4_code: nil, icmpv6_type: nil, icmpv6_code: nil,\n arp_op_code: nil, arp_source_ipv4: nil, arp_target_ipv4: nil,\n arp_source_hardware_address: nil, arp_target_hardware_address: nil,\n vlan_id: nil, vlan_pcp: nil, sctp_destination: nil, sctp_source: nil,\n mpls_label: nil, mpls_tc: nil, mpls_bos: nil, tunnel_id: nil,\n metadata: nil, metadata_mask: nil)\n @eth_type = eth_type\n @ipv4_dst = ipv4_destination\n @ipv4_src = ipv4_source\n @ipv6_dst = ipv6_destination\n @ipv6_src = ipv6_source\n @ipv6_flabel = ipv6_flabel\n @ipv6_ext_hdr = ipv6_ext_header\n @ethernet_dst = ethernet_destination\n @ethernet_src = ethernet_source\n @in_port = in_port\n @in_phy_port = in_physical_port\n @ip_proto = ip_protocol_num\n @ip_dscp = ip_dscp\n @ip_ecn = ip_ecn\n @tcp_src_port = tcp_source_port\n @tcp_dst_port = tcp_destination_port\n @udp_dst_port = udp_destination_port\n @udp_src_port = udp_source_port\n @icmpv4_type = icmpv4_type\n @icmpv4_code = icmpv4_code\n @icmpv6_type = icmpv6_type\n @icmpv6_code = icmpv6_code\n @arp_op_code = arp_op_code\n @arp_src_ipv4 = arp_source_ipv4\n @arp_tgt_ipv4 = arp_target_ipv4\n @arp_src_hw_addr = arp_source_hardware_address\n @arp_tgt_hw_addr = arp_target_hardware_address\n @vlan_id = vlan_id\n @vlan_pcp = vlan_pcp\n @sctp_dst = sctp_destination\n @sctp_src = sctp_source\n @mpls_label = mpls_label\n @mpls_tc = mpls_tc\n @mpls_bos = mpls_bos\n @tunnel_id = tunnel_id\n @metdata = metadata\n @metadata_mask = metadata_mask\n end", "def create_address!(options = {})\n method_not_implemented\n end", "def peer\n @peer ||= begin\n addr = @socket.getpeername\n ip_address = Socket.getnameinfo(addr, Socket::NI_NUMERICHOST | Socket::NI_NUMERICSERV).first\n { :ip => ip_address, :port => @port.to_i, :host => @host }\n end\n end", "def show\n @link.clicks.create(ip_address: request.remote_ip)\n redirect_to @link.full_url\n end", "def initsock(params = nil)\n if (params)\n self.peerhost = params.peerhost\n self.peerhostname = params.peerhostname\n self.peerport = params.peerport\n self.localhost = params.localhost\n self.localport = params.localport\n self.context = params.context || {}\n self.ipv = params.v6 ? 6 : 4\n end\n end", "def create\n @participant = Participant.new(participant_params)\n @participant.session_id = session[:session_id]\n @participant.ip_address = request.ip\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to directions_path }\n format.json { render action: 'show', status: :created, location: @participant }\n else\n format.html { render action: 'new' }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_internet_address (contact_id, params)\n update_internet_address(contact_id, 0, params)\n end", "def init(nbr_ipname, nbr_type, ip_ver)\n begin\n ret = esc 'show running-configuration bgp | display-xml'\n bgp = extract(ret, :stdout, 'rpc-reply', :data, :'bgp-router')\n\n raise 'bgp configuration not present.' if !bgp\n\n # Fail if the asn differs at first place\n @property_hash[:asn] = extract(bgp, :vrf, :'local-as-number')\n if @property_hash[:asn] != resource[:asn]\n raise \"asn #{@property_hash[:asn]} differs from #{resource[:asn]}\"\n end\n\n # Fail if there is no neighbor configuration\n nbr = extract_peer(bgp, nbr_ipname, nbr_type)\n raise \"neighbor #{nbr_ipname} not configured.\" if !nbr\n\n @nbr_af = extract(nbr, (ip_ver.to_s + '-unicast').to_sym)\n if !@nbr_af\n # There is no af configuration for the given ip type\n return\n end\n\n @property_hash[:activate] = extract(@nbr_af, :'activate')\n @property_hash[:allowas_in] = extract(@nbr_af, :'allowas-in')\n @property_hash[:add_path] = extract_add_path(@nbr_af)\n\n val = extract(@nbr_af, :'next-hop-self')\n val = :false if !val\n @property_hash[:next_hop_self] = val\n\n val = extract(@nbr_af, :'sender-side-loop-detection')\n val = :true if !val\n @property_hash[:sender_side_loop_detection] = val\n\n val = @nbr_af.has_key? :'soft-reconfiguration-inbound'\n val = :false if !val\n @property_hash[:soft_reconfiguration] = val\n\n val = extract(@nbr_af, :'distribute-list-name-in')\n val = '' if !val\n @property_hash[:distribute_list] = [val]\n\n val = extract(@nbr_af, :'distribute-list-name-out')\n val = '' if !val\n @property_hash[:distribute_list].push(val)\n\n val = extract(@nbr_af, :'route-map-in')\n val = '' if !val\n @property_hash[:route_map] = [val]\n\n val = extract(@nbr_af, :'route-map-out')\n val = '' if !val\n @property_hash[:route_map].push(val)\n\n rescue Exception => e\n err \"Exception in #{__method__}\"\n err e.message\n err e.backtrace[0]\n raise\n end\n end", "def send_create\n msg = {:action => \"create\", :object => \"firewall\", :objectid => self.id, :accountid => self.account_id }.to_yaml\n sendMsg(msg)\n end", "def create_ip_sec_vpn_peer_end_point(ip_sec_vpn_peer_endpoint, opts = {})\n data, _status_code, _headers = create_ip_sec_vpn_peer_end_point_with_http_info(ip_sec_vpn_peer_endpoint, opts)\n data\n end", "def create_or_replace_segment_dhcp_static_binding_with_http_info(tier_1_id, segment_id, binding_id, dhcp_static_binding_config, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding\"\n end\n # verify the required parameter 'binding_id' is set\n if @api_client.config.client_side_validation && binding_id.nil?\n fail ArgumentError, \"Missing the required parameter 'binding_id' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding\"\n end\n # verify the required parameter 'dhcp_static_binding_config' is set\n if @api_client.config.client_side_validation && dhcp_static_binding_config.nil?\n fail ArgumentError, \"Missing the required parameter 'dhcp_static_binding_config' when calling PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi.create_or_replace_segment_dhcp_static_binding\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/dhcp-static-binding-configs/{binding-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'binding-id' + '}', binding_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dhcp_static_binding_config)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DhcpStaticBindingConfig')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingIPManagementDHCPDHCPStaticBindingsSegmentsBindingsFixedApi#create_or_replace_segment_dhcp_static_binding\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize_server(aa, ephemeral = nil)\n validate_ephemeral(aa)\n @aa = aa\n @b = ephemeral || bigrand(32).hex\n end", "def create_dpg(one_vnet, dc, cluster, vi_client)\n begin\n # Get parameters needed to create the network\n pnics = one_vnet['TEMPLATE/PHYDEV']\n pg_name = one_vnet['TEMPLATE/BRIDGE']\n sw_name = one_vnet['TEMPLATE/VCENTER_SWITCH_NAME']\n mtu = one_vnet['TEMPLATE/MTU']\n vlan_id = one_vnet['VLAN_ID'] || 0\n\n if one_vnet['TEMPLATE/VCENTER_SWITCH_NPORTS']\n nports = one_vnet['TEMPLATE/VCENTER_SWITCH_NPORTS']\n else\n nports = 8\n end\n\n dc.lock\n net_folder = dc.network_folder\n net_folder.fetch!\n\n # Get distributed port group if it exists\n dpg = dc.dpg_exists(pg_name, net_folder)\n\n # Disallow changes of switch name for existing pg\n if dpg && dc.pg_changes_sw?(dpg, sw_name)\n err_msg = \"The port group's switch name can not be modified\"\\\n \" for OpenNebula's virtual network.\"\n raise CreateNetworkError, err_msg\n end\n\n if !dpg\n # Get distributed virtual switch if it exists\n dvs = dc.dvs_exists(sw_name, net_folder)\n\n if !dvs\n dvs = dc.create_dvs(sw_name, pnics, mtu)\n end\n # Creates distributed port group\n new_dpg = dc.create_dpg(dvs, pg_name, vlan_id, nports)\n # Attach dpg to esxi hosts\n cluster['host'].each do |host|\n begin\n esx_host = VCenterDriver::ESXHost\n .new_from_ref(host._ref, vi_client)\n esx_host.lock\n if dvs\n pnics_available = nil\n if pnics && !pnics.empty?\n pnics_available = esx_host.get_available_pnics\n end\n esx_host.assign_proxy_switch(dvs,\n sw_name,\n pnics,\n pnics_available)\n end\n rescue StandardError => e\n raise e\n ensure\n esx_host.unlock if esx_host\n end\n end\n else\n err_msg = \"Port group #{pg_name} already exists\"\n raise CreateNetworkError, err_msg\n end\n new_dpg\n ensure\n dc.unlock if dc\n end\nend", "def peer\n \"#{ssl ? 'https://' : 'http://' }#{rhost}:#{rport}\"\n end", "def edgeb_network(cmd)\n node = $node_info.new \n $lock.synchronize{\n \n node.src = $hostname\n node.dst = cmd[1]\n node.cost = 1\n node.nexthop = cmd[1]\n $rt[cmd[1]] = node\n if $local_ip == nil then $local_ip = cmd[2] end\n\n $network.undir_connection($hostname, cmd[1], cmd[3].to_i, 1) \n }\n #puts \"THIS IS THE ROUTING TABLE: #{$rt}\"\nend", "def create_packet\n lock = (@type == :ack ? true : false)\n payload = @pool.get_payload(@hwaddr,lock)\n return :noboot if payload[:netboot] == 'false'\n params = {\n\top: $DHCP_OP_REPLY,\n\txid: @msg.xid,\n\tchaddr: @msg.chaddr,\n\tyiaddr: payload[:ipaddr],\n\tsiaddr: IPAddr.new(payload[:dhcp_server].join('.')).to_i,\n\tfname: payload[:filename],\n\toptions: [\n\t REPLY_TYPES[@type],\n\t ServerIdentifierOption.new({payload: payload[:dhcp_server]}),\n\t DomainNameOption.new({payload: payload[:domainname]}),\n\t DomainNameServerOption.new({payload: payload[:dns_server]}),\n\t IPAddressLeaseTimeOption.new({payload: payload[:lease_time]}),\n\t SubnetMaskOption.new({payload: payload[:subnet_mask]}),\n\t RouterOption.new({payload: payload[:gateway]})\n\t]\n }\n Message.new(params).pack\n end", "def peer_info\n peer_bytes = get_peername[2, 6].unpack(\"nC4\")\n port = peer_bytes.first.to_i\n ip = peer_bytes[1, 4].join(\".\")\n\n [ip, port]\n end", "def init(intface, victimIP)\n\n\t@interface = intface\n\t@victimIP = victimIP\n\t@routerIP = \"192.168.0.100\"\n\t@srcMAC = PacketFu::Utils.whoami?(:iface => @interface)\n\t@victimMAC = PacketFu::Utils.arp(@victimIP, :iface => @interface)\n\t@routerMAC = PacketFu::Utils.arp(@routerIP, :iface => @interface)\n\n\t# Construct the target's packet\n\t@arp_packet_target = PacketFu::ARPPacket.new()\n\t@arp_packet_target.eth_saddr = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_target.eth_daddr = @victimMAC \t\t# target's MAC address\n\t@arp_packet_target.arp_saddr_mac = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_target.arp_daddr_mac = @victimMAC \t\t# target's MAC address\n\t@arp_packet_target.arp_saddr_ip = @routerIP \t\t# router's IP\n\t@arp_packet_target.arp_daddr_ip = @victimIP \t\t# target's IP\n\t@arp_packet_target.arp_opcode = 2 \t# arp code 2 == ARP reply\n\t \n\t# Construct the router's packet\n\t@arp_packet_router = PacketFu::ARPPacket.new()\n\t@arp_packet_router.eth_saddr = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_router.eth_daddr = @routerMAC \t\t# router's MAC address\n\t@arp_packet_router.arp_saddr_mac = @srcMAC[:eth_saddr] \t# sender's MAC address\n\t@arp_packet_router.arp_daddr_mac = @routerMAC \t\t# router's MAC address\n\t@arp_packet_router.arp_saddr_ip = @victimIP \t\t# target's IP\n\t@arp_packet_router.arp_daddr_ip = @routerIP \t\t# router's IP\n\t@arp_packet_router.arp_opcode = 2 \t# arp code 2 == ARP reply\n\n\t# Initialize IP Forwarding\n\t`echo 1 > /proc/sys/net/ipv4/ip_forward`\n\n\t# Append Firewall rules to drop legitimate DNS Responses\n\t`iptables -A FORWARD -p UDP --dport 53 -j DROP`\n\t`iptables -A FORWARD -p TCP --dport 53 -j DROP`\n\nend", "def create_address!\n method_not_implemented\n end", "def initialize(victim_ip, victim_mac, gateway, router_mac, iface = \"em1\")\n \n @ifconfig = PacketFu::Utils.whoami?(:iface => iface) \n @ifname = iface\n @v_packet = PacketFu::ARPPacket.new\n @r_packet = PacketFu::ARPPacket.new\n # Make the victim response packet\n \n #link layer components\n @v_packet.eth_saddr = @ifconfig[:eth_saddr] # attacker MAC address\n @v_packet.eth_daddr = victim_mac # the victim's MAC address\n #arp components\n \n @v_packet.arp_saddr_mac = @ifconfig[:eth_saddr]\n @v_packet.arp_daddr_mac = victim_mac\n @v_packet.arp_saddr_ip = gateway\n @v_packet.arp_daddr_ip = victim_ip\n @v_packet.arp_opcode = 2 \n \n #Make the router response packet\n \n #link layer components\n @r_packet.eth_saddr = @ifconfig[:eth_saddr]\n @r_packet.eth_daddr = router_mac\n #arp components\n @r_packet.arp_saddr_mac = @ifconfig[:eth_saddr]\n @r_packet.arp_daddr_mac = router_mac\n @r_packet.arp_saddr_ip = victim_ip\n @r_packet.arp_daddr_ip = gateway\n @r_packet.arp_opcode = 2\n\n\tend", "def create_or_replace_segment_dhcp_static_binding_0(tier_1_id, segment_id, binding_id, dhcp_static_binding_config, opts = {})\n data, _status_code, _headers = create_or_replace_segment_dhcp_static_binding_0_with_http_info(tier_1_id, segment_id, binding_id, dhcp_static_binding_config, opts)\n data\n end", "def new\n # @gossip = Gossip.new\n\n end", "def relay_request(session)\n peer_session = get_peer_session(session)\n if peer_session\n r = create_b2bua_request(session)\n peer_session.send(r)\n else\n @ilog.warn(\"No peer session found, cannot relay the request\") if @ilog.warn?\n raise \"Unable to relay the request\" \n end\n end", "def create_edge origin, destiny\n return GraphElements::EdgeDefault.new origin, destiny\n end", "def generate\n conf = {\n port: datastore['LPORT'],\n reliable: false\n }\n\n # Generate the more advanced stager if we have the space\n if self.available_space && required_space <= self.available_space\n conf[:exitfunk] = datastore['EXITFUNC']\n conf[:reliable] = true\n end\n\n generate_bind_tcp(conf)\n end", "def new\n @pathway = @team.ae_team_pathways.new\n end", "def create_forwarding_rule(body, opts = {})\n data, _status_code, _headers = create_forwarding_rule_with_http_info(body, opts)\n return data\n end", "def initialize\n if (@handle = ::Dnet.route_open()).address == 0\n raise H_ERR.new(\"unable to open route handle\")\n end\n _handle_opened!\n end", "def abs_adr(ip)\n Verneuil::Address.new(ip, self)\n end", "def peer\r\n \"#{ssl ? 'https://' : 'http://' }#{rhost}:#{rport}\"\r\n end", "def find_or_create_host(opts)\n host = get_host(opts.clone)\n return host unless host.nil?\n\n report_host(opts)\n end" ]
[ "0.7930343", "0.62298757", "0.6094754", "0.587161", "0.5788293", "0.5787778", "0.57824856", "0.5504895", "0.5381322", "0.53558946", "0.5350371", "0.5236187", "0.52263016", "0.5206584", "0.51940227", "0.51940227", "0.5095933", "0.50930303", "0.5076193", "0.5038284", "0.4989422", "0.4969454", "0.49652657", "0.49329472", "0.49329472", "0.4911549", "0.48940846", "0.4890216", "0.48796695", "0.48719335", "0.4861984", "0.4861984", "0.4861578", "0.48566735", "0.48516336", "0.48242375", "0.4768363", "0.47670013", "0.47535756", "0.47517335", "0.47261274", "0.4725803", "0.46935052", "0.46906033", "0.46889704", "0.4684741", "0.4676112", "0.46624678", "0.46602282", "0.46485636", "0.46355638", "0.4624529", "0.4623636", "0.4617772", "0.46157604", "0.4612072", "0.46096876", "0.4587071", "0.45801604", "0.45788512", "0.45724794", "0.45552745", "0.4549525", "0.45481968", "0.4539516", "0.45332247", "0.45197314", "0.44869894", "0.44830742", "0.44763994", "0.44706923", "0.4459537", "0.44585454", "0.44573438", "0.44552442", "0.44524258", "0.44518092", "0.44469133", "0.4436049", "0.4432745", "0.44285727", "0.44275442", "0.4414648", "0.4414259", "0.4411794", "0.4410913", "0.4409415", "0.4408895", "0.4407705", "0.4406037", "0.44029328", "0.4400969", "0.4399102", "0.43987632", "0.437233", "0.43675283", "0.43541798", "0.43516353", "0.43488297", "0.43453845" ]
0.6618446
1
Delete a specified static route BFD peer cofigured on a specified logical router Deletes the specified BFD peer present on specified logical router.
def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {}) delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_static_route(logical_router_id, id, opts = {})\n delete_static_route_with_http_info(logical_router_id, id, opts)\n nil\n end", "def delete_router(router)\n return delete_request(address(\"routers/\" + router), @token)\n end", "def delete(peer)\n @peersByAddr.delete byAddrKey(peer)\n\n list = @peersByInfoHash[peer.infoHash]\n if list\n list.collect! do |p|\n if !p.eql?(peer)\n peer\n else\n nil\n end\n end\n list.compact!\n end\n\n if peer.trackerPeer.id\n list = @peersById[peer.trackerPeer.id]\n if list\n list.collect! do |p|\n if !p.eql?(peer)\n peer\n else\n nil\n end\n end\n list.compact!\n end\n end\n end", "def delete_router_gateway(router)\n data = { 'router' => {'external_gateway_info' => nil}}\n return put_request(address('routers/' + router), data, @token)\n end", "def asr_delete_router(router_id)\n elektron_networking.delete(\"/asr1k/routers/#{router_id}\").body\n end", "def destroy\n router_bgp('no')\n end", "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def delete(route_guid)\n route = @client.route(route_guid)\n route.delete!\n end", "def remove_peer(id)\n @link_table.remove_peer(peer)\n end", "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def delete(name)\n cmd = \"no neighbor #{name}\"\n response = configure_bgp(cmd)\n unless response\n cmd = \"no neighbor #{name} peer-group\"\n response = configure_bgp(cmd)\n end\n response\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def destroy\n @route = Route.find(params[:id]) \n \n if @route.fellow_id\n route = @route\n tmp_route = Route.find(@route.fellow_id)\n user = tmp_route.user\n UserMailer.deleted_route(user, route).deliver\n end\n \n @route.destroy\n \n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def delete_logical_router(logical_router_id, opts = {})\n delete_logical_router_with_http_info(logical_router_id, opts)\n nil\n end", "def delete_l7route(lb_id, config_id, id, headers = {})\n res = delete!(\"loadbalancers/#{lb_id}/configs/#{config_id}/l7routes/#{id}\", {}, headers)\n check_job(res.body[\"job_id\"], headers)\n end", "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def destroy\n @router.destroy\n respond_to do |format|\n format.html { redirect_to admin_routers_url, notice: 'Router was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n unless params[:route_id]\n render status: :bad_request, json: {error: 'route_id must be provided'}\n return\n end\n\n route = Route.where(id: params[:route_id]).first\n unless route.present?\n render status: :bad_request, json: {error: 'No route found with provided route_id'}\n return\n end\n\n unless route.user_id == current_user.id\n render status: :unauthorized, json: {error: 'Routes can only be deleted by the owner'}\n return\n end\n\n route.destroy\n\n render nothing:true\n end", "def delete(destination, nexthop = nil)\n cmd = \"no ip route #{destination}\"\n cmd << \" #{nexthop}\" if nexthop\n configure cmd\n end", "def delete\n config = get\n return true unless config\n configure(\"no router bgp #{config[:bgp_as]}\")\n end", "def delete_logical_router_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesLogicalRoutersApi.delete_logical_router ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesLogicalRoutersApi.delete_logical_router\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cascade_delete_linked_ports'] = opts[:'cascade_delete_linked_ports'] if !opts[:'cascade_delete_linked_ports'].nil?\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesLogicalRoutersApi#delete_logical_router\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_bgp_neighbor(logical_router_id, id, opts = {})\n delete_bgp_neighbor_with_http_info(logical_router_id, id, opts)\n nil\n end", "def delete_route request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_route_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def delete_route request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_route_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def delete_static_route_with_http_info(logical_router_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_static_route ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_static_route\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_static_route\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#delete_static_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_station_in_route\n if @routes.empty?\n routes_void\n else\n request = [\"Enter route name [#{@routes.keys.join(', ')}]: \"]\n route = getting(request, :approve_route_selection, :select_route)\n request = [\"Enter station name [#{all_stations(route)}]: \"]\n station = getting(request, :approve_station_for_route, :select_station)\n station_deleted if route.delete_station(station)\n end\n end", "def delete_route(resource_name)\n desc \"Deletes an existing #{resource_name}\"\n params do\n requires :query_parameter_id, type: String, desc: \"The id of the #{resource_name}\"\n end\n delete ':query_parameter_id' do\n delete_instance(find_instance(params[:query_parameter_id]))\n body false\n end\n end", "def destroy\n @router_firmware.destroy\n respond_to do |format|\n format.html { redirect_to admin_router_firmwares_url, notice: 'Router firmware was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_router_interface(router, id, type)\n data = case type\n when 'port' then { 'port_id' => id }\n when 'subnet' then { 'subnet_id' => id } \n else raise \"Invalid Interface Type\" \n end\n return put_request(address(\"routers/\" + router + \"/remove_router_interface\"), data, @token)\n end", "def delete(actor)\n @links.delete actor.mailbox.address\n end", "def delete(actor)\n @lock.synchronize do\n @links.delete actor\n end\n actor\n end", "def delete(opt)\n raise \"Missing vlan_id\" unless opt[:vlan_id]\n raise \"Missing link\" unless opt[:link]\n link = list(:link=>opt[:link]).find { |l|\n l.linkinfo.data &&\n l.linkinfo.data.id == opt[:vlan_id]\n }\n raise Errno::ENODEV unless link\n @rtsocket.link.delete(link.index)\n end", "def static_delete(nodeId)\n\n raise \"NodeId must not be nil\" if nodeId.nil?\n\n @discovery_urls.each do |discovery_url|\n\n delete_uri = URI.parse(discovery_url).merge(\"/v1/announcement/static/#{nodeId}\")\n\n @logger.debug(\"Delete Request: #{delete_uri.to_s}\")\n\n begin\n response = @client.delete(delete_uri.to_s)\n if response.status >= 200 && response.status <= 299\n return\n end\n\n @logger.error(\"#{delete_uri.to_s}: Response Status #{response.status}\")\n @logger.error(response.body)\n\n rescue\n @logger.error(\"#{delete_uri.to_s}: #{$!}\")\n end\n\n end\n\n raise \"Failed to delete static announcement #{nodeId} on any of [ #{@discovery_urls.join(\",\")} ]\"\n\n end", "def delete(fw_rule)\n Dnet.fw_delete @handle, fw_rule\n end", "def delete(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::DELETE, path, to, as, constraints, &blk)\n end", "def deletePeers(cluster, args={})\n raise(ArgumentError, \"Cluster name cannot be null\") if cluster.nil?\n peers = args[PEERS] if args[PEERS]\n if peers != nil\n raise(ArgumentError, \"Peers should be string array\") unless peers.kind_of?(Array)\n peers = [peers].flatten.compact\n @crosssiteadmin.deletePeers(cluster, peers.to_java(:string))\n else \n @crosssiteadmin.deletePeers(cluster)\t\n end\n end", "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @wireless_router.destroy\n respond_to do |format|\n format.html { redirect_to wireless_routers_url, notice: 'Wireless router was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/routers/#{request_pb.router}\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_delete_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def delete(path, *data, &block)\n map(path, R3::DELETE, *data, &block)\n end", "def destroy\n @road = Road.find(params[:id])\n @road.destroy\n\n respond_to do |format|\n format.html { redirect_to roads_url }\n format.json { head :no_content }\n end\n end", "def remove_sibling_for(peer, id = nil)\n\t if id && remote_siblings[peer] != id\n\t\treturn\n\t end\n\n\t if remote_object = remote_siblings.delete(peer)\n peer.removed_sibling(remote_object)\n\t\tRoby::Distributed.debug { \"removed sibling #{remote_object} for #{self} on #{peer}\" }\n\t\tremote_object\n\t end\n\tend", "def list_static_hop_bfd_peers(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)\n data\n end", "def remove_route(route={})\n request :delete, '/routes', route\n end", "def destroy\n Rails.logger.info('👻 Disraptor: Destroying route.')\n\n if Disraptor::Route.remove(params[:route_id])\n Rails.application.reload_routes!\n\n render json: success_json\n else\n render json: failed_json\n end\n end", "def destroy\n @transport_route = TransportRoute.find(params[:id])\n @transport_route.destroy\n\n respond_to do |format|\n format.html { redirect_to transport_routes_url }\n format.json { head :no_content }\n end\n end", "def delete(path_part, additional_headers = {}, &block)\n api_request { @rest.delete('/REST/' + path_part, \"\", additional_headers, &block) }\n end", "def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to driver_path(@route.driver_id ), notice: 'Route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteVehicle _args\n \"deleteVehicle _args;\" \n end", "def manage_routes_delete_station\n @ui.manage_routes_delete_station_msg(routes, stations)\n route_name = gets.chomp\n route = routes.find { |route_elem| route_elem.name == route_name }\n validate_route_for_delete!\n @ui.manage_routes_delete_station_input_station_msg(route)\n station_name = gets.chomp\n validate_route_deletion!\n manage_routes_delete_station_delete(route_name, station_name)\n rescue RuntimeError => e\n puts e.inspect\n @attempt += 1\n if @attempt < 3\n @ui.wrong_input_msg\n retry\n end\n @attempt = 0\n end", "def delete_virtual_m_f_a_device(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeleteVirtualMFADevice'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :serial_number\n\t\t\targs[:query]['SerialNumber'] = optional[:serial_number]\n\t\tend\n\t\tself.run(args)\n\tend", "def destroy\r\n @route_detail = RouteDetail.find(params[:id])\r\n @route_detail.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_details_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @admin_neighbour.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbours_url, notice: 'Neighbour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end", "def destroy\n\t photos = @route.assets\t\t\t\t\t#delete photos associated with given route\n\t delete_photos(photos)\t\t\t\t\t\t#\n\t event = Event.find_by_route_id(@route.id)\n\t unless event.nil?\n\t @route.update_attributes(:user_id => event.user_id)\t\n\t\tuser = User.find(event.user_id)\n\t\tflash[:success] = \"Route was handed to another user (it is still used in an event): #{user.email}!\"\n\t\tredirect_to current_user\n\t else\n\t\[email protected]\n\t\tflash[:success] = \"Route was deleted!\"\n\t\tredirect_to current_user\n\t end\n\tend", "def delete_route(path, options = nil)\n route = get_route(path, options)\n root.delete(route)\n routes.replace(root.unique_routes)\n build_grapher!\n route\n end", "def rec_delete(zone, zoneid)\n send_req({a: :rec_delete, z: zone, id: zoneid})\n end", "def delete_segment_dhcp_static_binding(tier_1_id, segment_id, binding_id, opts = {})\n delete_segment_dhcp_static_binding_with_http_info(tier_1_id, segment_id, binding_id, opts)\n nil\n end", "def destroy\n\n @plant = Plant.find(params[:id])\n @friendship = @plant.friendships.find_by_friend_id(params[:friend_id])\n\n if @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to request.referrer\n else\n flash[:error] = \"Unable to remove friend\"\n redirect_to request.referrer\n end\n end", "def delete_named_route(name, path, options = nil)\n delete_route(path, options)\n named_routes.delete(name)\n end", "def delete_route(path, options = nil)\n route = get_route(path, options)\n @root.delete(route)\n @routes = @root.unique_routes\n rebuild_grapher!\n route\n end", "def destroy\n @admin_route = Admin::Route.find(params[:id])\n @admin_route.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_routes_url }\n format.json { head :no_content }\n end\n end", "def deleteWaypoint _wp\n SQF.deleteWaypoint _wp\n end", "def destroy\n @bus_route = BusRoute.find(params[:id])\n @bus_route.destroy\n\n respond_to do |format|\n format.html { redirect_to bus_routes_url }\n format.json { head :no_content }\n end\n end", "def delete(dst)\n _check_open!\n re = Entry.new\n if( re.dst.set_string(dst) and ::Dnet.route_get(@handle, re) == 0 )\n return re \n end\n end", "def delete_on_machine(machine, r_path)\n handle_action_exceptions(__method__) do\n do_delete_on_machine(machine, r_path)\n @json ? { 'result' => 'Success' } : true\n end\n end", "def destroy\r\n @route_detail = RouteDetail.find(params[:id])\r\n @route_detail.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_details_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @street_directory = StreetDirectory.find(params[:id])\n\n respond_to do |format|\n if @street_directory.destroy\n format.html { redirect_to street_directories_url,\n notice: (crud_notice('destroyed', @street_directory) + \"#{undo_link(@street_directory)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to street_directories_url, alert: \"#{@street_directory.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @street_directory.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def destroy\n @route.delete\n respond_to do |format|\n format.html { redirect_to routes_url, notice: t(\"routes.deleted\") }\n format.json { head :no_content }\n end\n end", "def delete_named_route(name, path, options = nil)\n delete_route(path, options)\n @named_routes.delete(name)\n end", "def destroy\n @relay_destination.destroy\n respond_to do |format|\n format.html { redirect_to @relay, notice: 'Relay destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def excluir(telefone)\n @client.delete(Route.new([ROTA_BINA, telefone]))\n end", "def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to(subways_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @neighbour.destroy\n respond_to do |format|\n format.html { redirect_to neighbours_url, notice: 'Neighbour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @roadmap = @destination.roadmap \n \n if not validate_permission(@roadmap)\n return\n end\n \n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to(@roadmap) }\n format.xml { head :ok }\n end\n end", "def delete_logical_router_port_with_http_info(logical_router_port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.delete_logical_router_port ...'\n end\n # verify the required parameter 'logical_router_port_id' is set\n if @api_client.config.client_side_validation && logical_router_port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_port_id' when calling ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.delete_logical_router_port\"\n end\n # resource path\n local_var_path = '/logical-router-ports/{logical-router-port-id}'.sub('{' + 'logical-router-port-id' + '}', logical_router_port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cascade_delete_linked_ports'] = opts[:'cascade_delete_linked_ports'] if !opts[:'cascade_delete_linked_ports'].nil?\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi#delete_logical_router_port\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete\n model.delete_attachment(@path)\n end", "def delete_contact(params={})\n @obj.delete('delete-contact', @auth.merge(params))\n end", "def destroy\n @beacon.destroy\n end", "def destroy\n @direction = Direction.find(params[:id])\n @direction.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_directions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def delete(opt)\n ipaddr_modify(RTM_DELADDR, 0, opt)\n end", "def delete(path, options = {}, &block)\n map(path, options, :delete, &block)\n end", "def destroy\n @pneighbour = Pneighbour.find(params[:id])\n @pneighbour.destroy\n\n respond_to do |format|\n format.html { redirect_to(pneighbours_url) }\n format.xml { head :ok }\n end\n end", "def delete_entry(params)\n dd = DBDeleter.new(params)\n dd.delete\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete_route!(name)\n route_added_to_list if @routes.delete(name.to_sym)\n end", "def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end", "def unregister(obj, peer)\n peers(obj).tap {|plist| true while plist.delete(peer) }\n end", "def delete_bgp_neighbor_with_http_info(logical_router_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_bgp_neighbor ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_bgp_neighbor\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_bgp_neighbor\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/bgp/neighbors/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#delete_bgp_neighbor\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete(resource_type_identifier)\n # convert type to type identifier\n raise \"Endpoint is not connected!\" unless @connected\n\n path = path_for_resource_type resource_type_identifier\n\n del path\n end" ]
[ "0.67823887", "0.6534451", "0.6495973", "0.64280313", "0.6255645", "0.5999183", "0.59921753", "0.5791187", "0.5701881", "0.56482565", "0.5554026", "0.5551079", "0.5528091", "0.5514554", "0.5485993", "0.54585177", "0.5414058", "0.5398831", "0.5361642", "0.5350564", "0.53363323", "0.53139496", "0.530868", "0.5303126", "0.5296556", "0.5296556", "0.52901304", "0.52791506", "0.5212509", "0.52028143", "0.5193837", "0.51876634", "0.51553816", "0.5134225", "0.512721", "0.51229894", "0.5110259", "0.5099315", "0.509631", "0.5095443", "0.5092862", "0.509063", "0.50633585", "0.50571454", "0.50473493", "0.5034722", "0.5018813", "0.5005281", "0.5001324", "0.50004673", "0.49970028", "0.49840528", "0.49827784", "0.4962019", "0.49615684", "0.49586505", "0.495215", "0.49453148", "0.49406192", "0.49350214", "0.4933353", "0.49296373", "0.49291122", "0.49273318", "0.4910773", "0.49105912", "0.49087885", "0.49041837", "0.48983765", "0.48937732", "0.48893818", "0.4874828", "0.48704648", "0.48678356", "0.48651597", "0.48647574", "0.48618603", "0.4860898", "0.4860898", "0.48582402", "0.48566896", "0.48561603", "0.48543674", "0.4852518", "0.48505056", "0.48431775", "0.4837743", "0.4837743", "0.4837743", "0.4837743", "0.48365107", "0.48224097", "0.48210397", "0.4819135", "0.48181435", "0.48122203", "0.48110613", "0.4807633", "0.4802885", "0.48025224" ]
0.82927024
0
Delete a specified static route BFD peer cofigured on a specified logical router Deletes the specified BFD peer present on specified logical router.
def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer" end # verify the required parameter 'bfd_peer_id' is set if @api_client.config.client_side_validation && bfd_peer_id.nil? fail ArgumentError, "Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer" end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s) # query parameters query_params = {} query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def delete_static_route(logical_router_id, id, opts = {})\n delete_static_route_with_http_info(logical_router_id, id, opts)\n nil\n end", "def delete_router(router)\n return delete_request(address(\"routers/\" + router), @token)\n end", "def delete(peer)\n @peersByAddr.delete byAddrKey(peer)\n\n list = @peersByInfoHash[peer.infoHash]\n if list\n list.collect! do |p|\n if !p.eql?(peer)\n peer\n else\n nil\n end\n end\n list.compact!\n end\n\n if peer.trackerPeer.id\n list = @peersById[peer.trackerPeer.id]\n if list\n list.collect! do |p|\n if !p.eql?(peer)\n peer\n else\n nil\n end\n end\n list.compact!\n end\n end\n end", "def delete_router_gateway(router)\n data = { 'router' => {'external_gateway_info' => nil}}\n return put_request(address('routers/' + router), data, @token)\n end", "def asr_delete_router(router_id)\n elektron_networking.delete(\"/asr1k/routers/#{router_id}\").body\n end", "def destroy\n router_bgp('no')\n end", "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def delete(route_guid)\n route = @client.route(route_guid)\n route.delete!\n end", "def remove_peer(id)\n @link_table.remove_peer(peer)\n end", "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def delete(name)\n cmd = \"no neighbor #{name}\"\n response = configure_bgp(cmd)\n unless response\n cmd = \"no neighbor #{name} peer-group\"\n response = configure_bgp(cmd)\n end\n response\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def destroy\n @route = Route.find(params[:id]) \n \n if @route.fellow_id\n route = @route\n tmp_route = Route.find(@route.fellow_id)\n user = tmp_route.user\n UserMailer.deleted_route(user, route).deliver\n end\n \n @route.destroy\n \n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def delete_logical_router(logical_router_id, opts = {})\n delete_logical_router_with_http_info(logical_router_id, opts)\n nil\n end", "def delete_l7route(lb_id, config_id, id, headers = {})\n res = delete!(\"loadbalancers/#{lb_id}/configs/#{config_id}/l7routes/#{id}\", {}, headers)\n check_job(res.body[\"job_id\"], headers)\n end", "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def destroy\n @router.destroy\n respond_to do |format|\n format.html { redirect_to admin_routers_url, notice: 'Router was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n unless params[:route_id]\n render status: :bad_request, json: {error: 'route_id must be provided'}\n return\n end\n\n route = Route.where(id: params[:route_id]).first\n unless route.present?\n render status: :bad_request, json: {error: 'No route found with provided route_id'}\n return\n end\n\n unless route.user_id == current_user.id\n render status: :unauthorized, json: {error: 'Routes can only be deleted by the owner'}\n return\n end\n\n route.destroy\n\n render nothing:true\n end", "def delete(destination, nexthop = nil)\n cmd = \"no ip route #{destination}\"\n cmd << \" #{nexthop}\" if nexthop\n configure cmd\n end", "def delete\n config = get\n return true unless config\n configure(\"no router bgp #{config[:bgp_as]}\")\n end", "def delete_logical_router_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesLogicalRoutersApi.delete_logical_router ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesLogicalRoutersApi.delete_logical_router\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cascade_delete_linked_ports'] = opts[:'cascade_delete_linked_ports'] if !opts[:'cascade_delete_linked_ports'].nil?\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesLogicalRoutersApi#delete_logical_router\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_bgp_neighbor(logical_router_id, id, opts = {})\n delete_bgp_neighbor_with_http_info(logical_router_id, id, opts)\n nil\n end", "def delete_route request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_route_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def delete_route request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_route_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def delete_static_route_with_http_info(logical_router_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_static_route ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_static_route\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_static_route\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#delete_static_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_station_in_route\n if @routes.empty?\n routes_void\n else\n request = [\"Enter route name [#{@routes.keys.join(', ')}]: \"]\n route = getting(request, :approve_route_selection, :select_route)\n request = [\"Enter station name [#{all_stations(route)}]: \"]\n station = getting(request, :approve_station_for_route, :select_station)\n station_deleted if route.delete_station(station)\n end\n end", "def delete_route(resource_name)\n desc \"Deletes an existing #{resource_name}\"\n params do\n requires :query_parameter_id, type: String, desc: \"The id of the #{resource_name}\"\n end\n delete ':query_parameter_id' do\n delete_instance(find_instance(params[:query_parameter_id]))\n body false\n end\n end", "def destroy\n @router_firmware.destroy\n respond_to do |format|\n format.html { redirect_to admin_router_firmwares_url, notice: 'Router firmware was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_router_interface(router, id, type)\n data = case type\n when 'port' then { 'port_id' => id }\n when 'subnet' then { 'subnet_id' => id } \n else raise \"Invalid Interface Type\" \n end\n return put_request(address(\"routers/\" + router + \"/remove_router_interface\"), data, @token)\n end", "def delete(actor)\n @links.delete actor.mailbox.address\n end", "def delete(actor)\n @lock.synchronize do\n @links.delete actor\n end\n actor\n end", "def delete(opt)\n raise \"Missing vlan_id\" unless opt[:vlan_id]\n raise \"Missing link\" unless opt[:link]\n link = list(:link=>opt[:link]).find { |l|\n l.linkinfo.data &&\n l.linkinfo.data.id == opt[:vlan_id]\n }\n raise Errno::ENODEV unless link\n @rtsocket.link.delete(link.index)\n end", "def static_delete(nodeId)\n\n raise \"NodeId must not be nil\" if nodeId.nil?\n\n @discovery_urls.each do |discovery_url|\n\n delete_uri = URI.parse(discovery_url).merge(\"/v1/announcement/static/#{nodeId}\")\n\n @logger.debug(\"Delete Request: #{delete_uri.to_s}\")\n\n begin\n response = @client.delete(delete_uri.to_s)\n if response.status >= 200 && response.status <= 299\n return\n end\n\n @logger.error(\"#{delete_uri.to_s}: Response Status #{response.status}\")\n @logger.error(response.body)\n\n rescue\n @logger.error(\"#{delete_uri.to_s}: #{$!}\")\n end\n\n end\n\n raise \"Failed to delete static announcement #{nodeId} on any of [ #{@discovery_urls.join(\",\")} ]\"\n\n end", "def delete(fw_rule)\n Dnet.fw_delete @handle, fw_rule\n end", "def delete(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::DELETE, path, to, as, constraints, &blk)\n end", "def deletePeers(cluster, args={})\n raise(ArgumentError, \"Cluster name cannot be null\") if cluster.nil?\n peers = args[PEERS] if args[PEERS]\n if peers != nil\n raise(ArgumentError, \"Peers should be string array\") unless peers.kind_of?(Array)\n peers = [peers].flatten.compact\n @crosssiteadmin.deletePeers(cluster, peers.to_java(:string))\n else \n @crosssiteadmin.deletePeers(cluster)\t\n end\n end", "def destroy\n @wireless_router.destroy\n respond_to do |format|\n format.html { redirect_to wireless_routers_url, notice: 'Wireless router was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/routers/#{request_pb.router}\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_delete_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def delete(path, *data, &block)\n map(path, R3::DELETE, *data, &block)\n end", "def destroy\n @road = Road.find(params[:id])\n @road.destroy\n\n respond_to do |format|\n format.html { redirect_to roads_url }\n format.json { head :no_content }\n end\n end", "def remove_sibling_for(peer, id = nil)\n\t if id && remote_siblings[peer] != id\n\t\treturn\n\t end\n\n\t if remote_object = remote_siblings.delete(peer)\n peer.removed_sibling(remote_object)\n\t\tRoby::Distributed.debug { \"removed sibling #{remote_object} for #{self} on #{peer}\" }\n\t\tremote_object\n\t end\n\tend", "def list_static_hop_bfd_peers(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)\n data\n end", "def remove_route(route={})\n request :delete, '/routes', route\n end", "def destroy\n Rails.logger.info('👻 Disraptor: Destroying route.')\n\n if Disraptor::Route.remove(params[:route_id])\n Rails.application.reload_routes!\n\n render json: success_json\n else\n render json: failed_json\n end\n end", "def destroy\n @transport_route = TransportRoute.find(params[:id])\n @transport_route.destroy\n\n respond_to do |format|\n format.html { redirect_to transport_routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to driver_path(@route.driver_id ), notice: 'Route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path_part, additional_headers = {}, &block)\n api_request { @rest.delete('/REST/' + path_part, \"\", additional_headers, &block) }\n end", "def deleteVehicle _args\n \"deleteVehicle _args;\" \n end", "def manage_routes_delete_station\n @ui.manage_routes_delete_station_msg(routes, stations)\n route_name = gets.chomp\n route = routes.find { |route_elem| route_elem.name == route_name }\n validate_route_for_delete!\n @ui.manage_routes_delete_station_input_station_msg(route)\n station_name = gets.chomp\n validate_route_deletion!\n manage_routes_delete_station_delete(route_name, station_name)\n rescue RuntimeError => e\n puts e.inspect\n @attempt += 1\n if @attempt < 3\n @ui.wrong_input_msg\n retry\n end\n @attempt = 0\n end", "def delete_virtual_m_f_a_device(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeleteVirtualMFADevice'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :serial_number\n\t\t\targs[:query]['SerialNumber'] = optional[:serial_number]\n\t\tend\n\t\tself.run(args)\n\tend", "def destroy\r\n @route_detail = RouteDetail.find(params[:id])\r\n @route_detail.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_details_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @admin_neighbour.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbours_url, notice: 'Neighbour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end", "def destroy\n\t photos = @route.assets\t\t\t\t\t#delete photos associated with given route\n\t delete_photos(photos)\t\t\t\t\t\t#\n\t event = Event.find_by_route_id(@route.id)\n\t unless event.nil?\n\t @route.update_attributes(:user_id => event.user_id)\t\n\t\tuser = User.find(event.user_id)\n\t\tflash[:success] = \"Route was handed to another user (it is still used in an event): #{user.email}!\"\n\t\tredirect_to current_user\n\t else\n\t\[email protected]\n\t\tflash[:success] = \"Route was deleted!\"\n\t\tredirect_to current_user\n\t end\n\tend", "def delete_route(path, options = nil)\n route = get_route(path, options)\n root.delete(route)\n routes.replace(root.unique_routes)\n build_grapher!\n route\n end", "def rec_delete(zone, zoneid)\n send_req({a: :rec_delete, z: zone, id: zoneid})\n end", "def delete_segment_dhcp_static_binding(tier_1_id, segment_id, binding_id, opts = {})\n delete_segment_dhcp_static_binding_with_http_info(tier_1_id, segment_id, binding_id, opts)\n nil\n end", "def destroy\n\n @plant = Plant.find(params[:id])\n @friendship = @plant.friendships.find_by_friend_id(params[:friend_id])\n\n if @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to request.referrer\n else\n flash[:error] = \"Unable to remove friend\"\n redirect_to request.referrer\n end\n end", "def delete_named_route(name, path, options = nil)\n delete_route(path, options)\n named_routes.delete(name)\n end", "def delete_route(path, options = nil)\n route = get_route(path, options)\n @root.delete(route)\n @routes = @root.unique_routes\n rebuild_grapher!\n route\n end", "def destroy\n @admin_route = Admin::Route.find(params[:id])\n @admin_route.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bus_route = BusRoute.find(params[:id])\n @bus_route.destroy\n\n respond_to do |format|\n format.html { redirect_to bus_routes_url }\n format.json { head :no_content }\n end\n end", "def deleteWaypoint _wp\n SQF.deleteWaypoint _wp\n end", "def delete(dst)\n _check_open!\n re = Entry.new\n if( re.dst.set_string(dst) and ::Dnet.route_get(@handle, re) == 0 )\n return re \n end\n end", "def delete_on_machine(machine, r_path)\n handle_action_exceptions(__method__) do\n do_delete_on_machine(machine, r_path)\n @json ? { 'result' => 'Success' } : true\n end\n end", "def destroy\r\n @route_detail = RouteDetail.find(params[:id])\r\n @route_detail.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_details_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @street_directory = StreetDirectory.find(params[:id])\n\n respond_to do |format|\n if @street_directory.destroy\n format.html { redirect_to street_directories_url,\n notice: (crud_notice('destroyed', @street_directory) + \"#{undo_link(@street_directory)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to street_directories_url, alert: \"#{@street_directory.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @street_directory.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def destroy\n @route.delete\n respond_to do |format|\n format.html { redirect_to routes_url, notice: t(\"routes.deleted\") }\n format.json { head :no_content }\n end\n end", "def delete_named_route(name, path, options = nil)\n delete_route(path, options)\n @named_routes.delete(name)\n end", "def destroy\n @relay_destination.destroy\n respond_to do |format|\n format.html { redirect_to @relay, notice: 'Relay destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def excluir(telefone)\n @client.delete(Route.new([ROTA_BINA, telefone]))\n end", "def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to(subways_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to(routes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @neighbour.destroy\n respond_to do |format|\n format.html { redirect_to neighbours_url, notice: 'Neighbour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @destination = Destination.find(params[:id])\n @roadmap = @destination.roadmap \n \n if not validate_permission(@roadmap)\n return\n end\n \n @destination.destroy\n\n respond_to do |format|\n format.html { redirect_to(@roadmap) }\n format.xml { head :ok }\n end\n end", "def delete_logical_router_port_with_http_info(logical_router_port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.delete_logical_router_port ...'\n end\n # verify the required parameter 'logical_router_port_id' is set\n if @api_client.config.client_side_validation && logical_router_port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_port_id' when calling ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi.delete_logical_router_port\"\n end\n # resource path\n local_var_path = '/logical-router-ports/{logical-router-port-id}'.sub('{' + 'logical-router-port-id' + '}', logical_router_port_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cascade_delete_linked_ports'] = opts[:'cascade_delete_linked_ports'] if !opts[:'cascade_delete_linked_ports'].nil?\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesLogicalRouterPortsApi#delete_logical_router_port\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete\n model.delete_attachment(@path)\n end", "def delete_contact(params={})\n @obj.delete('delete-contact', @auth.merge(params))\n end", "def destroy\n @beacon.destroy\n end", "def destroy\n @direction = Direction.find(params[:id])\n @direction.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_directions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end", "def delete(opt)\n ipaddr_modify(RTM_DELADDR, 0, opt)\n end", "def delete(path, options = {}, &block)\n map(path, options, :delete, &block)\n end", "def destroy\n @pneighbour = Pneighbour.find(params[:id])\n @pneighbour.destroy\n\n respond_to do |format|\n format.html { redirect_to(pneighbours_url) }\n format.xml { head :ok }\n end\n end", "def delete_entry(params)\n dd = DBDeleter.new(params)\n dd.delete\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete_route!(name)\n route_added_to_list if @routes.delete(name.to_sym)\n end", "def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end", "def unregister(obj, peer)\n peers(obj).tap {|plist| true while plist.delete(peer) }\n end", "def delete_bgp_neighbor_with_http_info(logical_router_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_bgp_neighbor ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_bgp_neighbor\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.delete_bgp_neighbor\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/bgp/neighbors/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#delete_bgp_neighbor\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete(resource_type_identifier)\n # convert type to type identifier\n raise \"Endpoint is not connected!\" unless @connected\n\n path = path_for_resource_type resource_type_identifier\n\n del path\n end" ]
[ "0.82927585", "0.6535487", "0.649687", "0.64274323", "0.62566966", "0.6000363", "0.59927255", "0.57916", "0.5702532", "0.5646954", "0.55535996", "0.5549381", "0.5527597", "0.5515386", "0.54870594", "0.54595447", "0.5413791", "0.5399849", "0.53616154", "0.5349558", "0.533597", "0.53139293", "0.53084594", "0.53031796", "0.52960896", "0.52960896", "0.52905583", "0.5281053", "0.5212579", "0.5203723", "0.519369", "0.51874644", "0.515513", "0.51339537", "0.5127494", "0.51233995", "0.5109988", "0.50982153", "0.509602", "0.50956476", "0.50921404", "0.50913423", "0.50643796", "0.50563145", "0.50473803", "0.50353646", "0.5020117", "0.50059545", "0.50010115", "0.50005406", "0.49961594", "0.4985352", "0.49821857", "0.49629924", "0.49625775", "0.49596685", "0.495301", "0.4946148", "0.49394056", "0.49351674", "0.4932722", "0.4929866", "0.4929844", "0.49280825", "0.49120107", "0.49112558", "0.49092844", "0.49041465", "0.48993543", "0.4895147", "0.4888638", "0.4875434", "0.48707888", "0.48677266", "0.48660728", "0.48655418", "0.4862551", "0.4861453", "0.4861453", "0.48591822", "0.48574314", "0.4856237", "0.48544922", "0.48523155", "0.48513684", "0.4842872", "0.4838375", "0.4838375", "0.4838375", "0.4838375", "0.48357645", "0.48223266", "0.48213547", "0.48183808", "0.48178494", "0.48128515", "0.48118126", "0.48070556", "0.48022735", "0.4801602" ]
0.6781829
1
List static routes BFD Peers Returns information about all BFD peers created on specified logical router for static routes.
def list_static_hop_bfd_peers(logical_router_id, opts = {}) data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_static_routes(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_routes_with_http_info(logical_router_id, opts)\n data\n end", "def list_static_hop_bfd_peers_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeerListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#list_static_hop_bfd_peers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def routes_list\n response = RestClient.get(\n BASE_URL,\n params: {command: 'routeList', a: AGENCY}\n )\n\n parse_routes_response(response.body)\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def routes\n @logger.info \"#{__method__}\"\n fill_in \"JourneyPlanner$txtNumberOfPassengers\", with: \"1\"\n country_routes = list_countries.inject([]) do |country_result, country|\n @logger.info \"routes for #{country}\"\n select(country, :from => \"JourneyPlanner_ddlLeavingFromState\")\n sleep 3\n to_from = list_leaving_from.inject([]) do |from_result, from|\n @logger.info \"routes from #{from}\"\n sleep 2\n select(from, :from => \"JourneyPlanner$ddlLeavingFrom\")\n from_result << {from => list_travelling_to}\n from_result\n end\n country_result << {country => to_from}\n country_result\n end\n end", "def listpeers\n id = @utils.id_generate\n send_packet @utils.packet_mangler({\"Identifier\" => id, \"WithMetaData\" => true, \"WithVolatile\" => false},\"ListPeers\")\n wait_for id, /EndListPeers/\n end", "def show_all_routes\n if @routes.empty?\n routes_void\n else\n routes_list\n end\n end", "def routes_list\n Route.all.each.with_index(1) do |(route), index|\n puts \"#{index}. Маршрут: #{route.stations.first.name} - #{route.stations.last.name}\"\n end\n end", "def routers\n @cons.map{|c| c[:router]}.uniq.map{|m| try_resolve m}\n end", "def routes\n { :static => @route_ids, :dynamic => @dynamic }\n end", "def get_routes(params)\n graph_data = create_data(params)\n if graph_data.is_a?(Array)\n graph_data.each do |data|\n add_vertex(data[0][0], data[0][1])\n end\n path_array = shortest_path(params[:source], params[:destination])\n if path_array.is_a?(Array)\n get_path_description(path_array, params)\n else\n path_array\n end\n else\n graph_data\n end\n end", "def index\n @routing_lists = RoutingList.all\n end", "def list_routes request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_routes_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Datastream::V1::ListRoutesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def list_routes request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_routes_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Datastream::V1alpha1::ListRoutesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def show_routes\n seen = []\n unless Merb::Router.named_routes.empty?\n puts \"Named Routes\"\n Merb::Router.named_routes.each do |name,route|\n puts \" #{name}: #{route}\"\n seen << route\n end\n end\n puts \"Anonymous Routes\"\n (Merb::Router.routes - seen).each do |route|\n puts \" #{route}\"\n end\n nil\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def getRoutesFrom(station)\n routeList = @fromNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end", "def _roda_before_30__static_routing\n r = @_request\n r.hash_paths(r.request_method)\n r.hash_paths(:static_routing)\n end", "def index\n @routers = Router.all\n end", "def show_routes\n seen = []\n unless Merb::Router.named_routes.empty?\n puts \"==== Named routes\"\n Merb::Router.named_routes.each do |name,route|\n # something weird happens when you combine sprintf and irb\n puts \"Helper : #{name}\"\n meth = $1.upcase if route.conditions[:method].to_s =~ /(get|post|put|delete)/\n puts \"HTTP method: #{meth || 'GET'}\"\n puts \"Route : #{route}\"\n puts \"Params : #{route.params.inspect}\"\n puts\n seen << route\n end\n end\n puts \"==== Anonymous routes\"\n (Merb::Router.routes - seen).each do |route|\n meth = $1.upcase if route.conditions[:method].to_s =~ /(get|post|put|delete)/\n puts \"HTTP method: #{meth || 'GET'}\"\n puts \"Route : #{route}\"\n puts \"Params : #{route.params.inspect}\"\n puts\n end\n nil\n end", "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def getRoutesTo(station)\n routeList = @toNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end", "def list request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/routers\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n query_string_params[\"maxResults\"] = request_pb.max_results.to_s if request_pb.max_results && request_pb.max_results != 0\n query_string_params[\"orderBy\"] = request_pb.order_by.to_s if request_pb.order_by && request_pb.order_by != \"\"\n query_string_params[\"pageToken\"] = request_pb.page_token.to_s if request_pb.page_token && request_pb.page_token != \"\"\n query_string_params[\"returnPartialSuccess\"] = request_pb.return_partial_success.to_s if request_pb.return_partial_success && request_pb.return_partial_success != false\n\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::RouterList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def get_routes\n raise \"Method not implemented\"\n end", "def list_static_routes_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.list_static_routes ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.list_static_routes\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.list_static_routes, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.list_static_routes, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticRouteListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#list_static_routes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @parcel_routes = ParcelRoute.all\n end", "def get_routes\n\t\trequest = Packet.create_request('stdapi_net_config_get_routes')\n\t\troutes = []\n\n\t\tresponse = client.send_request(request)\n\n\t\t# Build out the array of routes\n\t\tresponse.each(TLV_TYPE_NETWORK_ROUTE) { |route|\n\t\t\troutes << Route.new(\n\t\t\t\t\troute.get_tlv_value(TLV_TYPE_SUBNET),\n\t\t\t\t\troute.get_tlv_value(TLV_TYPE_NETMASK),\n\t\t\t\t\troute.get_tlv_value(TLV_TYPE_GATEWAY))\n\t\t}\n\n\t\treturn routes\n\tend", "def client_routers(client)\n @cons.select{|c| c[:client]==client}.map{|c| try_resolve c[:router]}.uniq\n end", "def all_routes\n matching_routes\n end", "def index\n @routes_title = I18n.t(\"interface.routes.titles.default\")\n @order = params[:order] || 'updated_at'\n @page = params[:page] || '1'\n @asc = params[:asc] || 'desc'\n conditions = params[:user_id] ? {:user_id => params[:user_id].split('-').first} : {}\n\n #FIXME intentar cargar solo los waypoints para el static path\n #FIXME se debería hacer como un has_many a nivel de modelo o en named_scope\n @routes = Route.paginate :include => [:waypoints, :user, :comments, :favoriters],\n :conditions => conditions, :per_page => '10',\n :page => @page,\n :order => @order + \" \" + @asc\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @routes }\n end\n end", "def list_l7routes(lb_id, config_id, headers = {})\n get!(\"loadbalancers/#{lb_id}/configs/#{config_id}/l7routes\", {}, headers)\n end", "def index\n @rec_run_routes = RecRunRoute.all\n end", "def peer_list\n ip_list = []\n raw_peers.each_slice(6) { |e| ip_list << e if e.length == 6 }\n\n ip_list.map! { |e| { :ip => e[0..3].join('.'), :port => (e[4] * 256) + e[5] } }\n end", "def routes\n routes = get('/gtfs/routes')\n routes.map do |route|\n Route.from_json(route)\n end\n end", "def routes\n @routes ||= load_routes\n end", "def index\n @routes = Route.all\n end", "def index\n @routes = Route.all\n end", "def index\n @routes = Route.all\n end", "def index\n @routes = Route.all\n end", "def get_routes\n @agency = params[:name]\n request_url = \"http://services.my511.org/Transit2.0/GetRoutesForAgency.aspx?token=#{@@token}&agencyName=#{@agency}\"\n request_url = request_url.gsub(/ /,\"%20\")\n @routes = search_for_key(parse_request(request_url), \"Route\")\n @routes = [@routes] unless @routes.kind_of?(Array)\n respond_to do |format|\n format.js {}\n end\n end", "def all\n routes = {}\n routable.each do |r|\n routes.merge!(@ruhoh.collection(r).routes)\n end\n routes\n end", "def index\n @select_routes = SelectRoute.all\n end", "def index\n @trip_routes = TripRoute.all\n end", "def index\n @admin_neighbours = Admin::Neighbour.all\n end", "def index\n @check_routes = CheckRoute.all\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::PeeringGroupPeerListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"PeeringGroupPeers.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.peering_group_peers.each do |plumbing_item|\n g.yield Plumbing::convert_peering_group_peer_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def staticresources( params={} )\n staticresources = get_connections(\"staticresources\", params)\n return map_connections staticresources, :to => Facebook::Graph::Generic\n end", "def routes\n app_obj.routes\n end", "def routes(&block); end", "def routes(&block); end", "def routes\n @db[:routes].\n select(:route_id, :route_long_name).\n where(:route_id => routes_for_today).\n order(:route_long_name).\n all\n end", "def show\n @routes = @mountain.routes.order(\"name\")\n end", "def diffable_routes\n self.routes.select { |route| route.gateway_id != \"local\" and route.origin != \"CreateRouteTable\" and !route.destination_prefix_list_id }\n end", "def index\n @ht_routes = HtRoute.all\n end", "def routes\n @route_map.dup\n end", "def routes_normal\n return Array.new\n end", "def routes_hostnames(output, options)\n fail NoRoutesError unless output\n lines = output.split(\"\\n\")[1..-1]\n hostnames = []\n lines.each do |line|\n if options[:all]\n hostnames << line.split[2]\n else\n hostnames << line.split[1]\n end\n end\n fail NoRoutesError if hostnames.empty?\n hostnames\n end", "def router_content\n buf = []\n buf << ROUTER_HEADER\n indent = 1\n new_routes = routes_fix_names(@parser.routes)\n @parser.descriptions.sort.each do |name|\n buf += find_route(indent, name, new_routes, @route_depth)\n end\n buf << ROUTER_FOOTER\n buf.join(\"\\n\")\n end", "def index\n @routes = Route.get_active\n end", "def routes\n @routes || self.class.routes\n end", "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def index\n @static_patterns = StaticPattern.all\n end", "def get_router_interface_attached(sCloudObj, hParams)\n name = hParams[:network, :name]\n PrcLib.state(\"Searching for router port attached to the network '%s'\", name)\n routers = controller_query(:router, {})\n routers.each do |router|\n begin\n router_name = router[:name]\n # Searching for router port attached\n #################\n query = { :network_id => hParams[:network, :id],\n :device_id => router[:id] }\n info = {\n :notfound => \"Network '#{name}' not attached to router \"\\\n \"'#{router_name}'\",\n :checkmatch => 'Found 1 router %s. '\\\n \"Checking exact match for network '%s'.\",\n :nomatch => \"No router %s for network '%s' match\",\n :found => \"Found router %s ID (#{router_name}) %s attached to \"\\\n \"network '#{name}'.\",\n :more => \"Found several router %s. Searching for network '%s'.\",\n :items => [:id]\n }\n interfaces = query_single(sCloudObj, query, name, info)\n return interfaces unless interfaces.length == 0\n rescue => e\n PrcLib.error(\"%s\\n%s\", e.message, e.backtrace.join(\"\\n\"))\n end\n end\n end", "def routes\n Resources::Routes.new(self)\n end", "def mx_static_routes\r\n MXStaticRoutesController.instance\r\n end", "def routes\n ['Agriculture, environmental and animal care', 'Business administration', 'Catering and hospitality' \\\n 'Construction',\n 'Creative and design', 'Digital', 'Engineering and manufacturing', 'Hair and beauty', 'Health and science',\n 'Legal, finance and accounting', 'Protective services', 'Sales, marketing and procurement', 'Transport']\n end", "def find_routes_to(destination_object, options = {})\n if options[:via]\n unless options[:via].kind_of? Array\n options[:via] = [ options[:via] ]\n end\n end\n options[:via] ||= []\n \n counter = 0\n via_object_names = []\n via_object_declarations = options[:via].collect do |active_record_object|\n counter += 1\n via_object_names << \"obj#{counter}\"\n \"(obj#{counter} {#{active_record_object.neo_id}})\"\n end\n \n via_object_declarations_str = via_object_declarations.join(', ')\n via_object_declarations_str += \", \" if via_object_declarations_str.present?\n nodes_to_connect = [\"self\"] + via_object_names + [\"destination_object\"]\n \n # Note: Providing the :direction option if the direction is known,\n # may reduce the query time considerably.\n #\n if options[:direction] == :outgoing\n relation_str = \"-[:is_parent_of*1..100]->\"\n elsif options[:direction] == :incoming\n relation_str = \"<-[:is_parent_of*1..100]-\"\n else\n relation_str = \"-[:is_parent_of*1..100]-\"\n end\n \n find_related_nodes_via_cypher(\"\n match \n #{via_object_declarations_str}\n (destination_object {#{destination_object.neo_id}}),\n paths = (#{nodes_to_connect.join(')' + relation_str + '(')})\n return paths\n order by length(paths)\n \") || []\n end", "def index\n @texi_routes = TexiRoute.all\n end", "def index\n @route_types = RouteType.all\n end", "def router_clients(router)\n lbl = try_resolve router\n @cons.select{|c| try_resolve(c[:router]) == lbl}.map{|c| c[:client]}.uniq\n end", "def all\n @peersByAddr.values\n end", "def read_static_route(logical_router_id, id, opts = {})\n data, _status_code, _headers = read_static_route_with_http_info(logical_router_id, id, opts)\n data\n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def routes\r\n RoutesController.instance\r\n end", "def routes(filter = nil)\n Rails.application.reload_routes!\n formatted = formatted_routes\n if filter\n formatted.select!{ |r| r.match(filter) }\n end\n puts formatted\n end", "def index\n @rcadmin_static_pages = Rcadmin::StaticPage.all\n end", "def list_node_network_routes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.list_node_network_routes ...\"\n end\n # resource path\n local_var_path = \"/node/network/routes\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeRoutePropertiesListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#list_node_network_routes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connectedRoutes(city)\r\n results = @edge.select{ |code, cname| code.include?(city)}\r\n end", "def routes\n raise NotImplementedError\n end", "def filter_by_route\n array = []\n data.entry.arrivalsAndDepartures.each do |bus|\n time = OneBusAway::Utilities.convert_time bus.scheduledDepartureTime\n array << { bus.routeShortName => time }\n end\n array\n end", "def routes\n routes_method.call\n end", "def to_a\n @routes\n end", "def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end", "def list_logical_routers(opts = {})\n data, _status_code, _headers = list_logical_routers_with_http_info(opts)\n data\n end", "def count_routes(n)\n\n\treturn 0\nend", "def routes_map; end", "def list_bgp_neighbors(logical_router_id, opts = {})\n data, _status_code, _headers = list_bgp_neighbors_with_http_info(logical_router_id, opts)\n data\n end", "def index\n @rails_routes = RailsRoute.all\n end", "def get_route\n data = {\n visits: visits,\n fleet: fleet\n }\n\n data[:options] = options if options\n result = Util.send_request(\"POST\", \"vrp\", Routific.token, data)\n RoutificApi::Route.parse(result)\n end", "def get_routes from, to, options = {}\n options[:start_type] = check_point_type(from) || options[:start_type]\n options[:target_type] = check_point_type(to) || options[:target_type]\n # default options\n options = {\n :time => Time.now, \n :depth => 0, \n :include_coords => true, \n :limit => 2,\n :time_relation => :depature,\n :identify_part_prices => :none }.merge(options)\n\n options[:time] = options[:time].in_time_zone(\"Berlin\") #+ 10.minutes # Ansonsten liegt die erste Verbindung in der Vergangenheit\n page = @agent.get @@options[:url_route]\n \n result = submit_form page.forms.first, from, to, options\t\t\n routes = []\n links = result.links_with(:href => /details=opened!/).select { |l| l.to_s.size > 0} # only select connection links, no warning links\n links.reverse! if options[:time_relation] == :arrival # respect :time_relation for route processing\n \n link_threads = Array.new\n links.each_index do |idx|\n link_threads[idx] = Thread.new {\n # maybe we are too fast in requesting :-)\n (1..5).each do |i|\n page = links[idx].click \n break unless page.title.match(/Fehler/)\n # puts \"link.click error: %i\" % i\n sleep(1)\n end\n Thread.current[:route] = Route.new(page, options)\n }\n break if idx == options[:limit]\n end\n\n link_threads.each { |t| t.abort_on_exception = true}\n routes = link_threads.map { |t| t.join; t[:route] }\n\n # Keine Station gefunden also suchen wir nach der nächstbesten Adresse/Station\n if links.count == 0 && options[:depth] == 0\n if options[:start_type] == :address\n from = find_address(from, options)\n options[:start_type] = from.station_type\n from = from.name\n elsif options[:start_type] == :station\n from = find_station(from, options)\n options[:start_type] = from.station_type\n from = from.name\n end\n \n if options[:target_type] == :address\n to = find_address(to, options)\n options[:target_type] = to.station_type\n to = to.name\n elsif options[:target_type] == :station\n to = find_station(to, options)\n options[:target_type] = to.station_type\n to = to.name\n end\n \n return get_routes from, to, options.merge(:depth => options[:depth]+1)\n end\n \n raise \"no_route\" if routes.count == 0 || links.count == 0\t\t\t\n\n # attach price information for each routepart if necessary\n identify_part_prices(routes, options) unless options[:identify_part_prices] == :none\n \n return routes\n end", "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def index\n @router_firmwares = RouterFirmware.all\n end", "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::PeeringGroupListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"PeeringGroups.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.peering_groups.each do |plumbing_item|\n g.yield Plumbing::convert_peering_group_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def l7routes(lb_id, config_id, headers = {})\n list_l7routes(lb_id, config_id, headers).resources.map do |l7route|\n Resources::L7route.new(self, l7route)\n end\n end", "def get_all_route(resource_name, representer)\n list_representer = Class.new(Grape::Roar::Decorator) do\n include ::Roar::JSON\n collection :entries, extend: representer, as: :data\n end\n\n desc \"Returns all #{resource_name}\"\n get do\n present find_instances, with: list_representer\n end\n end" ]
[ "0.6381591", "0.5682232", "0.56553996", "0.5518457", "0.5518457", "0.5495218", "0.547126", "0.5423009", "0.54211867", "0.5328362", "0.532435", "0.52953637", "0.52602637", "0.5161609", "0.5137966", "0.5121958", "0.512092", "0.5114098", "0.51108235", "0.50975984", "0.5093997", "0.5070539", "0.50408274", "0.499079", "0.49871907", "0.49871254", "0.49401358", "0.49315983", "0.49269897", "0.49196514", "0.49186933", "0.49102342", "0.49091277", "0.49027014", "0.48938832", "0.48929384", "0.48787984", "0.48782414", "0.48639616", "0.48639616", "0.48639616", "0.48639616", "0.48628807", "0.4853358", "0.48525563", "0.4813247", "0.48009327", "0.47941765", "0.47931075", "0.47856045", "0.47711456", "0.4769604", "0.4769604", "0.47603518", "0.47474784", "0.47466195", "0.47385925", "0.47342575", "0.47222716", "0.47199222", "0.47127593", "0.4696371", "0.46855894", "0.46828273", "0.46823466", "0.46782303", "0.46467888", "0.46444765", "0.46400675", "0.46324086", "0.4628624", "0.46147123", "0.4610578", "0.45955753", "0.455678", "0.4556395", "0.4556395", "0.45476604", "0.45433187", "0.4539685", "0.4534655", "0.45332462", "0.45299333", "0.45255864", "0.45239678", "0.45096636", "0.45094594", "0.45041037", "0.45033315", "0.44986284", "0.4490381", "0.4488254", "0.44867468", "0.44858336", "0.4484741", "0.4475529", "0.4473962", "0.4473121", "0.4460266", "0.445696" ]
0.72717303
0
List static routes BFD Peers Returns information about all BFD peers created on specified logical router for static routes.
def list_static_hop_bfd_peers_with_http_info(logical_router_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be greater than or equal to 0.' end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s) # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'StaticHopBfdPeerListResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#list_static_hop_bfd_peers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_static_hop_bfd_peers(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)\n data\n end", "def list_static_routes(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_routes_with_http_info(logical_router_id, opts)\n data\n end", "def routes_list\n response = RestClient.get(\n BASE_URL,\n params: {command: 'routeList', a: AGENCY}\n )\n\n parse_routes_response(response.body)\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def routes\n @logger.info \"#{__method__}\"\n fill_in \"JourneyPlanner$txtNumberOfPassengers\", with: \"1\"\n country_routes = list_countries.inject([]) do |country_result, country|\n @logger.info \"routes for #{country}\"\n select(country, :from => \"JourneyPlanner_ddlLeavingFromState\")\n sleep 3\n to_from = list_leaving_from.inject([]) do |from_result, from|\n @logger.info \"routes from #{from}\"\n sleep 2\n select(from, :from => \"JourneyPlanner$ddlLeavingFrom\")\n from_result << {from => list_travelling_to}\n from_result\n end\n country_result << {country => to_from}\n country_result\n end\n end", "def show_all_routes\n if @routes.empty?\n routes_void\n else\n routes_list\n end\n end", "def listpeers\n id = @utils.id_generate\n send_packet @utils.packet_mangler({\"Identifier\" => id, \"WithMetaData\" => true, \"WithVolatile\" => false},\"ListPeers\")\n wait_for id, /EndListPeers/\n end", "def routes_list\n Route.all.each.with_index(1) do |(route), index|\n puts \"#{index}. Маршрут: #{route.stations.first.name} - #{route.stations.last.name}\"\n end\n end", "def routers\n @cons.map{|c| c[:router]}.uniq.map{|m| try_resolve m}\n end", "def routes\n { :static => @route_ids, :dynamic => @dynamic }\n end", "def get_routes(params)\n graph_data = create_data(params)\n if graph_data.is_a?(Array)\n graph_data.each do |data|\n add_vertex(data[0][0], data[0][1])\n end\n path_array = shortest_path(params[:source], params[:destination])\n if path_array.is_a?(Array)\n get_path_description(path_array, params)\n else\n path_array\n end\n else\n graph_data\n end\n end", "def index\n @routing_lists = RoutingList.all\n end", "def list_routes request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_routes_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Datastream::V1::ListRoutesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def show_routes\n seen = []\n unless Merb::Router.named_routes.empty?\n puts \"Named Routes\"\n Merb::Router.named_routes.each do |name,route|\n puts \" #{name}: #{route}\"\n seen << route\n end\n end\n puts \"Anonymous Routes\"\n (Merb::Router.routes - seen).each do |route|\n puts \" #{route}\"\n end\n nil\n end", "def list_routes request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_routes_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Datastream::V1alpha1::ListRoutesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def getRoutesFrom(station)\n routeList = @fromNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end", "def _roda_before_30__static_routing\n r = @_request\n r.hash_paths(r.request_method)\n r.hash_paths(:static_routing)\n end", "def index\n @routers = Router.all\n end", "def show_routes\n seen = []\n unless Merb::Router.named_routes.empty?\n puts \"==== Named routes\"\n Merb::Router.named_routes.each do |name,route|\n # something weird happens when you combine sprintf and irb\n puts \"Helper : #{name}\"\n meth = $1.upcase if route.conditions[:method].to_s =~ /(get|post|put|delete)/\n puts \"HTTP method: #{meth || 'GET'}\"\n puts \"Route : #{route}\"\n puts \"Params : #{route.params.inspect}\"\n puts\n seen << route\n end\n end\n puts \"==== Anonymous routes\"\n (Merb::Router.routes - seen).each do |route|\n meth = $1.upcase if route.conditions[:method].to_s =~ /(get|post|put|delete)/\n puts \"HTTP method: #{meth || 'GET'}\"\n puts \"Route : #{route}\"\n puts \"Params : #{route.params.inspect}\"\n puts\n end\n nil\n end", "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def getRoutesTo(station)\n routeList = @toNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end", "def list request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/routers\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n query_string_params[\"maxResults\"] = request_pb.max_results.to_s if request_pb.max_results && request_pb.max_results != 0\n query_string_params[\"orderBy\"] = request_pb.order_by.to_s if request_pb.order_by && request_pb.order_by != \"\"\n query_string_params[\"pageToken\"] = request_pb.page_token.to_s if request_pb.page_token && request_pb.page_token != \"\"\n query_string_params[\"returnPartialSuccess\"] = request_pb.return_partial_success.to_s if request_pb.return_partial_success && request_pb.return_partial_success != false\n\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::RouterList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def get_routes\n raise \"Method not implemented\"\n end", "def list_static_routes_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.list_static_routes ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.list_static_routes\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.list_static_routes, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.list_static_routes, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticRouteListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#list_static_routes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @parcel_routes = ParcelRoute.all\n end", "def client_routers(client)\n @cons.select{|c| c[:client]==client}.map{|c| try_resolve c[:router]}.uniq\n end", "def get_routes\n\t\trequest = Packet.create_request('stdapi_net_config_get_routes')\n\t\troutes = []\n\n\t\tresponse = client.send_request(request)\n\n\t\t# Build out the array of routes\n\t\tresponse.each(TLV_TYPE_NETWORK_ROUTE) { |route|\n\t\t\troutes << Route.new(\n\t\t\t\t\troute.get_tlv_value(TLV_TYPE_SUBNET),\n\t\t\t\t\troute.get_tlv_value(TLV_TYPE_NETMASK),\n\t\t\t\t\troute.get_tlv_value(TLV_TYPE_GATEWAY))\n\t\t}\n\n\t\treturn routes\n\tend", "def all_routes\n matching_routes\n end", "def index\n @routes_title = I18n.t(\"interface.routes.titles.default\")\n @order = params[:order] || 'updated_at'\n @page = params[:page] || '1'\n @asc = params[:asc] || 'desc'\n conditions = params[:user_id] ? {:user_id => params[:user_id].split('-').first} : {}\n\n #FIXME intentar cargar solo los waypoints para el static path\n #FIXME se debería hacer como un has_many a nivel de modelo o en named_scope\n @routes = Route.paginate :include => [:waypoints, :user, :comments, :favoriters],\n :conditions => conditions, :per_page => '10',\n :page => @page,\n :order => @order + \" \" + @asc\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @routes }\n end\n end", "def list_l7routes(lb_id, config_id, headers = {})\n get!(\"loadbalancers/#{lb_id}/configs/#{config_id}/l7routes\", {}, headers)\n end", "def index\n @rec_run_routes = RecRunRoute.all\n end", "def peer_list\n ip_list = []\n raw_peers.each_slice(6) { |e| ip_list << e if e.length == 6 }\n\n ip_list.map! { |e| { :ip => e[0..3].join('.'), :port => (e[4] * 256) + e[5] } }\n end", "def routes\n @routes ||= load_routes\n end", "def routes\n routes = get('/gtfs/routes')\n routes.map do |route|\n Route.from_json(route)\n end\n end", "def get_routes\n @agency = params[:name]\n request_url = \"http://services.my511.org/Transit2.0/GetRoutesForAgency.aspx?token=#{@@token}&agencyName=#{@agency}\"\n request_url = request_url.gsub(/ /,\"%20\")\n @routes = search_for_key(parse_request(request_url), \"Route\")\n @routes = [@routes] unless @routes.kind_of?(Array)\n respond_to do |format|\n format.js {}\n end\n end", "def index\n @routes = Route.all\n end", "def index\n @routes = Route.all\n end", "def index\n @routes = Route.all\n end", "def index\n @routes = Route.all\n end", "def all\n routes = {}\n routable.each do |r|\n routes.merge!(@ruhoh.collection(r).routes)\n end\n routes\n end", "def index\n @select_routes = SelectRoute.all\n end", "def index\n @trip_routes = TripRoute.all\n end", "def index\n @admin_neighbours = Admin::Neighbour.all\n end", "def index\n @check_routes = CheckRoute.all\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::PeeringGroupPeerListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"PeeringGroupPeers.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.peering_group_peers.each do |plumbing_item|\n g.yield Plumbing::convert_peering_group_peer_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def staticresources( params={} )\n staticresources = get_connections(\"staticresources\", params)\n return map_connections staticresources, :to => Facebook::Graph::Generic\n end", "def routes(&block); end", "def routes(&block); end", "def routes\n app_obj.routes\n end", "def routes\n @db[:routes].\n select(:route_id, :route_long_name).\n where(:route_id => routes_for_today).\n order(:route_long_name).\n all\n end", "def show\n @routes = @mountain.routes.order(\"name\")\n end", "def diffable_routes\n self.routes.select { |route| route.gateway_id != \"local\" and route.origin != \"CreateRouteTable\" and !route.destination_prefix_list_id }\n end", "def index\n @ht_routes = HtRoute.all\n end", "def routes\n @route_map.dup\n end", "def routes_normal\n return Array.new\n end", "def routes_hostnames(output, options)\n fail NoRoutesError unless output\n lines = output.split(\"\\n\")[1..-1]\n hostnames = []\n lines.each do |line|\n if options[:all]\n hostnames << line.split[2]\n else\n hostnames << line.split[1]\n end\n end\n fail NoRoutesError if hostnames.empty?\n hostnames\n end", "def router_content\n buf = []\n buf << ROUTER_HEADER\n indent = 1\n new_routes = routes_fix_names(@parser.routes)\n @parser.descriptions.sort.each do |name|\n buf += find_route(indent, name, new_routes, @route_depth)\n end\n buf << ROUTER_FOOTER\n buf.join(\"\\n\")\n end", "def index\n @routes = Route.get_active\n end", "def routes\n @routes || self.class.routes\n end", "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def index\n @static_patterns = StaticPattern.all\n end", "def get_router_interface_attached(sCloudObj, hParams)\n name = hParams[:network, :name]\n PrcLib.state(\"Searching for router port attached to the network '%s'\", name)\n routers = controller_query(:router, {})\n routers.each do |router|\n begin\n router_name = router[:name]\n # Searching for router port attached\n #################\n query = { :network_id => hParams[:network, :id],\n :device_id => router[:id] }\n info = {\n :notfound => \"Network '#{name}' not attached to router \"\\\n \"'#{router_name}'\",\n :checkmatch => 'Found 1 router %s. '\\\n \"Checking exact match for network '%s'.\",\n :nomatch => \"No router %s for network '%s' match\",\n :found => \"Found router %s ID (#{router_name}) %s attached to \"\\\n \"network '#{name}'.\",\n :more => \"Found several router %s. Searching for network '%s'.\",\n :items => [:id]\n }\n interfaces = query_single(sCloudObj, query, name, info)\n return interfaces unless interfaces.length == 0\n rescue => e\n PrcLib.error(\"%s\\n%s\", e.message, e.backtrace.join(\"\\n\"))\n end\n end\n end", "def routes\n Resources::Routes.new(self)\n end", "def mx_static_routes\r\n MXStaticRoutesController.instance\r\n end", "def routes\n ['Agriculture, environmental and animal care', 'Business administration', 'Catering and hospitality' \\\n 'Construction',\n 'Creative and design', 'Digital', 'Engineering and manufacturing', 'Hair and beauty', 'Health and science',\n 'Legal, finance and accounting', 'Protective services', 'Sales, marketing and procurement', 'Transport']\n end", "def find_routes_to(destination_object, options = {})\n if options[:via]\n unless options[:via].kind_of? Array\n options[:via] = [ options[:via] ]\n end\n end\n options[:via] ||= []\n \n counter = 0\n via_object_names = []\n via_object_declarations = options[:via].collect do |active_record_object|\n counter += 1\n via_object_names << \"obj#{counter}\"\n \"(obj#{counter} {#{active_record_object.neo_id}})\"\n end\n \n via_object_declarations_str = via_object_declarations.join(', ')\n via_object_declarations_str += \", \" if via_object_declarations_str.present?\n nodes_to_connect = [\"self\"] + via_object_names + [\"destination_object\"]\n \n # Note: Providing the :direction option if the direction is known,\n # may reduce the query time considerably.\n #\n if options[:direction] == :outgoing\n relation_str = \"-[:is_parent_of*1..100]->\"\n elsif options[:direction] == :incoming\n relation_str = \"<-[:is_parent_of*1..100]-\"\n else\n relation_str = \"-[:is_parent_of*1..100]-\"\n end\n \n find_related_nodes_via_cypher(\"\n match \n #{via_object_declarations_str}\n (destination_object {#{destination_object.neo_id}}),\n paths = (#{nodes_to_connect.join(')' + relation_str + '(')})\n return paths\n order by length(paths)\n \") || []\n end", "def index\n @texi_routes = TexiRoute.all\n end", "def index\n @route_types = RouteType.all\n end", "def router_clients(router)\n lbl = try_resolve router\n @cons.select{|c| try_resolve(c[:router]) == lbl}.map{|c| c[:client]}.uniq\n end", "def all\n @peersByAddr.values\n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def routes(context={})\n \n routes = [ \n ]\n \n end", "def read_static_route(logical_router_id, id, opts = {})\n data, _status_code, _headers = read_static_route_with_http_info(logical_router_id, id, opts)\n data\n end", "def routes\r\n RoutesController.instance\r\n end", "def routes(filter = nil)\n Rails.application.reload_routes!\n formatted = formatted_routes\n if filter\n formatted.select!{ |r| r.match(filter) }\n end\n puts formatted\n end", "def index\n @rcadmin_static_pages = Rcadmin::StaticPage.all\n end", "def connectedRoutes(city)\r\n results = @edge.select{ |code, cname| code.include?(city)}\r\n end", "def list_node_network_routes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.list_node_network_routes ...\"\n end\n # resource path\n local_var_path = \"/node/network/routes\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeRoutePropertiesListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#list_node_network_routes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def routes\n raise NotImplementedError\n end", "def filter_by_route\n array = []\n data.entry.arrivalsAndDepartures.each do |bus|\n time = OneBusAway::Utilities.convert_time bus.scheduledDepartureTime\n array << { bus.routeShortName => time }\n end\n array\n end", "def routes\n routes_method.call\n end", "def to_a\n @routes\n end", "def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end", "def list_logical_routers(opts = {})\n data, _status_code, _headers = list_logical_routers_with_http_info(opts)\n data\n end", "def count_routes(n)\n\n\treturn 0\nend", "def routes_map; end", "def list_bgp_neighbors(logical_router_id, opts = {})\n data, _status_code, _headers = list_bgp_neighbors_with_http_info(logical_router_id, opts)\n data\n end", "def index\n @rails_routes = RailsRoute.all\n end", "def get_route\n data = {\n visits: visits,\n fleet: fleet\n }\n\n data[:options] = options if options\n result = Util.send_request(\"POST\", \"vrp\", Routific.token, data)\n RoutificApi::Route.parse(result)\n end", "def get_routes from, to, options = {}\n options[:start_type] = check_point_type(from) || options[:start_type]\n options[:target_type] = check_point_type(to) || options[:target_type]\n # default options\n options = {\n :time => Time.now, \n :depth => 0, \n :include_coords => true, \n :limit => 2,\n :time_relation => :depature,\n :identify_part_prices => :none }.merge(options)\n\n options[:time] = options[:time].in_time_zone(\"Berlin\") #+ 10.minutes # Ansonsten liegt die erste Verbindung in der Vergangenheit\n page = @agent.get @@options[:url_route]\n \n result = submit_form page.forms.first, from, to, options\t\t\n routes = []\n links = result.links_with(:href => /details=opened!/).select { |l| l.to_s.size > 0} # only select connection links, no warning links\n links.reverse! if options[:time_relation] == :arrival # respect :time_relation for route processing\n \n link_threads = Array.new\n links.each_index do |idx|\n link_threads[idx] = Thread.new {\n # maybe we are too fast in requesting :-)\n (1..5).each do |i|\n page = links[idx].click \n break unless page.title.match(/Fehler/)\n # puts \"link.click error: %i\" % i\n sleep(1)\n end\n Thread.current[:route] = Route.new(page, options)\n }\n break if idx == options[:limit]\n end\n\n link_threads.each { |t| t.abort_on_exception = true}\n routes = link_threads.map { |t| t.join; t[:route] }\n\n # Keine Station gefunden also suchen wir nach der nächstbesten Adresse/Station\n if links.count == 0 && options[:depth] == 0\n if options[:start_type] == :address\n from = find_address(from, options)\n options[:start_type] = from.station_type\n from = from.name\n elsif options[:start_type] == :station\n from = find_station(from, options)\n options[:start_type] = from.station_type\n from = from.name\n end\n \n if options[:target_type] == :address\n to = find_address(to, options)\n options[:target_type] = to.station_type\n to = to.name\n elsif options[:target_type] == :station\n to = find_station(to, options)\n options[:target_type] = to.station_type\n to = to.name\n end\n \n return get_routes from, to, options.merge(:depth => options[:depth]+1)\n end\n \n raise \"no_route\" if routes.count == 0 || links.count == 0\t\t\t\n\n # attach price information for each routepart if necessary\n identify_part_prices(routes, options) unless options[:identify_part_prices] == :none\n \n return routes\n end", "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def index\n @router_firmwares = RouterFirmware.all\n end", "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::PeeringGroupListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"PeeringGroups.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.peering_groups.each do |plumbing_item|\n g.yield Plumbing::convert_peering_group_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def l7routes(lb_id, config_id, headers = {})\n list_l7routes(lb_id, config_id, headers).resources.map do |l7route|\n Resources::L7route.new(self, l7route)\n end\n end", "def get_all_route(resource_name, representer)\n list_representer = Class.new(Grape::Roar::Decorator) do\n include ::Roar::JSON\n collection :entries, extend: representer, as: :data\n end\n\n desc \"Returns all #{resource_name}\"\n get do\n present find_instances, with: list_representer\n end\n end" ]
[ "0.72717154", "0.63821566", "0.5654464", "0.55182755", "0.55182755", "0.5495078", "0.5472782", "0.5420841", "0.54201937", "0.5327967", "0.5324518", "0.5295144", "0.5260151", "0.5161899", "0.5136402", "0.5120511", "0.51203746", "0.5113525", "0.5110664", "0.5096531", "0.5094369", "0.5071659", "0.5040294", "0.4991293", "0.49865794", "0.49864805", "0.49401033", "0.4932364", "0.4927269", "0.49190882", "0.4918008", "0.49100235", "0.4908749", "0.49024564", "0.48947927", "0.48910153", "0.4878168", "0.48778796", "0.4863691", "0.48634785", "0.48634785", "0.48634785", "0.48634785", "0.4853563", "0.48527068", "0.48139137", "0.4800449", "0.4793978", "0.47913077", "0.47846135", "0.4771132", "0.4771132", "0.4770927", "0.47600228", "0.4747069", "0.47463068", "0.47385207", "0.4734078", "0.47224322", "0.4720244", "0.47135633", "0.4695908", "0.468525", "0.4682728", "0.46817255", "0.467835", "0.46463415", "0.46438256", "0.46412012", "0.46316642", "0.46283758", "0.46141082", "0.46105975", "0.4593668", "0.455782", "0.455782", "0.45575324", "0.45476928", "0.45433992", "0.45384535", "0.45340478", "0.45333585", "0.4530924", "0.45256984", "0.4525422", "0.45088366", "0.45086935", "0.4506009", "0.45043382", "0.4499833", "0.4490333", "0.44882762", "0.44868955", "0.44865388", "0.44854313", "0.44766843", "0.44749737", "0.44717926", "0.4460441", "0.4457369" ]
0.56827587
2
Read a static route BFD peer Read the BFD peer having specified ID.
def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {}) data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_static_route(logical_router_id, id, opts = {})\n data, _status_code, _headers = read_static_route_with_http_info(logical_router_id, id, opts)\n data\n end", "def read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#read_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read(id)\n begin\n find(id).read\n rescue\n nil\n end\n end", "def read(id)\n path(id).binread\n end", "def findById(peerId)\n @peersById[peerId]\n end", "def get_route_by_id(id, opts = {})\n data, _status_code, _headers = get_route_by_id_with_http_info(id, opts)\n return data\n end", "def route_by_id(route_id)\n get \"/gtfs/routes/#{route_id}\"\n end", "def read(id)\n File.read(find(id))\n end", "def read_bgp_neighbor(logical_router_id, id, opts = {})\n data, _status_code, _headers = read_bgp_neighbor_with_http_info(logical_router_id, id, opts)\n data\n end", "def read id, &block\n fn = _data_path(id)\n if block_given?\n File.open(fn, 'r', &block)\n else\n File.read(fn)\n end\n end", "def get_way(id)\n get_object('way', id)\n end", "def read(id)\n perform(:get, \"#{@resource_type}/#{id}\")\n end", "def get_route_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutesApi.get_route_by_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling RoutesApi.get_route_by_id\"\n end\n # resource path\n local_var_path = \"/routes/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['strava_oauth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Route')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutesApi#get_route_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_l7route(lb_id, config_id, id, headers = {})\n get!(\"loadbalancers/#{lb_id}/configs/#{config_id}/l7routes/#{id}\", {}, headers)\n end", "def read_dns_forwader(forwarder_id, opts = {})\n data, _status_code, _headers = read_dns_forwader_with_http_info(forwarder_id, opts)\n data\n end", "def find_passenger(id)\n return find_by_id(@passengers, id)\n end", "def read(id)\n raise(ArgumentError, \"ID parameter is nil\") if id.nil?\n\n sql, vals = sql_select(nil, id_fld => id) \n rows = select sql_subst(sql, *vals.map{|v| quote v}) \n Octothorpe.new(rows.first)\n\n rescue => e\n # select already wrapped any error in a Pod4::DatabaseError, but in this case we want to try\n # to catch something. Ruby 2.0 doesn't define Exception.cause, but if it doesn't, we do in\n # Pod4Error, so. (Side note: TinyTds' error class structure is a bit poor...)\n raise CantContinue, \"Problem reading record. Is '#{id}' really an ID?\" \\\n if e.respond_to?(:cause) \\\n && e.cause.class == TinyTds::Error \\\n && e.cause.message =~ /conversion failed/i\n\n handle_error(e)\n end", "def lookup_address(forwarder_id, opts = {})\n data, _status_code, _headers = lookup_address_with_http_info(forwarder_id, opts)\n data\n end", "def show\n route_id = params.require(:route_id)\n\n route = Disraptor::RouteStore.get_route(route_id)\n\n if route.nil?\n error_message = \"Couldn’t find route for the ID '#{route_id}'.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 404\n end\n\n render json: { 'disraptor/route': route }\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end", "def get_way(id)\n @ways[id.to_i]\n end", "def read_static_route_with_http_info(logical_router_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_static_route ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_static_route\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_static_route\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticRoute')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#read_static_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(id)\n id = id.to_i\n contacts = Contact.all\n contact = nil\n contact = contacts[id-1] unless contacts[id-1].nil?\n end", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def list_static_hop_bfd_peers(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)\n data\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def read_bgp_neighbor_with_http_info(logical_router_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_bgp_neighbor ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_bgp_neighbor\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_bgp_neighbor\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/bgp/neighbors/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BgpNeighbor')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#read_bgp_neighbor\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_field_by_id(id, params = {})\n get(\"/fields/#{id}\", params)\n end", "def show\n @breadcrumb = 'read'\n @reading_route = ReadingRoute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading_route }\n end\n end", "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n @@conn.exec_params('SELECT * FROM contacts WHERE ID = $1::int', [id])\n end", "def get(id)\n client.read(dstu2_model, id)\n end", "def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ladder(id)\r\n BnetApi.make_request(\"/sc2/ladder/#{id}\")\r\n end", "def route\n @route ||= self.route_id ? Route.find_by_id(self.route_id) : nil\n end", "def route\n @route ||= self.route_id ? Route.find_by_id(self.route_id) : nil\n end", "def busca_chamada_recebida(id)\n @client.get(Route.new([ROTA_DID_CHAMADA, id.to_s]))\n end", "def read_node_network_route(route_id, opts = {})\n data, _status_code, _headers = read_node_network_route_with_http_info(route_id, opts)\n return data\n end", "def read_dad_profile_with_http_info(dad_profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_dad_profile ...'\n end\n # verify the required parameter 'dad_profile_id' is set\n if @api_client.config.client_side_validation && dad_profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dad_profile_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_dad_profile\"\n end\n # resource path\n local_var_path = '/ipv6/dad-profiles/{dad-profile-id}'.sub('{' + 'dad-profile-id' + '}', dad_profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DADProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#read_dad_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(id)\n new.from_json(db_root.join(id).read)\n end", "def get_direction(direction_id)\n direction = Direction.find_by_id(direction_id)\n return direction\n end", "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def direct_child_by_id(id, scope = {})\n direct_children_by_id(id, scope).first\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def find_volume_attachment_by_id(id, opts = {})\n data, _status_code, _headers = find_volume_attachment_by_id_with_http_info(id, opts)\n data\n end", "def route_by_stop_id(stop_id)\n get \"/gtfs/routes/stopid/#{stop_id}\"\n end", "def find(id)\n # Find the Contact in the 'contacts.csv' file with the matching id.\n csv_array = CSV.read(CSV_FILE)\n csv_array[id - 1]\n end", "def find(id)\n CSV.foreach(\"contact_data.csv\") do |line|\n if line[0] == id\n return line\n end\n end\n end", "def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(id, params = {}, header = {})\n request = requester.new(:get, \"#{to_url}/#{id}\", {}, params, header)\n build(request.resource)\n end", "def list_static_hop_bfd_peers_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeerListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#list_static_hop_bfd_peers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read(id)\n store.read do |data|\n Record.new(column, id, data[:columns][column][id])\n end\n end", "def read(id)\n # do not respond with anything\n end", "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def get(id)\n record = @dao.read(id)\n record_to_vehicle(record)\n end", "def find(id)\n all.find { |contact| contact.id == id }\n end", "def read_ip_address_block(ip_block_id, opts = {})\n data, _status_code, _headers = read_ip_address_block_with_http_info(ip_block_id, opts)\n data\n end", "def find(id)\n # TODO: Find the Contact in the 'MOCK_DATA.csv' file with the matching id.\n begin\n raise IndexError, \"That ID is out of bounds.\" if in_bounds?(id)\n index = id - 1\n return [@@contacts[index], nil]\n rescue IndexError => ex\n puts \"#{ex.message}\"\n return nil\n end\n\n end", "def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end", "def get(\n id,\n deadline: nil\n )\n req = V1::PeeringGroupPeerGetRequest.new()\n if not @parent.snapshot_time.nil?\n req.meta = V1::GetRequestMetadata.new()\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.get(req, metadata: @parent.get_metadata(\"PeeringGroupPeers.Get\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = PeeringGroupPeerGetResponse.new()\n resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)\n resp.peering_group_peer = Plumbing::convert_peering_group_peer_to_porcelain(plumbing_response.peering_group_peer)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end", "def retrieve(id)\n agent = Client.get(\"#{path}/#{id}\").with_indifferent_access\n new(\n agent[:id],\n agent[:name]\n )\n end", "def read_object(id)\n return nil unless (index_entry = find(id))\n read_from_blobs_file(index_entry)\n end", "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def remove_peer(id)\n @link_table.remove_peer(peer)\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path lambda { \"#{@owner.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get(path, @params)\n end", "def retrieve(id)\n sender = Client.get(\"#{path}/#{id}\")\n initialize_from_hash(sender['user'])\n end", "def get(dst)\n _check_open!\n re = Entry.new\n if( re.dst.set_string(dst) and ::Dnet.route_get(@handle, re) == 0 )\n return re \n end\n end", "def flight(id)\n perform_get(\"/flights/#{id}.xml\")\n end", "def read_dns_forwader_with_http_info(forwarder_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesDnsApi.read_dns_forwader ...'\n end\n # verify the required parameter 'forwarder_id' is set\n if @api_client.config.client_side_validation && forwarder_id.nil?\n fail ArgumentError, \"Missing the required parameter 'forwarder_id' when calling ManagementPlaneApiServicesDnsApi.read_dns_forwader\"\n end\n # resource path\n local_var_path = '/dns/forwarders/{forwarder-id}'.sub('{' + 'forwarder-id' + '}', forwarder_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesDnsApi#read_dns_forwader\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(id=nil)\n record = self.connection.exec_params('SELECT * FROM contacts '\\\n 'WHERE id = $1::int', [id]) if id.is_a?(Integer)\n \n record.nil? || record.num_tuples.zero? ? nil : new(record[0].values[1], record[0].values[2], record[0].values[0])\n end", "def get_relationship_by_id id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id, headers\n end", "def get_contact(id)\n contacts = read_contacts\n contacts.select { |contact| contact[:id] == id }.first\nend", "def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end", "def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end", "def episode_by_id(id)\n episode = $delivery.entry(id, include: 2)\n halt 404 if episode.nil?\n Episode.new(episode)\n end", "def read_node_network_route_with_http_info(route_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.read_node_network_route ...\"\n end\n # verify the required parameter 'route_id' is set\n if @api_client.config.client_side_validation && route_id.nil?\n fail ArgumentError, \"Missing the required parameter 'route_id' when calling NsxComponentAdministrationApi.read_node_network_route\"\n end\n # resource path\n local_var_path = \"/node/network/routes/{route-id}\".sub('{' + 'route-id' + '}', route_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeRouteProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#read_node_network_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get(id)\n request do\n response =\n connection.get id\n\n parse(response.body)\n end\n end", "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n CSV.foreach('contacts.csv') do |contact|\n if contact[0].to_i == id\n match = Contact.new(contact[1],contact[2],contact[0])\n contact.drop(3).each do |number|\n number = number.split(\": \")\n phone = PhoneNumber.new(number[0],number[1])\n match.add_number(phone)\n end\n return match\n end\n end\n nil\n end", "def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end", "def rd_route client, server_type, msg, &block\n end", "def get_by_db4o_id(id)\n obj = database.get_by_id(id.to_i)\n # NOTE: Activate depth should be configurable\n database.connection.activate(obj, 5)\n obj.load_attributes!\n end", "def read_firewall_rule(rule_id, opts = {})\n data, _status_code, _headers = read_firewall_rule_with_http_info(rule_id, opts)\n data\n end", "def show(id)\n print_id.each do |contact|\n if contact[0] == id\n puts contact\n end\n end\n end", "def get(\n id,\n deadline: nil\n )\n return @peering_group_peers.get(\n id,\n deadline: deadline,\n )\n end", "def field_by_id(id = nil)\n @fields.find { |h| h[:id] == id.to_s }\n end", "def read_links(ltype, id)\n return {} if !v[ltype]\n return {} if !v[ltype][id]\n v[ltype][id]\n end", "def read_routing_config(logical_router_id, opts = {})\n data, _status_code, _headers = read_routing_config_with_http_info(logical_router_id, opts)\n data\n end", "def find(id, options = {})\n raise MethodNotAllowed.new(self, :all) unless self.class.permissions && self.class.permissions[:read]\n response_body = @application.http_get(@application.client, \"#{url}/#{CGI.escape(id)}\", options)\n response = parse_response(response_body, options)\n result = response.response_items.first if response.response_items.is_a?(Array)\n result.complete_record_downloaded = true if result\n result\n end", "def show_field(id)\n get(\"fields/#{id}\")\n end", "def find(id)\n end", "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n flag = false\n CSV.foreach('contacts.csv') do |csv|\n if id.to_i == csv[0].to_i\n flag = true\n puts csv\n break\n end\n end\n if flag == false\n puts \"Record not found\"\n end\n end", "def get_closest_node(id, num = 1)\n @link_table.closest_peers(id, num)\n end", "def find id, params = {}, &block\n rel = relation params, &block\n rel.where!(config.document_unique_id_param => id) \n rel.load\n rel\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def dereference(id)\n crate.dereference(id)\n end", "def fetch id=nil\n id ||= self.id\n resp = @nimble.get \"contact/#{id}\"\n self.contact = resp['resources'].first\n return nil unless self.contact\n self\n end", "def show_address(id)\n get(\"addresses/#{id}\")\n end", "def find(id, params = {})\n from_base id, params\n end", "def find(id)\n request(:get, \"/connections/#{id}\")\n end" ]
[ "0.6606323", "0.6104351", "0.5968783", "0.5813354", "0.5699982", "0.5678284", "0.56629646", "0.56325006", "0.5626648", "0.54887843", "0.5481124", "0.53925824", "0.5363777", "0.5340827", "0.52619636", "0.5257866", "0.5216754", "0.521414", "0.5208699", "0.5193338", "0.5193304", "0.51844865", "0.5147744", "0.5124236", "0.51029253", "0.5068849", "0.5061561", "0.5058552", "0.504235", "0.5040129", "0.50239944", "0.49911472", "0.49830922", "0.4963199", "0.4963199", "0.49628636", "0.4953762", "0.4930901", "0.49303028", "0.492927", "0.49291238", "0.49223074", "0.4913754", "0.49135208", "0.49053687", "0.49012786", "0.48890987", "0.48825446", "0.48721498", "0.4865997", "0.48621452", "0.48591524", "0.48580545", "0.48391655", "0.4832157", "0.48309317", "0.4809263", "0.47973433", "0.47953832", "0.47882992", "0.47863844", "0.4775336", "0.47739947", "0.4769037", "0.47534066", "0.47523618", "0.47501498", "0.474658", "0.4745525", "0.47440472", "0.47381917", "0.47322926", "0.47278893", "0.47278893", "0.4724564", "0.4722812", "0.47202834", "0.47184998", "0.47165352", "0.47157645", "0.47084272", "0.47050345", "0.47000134", "0.46967515", "0.46964484", "0.46819112", "0.46817398", "0.4680906", "0.46770123", "0.4669458", "0.46675363", "0.46659598", "0.46555555", "0.4654049", "0.46534365", "0.46502358", "0.46484149", "0.46461385", "0.46451217", "0.46450454" ]
0.69173354
0
Read a static route BFD peer Read the BFD peer having specified ID.
def read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer" end # verify the required parameter 'bfd_peer_id' is set if @api_client.config.client_side_validation && bfd_peer_id.nil? fail ArgumentError, "Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer" end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'StaticHopBfdPeer') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#read_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def read_static_route(logical_router_id, id, opts = {})\n data, _status_code, _headers = read_static_route_with_http_info(logical_router_id, id, opts)\n data\n end", "def read(id)\n begin\n find(id).read\n rescue\n nil\n end\n end", "def read(id)\n path(id).binread\n end", "def findById(peerId)\n @peersById[peerId]\n end", "def get_route_by_id(id, opts = {})\n data, _status_code, _headers = get_route_by_id_with_http_info(id, opts)\n return data\n end", "def route_by_id(route_id)\n get \"/gtfs/routes/#{route_id}\"\n end", "def read(id)\n File.read(find(id))\n end", "def read_bgp_neighbor(logical_router_id, id, opts = {})\n data, _status_code, _headers = read_bgp_neighbor_with_http_info(logical_router_id, id, opts)\n data\n end", "def read id, &block\n fn = _data_path(id)\n if block_given?\n File.open(fn, 'r', &block)\n else\n File.read(fn)\n end\n end", "def get_way(id)\n get_object('way', id)\n end", "def read(id)\n perform(:get, \"#{@resource_type}/#{id}\")\n end", "def get_route_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutesApi.get_route_by_id ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling RoutesApi.get_route_by_id\"\n end\n # resource path\n local_var_path = \"/routes/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['strava_oauth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Route')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutesApi#get_route_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_l7route(lb_id, config_id, id, headers = {})\n get!(\"loadbalancers/#{lb_id}/configs/#{config_id}/l7routes/#{id}\", {}, headers)\n end", "def read_dns_forwader(forwarder_id, opts = {})\n data, _status_code, _headers = read_dns_forwader_with_http_info(forwarder_id, opts)\n data\n end", "def find_passenger(id)\n return find_by_id(@passengers, id)\n end", "def read(id)\n raise(ArgumentError, \"ID parameter is nil\") if id.nil?\n\n sql, vals = sql_select(nil, id_fld => id) \n rows = select sql_subst(sql, *vals.map{|v| quote v}) \n Octothorpe.new(rows.first)\n\n rescue => e\n # select already wrapped any error in a Pod4::DatabaseError, but in this case we want to try\n # to catch something. Ruby 2.0 doesn't define Exception.cause, but if it doesn't, we do in\n # Pod4Error, so. (Side note: TinyTds' error class structure is a bit poor...)\n raise CantContinue, \"Problem reading record. Is '#{id}' really an ID?\" \\\n if e.respond_to?(:cause) \\\n && e.cause.class == TinyTds::Error \\\n && e.cause.message =~ /conversion failed/i\n\n handle_error(e)\n end", "def lookup_address(forwarder_id, opts = {})\n data, _status_code, _headers = lookup_address_with_http_info(forwarder_id, opts)\n data\n end", "def show\n route_id = params.require(:route_id)\n\n route = Disraptor::RouteStore.get_route(route_id)\n\n if route.nil?\n error_message = \"Couldn’t find route for the ID '#{route_id}'.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 404\n end\n\n render json: { 'disraptor/route': route }\n end", "def get_way(id)\n @ways[id.to_i]\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end", "def read_static_route_with_http_info(logical_router_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_static_route ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_static_route\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_static_route\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticRoute')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#read_static_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(id)\n id = id.to_i\n contacts = Contact.all\n contact = nil\n contact = contacts[id-1] unless contacts[id-1].nil?\n end", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def list_static_hop_bfd_peers(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)\n data\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def read_bgp_neighbor_with_http_info(logical_router_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_bgp_neighbor ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_bgp_neighbor\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_bgp_neighbor\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/bgp/neighbors/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BgpNeighbor')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#read_bgp_neighbor\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_field_by_id(id, params = {})\n get(\"/fields/#{id}\", params)\n end", "def show\n @breadcrumb = 'read'\n @reading_route = ReadingRoute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading_route }\n end\n end", "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n @@conn.exec_params('SELECT * FROM contacts WHERE ID = $1::int', [id])\n end", "def get(id)\n client.read(dstu2_model, id)\n end", "def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ladder(id)\r\n BnetApi.make_request(\"/sc2/ladder/#{id}\")\r\n end", "def route\n @route ||= self.route_id ? Route.find_by_id(self.route_id) : nil\n end", "def route\n @route ||= self.route_id ? Route.find_by_id(self.route_id) : nil\n end", "def busca_chamada_recebida(id)\n @client.get(Route.new([ROTA_DID_CHAMADA, id.to_s]))\n end", "def read_node_network_route(route_id, opts = {})\n data, _status_code, _headers = read_node_network_route_with_http_info(route_id, opts)\n return data\n end", "def read_dad_profile_with_http_info(dad_profile_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_dad_profile ...'\n end\n # verify the required parameter 'dad_profile_id' is set\n if @api_client.config.client_side_validation && dad_profile_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dad_profile_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.read_dad_profile\"\n end\n # resource path\n local_var_path = '/ipv6/dad-profiles/{dad-profile-id}'.sub('{' + 'dad-profile-id' + '}', dad_profile_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DADProfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#read_dad_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_direction(direction_id)\n direction = Direction.find_by_id(direction_id)\n return direction\n end", "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(id)\n new.from_json(db_root.join(id).read)\n end", "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def direct_child_by_id(id, scope = {})\n direct_children_by_id(id, scope).first\n end", "def find_volume_attachment_by_id(id, opts = {})\n data, _status_code, _headers = find_volume_attachment_by_id_with_http_info(id, opts)\n data\n end", "def route_by_stop_id(stop_id)\n get \"/gtfs/routes/stopid/#{stop_id}\"\n end", "def find(id)\n # Find the Contact in the 'contacts.csv' file with the matching id.\n csv_array = CSV.read(CSV_FILE)\n csv_array[id - 1]\n end", "def find(id)\n CSV.foreach(\"contact_data.csv\") do |line|\n if line[0] == id\n return line\n end\n end\n end", "def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(id, params = {}, header = {})\n request = requester.new(:get, \"#{to_url}/#{id}\", {}, params, header)\n build(request.resource)\n end", "def list_static_hop_bfd_peers_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeerListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#list_static_hop_bfd_peers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read(id)\n store.read do |data|\n Record.new(column, id, data[:columns][column][id])\n end\n end", "def read(id)\n # do not respond with anything\n end", "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def get(id)\n record = @dao.read(id)\n record_to_vehicle(record)\n end", "def find(id)\n all.find { |contact| contact.id == id }\n end", "def read_ip_address_block(ip_block_id, opts = {})\n data, _status_code, _headers = read_ip_address_block_with_http_info(ip_block_id, opts)\n data\n end", "def find(id)\n # TODO: Find the Contact in the 'MOCK_DATA.csv' file with the matching id.\n begin\n raise IndexError, \"That ID is out of bounds.\" if in_bounds?(id)\n index = id - 1\n return [@@contacts[index], nil]\n rescue IndexError => ex\n puts \"#{ex.message}\"\n return nil\n end\n\n end", "def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end", "def get(\n id,\n deadline: nil\n )\n req = V1::PeeringGroupPeerGetRequest.new()\n if not @parent.snapshot_time.nil?\n req.meta = V1::GetRequestMetadata.new()\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.get(req, metadata: @parent.get_metadata(\"PeeringGroupPeers.Get\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = PeeringGroupPeerGetResponse.new()\n resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)\n resp.peering_group_peer = Plumbing::convert_peering_group_peer_to_porcelain(plumbing_response.peering_group_peer)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end", "def retrieve(id)\n agent = Client.get(\"#{path}/#{id}\").with_indifferent_access\n new(\n agent[:id],\n agent[:name]\n )\n end", "def read_object(id)\n return nil unless (index_entry = find(id))\n read_from_blobs_file(index_entry)\n end", "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def remove_peer(id)\n @link_table.remove_peer(peer)\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path lambda { \"#{@owner.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get(path, @params)\n end", "def retrieve(id)\n sender = Client.get(\"#{path}/#{id}\")\n initialize_from_hash(sender['user'])\n end", "def get(dst)\n _check_open!\n re = Entry.new\n if( re.dst.set_string(dst) and ::Dnet.route_get(@handle, re) == 0 )\n return re \n end\n end", "def flight(id)\n perform_get(\"/flights/#{id}.xml\")\n end", "def read_dns_forwader_with_http_info(forwarder_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesDnsApi.read_dns_forwader ...'\n end\n # verify the required parameter 'forwarder_id' is set\n if @api_client.config.client_side_validation && forwarder_id.nil?\n fail ArgumentError, \"Missing the required parameter 'forwarder_id' when calling ManagementPlaneApiServicesDnsApi.read_dns_forwader\"\n end\n # resource path\n local_var_path = '/dns/forwarders/{forwarder-id}'.sub('{' + 'forwarder-id' + '}', forwarder_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesDnsApi#read_dns_forwader\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(id=nil)\n record = self.connection.exec_params('SELECT * FROM contacts '\\\n 'WHERE id = $1::int', [id]) if id.is_a?(Integer)\n \n record.nil? || record.num_tuples.zero? ? nil : new(record[0].values[1], record[0].values[2], record[0].values[0])\n end", "def get_relationship_by_id id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id, headers\n end", "def get_contact(id)\n contacts = read_contacts\n contacts.select { |contact| contact[:id] == id }.first\nend", "def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end", "def extract_peer(bgp, ip_name, type)\n # rubocop:disable Style/Semicolon\n ret = nil\n if type == :ip\n vrf = extract(bgp, :vrf, :'peer-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:'remote-address'] == ip_name }\n end\n elsif type == :template\n vrf = extract(bgp, :vrf, :'peer-group-config')\n if vrf\n vrf = [vrf] if vrf.class != Array\n\n vrf.each { |v| (ret = v; break) if v[:name] == ip_name }\n end\n else\n # This condition should not be hit.\n raise \"Invalid neighbor type #{type}\"\n end\n ret\n # rubocop:enable Style/Semicolon\n end", "def read_node_network_route_with_http_info(route_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.read_node_network_route ...\"\n end\n # verify the required parameter 'route_id' is set\n if @api_client.config.client_side_validation && route_id.nil?\n fail ArgumentError, \"Missing the required parameter 'route_id' when calling NsxComponentAdministrationApi.read_node_network_route\"\n end\n # resource path\n local_var_path = \"/node/network/routes/{route-id}\".sub('{' + 'route-id' + '}', route_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeRouteProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#read_node_network_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def episode_by_id(id)\n episode = $delivery.entry(id, include: 2)\n halt 404 if episode.nil?\n Episode.new(episode)\n end", "def get(id)\n request do\n response =\n connection.get id\n\n parse(response.body)\n end\n end", "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n CSV.foreach('contacts.csv') do |contact|\n if contact[0].to_i == id\n match = Contact.new(contact[1],contact[2],contact[0])\n contact.drop(3).each do |number|\n number = number.split(\": \")\n phone = PhoneNumber.new(number[0],number[1])\n match.add_number(phone)\n end\n return match\n end\n end\n nil\n end", "def rd_route client, server_type, msg, &block\n end", "def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end", "def get_by_db4o_id(id)\n obj = database.get_by_id(id.to_i)\n # NOTE: Activate depth should be configurable\n database.connection.activate(obj, 5)\n obj.load_attributes!\n end", "def read_firewall_rule(rule_id, opts = {})\n data, _status_code, _headers = read_firewall_rule_with_http_info(rule_id, opts)\n data\n end", "def show(id)\n print_id.each do |contact|\n if contact[0] == id\n puts contact\n end\n end\n end", "def field_by_id(id = nil)\n @fields.find { |h| h[:id] == id.to_s }\n end", "def get(\n id,\n deadline: nil\n )\n return @peering_group_peers.get(\n id,\n deadline: deadline,\n )\n end", "def read_links(ltype, id)\n return {} if !v[ltype]\n return {} if !v[ltype][id]\n v[ltype][id]\n end", "def read_routing_config(logical_router_id, opts = {})\n data, _status_code, _headers = read_routing_config_with_http_info(logical_router_id, opts)\n data\n end", "def find(id, options = {})\n raise MethodNotAllowed.new(self, :all) unless self.class.permissions && self.class.permissions[:read]\n response_body = @application.http_get(@application.client, \"#{url}/#{CGI.escape(id)}\", options)\n response = parse_response(response_body, options)\n result = response.response_items.first if response.response_items.is_a?(Array)\n result.complete_record_downloaded = true if result\n result\n end", "def show_field(id)\n get(\"fields/#{id}\")\n end", "def find(id)\n end", "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n flag = false\n CSV.foreach('contacts.csv') do |csv|\n if id.to_i == csv[0].to_i\n flag = true\n puts csv\n break\n end\n end\n if flag == false\n puts \"Record not found\"\n end\n end", "def get_closest_node(id, num = 1)\n @link_table.closest_peers(id, num)\n end", "def find id, params = {}, &block\n rel = relation params, &block\n rel.where!(config.document_unique_id_param => id) \n rel.load\n rel\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def dereference(id)\n crate.dereference(id)\n end", "def fetch id=nil\n id ||= self.id\n resp = @nimble.get \"contact/#{id}\"\n self.contact = resp['resources'].first\n return nil unless self.contact\n self\n end", "def show_address(id)\n get(\"addresses/#{id}\")\n end", "def find(id, params = {})\n from_base id, params\n end", "def find(id)\n request(:get, \"/connections/#{id}\")\n end" ]
[ "0.6917232", "0.6608929", "0.59693867", "0.5812565", "0.5699138", "0.56788343", "0.56645817", "0.56325674", "0.56258357", "0.5488818", "0.54817367", "0.5394265", "0.5364146", "0.5341863", "0.52623606", "0.52566415", "0.52169806", "0.52130526", "0.52111435", "0.5193842", "0.5193377", "0.51863444", "0.5148012", "0.5124399", "0.5103184", "0.50690365", "0.506072", "0.5059484", "0.5044098", "0.50396454", "0.50243646", "0.4990386", "0.49823463", "0.4964815", "0.4964815", "0.49628392", "0.49554548", "0.49305367", "0.4930142", "0.49297717", "0.4928822", "0.4922397", "0.49141383", "0.49123794", "0.49046567", "0.49021512", "0.48892924", "0.4882862", "0.4871651", "0.48660436", "0.4862252", "0.48589283", "0.48581466", "0.48391402", "0.4832918", "0.48306787", "0.48093566", "0.47977784", "0.47963896", "0.4787335", "0.4786669", "0.47755942", "0.4773949", "0.47675648", "0.47531357", "0.47521088", "0.4751651", "0.47468343", "0.4745882", "0.47434705", "0.47382", "0.47338143", "0.4728281", "0.4728281", "0.47241673", "0.47237697", "0.47208962", "0.47185153", "0.4718044", "0.47162288", "0.47080183", "0.4706079", "0.46993017", "0.46965382", "0.46961412", "0.46831903", "0.46825022", "0.46814725", "0.46779758", "0.46692497", "0.46673203", "0.46656725", "0.4655052", "0.46539918", "0.46532315", "0.46495363", "0.46489644", "0.4645734", "0.46446627", "0.46445745" ]
0.6103767
2
Update a static route BFD peer Modifies the static route BFD peer. Modifiable parameters includes peer IP, enable flag and configuration of the BFD peer.
def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {}) data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_static_route(logical_router_id, id, static_route, opts = {})\n data, _status_code, _headers = update_static_route_with_http_info(logical_router_id, id, static_route, opts)\n data\n end", "def update\n Rails.logger.info('👻 Disraptor: Updating route.')\n\n route_id = params.require(:route_id)\n payload = params.require('disraptor/route')\n source_path = normalize_path(payload['sourcePath'])\n target_url = normalize_uri(payload['targetUrl'])\n request_method = normalize_request_method(payload['requestMethod'])\n\n if !@@allowed_methods.include?(request_method)\n error_message = \"Route request method was #{request_method} but expected one of these: #{@@allowed_methods.join(', ')}.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n if source_path != '/' and source_path.end_with?('/')\n error_message = \"Route source path was #{source_path} but it must not end in a slash.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n route = Disraptor::Route.edit(route_id, source_path, target_url, request_method)\n\n Rails.application.reload_routes!\n\n render json: { 'disraptor/route': route }\n end", "def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @destination_ip_address_packed = args[:destination_ip_address_packed] if args.key?(:destination_ip_address_packed)\n @destination_port = args[:destination_port] if args.key?(:destination_port)\n @source_ip_address_packed = args[:source_ip_address_packed] if args.key?(:source_ip_address_packed)\n @source_port = args[:source_port] if args.key?(:source_port)\n end", "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def update!(**args)\n @display_preference = args[:display_preference] if args.key?(:display_preference)\n @metadata = args[:metadata] if args.key?(:metadata)\n @route = args[:route] if args.key?(:route)\n @route_direction = args[:route_direction] if args.key?(:route_direction)\n end", "def update_static_route_with_http_info(logical_router_id, id, static_route, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.update_static_route ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.update_static_route\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.update_static_route\"\n end\n # verify the required parameter 'static_route' is set\n if @api_client.config.client_side_validation && static_route.nil?\n fail ArgumentError, \"Missing the required parameter 'static_route' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.update_static_route\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_route)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticRoute')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#update_static_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @allow_non_street_level_address = args[:allow_non_street_level_address] if args.key?(:allow_non_street_level_address)\n @departure_hour_local = args[:departure_hour_local] if args.key?(:departure_hour_local)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @road_traffic = args[:road_traffic] if args.key?(:road_traffic)\n @start_location = args[:start_location] if args.key?(:start_location)\n @travel_time = args[:travel_time] if args.key?(:travel_time)\n end", "def update!(**args)\n @allow_non_street_level_address = args[:allow_non_street_level_address] if args.key?(:allow_non_street_level_address)\n @departure_hour_local = args[:departure_hour_local] if args.key?(:departure_hour_local)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @road_traffic = args[:road_traffic] if args.key?(:road_traffic)\n @start_location = args[:start_location] if args.key?(:start_location)\n @travel_time = args[:travel_time] if args.key?(:travel_time)\n end", "def update!(**args)\n @supported_routes = args[:supported_routes] if args.key?(:supported_routes)\n end", "def update!(**args)\n @road_info = args[:road_info] if args.key?(:road_info)\n end", "def update!(**args)\n @road_info = args[:road_info] if args.key?(:road_info)\n end", "def update!(**args)\n @continue = args[:continue] if args.key?(:continue)\n @resource_version = args[:resource_version] if args.key?(:resource_version)\n @self_link = args[:self_link] if args.key?(:self_link)\n end", "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def update!(**args)\n @neighbor_distance = args[:neighbor_distance] if args.key?(:neighbor_distance)\n @neighbor_id = args[:neighbor_id] if args.key?(:neighbor_id)\n end", "def update request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/routers/#{request_pb.router}\"\n body = request_pb.router_resource.to_json\n\n response = @client_stub.make_put_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def update\n begin\n @check_route.update(check_route_params)\n #TODO dedup\n @check_route.assets<< Asset.find(params[:asset_id]) if (!params[:asset_id].nil?)\n render template: 'check_routes/show', status: :ok\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, status: :internal_server_error\n end\n end", "def update\n @static_link = StaticLink.find(params[:id])\n\n respond_to do |format|\n if @static_link.update_attributes(params[:static_link])\n format.html { redirect_to(static_links_path, :notice => 'Static link was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @static_link.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to driver_path(@driver.id), notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n admin_only\n respond_to do |format|\n if @static.update(static_params)\n format.html { redirect_to @static, notice: 'Static was successfully updated.' }\n format.json { render :show, status: :ok, location: @static }\n else\n format.html { render :edit }\n format.json { render json: @static.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @app_engine_routing_override = args[:app_engine_routing_override] if args.key?(:app_engine_routing_override)\n end", "def update!(**args)\n @destination_ip = args[:destination_ip] if args.key?(:destination_ip)\n @destination_network_uri = args[:destination_network_uri] if args.key?(:destination_network_uri)\n @destination_port = args[:destination_port] if args.key?(:destination_port)\n @protocol = args[:protocol] if args.key?(:protocol)\n @source_agent_uri = args[:source_agent_uri] if args.key?(:source_agent_uri)\n @source_ip = args[:source_ip] if args.key?(:source_ip)\n @source_network_uri = args[:source_network_uri] if args.key?(:source_network_uri)\n @source_port = args[:source_port] if args.key?(:source_port)\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n end", "def update!(**args)\n @match_grpc_address = args[:match_grpc_address] if args.key?(:match_grpc_address)\n @service_attachment = args[:service_attachment] if args.key?(:service_attachment)\n end", "def update\n @route.update(route_params)\n render :show\n end", "def update\n @route = Route.find(params[:id])\n @tmp = @route.dup\n \n respond_to do |format|\n if @route.update_attributes(params[:route])\n \n if @tmp.fellow_id\n route = @tmp\n tmp_route = Route.find(@tmp.fellow_id)\n user = tmp_route.user\n UserMailer.deleted_route(user, route).deliver\n end\n \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @http_route = args[:http_route] if args.key?(:http_route)\n @route_update_wait_time = args[:route_update_wait_time] if args.key?(:route_update_wait_time)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @manual_lb_config = args[:manual_lb_config] if args.key?(:manual_lb_config)\n @port_config = args[:port_config] if args.key?(:port_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def update!(**args)\n @abort_cause = args[:abort_cause] if args.key?(:abort_cause)\n @destination_egress_location = args[:destination_egress_location] if args.key?(:destination_egress_location)\n @endpoint_info = args[:endpoint_info] if args.key?(:endpoint_info)\n @error = args[:error] if args.key?(:error)\n @probing_latency = args[:probing_latency] if args.key?(:probing_latency)\n @result = args[:result] if args.key?(:result)\n @sent_probe_count = args[:sent_probe_count] if args.key?(:sent_probe_count)\n @successful_probe_count = args[:successful_probe_count] if args.key?(:successful_probe_count)\n @verify_time = args[:verify_time] if args.key?(:verify_time)\n end", "def update!(**args)\n @bgp_lb_config = args[:bgp_lb_config] if args.key?(:bgp_lb_config)\n @manual_lb_config = args[:manual_lb_config] if args.key?(:manual_lb_config)\n @metal_lb_config = args[:metal_lb_config] if args.key?(:metal_lb_config)\n @port_config = args[:port_config] if args.key?(:port_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to admin_route_url(@route), notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_route_url(@route) }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n @port = args[:port] if args.key?(:port)\n end", "def update\n respond_to do |format|\n if @static.update(static_params)\n format.html { redirect_to @static, notice: 'Static was successfully updated.' }\n format.json { render :show, status: :ok, location: @static }\n else\n format.html { render :edit }\n format.json { render json: @static.errors, status: :unprocessable_entity }\n end\n end\n end", "def read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#read_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @enable_private_endpoint = args[:enable_private_endpoint] if args.key?(:enable_private_endpoint)\n @master_ipv4_cidr_block = args[:master_ipv4_cidr_block] if args.key?(:master_ipv4_cidr_block)\n @master_ipv4_reserved_range = args[:master_ipv4_reserved_range] if args.key?(:master_ipv4_reserved_range)\n end", "def set_routes(my_port, name, node_type, keys)\r\n # Give Access To This Node's Name\r\n get \"/peer_name\" do\r\n return name\r\n end\r\n # Give Access To This Node's Type (Client/Miner)\r\n get \"/peer_type\" do\r\n return node_type.to_s\r\n end\r\n # Give Access To This Node's Public Key For Validation & Handshake\r\n get \"/peer_key_public\" do\r\n return \"#{keys[0]},#{keys[2]}\"\r\n end\r\n # Give Access To This Node's Discovered Peers\r\n get \"/peer_peers\" do\r\n peer_ports = \"\"\r\n $peers.length.times do |i|\r\n peer_ports += \",\" if (i != 0)\r\n peer_ports += $peers[i].port.to_s\r\n end\r\n return peer_ports\r\n end\r\n # Another Peer Requests Handshake\r\n post \"/peer_handshake\" do\r\n port = params[\"port\"].chomp.to_i\r\n signature = params[\"signature\"].chomp.to_i\r\n timestamp = params[\"timestamp\"].chomp.to_i\r\n # Handshake Only With Undiscovered Peers\r\n if (search_peers_by_port(port) == -1)\r\n key_public = Faraday.get(\"#{URL}:#{port}/peer_key_public\").body\r\n key_public = key_public.split(\",\") # Convert String To Array\r\n # Validate Node's Authenticity Using RSA Decryption\r\n if (validate_signature(key_public, signature, timestamp))\r\n add_peer(port)\r\n handshake_peer(my_port, port, [keys[1], keys[2]])\r\n end\r\n end\r\n end\r\n # Request To Mine A Block\r\n post \"/mine_block\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = my_port.to_s\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n mine(amount, payer, payee, miner, timestamp, signature, prev_hash)\r\n else\r\n puts \"Denied mining request from rogue node\".red\r\n $status = \"Denied mining request from rogue node\"\r\n end\r\n end\r\n # Recieve A Mined Block\r\n post \"/block_mined\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = params[\"miner\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n # Add Block If Not Already Mined\r\n block_exists = check_if_block_exists(miner.to_i, timestamp.chomp.to_i)\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, true) if (!block_exists)\r\n end\r\n # Peer Sent A Mined Block\r\n post \"/broadcast_block\" do\r\n amount = params[\"amount\"].to_f\r\n signature = params[\"signature\"].to_s\r\n timestamp = params[\"timestamp\"].to_i\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n hash = params[\"hash\"].to_s\r\n payer = params[\"payer\"].to_i\r\n payee = params[\"payee\"].to_i\r\n miner = params[\"miner\"].to_i\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (prev_hash == \"0000000000000000000000000000000000000000000000000000000000000000\" && $blockchain.length > 0)\r\n # Genesis Node is being shared with everyone, this node does not require as it already has a chain. Ignore.\r\n else\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n is_valid = validate_block(amount, signature, timestamp, prev_hash, nonce, hash, payer, payee, miner)\r\n if (is_valid)\r\n puts \"VALIDATED OK\".green\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, false)\r\n end\r\n else\r\n puts \"Denied block broadcast from rogue node\".red\r\n $status = \"Denied block broadcast from rogue node\"\r\n end\r\n end\r\n end\r\n # Broadcast First Block (Genesis Block) To Peers\r\n post \"/genesis\" do\r\n broadcast_block($blockchain[0])\r\n end\r\nend", "def update!(**args)\n @direct_target_link = args[:direct_target_link] if args.key?(:direct_target_link)\n @indirect_target_link = args[:indirect_target_link] if args.key?(:indirect_target_link)\n end", "def update\n respond_to do |format|\n if @admin_neighbour.update(admin_neighbour_params)\n format.html { redirect_to @admin_neighbour, notice: 'Neighbour was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_neighbour }\n else\n format.html { render :edit }\n format.json { render json: @admin_neighbour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @advertised_id = args[:advertised_id] if args.key?(:advertised_id)\n @beacon_name = args[:beacon_name] if args.key?(:beacon_name)\n @attachments = args[:attachments] if args.key?(:attachments)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @routes = args[:routes] if args.key?(:routes)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n # UserMailer.welcome_email(@user).deliver\n format.html { redirect_to(@route, :notice => 'Route was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @control_plane_ip_block = args[:control_plane_ip_block] if args.key?(:control_plane_ip_block)\n end", "def update!(**args)\n @control_plane_ip_block = args[:control_plane_ip_block] if args.key?(:control_plane_ip_block)\n end", "def add_peer(peer)\n @link_table.store_peer(peer)\n end", "def addPeer(options, peerId, clusterKey, tableCfs=nil, endpointClass=nil, isTemporary=\"false\")\n unless peerId !~ /\\D/\n raise 'peerId should be Integer ID for peer cluster'\n end\n replAdm = ReplicationAdmin.new(getConfiguration())\n replPeerConfig = ReplicationPeerConfig.new()\n replPeerConfig.setClusterKey(clusterKey)\n printf \"Ading Peer Id %s with ClusterKey %s\\n\", peerId, clusterKey\n #replPeerConfig.getConfiguration().put(\"IS_TEMPORARY\", cluster.isTemporary)\n if endpointClass\n replPeerConfig.setReplicationEndpointImpl(endpointClass)\n peerId.gsub!(\"-\", \"*\") # odr TenantReplicationEndpoint expects hyphens to be escaped to astericks\n end\n replPeerConfig.getConfiguration().put(\"IS_TEMPORARY\", isTemporary)\n\n replAdm.addPeer(peerId, replPeerConfig, tableCfs)\nend", "def update\n @admin_route = Admin::Route.find(params[:id])\n\n respond_to do |format|\n if @admin_route.update_attributes(admin_route_params)\n format.html { redirect_to @admin_route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pneighbour = Pneighbour.find(params[:id])\n\n respond_to do |format|\n if @pneighbour.update_attributes(params[:pneighbour])\n format.html { redirect_to(@pneighbour, :notice => 'Pneighbour was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pneighbour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @neighbour.update(neighbour_params)\n format.html { redirect_to @neighbour, notice: 'Neighbour was successfully updated.' }\n format.json { render :show, status: :ok, location: @neighbour }\n else\n format.html { render :edit }\n format.json { render json: @neighbour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @attachment = args[:attachment] if args.key?(:attachment)\n @segment = args[:segment] if args.key?(:segment)\n end", "def update\n respond_to do |format|\n if @static_pattern.update(static_pattern_params)\n format.html { redirect_to @static_pattern, notice: 'Saved pattern was successfully updated.' }\n format.json { render :show, status: :ok, location: @static_pattern }\n else\n format.html { render :edit }\n format.json { render json: @static_pattern.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @attachment_id = args[:attachment_id] if args.key?(:attachment_id)\n @initiator = args[:initiator] if args.key?(:initiator)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @neighbors = args[:neighbors] if args.key?(:neighbors)\n end", "def update\n @routing = Routing.find(params[:id])\n\n respond_to do |format|\n if @routing.update_attributes(params[:routing])\n format.html { redirect_to @routing, notice: 'Routing was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @ad_tracking_id = args[:ad_tracking_id] if args.key?(:ad_tracking_id)\n @path1 = args[:path1] if args.key?(:path1)\n @path2 = args[:path2] if args.key?(:path2)\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n @partition = args[:partition] if args.key?(:partition)\n @snat_pool = args[:snat_pool] if args.key?(:snat_pool)\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n @partition = args[:partition] if args.key?(:partition)\n @snat_pool = args[:snat_pool] if args.key?(:snat_pool)\n end", "def add_static_route_with_http_info(logical_router_id, static_route, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.add_static_route ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.add_static_route\"\n end\n # verify the required parameter 'static_route' is set\n if @api_client.config.client_side_validation && static_route.nil?\n fail ArgumentError, \"Missing the required parameter 'static_route' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.add_static_route\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_route)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticRoute')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#add_static_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @destination_id = args[:destination_id] if args.key?(:destination_id)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @static_ips = args[:static_ips] if args.key?(:static_ips)\n end", "def update!(**args)\n @cidr = args[:cidr] if args.key?(:cidr)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @mac_address = args[:mac_address] if args.key?(:mac_address)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n @vlan_id = args[:vlan_id] if args.key?(:vlan_id)\n @vrf = args[:vrf] if args.key?(:vrf)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @link = args[:link] if args.key?(:link)\n @surface_type = args[:surface_type] if args.key?(:surface_type)\n end", "def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end", "def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end", "def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end", "def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end", "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n flash[:notice] = 'Route was successfully updated.'\n format.html { redirect_to routes_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @matched_port_range = args[:matched_port_range] if args.key?(:matched_port_range)\n @matched_protocol = args[:matched_protocol] if args.key?(:matched_protocol)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @target = args[:target] if args.key?(:target)\n @uri = args[:uri] if args.key?(:uri)\n @vip = args[:vip] if args.key?(:vip)\n end", "def update\n respond_to do |format|\n if @router.update(router_params)\n format.html { redirect_to admin_routers_url, notice: 'Router was successfully updated.' }\n format.json { render :show, status: :ok, location: @router }\n else\n format.html { render :edit }\n format.json { render json: @router.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @deeplink_url = args[:deeplink_url] if args.key?(:deeplink_url)\n @provider_mid = args[:provider_mid] if args.key?(:provider_mid)\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n @no_external_ip_address = args[:no_external_ip_address] if args.key?(:no_external_ip_address)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n end", "def update!(**args)\n @gateway = args[:gateway] if args.key?(:gateway)\n @ips = args[:ips] if args.key?(:ips)\n @netmask = args[:netmask] if args.key?(:netmask)\n end", "def update!(**args)\n @forwarding_url = args[:forwarding_url] if args.key?(:forwarding_url)\n end", "def update!(**args)\n @app_gateway = args[:app_gateway] if args.key?(:app_gateway)\n @ingress_port = args[:ingress_port] if args.key?(:ingress_port)\n @l7psc = args[:l7psc] if args.key?(:l7psc)\n @type = args[:type] if args.key?(:type)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @remote_path = args[:remote_path] if args.key?(:remote_path)\n end", "def update!(**args)\n @beacon_name = args[:beacon_name] if args.key?(:beacon_name)\n @advertised_id = args[:advertised_id] if args.key?(:advertised_id)\n @status = args[:status] if args.key?(:status)\n @place_id = args[:place_id] if args.key?(:place_id)\n @lat_lng = args[:lat_lng] if args.key?(:lat_lng)\n @indoor_level = args[:indoor_level] if args.key?(:indoor_level)\n @expected_stability = args[:expected_stability] if args.key?(:expected_stability)\n @description = args[:description] if args.key?(:description)\n @properties = args[:properties] if args.key?(:properties)\n @ephemeral_id_registration = args[:ephemeral_id_registration] if args.key?(:ephemeral_id_registration)\n @provisioning_key = args[:provisioning_key] if args.key?(:provisioning_key)\n end", "def update!(**args)\n @dest_ip_range = args[:dest_ip_range] if args.key?(:dest_ip_range)\n @dest_port_ranges = args[:dest_port_ranges] if args.key?(:dest_port_ranges)\n @display_name = args[:display_name] if args.key?(:display_name)\n @instance_tags = args[:instance_tags] if args.key?(:instance_tags)\n @ncc_hub_uri = args[:ncc_hub_uri] if args.key?(:ncc_hub_uri)\n @ncc_spoke_uri = args[:ncc_spoke_uri] if args.key?(:ncc_spoke_uri)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @next_hop = args[:next_hop] if args.key?(:next_hop)\n @next_hop_type = args[:next_hop_type] if args.key?(:next_hop_type)\n @priority = args[:priority] if args.key?(:priority)\n @protocols = args[:protocols] if args.key?(:protocols)\n @route_scope = args[:route_scope] if args.key?(:route_scope)\n @route_type = args[:route_type] if args.key?(:route_type)\n @src_ip_range = args[:src_ip_range] if args.key?(:src_ip_range)\n @src_port_ranges = args[:src_port_ranges] if args.key?(:src_port_ranges)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @referrer = args[:referrer] if args.key?(:referrer)\n @remote_ip = args[:remote_ip] if args.key?(:remote_ip)\n @type = args[:type] if args.key?(:type)\n @url = args[:url] if args.key?(:url)\n end", "def update!(**args)\n @alternate = args[:alternate] if args.key?(:alternate)\n @canonical = args[:canonical] if args.key?(:canonical)\n @country = args[:country] if args.key?(:country)\n @flags = args[:flags] if args.key?(:flags)\n @language = args[:language] if args.key?(:language)\n @position = args[:position] if args.key?(:position)\n @visible_type_id = args[:visible_type_id] if args.key?(:visible_type_id)\n end", "def update_router\n router = Router.new\n if @enabled_changed and not self.enabled\n router.disable self\n elsif @enabled_changed and self.enabled\n router.enable self\n else\n router.update self\n end\n end", "def update\n\n respond_to do |format|\n if @check_route.update(check_route_params)\n format.html { redirect_to @check_route, notice: 'Check Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @check_route.errors, status: :internal_server_error }\n end\n end\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @node_id = args[:node_id] if args.key?(:node_id)\n @parameters = args[:parameters] if args.key?(:parameters)\n @port = args[:port] if args.key?(:port)\n @state = args[:state] if args.key?(:state)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update\n respond_to do |format|\n if @select_route.update(select_route_params)\n format.html { redirect_to @select_route, notice: 'Select route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @select_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @agency = args[:agency] if args.key?(:agency)\n @agency_name = args[:agency_name] if args.key?(:agency_name)\n @debug_extraction_info = args[:debug_extraction_info] if args.key?(:debug_extraction_info)\n @debug_funding_text_block = args[:debug_funding_text_block] if args.key?(:debug_funding_text_block)\n @grant_number = args[:grant_number] if args.key?(:grant_number)\n @recipient = args[:recipient] if args.key?(:recipient)\n @source_text = args[:source_text] if args.key?(:source_text)\n @url_based_funding_source = args[:url_based_funding_source] if args.key?(:url_based_funding_source)\n end", "def update!(**args)\n @monitored_road = args[:monitored_road] if args.key?(:monitored_road)\n end", "def update!(**args)\n @anchor = args[:anchor] if args.key?(:anchor)\n @block_id = args[:block_id] if args.key?(:block_id)\n @doc_id = args[:doc_id] if args.key?(:doc_id)\n @page_id = args[:page_id] if args.key?(:page_id)\n @paragraph_id = args[:paragraph_id] if args.key?(:paragraph_id)\n @route_id = args[:route_id] if args.key?(:route_id)\n @symbol_id = args[:symbol_id] if args.key?(:symbol_id)\n @url = args[:url] if args.key?(:url)\n @word_id = args[:word_id] if args.key?(:word_id)\n end", "def update!(**args)\n @mount_point = args[:mount_point] if args.key?(:mount_point)\n @path = args[:path] if args.key?(:path)\n @server = args[:server] if args.key?(:server)\n end", "def update\n @via = Via.find(params[:id])\n\n respond_to do |format|\n if @via.update_attributes(params[:via])\n flash[:notice] = 'Via was successfully updated.'\n format.html { redirect_to(@via) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @via.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @addr_fprint = args[:addr_fprint] if args.key?(:addr_fprint)\n @address = args[:address] if args.key?(:address)\n @lat_e7 = args[:lat_e7] if args.key?(:lat_e7)\n @lng_e7 = args[:lng_e7] if args.key?(:lng_e7)\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @reading_route = ReadingRoute.find(params[:id])\n @reading_route.updated_by = current_user.id if !current_user.nil?\n set_projects_offices\n\n respond_to do |format|\n if @reading_route.update_attributes(params[:reading_route])\n format.html { redirect_to @reading_route,\n notice: (crud_notice('updated', @reading_route) + \"#{undo_link(@reading_route)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reading_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @link = args[:link] if args.key?(:link)\n end", "def update!(**args)\n @outlink_info = args[:outlink_info] if args.key?(:outlink_info)\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n @brick_and_mortar_strength = args[:brick_and_mortar_strength] if args.key?(:brick_and_mortar_strength)\n @cluster = args[:cluster] if args.key?(:cluster)\n @docid = args[:docid] if args.key?(:docid)\n @geotopicality = args[:geotopicality] if args.key?(:geotopicality)\n @hours = args[:hours] if args.key?(:hours)\n @is_large_chain = args[:is_large_chain] if args.key?(:is_large_chain)\n @is_large_localwwwinfo = args[:is_large_localwwwinfo] if args.key?(:is_large_localwwwinfo)\n @phone = args[:phone] if args.key?(:phone)\n @site_siblings = args[:site_siblings] if args.key?(:site_siblings)\n @url = args[:url] if args.key?(:url)\n @wrapptor_item = args[:wrapptor_item] if args.key?(:wrapptor_item)\n end", "def update!(**args)\n @flags = args[:flags] if args.key?(:flags)\n @kc_link_name = args[:kc_link_name] if args.key?(:kc_link_name)\n @topic_property_name = args[:topic_property_name] if args.key?(:topic_property_name)\n end", "def update!(**args)\n @flags = args[:flags] if args.key?(:flags)\n @kc_link_name = args[:kc_link_name] if args.key?(:kc_link_name)\n @topic_property_name = args[:topic_property_name] if args.key?(:topic_property_name)\n end" ]
[ "0.6365141", "0.55864155", "0.55398107", "0.54104346", "0.5408062", "0.52611494", "0.52549493", "0.52203995", "0.521008", "0.52073044", "0.5157824", "0.5157343", "0.51220965", "0.5112575", "0.5112575", "0.5034793", "0.5000252", "0.4960514", "0.4959216", "0.4952912", "0.4934631", "0.49332425", "0.49079782", "0.48795176", "0.4875916", "0.4863863", "0.48507598", "0.48360357", "0.4830988", "0.48284552", "0.48277918", "0.4805307", "0.48036614", "0.48021027", "0.4797299", "0.4777512", "0.47769254", "0.47732902", "0.47672158", "0.4747649", "0.47176403", "0.4717584", "0.47175258", "0.47080994", "0.47080508", "0.47080508", "0.4703872", "0.4700326", "0.4697809", "0.46957257", "0.4682518", "0.4676764", "0.46739268", "0.466164", "0.46551248", "0.4650506", "0.46447924", "0.4639012", "0.4639012", "0.46367505", "0.46363217", "0.46204734", "0.46170357", "0.4612465", "0.4611308", "0.4611308", "0.4611308", "0.4611308", "0.46082705", "0.46074137", "0.460492", "0.4597726", "0.4597641", "0.45944282", "0.45930928", "0.4593019", "0.45907947", "0.4590035", "0.45800433", "0.45791343", "0.45778912", "0.45772886", "0.45685145", "0.45635763", "0.4562219", "0.45603672", "0.45597365", "0.45528078", "0.45490295", "0.4543832", "0.45412263", "0.45367518", "0.45367518", "0.4536424", "0.453631", "0.45350507", "0.45268303", "0.4526622", "0.45254552", "0.45254552" ]
0.70052713
0
Update a static route BFD peer Modifies the static route BFD peer. Modifiable parameters includes peer IP, enable flag and configuration of the BFD peer.
def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer" end # verify the required parameter 'bfd_peer_id' is set if @api_client.config.client_side_validation && bfd_peer_id.nil? fail ArgumentError, "Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer" end # verify the required parameter 'static_hop_bfd_peer' is set if @api_client.config.client_side_validation && static_hop_bfd_peer.nil? fail ArgumentError, "Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer" end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(static_hop_bfd_peer) auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'StaticHopBfdPeer') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def update_static_route(logical_router_id, id, static_route, opts = {})\n data, _status_code, _headers = update_static_route_with_http_info(logical_router_id, id, static_route, opts)\n data\n end", "def update\n Rails.logger.info('👻 Disraptor: Updating route.')\n\n route_id = params.require(:route_id)\n payload = params.require('disraptor/route')\n source_path = normalize_path(payload['sourcePath'])\n target_url = normalize_uri(payload['targetUrl'])\n request_method = normalize_request_method(payload['requestMethod'])\n\n if !@@allowed_methods.include?(request_method)\n error_message = \"Route request method was #{request_method} but expected one of these: #{@@allowed_methods.join(', ')}.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n if source_path != '/' and source_path.end_with?('/')\n error_message = \"Route source path was #{source_path} but it must not end in a slash.\"\n Rails.logger.error('❌ Disraptor: Error: ' + error_message)\n\n return render json: { error: error_message }, status: 400\n end\n\n route = Disraptor::Route.edit(route_id, source_path, target_url, request_method)\n\n Rails.application.reload_routes!\n\n render json: { 'disraptor/route': route }\n end", "def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # verify the required parameter 'static_hop_bfd_peer' is set\n if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?\n fail ArgumentError, \"Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_hop_bfd_peer)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @destination_ip_address_packed = args[:destination_ip_address_packed] if args.key?(:destination_ip_address_packed)\n @destination_port = args[:destination_port] if args.key?(:destination_port)\n @source_ip_address_packed = args[:source_ip_address_packed] if args.key?(:source_ip_address_packed)\n @source_port = args[:source_port] if args.key?(:source_port)\n end", "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def update!(**args)\n @display_preference = args[:display_preference] if args.key?(:display_preference)\n @metadata = args[:metadata] if args.key?(:metadata)\n @route = args[:route] if args.key?(:route)\n @route_direction = args[:route_direction] if args.key?(:route_direction)\n end", "def update_static_route_with_http_info(logical_router_id, id, static_route, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.update_static_route ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.update_static_route\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.update_static_route\"\n end\n # verify the required parameter 'static_route' is set\n if @api_client.config.client_side_validation && static_route.nil?\n fail ArgumentError, \"Missing the required parameter 'static_route' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.update_static_route\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/{id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_route)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticRoute')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#update_static_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @allow_non_street_level_address = args[:allow_non_street_level_address] if args.key?(:allow_non_street_level_address)\n @departure_hour_local = args[:departure_hour_local] if args.key?(:departure_hour_local)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @road_traffic = args[:road_traffic] if args.key?(:road_traffic)\n @start_location = args[:start_location] if args.key?(:start_location)\n @travel_time = args[:travel_time] if args.key?(:travel_time)\n end", "def update!(**args)\n @allow_non_street_level_address = args[:allow_non_street_level_address] if args.key?(:allow_non_street_level_address)\n @departure_hour_local = args[:departure_hour_local] if args.key?(:departure_hour_local)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @road_traffic = args[:road_traffic] if args.key?(:road_traffic)\n @start_location = args[:start_location] if args.key?(:start_location)\n @travel_time = args[:travel_time] if args.key?(:travel_time)\n end", "def update!(**args)\n @supported_routes = args[:supported_routes] if args.key?(:supported_routes)\n end", "def update!(**args)\n @road_info = args[:road_info] if args.key?(:road_info)\n end", "def update!(**args)\n @road_info = args[:road_info] if args.key?(:road_info)\n end", "def update!(**args)\n @continue = args[:continue] if args.key?(:continue)\n @resource_version = args[:resource_version] if args.key?(:resource_version)\n @self_link = args[:self_link] if args.key?(:self_link)\n end", "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def update!(**args)\n @neighbor_distance = args[:neighbor_distance] if args.key?(:neighbor_distance)\n @neighbor_id = args[:neighbor_id] if args.key?(:neighbor_id)\n end", "def update request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/routers/#{request_pb.router}\"\n body = request_pb.router_resource.to_json\n\n response = @client_stub.make_put_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def update\n begin\n @check_route.update(check_route_params)\n #TODO dedup\n @check_route.assets<< Asset.find(params[:asset_id]) if (!params[:asset_id].nil?)\n render template: 'check_routes/show', status: :ok\n rescue Exception => e\n render json: {:message=> e.to_s}.to_json, status: :internal_server_error\n end\n end", "def update\n @static_link = StaticLink.find(params[:id])\n\n respond_to do |format|\n if @static_link.update_attributes(params[:static_link])\n format.html { redirect_to(static_links_path, :notice => 'Static link was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @static_link.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to driver_path(@driver.id), notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n admin_only\n respond_to do |format|\n if @static.update(static_params)\n format.html { redirect_to @static, notice: 'Static was successfully updated.' }\n format.json { render :show, status: :ok, location: @static }\n else\n format.html { render :edit }\n format.json { render json: @static.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @app_engine_routing_override = args[:app_engine_routing_override] if args.key?(:app_engine_routing_override)\n end", "def update!(**args)\n @destination_ip = args[:destination_ip] if args.key?(:destination_ip)\n @destination_network_uri = args[:destination_network_uri] if args.key?(:destination_network_uri)\n @destination_port = args[:destination_port] if args.key?(:destination_port)\n @protocol = args[:protocol] if args.key?(:protocol)\n @source_agent_uri = args[:source_agent_uri] if args.key?(:source_agent_uri)\n @source_ip = args[:source_ip] if args.key?(:source_ip)\n @source_network_uri = args[:source_network_uri] if args.key?(:source_network_uri)\n @source_port = args[:source_port] if args.key?(:source_port)\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n end", "def update!(**args)\n @match_grpc_address = args[:match_grpc_address] if args.key?(:match_grpc_address)\n @service_attachment = args[:service_attachment] if args.key?(:service_attachment)\n end", "def update\n @route.update(route_params)\n render :show\n end", "def update\n @route = Route.find(params[:id])\n @tmp = @route.dup\n \n respond_to do |format|\n if @route.update_attributes(params[:route])\n \n if @tmp.fellow_id\n route = @tmp\n tmp_route = Route.find(@tmp.fellow_id)\n user = tmp_route.user\n UserMailer.deleted_route(user, route).deliver\n end\n \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @manual_lb_config = args[:manual_lb_config] if args.key?(:manual_lb_config)\n @port_config = args[:port_config] if args.key?(:port_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @http_route = args[:http_route] if args.key?(:http_route)\n @route_update_wait_time = args[:route_update_wait_time] if args.key?(:route_update_wait_time)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @abort_cause = args[:abort_cause] if args.key?(:abort_cause)\n @destination_egress_location = args[:destination_egress_location] if args.key?(:destination_egress_location)\n @endpoint_info = args[:endpoint_info] if args.key?(:endpoint_info)\n @error = args[:error] if args.key?(:error)\n @probing_latency = args[:probing_latency] if args.key?(:probing_latency)\n @result = args[:result] if args.key?(:result)\n @sent_probe_count = args[:sent_probe_count] if args.key?(:sent_probe_count)\n @successful_probe_count = args[:successful_probe_count] if args.key?(:successful_probe_count)\n @verify_time = args[:verify_time] if args.key?(:verify_time)\n end", "def update!(**args)\n @bgp_lb_config = args[:bgp_lb_config] if args.key?(:bgp_lb_config)\n @manual_lb_config = args[:manual_lb_config] if args.key?(:manual_lb_config)\n @metal_lb_config = args[:metal_lb_config] if args.key?(:metal_lb_config)\n @port_config = args[:port_config] if args.key?(:port_config)\n @vip_config = args[:vip_config] if args.key?(:vip_config)\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to admin_route_url(@route), notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_route_url(@route) }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @path = args[:path] if args.key?(:path)\n @port = args[:port] if args.key?(:port)\n end", "def update\n respond_to do |format|\n if @static.update(static_params)\n format.html { redirect_to @static, notice: 'Static was successfully updated.' }\n format.json { render :show, status: :ok, location: @static }\n else\n format.html { render :edit }\n format.json { render json: @static.errors, status: :unprocessable_entity }\n end\n end\n end", "def read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # verify the required parameter 'bfd_peer_id' is set\n if @api_client.config.client_side_validation && bfd_peer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticHopBfdPeer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#read_static_hop_bfd_peer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @enable_private_endpoint = args[:enable_private_endpoint] if args.key?(:enable_private_endpoint)\n @master_ipv4_cidr_block = args[:master_ipv4_cidr_block] if args.key?(:master_ipv4_cidr_block)\n @master_ipv4_reserved_range = args[:master_ipv4_reserved_range] if args.key?(:master_ipv4_reserved_range)\n end", "def set_routes(my_port, name, node_type, keys)\r\n # Give Access To This Node's Name\r\n get \"/peer_name\" do\r\n return name\r\n end\r\n # Give Access To This Node's Type (Client/Miner)\r\n get \"/peer_type\" do\r\n return node_type.to_s\r\n end\r\n # Give Access To This Node's Public Key For Validation & Handshake\r\n get \"/peer_key_public\" do\r\n return \"#{keys[0]},#{keys[2]}\"\r\n end\r\n # Give Access To This Node's Discovered Peers\r\n get \"/peer_peers\" do\r\n peer_ports = \"\"\r\n $peers.length.times do |i|\r\n peer_ports += \",\" if (i != 0)\r\n peer_ports += $peers[i].port.to_s\r\n end\r\n return peer_ports\r\n end\r\n # Another Peer Requests Handshake\r\n post \"/peer_handshake\" do\r\n port = params[\"port\"].chomp.to_i\r\n signature = params[\"signature\"].chomp.to_i\r\n timestamp = params[\"timestamp\"].chomp.to_i\r\n # Handshake Only With Undiscovered Peers\r\n if (search_peers_by_port(port) == -1)\r\n key_public = Faraday.get(\"#{URL}:#{port}/peer_key_public\").body\r\n key_public = key_public.split(\",\") # Convert String To Array\r\n # Validate Node's Authenticity Using RSA Decryption\r\n if (validate_signature(key_public, signature, timestamp))\r\n add_peer(port)\r\n handshake_peer(my_port, port, [keys[1], keys[2]])\r\n end\r\n end\r\n end\r\n # Request To Mine A Block\r\n post \"/mine_block\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = my_port.to_s\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n mine(amount, payer, payee, miner, timestamp, signature, prev_hash)\r\n else\r\n puts \"Denied mining request from rogue node\".red\r\n $status = \"Denied mining request from rogue node\"\r\n end\r\n end\r\n # Recieve A Mined Block\r\n post \"/block_mined\" do\r\n amount = params[\"amount\"].to_s\r\n payer = params[\"payer\"].to_s\r\n payee = params[\"payee\"].to_s\r\n miner = params[\"miner\"].to_s\r\n timestamp = params[\"timestamp\"].to_s\r\n signature = params[\"signature\"].to_s\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n # Add Block If Not Already Mined\r\n block_exists = check_if_block_exists(miner.to_i, timestamp.chomp.to_i)\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, true) if (!block_exists)\r\n end\r\n # Peer Sent A Mined Block\r\n post \"/broadcast_block\" do\r\n amount = params[\"amount\"].to_f\r\n signature = params[\"signature\"].to_s\r\n timestamp = params[\"timestamp\"].to_i\r\n prev_hash = params[\"prev_hash\"].to_s\r\n nonce = params[\"nonce\"].to_s\r\n hash = params[\"hash\"].to_s\r\n payer = params[\"payer\"].to_i\r\n payee = params[\"payee\"].to_i\r\n miner = params[\"miner\"].to_i\r\n\r\n payer_peer = search_peers_by_port(payer)\r\n if (prev_hash == \"0000000000000000000000000000000000000000000000000000000000000000\" && $blockchain.length > 0)\r\n # Genesis Node is being shared with everyone, this node does not require as it already has a chain. Ignore.\r\n else\r\n if (payer_peer != -1 && payer_peer.node_type != 3) # Validate if peer exists and is not rogue\r\n is_valid = validate_block(amount, signature, timestamp, prev_hash, nonce, hash, payer, payee, miner)\r\n if (is_valid)\r\n puts \"VALIDATED OK\".green\r\n add_block(amount, payer, payee, miner, timestamp, signature, prev_hash, nonce, false)\r\n end\r\n else\r\n puts \"Denied block broadcast from rogue node\".red\r\n $status = \"Denied block broadcast from rogue node\"\r\n end\r\n end\r\n end\r\n # Broadcast First Block (Genesis Block) To Peers\r\n post \"/genesis\" do\r\n broadcast_block($blockchain[0])\r\n end\r\nend", "def update!(**args)\n @direct_target_link = args[:direct_target_link] if args.key?(:direct_target_link)\n @indirect_target_link = args[:indirect_target_link] if args.key?(:indirect_target_link)\n end", "def update\n respond_to do |format|\n if @admin_neighbour.update(admin_neighbour_params)\n format.html { redirect_to @admin_neighbour, notice: 'Neighbour was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_neighbour }\n else\n format.html { render :edit }\n format.json { render json: @admin_neighbour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @advertised_id = args[:advertised_id] if args.key?(:advertised_id)\n @beacon_name = args[:beacon_name] if args.key?(:beacon_name)\n @attachments = args[:attachments] if args.key?(:attachments)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @routes = args[:routes] if args.key?(:routes)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @control_plane_ip_block = args[:control_plane_ip_block] if args.key?(:control_plane_ip_block)\n end", "def update!(**args)\n @control_plane_ip_block = args[:control_plane_ip_block] if args.key?(:control_plane_ip_block)\n end", "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n # UserMailer.welcome_email(@user).deliver\n format.html { redirect_to(@route, :notice => 'Route was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_peer(peer)\n @link_table.store_peer(peer)\n end", "def addPeer(options, peerId, clusterKey, tableCfs=nil, endpointClass=nil, isTemporary=\"false\")\n unless peerId !~ /\\D/\n raise 'peerId should be Integer ID for peer cluster'\n end\n replAdm = ReplicationAdmin.new(getConfiguration())\n replPeerConfig = ReplicationPeerConfig.new()\n replPeerConfig.setClusterKey(clusterKey)\n printf \"Ading Peer Id %s with ClusterKey %s\\n\", peerId, clusterKey\n #replPeerConfig.getConfiguration().put(\"IS_TEMPORARY\", cluster.isTemporary)\n if endpointClass\n replPeerConfig.setReplicationEndpointImpl(endpointClass)\n peerId.gsub!(\"-\", \"*\") # odr TenantReplicationEndpoint expects hyphens to be escaped to astericks\n end\n replPeerConfig.getConfiguration().put(\"IS_TEMPORARY\", isTemporary)\n\n replAdm.addPeer(peerId, replPeerConfig, tableCfs)\nend", "def update\n @pneighbour = Pneighbour.find(params[:id])\n\n respond_to do |format|\n if @pneighbour.update_attributes(params[:pneighbour])\n format.html { redirect_to(@pneighbour, :notice => 'Pneighbour was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pneighbour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @admin_route = Admin::Route.find(params[:id])\n\n respond_to do |format|\n if @admin_route.update_attributes(admin_route_params)\n format.html { redirect_to @admin_route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @neighbour.update(neighbour_params)\n format.html { redirect_to @neighbour, notice: 'Neighbour was successfully updated.' }\n format.json { render :show, status: :ok, location: @neighbour }\n else\n format.html { render :edit }\n format.json { render json: @neighbour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @attachment = args[:attachment] if args.key?(:attachment)\n @segment = args[:segment] if args.key?(:segment)\n end", "def update\n respond_to do |format|\n if @static_pattern.update(static_pattern_params)\n format.html { redirect_to @static_pattern, notice: 'Saved pattern was successfully updated.' }\n format.json { render :show, status: :ok, location: @static_pattern }\n else\n format.html { render :edit }\n format.json { render json: @static_pattern.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @attachment_id = args[:attachment_id] if args.key?(:attachment_id)\n @initiator = args[:initiator] if args.key?(:initiator)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @neighbors = args[:neighbors] if args.key?(:neighbors)\n end", "def update\n @routing = Routing.find(params[:id])\n\n respond_to do |format|\n if @routing.update_attributes(params[:routing])\n format.html { redirect_to @routing, notice: 'Routing was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @ad_tracking_id = args[:ad_tracking_id] if args.key?(:ad_tracking_id)\n @path1 = args[:path1] if args.key?(:path1)\n @path2 = args[:path2] if args.key?(:path2)\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n @partition = args[:partition] if args.key?(:partition)\n @snat_pool = args[:snat_pool] if args.key?(:snat_pool)\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n @partition = args[:partition] if args.key?(:partition)\n @snat_pool = args[:snat_pool] if args.key?(:snat_pool)\n end", "def update!(**args)\n @destination_id = args[:destination_id] if args.key?(:destination_id)\n end", "def add_static_route_with_http_info(logical_router_id, static_route, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.add_static_route ...'\n end\n # verify the required parameter 'logical_router_id' is set\n if @api_client.config.client_side_validation && logical_router_id.nil?\n fail ArgumentError, \"Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.add_static_route\"\n end\n # verify the required parameter 'static_route' is set\n if @api_client.config.client_side_validation && static_route.nil?\n fail ArgumentError, \"Missing the required parameter 'static_route' when calling ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi.add_static_route\"\n end\n # resource path\n local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(static_route)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticRoute')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiLogicalRoutingAndServicesRoutingConfigurationApi#add_static_route\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @static_ips = args[:static_ips] if args.key?(:static_ips)\n end", "def update!(**args)\n @cidr = args[:cidr] if args.key?(:cidr)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @mac_address = args[:mac_address] if args.key?(:mac_address)\n @name = args[:name] if args.key?(:name)\n @network = args[:network] if args.key?(:network)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n @vlan_id = args[:vlan_id] if args.key?(:vlan_id)\n @vrf = args[:vrf] if args.key?(:vrf)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @link = args[:link] if args.key?(:link)\n @surface_type = args[:surface_type] if args.key?(:surface_type)\n end", "def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end", "def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end", "def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end", "def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @matched_port_range = args[:matched_port_range] if args.key?(:matched_port_range)\n @matched_protocol = args[:matched_protocol] if args.key?(:matched_protocol)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @target = args[:target] if args.key?(:target)\n @uri = args[:uri] if args.key?(:uri)\n @vip = args[:vip] if args.key?(:vip)\n end", "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n flash[:notice] = 'Route was successfully updated.'\n format.html { redirect_to routes_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @router.update(router_params)\n format.html { redirect_to admin_routers_url, notice: 'Router was successfully updated.' }\n format.json { render :show, status: :ok, location: @router }\n else\n format.html { render :edit }\n format.json { render json: @router.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @network = args[:network] if args.key?(:network)\n @no_external_ip_address = args[:no_external_ip_address] if args.key?(:no_external_ip_address)\n @subnetwork = args[:subnetwork] if args.key?(:subnetwork)\n end", "def update!(**args)\n @deeplink_url = args[:deeplink_url] if args.key?(:deeplink_url)\n @provider_mid = args[:provider_mid] if args.key?(:provider_mid)\n end", "def update!(**args)\n @gateway = args[:gateway] if args.key?(:gateway)\n @ips = args[:ips] if args.key?(:ips)\n @netmask = args[:netmask] if args.key?(:netmask)\n end", "def update!(**args)\n @app_gateway = args[:app_gateway] if args.key?(:app_gateway)\n @ingress_port = args[:ingress_port] if args.key?(:ingress_port)\n @l7psc = args[:l7psc] if args.key?(:l7psc)\n @type = args[:type] if args.key?(:type)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @forwarding_url = args[:forwarding_url] if args.key?(:forwarding_url)\n end", "def update!(**args)\n @remote_path = args[:remote_path] if args.key?(:remote_path)\n end", "def update!(**args)\n @beacon_name = args[:beacon_name] if args.key?(:beacon_name)\n @advertised_id = args[:advertised_id] if args.key?(:advertised_id)\n @status = args[:status] if args.key?(:status)\n @place_id = args[:place_id] if args.key?(:place_id)\n @lat_lng = args[:lat_lng] if args.key?(:lat_lng)\n @indoor_level = args[:indoor_level] if args.key?(:indoor_level)\n @expected_stability = args[:expected_stability] if args.key?(:expected_stability)\n @description = args[:description] if args.key?(:description)\n @properties = args[:properties] if args.key?(:properties)\n @ephemeral_id_registration = args[:ephemeral_id_registration] if args.key?(:ephemeral_id_registration)\n @provisioning_key = args[:provisioning_key] if args.key?(:provisioning_key)\n end", "def update!(**args)\n @dest_ip_range = args[:dest_ip_range] if args.key?(:dest_ip_range)\n @dest_port_ranges = args[:dest_port_ranges] if args.key?(:dest_port_ranges)\n @display_name = args[:display_name] if args.key?(:display_name)\n @instance_tags = args[:instance_tags] if args.key?(:instance_tags)\n @ncc_hub_uri = args[:ncc_hub_uri] if args.key?(:ncc_hub_uri)\n @ncc_spoke_uri = args[:ncc_spoke_uri] if args.key?(:ncc_spoke_uri)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @next_hop = args[:next_hop] if args.key?(:next_hop)\n @next_hop_type = args[:next_hop_type] if args.key?(:next_hop_type)\n @priority = args[:priority] if args.key?(:priority)\n @protocols = args[:protocols] if args.key?(:protocols)\n @route_scope = args[:route_scope] if args.key?(:route_scope)\n @route_type = args[:route_type] if args.key?(:route_type)\n @src_ip_range = args[:src_ip_range] if args.key?(:src_ip_range)\n @src_port_ranges = args[:src_port_ranges] if args.key?(:src_port_ranges)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @referrer = args[:referrer] if args.key?(:referrer)\n @remote_ip = args[:remote_ip] if args.key?(:remote_ip)\n @type = args[:type] if args.key?(:type)\n @url = args[:url] if args.key?(:url)\n end", "def update!(**args)\n @alternate = args[:alternate] if args.key?(:alternate)\n @canonical = args[:canonical] if args.key?(:canonical)\n @country = args[:country] if args.key?(:country)\n @flags = args[:flags] if args.key?(:flags)\n @language = args[:language] if args.key?(:language)\n @position = args[:position] if args.key?(:position)\n @visible_type_id = args[:visible_type_id] if args.key?(:visible_type_id)\n end", "def update_router\n router = Router.new\n if @enabled_changed and not self.enabled\n router.disable self\n elsif @enabled_changed and self.enabled\n router.enable self\n else\n router.update self\n end\n end", "def update\n\n respond_to do |format|\n if @check_route.update(check_route_params)\n format.html { redirect_to @check_route, notice: 'Check Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @check_route.errors, status: :internal_server_error }\n end\n end\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @node_id = args[:node_id] if args.key?(:node_id)\n @parameters = args[:parameters] if args.key?(:parameters)\n @port = args[:port] if args.key?(:port)\n @state = args[:state] if args.key?(:state)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update!(**args)\n @agency = args[:agency] if args.key?(:agency)\n @agency_name = args[:agency_name] if args.key?(:agency_name)\n @debug_extraction_info = args[:debug_extraction_info] if args.key?(:debug_extraction_info)\n @debug_funding_text_block = args[:debug_funding_text_block] if args.key?(:debug_funding_text_block)\n @grant_number = args[:grant_number] if args.key?(:grant_number)\n @recipient = args[:recipient] if args.key?(:recipient)\n @source_text = args[:source_text] if args.key?(:source_text)\n @url_based_funding_source = args[:url_based_funding_source] if args.key?(:url_based_funding_source)\n end", "def update\n respond_to do |format|\n if @select_route.update(select_route_params)\n format.html { redirect_to @select_route, notice: 'Select route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @select_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @monitored_road = args[:monitored_road] if args.key?(:monitored_road)\n end", "def update!(**args)\n @anchor = args[:anchor] if args.key?(:anchor)\n @block_id = args[:block_id] if args.key?(:block_id)\n @doc_id = args[:doc_id] if args.key?(:doc_id)\n @page_id = args[:page_id] if args.key?(:page_id)\n @paragraph_id = args[:paragraph_id] if args.key?(:paragraph_id)\n @route_id = args[:route_id] if args.key?(:route_id)\n @symbol_id = args[:symbol_id] if args.key?(:symbol_id)\n @url = args[:url] if args.key?(:url)\n @word_id = args[:word_id] if args.key?(:word_id)\n end", "def update!(**args)\n @mount_point = args[:mount_point] if args.key?(:mount_point)\n @path = args[:path] if args.key?(:path)\n @server = args[:server] if args.key?(:server)\n end", "def update\n @via = Via.find(params[:id])\n\n respond_to do |format|\n if @via.update_attributes(params[:via])\n flash[:notice] = 'Via was successfully updated.'\n format.html { redirect_to(@via) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @via.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @addr_fprint = args[:addr_fprint] if args.key?(:addr_fprint)\n @address = args[:address] if args.key?(:address)\n @lat_e7 = args[:lat_e7] if args.key?(:lat_e7)\n @lng_e7 = args[:lng_e7] if args.key?(:lng_e7)\n end", "def update\n @breadcrumb = 'update'\n @reading_route = ReadingRoute.find(params[:id])\n @reading_route.updated_by = current_user.id if !current_user.nil?\n set_projects_offices\n\n respond_to do |format|\n if @reading_route.update_attributes(params[:reading_route])\n format.html { redirect_to @reading_route,\n notice: (crud_notice('updated', @reading_route) + \"#{undo_link(@reading_route)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reading_route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @link = args[:link] if args.key?(:link)\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @address = args[:address] if args.key?(:address)\n @brick_and_mortar_strength = args[:brick_and_mortar_strength] if args.key?(:brick_and_mortar_strength)\n @cluster = args[:cluster] if args.key?(:cluster)\n @docid = args[:docid] if args.key?(:docid)\n @geotopicality = args[:geotopicality] if args.key?(:geotopicality)\n @hours = args[:hours] if args.key?(:hours)\n @is_large_chain = args[:is_large_chain] if args.key?(:is_large_chain)\n @is_large_localwwwinfo = args[:is_large_localwwwinfo] if args.key?(:is_large_localwwwinfo)\n @phone = args[:phone] if args.key?(:phone)\n @site_siblings = args[:site_siblings] if args.key?(:site_siblings)\n @url = args[:url] if args.key?(:url)\n @wrapptor_item = args[:wrapptor_item] if args.key?(:wrapptor_item)\n end", "def update!(**args)\n @outlink_info = args[:outlink_info] if args.key?(:outlink_info)\n end", "def update!(**args)\n @flags = args[:flags] if args.key?(:flags)\n @kc_link_name = args[:kc_link_name] if args.key?(:kc_link_name)\n @topic_property_name = args[:topic_property_name] if args.key?(:topic_property_name)\n end", "def update!(**args)\n @flags = args[:flags] if args.key?(:flags)\n @kc_link_name = args[:kc_link_name] if args.key?(:kc_link_name)\n @topic_property_name = args[:topic_property_name] if args.key?(:topic_property_name)\n end" ]
[ "0.70053154", "0.55831844", "0.55385983", "0.54096377", "0.5407031", "0.5260514", "0.5256426", "0.5219717", "0.5211384", "0.52049154", "0.51588905", "0.5158409", "0.5121474", "0.5113762", "0.5113762", "0.50361305", "0.4999628", "0.49626377", "0.49598977", "0.4952247", "0.49357572", "0.4932427", "0.49089894", "0.48791087", "0.4877643", "0.48660475", "0.48522952", "0.4836619", "0.48310247", "0.48291317", "0.48286408", "0.48072913", "0.48053965", "0.48013836", "0.4799245", "0.4778653", "0.47764352", "0.47746074", "0.47685024", "0.4749397", "0.47205126", "0.4719886", "0.47179943", "0.47097084", "0.47097084", "0.47083884", "0.47057876", "0.4701376", "0.46989956", "0.4697496", "0.4685415", "0.46791998", "0.46755368", "0.46645802", "0.4657328", "0.46512493", "0.4645314", "0.4641717", "0.4641717", "0.4637667", "0.4633651", "0.46214557", "0.4618434", "0.4614216", "0.46140414", "0.46140414", "0.46140414", "0.46140414", "0.46100187", "0.4607816", "0.46060923", "0.46005914", "0.46002778", "0.4596193", "0.45944363", "0.45939204", "0.45923385", "0.45915914", "0.45808706", "0.45807818", "0.4579969", "0.45765042", "0.4569029", "0.4565893", "0.4562937", "0.45626727", "0.4560635", "0.45552203", "0.4551049", "0.454546", "0.45432568", "0.453702", "0.45366684", "0.453641", "0.453641", "0.45360854", "0.45290378", "0.4528758", "0.45266956", "0.45266956" ]
0.63649476
1
show all the bookings on booking_history
def booking_history @bookings = Booking.where(:user_id => current_user.id).paginate(:page => params[:page], :per_page => 10) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_booking_history\n @booking_history = BookingHistory.find(params[:id])\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.order(updated_at: :desc).page(params[:page]).per(NUM_PER_PAGE)\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @booking_infos = BookingInfo.all\n end", "def index\n @borrow_histories = BorrowHistory.all\n end", "def show\n @booking_history = BookingHistory.find(params[:room_num])\n end", "def index\n @booking_details = BookingDetail.all\n end", "def index\n @bookings = current_user.coach_bookings\n @future_bookings = @bookings.booked.where(\"start_time > ?\", Time.now).order(:start_time)\n @past_bookings = @bookings.booked.where(\"end_time < ?\", Time.now).order(start_time: :DESC)\n @booking = Booking.new\n @review = Review.new\n end", "def index\n @room_bookings = RoomBooking.all\n end", "def all_bookings\n Booking.none\n end", "def index\n @online_bookings = OnlineBooking.all\n end", "def index\n @bookings = @hairdresser.bookings\n end", "def index\n @fg_bookings = FgBooking.all\n end", "def index\n @tablebookings = Tablebooking.all\n end", "def index\n @bookings = Booking.where(user_id: current_user.id)\n end", "def index\n @bookings = Booking.all.order('date DESC')\n end", "def index\n @booking_statuses = BookingStatus.all\n end", "def show\n @booking = @boat.bookings.build(user: current_user)\n @booking.start_time = Time.zone.tomorrow + 9.hours\n @booking.end_time = Time.zone.tomorrow + 18.hours\n @booking.people_on_board = 1\n #TODO disable also booked(accepted) days\n end", "def index\n @bookings = Booking.order(id: :desc)\n end", "def index\n @tblbookings = TblBooking.all\n \n end", "def index\n @booking_clerks = BookingClerk.all\n end", "def index\n @bookings = Booking.where(\"user_id = #{current_user.id}\")\n end", "def index\n @booking_tours = BookingTour.all\n end", "def show\n @bookings = Booking.all\n @rooms = Room.all\n end", "def index\n @booking_confirmations = BookingConfirmation.all\n end", "def index\n @bookings = Booking.where(:customer_id => session['customer_id'])\n end", "def index\n @borrowed_books = BorrowedBook.all\n end", "def index\n @borrowed_books = BorrowedBook.all\n end", "def index\n @borrowed_books = BorrowedBook.all\n end", "def viewAllBookings \n @SocketHandle.puts \"Bookings : \" + BookingCatalogue.instance.viewAllBookings \n end", "def set_book_history\n @book_history = BookHistory.find(params[:id])\n end", "def index\n @fbookings = Fbooking.all\n end", "def index\n @bookings = @user.bookings\n end", "def index \n session[:link_to_bookings] = params[:classroom][:links].last[:uri] if (params[:classroom]) \n @link = session[:link_to_bookings]\n @params= \"date=#{params[:date]}&limit=#{params[:limit]}&status=#{params[:status]}\"\n @bookings = ClientApi.bookings_list @link, @params\n end", "def index\n @tour_bookings = TourBooking.all\n end", "def show_bill_book_series\n @bill_book_series = BillBookSeries.all\n end", "def index\n @bookings = current_user.bookings\n end", "def index\n @formating_histories = FormatingHistory.all\n end", "def index\n @bhistories = Bhistory.all\n end", "def show\n Time.use_zone(@meetingroom.location.timezone) do\n @bookings = @meetingroom.bookings.where(\"ending >= ?\", Time.now.in_time_zone(@meetingroom.location.timezone)).order(\"starting asc\").all\n end\n end", "def index\n query = 'SELECT * FROM Booking'\n @bookings = Booking.find_by_sql(query)\n end", "def show\n @history = ExchangeRecord.get_historical_data(@exchange_combination.base,\n @exchange_combination.target)\n end", "def room_index\n @bookings = @room.bookings.where.not('is_canceled').order(start_date: :asc)\n end", "def index\n @seat_bookings = SeatBooking.all\n end", "def index\n @bookings = current_user.bookings\n binding.pry\n #@bookingsegregator = Booking.segregator\n end", "def index\n @booked_hours = BookedHour.all\n end", "def show\n\n @user_id = current_user\n case params[:id]\n when \"approaching\"\n @bookings = Booking.paginate :conditions=>[ \"user_id = #{@user_id} and enddate >= now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"history\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id} and enddate < now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"all\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n else\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n end\n\n if @bookings.nil?\n @bookings = Array.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookings }\n end\n end", "def past\n @bookings = Booking.completed(current_user)\n end", "def viewAllBookings\n connection.puts \"View All Bookings\" \n end", "def index\n @ninety_ten_bookings = NinetyTenBooking.all\n end", "def bookings()\n sql = \"SELECT bookings.*\n FROM bookings\n WHERE bookings.schedule_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql,values)\n bookings = Booking.map_items(result)\n return bookings\n end", "def index\n @bookings = Booking.user(@user.id)\n end", "def index\n if params[:fromDate] == '' || params[:toDate] == ''\n flash[:alert] = 'Please choose the date range'\n return redirect_to upcoming_bookings_url\n end\n\n build_date_params\n @bookings = Booking.all(\n coworker_id: nil, resource_ids: [],\n options: { from_time: @from_time, to_time: @to_time }\n ).sort_by(&:from_time)\n end", "def index\n @booking_communications = BookingCommunication.all\n end", "def show_all_books\n\t\tputs \"\\nAll Books\\n\"\n\t\tBook.all.each do |book|\n\t\t\tputs \"#{book.id} #{book.title}\"\n\t\tend\nend", "def index\n @bookings = Booking.all\n respond_with(@bookings)\n end", "def show\n @bookings = @customer.bookings\n end", "def index\n @book_statuses = BookStatus.all\n end", "def index\n @bookseries = Bookseries.all\n end", "def index\n @bookstatuses = Bookstatus.all\n end", "def index\n \n @booking = Booking.new\n \n if session[:club_id] != nil\n \t@club = Club.find(session[:club_id])\n\tend\n \n if session[:booking_viewingweek] != nil\n # Already a date set to display.\n else\n currentDay = Date.today.strftime(\"%w\")\n if currentDay == 0 \n currentDay = 7\n end\n session[:booking_viewingweek] = Date.today - (currentDay.to_i - 1).day\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bookings }\n end\n\n\n end", "def index\n @bookings = Booking.all(:include => [:user, :suite])\n @current_bookings = Booking.current_bookings\n @archived_bookings = Booking.archived_bookings\n @cancelled_bookings = Booking.cancelled_bookings\n\n respond_to do |format|\n format.html { render :layout => \"admin_layout\"}\n format.xml { render :xml => @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.order(\"updated_at DESC\").limit(5)\n @customizebookings = Customizebooking.order(\"updated_at DESC\").limit(5)\n @gbookings = Gbooking.order(\"updated_at DESC\").limit(5)\n @questions = Question.order(\"updated_at DESC\").limit(5)\n @dianpins = Dianpin.order(\"updated_at DESC\").limit(5)\n end", "def index\n @history_items = HistoryItem.all\n end", "def show\n @all_upcoming_bookings_by_facility = Booking.includes(:facility, :user).where(facility_id: params[:id]).where(\"booking_date >= ?\", Date.today)\n @bookings_by_facility_date_filtered = Booking.includes(:facility, :user).where(facility_id: params[:id]).where(\"booking_date = ?\", params[:date].presence || Date.today)\n @available_slots_by_facility_date_filtered = Timeslot.all.where.not(:id => Booking.where(facility_id: params[:id]).where(\"booking_date = ?\", params[:date].presence || Date.today).map(&:timeslot_id).presence || 0)\n end", "def on_date\n @bookings = []\n @bookings = Booking.on_date(params[:booking_date]) if params[:booking_date]\n \n respond_to do |format|\n format.html {render \"index\"}\n format.json {render json: @bookings}\n end\n \n end", "def index\n @call_histories = CallHistory.all\n end", "def show_history_items_page\n \t@sold = Transaction.find_all_by_seller_id(current_user.id)\n @bought = Transaction.find_all_by_buyer_id(current_user.id)\n end", "def index\n @bookings = Booking.includes(:services)\n end", "def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end", "def borrowed_books_list\n @borrowed_books.each {|book| puts \"'#{book.title}' by #{book.author}\" }\n end", "def index\n @originating_histories = OriginatingHistory.all\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @dating_histories = DatingHistory.all\n end", "def index\n @bookingfinals = Bookingfinal.all\n end", "def borrowed_books_list\n @borrowed_books.each do |book|\n puts \"#{book.title} by #{book.author}\"\n end\n end", "def borrowed_books\n\t\tputs \"Borrowed Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"checked_out\" }\n\tend", "def list_books\n @books.each do |books|\n puts books.title + \" is currently \" + books.status + \".\"\n end\n end", "def index\n @invoice_histories = InvoiceHistory.all\n end", "def index\n @attendance_histories = AttendanceHistory.all\n end", "def list_books\n @books.each {|book| puts \"'#{book.title}' is #{book.status}.\" }\n end", "def index\n @bookings = policy_scope(Booking).order(created_at: :desc)\n @bookings = Booking.all\n end", "def list_books\n @books.each do |book|\n puts \"#{book.title} by #{book.author}: #{book.status}\"\n end\n end", "def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end", "def list_books\n @books.each { |book| puts \"#{book.title} - #{book.author} : #{book.status}\"}\n end", "def index\n @bookings = policy_scope(Booking).order(created_at: :desc)\n @global_revenues = revenues_bookings(@bookings)\n end" ]
[ "0.75333446", "0.7191425", "0.71350545", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7123582", "0.6983818", "0.69792986", "0.6926872", "0.6871498", "0.68580306", "0.6738121", "0.67380786", "0.67334455", "0.673279", "0.6729338", "0.6724706", "0.6717802", "0.6710601", "0.67061406", "0.6705726", "0.6704071", "0.66238105", "0.6604236", "0.65921754", "0.6580847", "0.6580029", "0.65650296", "0.65467", "0.65467", "0.65467", "0.65117073", "0.648648", "0.6473302", "0.64727426", "0.64705557", "0.64587003", "0.64439636", "0.6428405", "0.6424999", "0.64187086", "0.6407861", "0.6397466", "0.6395971", "0.63922065", "0.63858026", "0.6384374", "0.63810307", "0.63689864", "0.63667023", "0.6346604", "0.63356936", "0.630834", "0.63052493", "0.6304469", "0.63015544", "0.6292848", "0.62837905", "0.6275869", "0.62550837", "0.62524974", "0.6220279", "0.6218361", "0.6213953", "0.6209346", "0.61947316", "0.619377", "0.61787444", "0.61769706", "0.61736405", "0.61679965", "0.6164225", "0.6162666", "0.61607856", "0.6158566", "0.61536777", "0.61485094", "0.6147377", "0.61438733", "0.6137579", "0.6133076", "0.61256355", "0.61191314", "0.611732", "0.61107874", "0.6108098", "0.61078376", "0.61063975", "0.61004657" ]
0.82227737
0
allocate taxi within range for booking
def booking_texi(vehicle_type_id, pickup_date, pickup_time, dropoff_date, dropoff_time, pickup_addr) @texi_info = TexiInfo.near(pickup_addr,4).where(vehicle_type_id: vehicle_type_id).map(&:id).uniq rescue 0 @bookings = Booking.where(:user_id => current_user.id).where('pickup_time <= ? AND dropoff_time >= ?', pickup_time, dropoff_time).where(:pickup_datetime => pickup_date.to_date).where(:return_pickup_datetime => dropoff_date.to_date).order('pickup_datetime ASC') rescue 0 @ids = @bookings.map(&:taxi_info_id).uniq unless @bookings.blank? rescue 0 if [email protected]? @texi_info = @texi_info-@ids end if @texi_info.blank? return [] else return @texi_info.sample end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tax_charge!\n #puts \"Adjustments #{adjustments} TAX #{tax_total}\"\n #puts \"CREATE TAX for #{ship_address} \"\n all_rates = Spree::TaxRate.all\n matching_rates = all_rates.select { |rate| rate.zone.include?(ship_address) }\n if matching_rates.empty?\n matching_rates = all_rates.select{|rate| # get all rates that apply to default country \n rate.zone.country_list.collect{|c| c.id}.include?(Spree::Config[:default_country_id])\n }\n end\n adjustments.where(:originator_type => \"TaxRate\").each do |old_charge|\n old_charge.destroy\n end\n matching_rates.each do |rate|\n #puts \"Creating rate #{rate.amount}\" \n rate.create_adjustment( rate.tax_category.description , self, self, true)\n end\n end", "def tax_bracket \n min = self.salary - 1000 \n max = self.salary + 1000\n @@all.select do |emp| \n emp.salary > min && emp.salary < max \n end\n end", "def create_tax_charge!\n unless self.account.try(:is_tax_exempt?)\n Spree::TaxRate.adjust(self, line_items)\n Spree::TaxRate.adjust(self, shipments) if shipments.any?\n end\n end", "def tax_calc(i)\n total = 0 # here I'm setting a vairble to hold the tax total \n index = 1 # I'm setting an index to help with looping ovet the integer\n \n if i < @@bracket[0][:max] # This checks to see if the integer is greater that the first range\n total += i * @@bracket[0][:percent] # if it isnt then it will just return zero. \n else \n while i > @@bracket[index][:max] #This will iterate over the number as longs it is larger than the number thats it being compared to \n total += ((i - @@bracket[index][:max]) * @@bracket[index][:percent]) / 100 #This section will subtract the current bracket from income and then add it to the total\n index +=1 # The index will be incremented. If the income is still larger than max, than the loop continues. \n \n end\n total # Once the loop ends the total is returned.\n end\n end", "def tax_breakdown(tax)\n _tax = (cents * (tax / 100.0)).round\n [Money.new(cents + _tax, currency), Money.new(_tax, currency)]\n end", "def declare_beg_range\n\t\t@beg_range = @beg_range.to_date \n\t\t@end_range = @end_range.to_date \n\tend", "def tax_share_25\n tax_share(tax25)\n end", "def create\n @taxi = Taxi.new(taxi_params)\n @taxi.user_id = @user.id\n Taxi.set_taxi_id(Taxi::IDLIST, @taxi)\n if @taxi.save\n if current_user.taxi_count == nil\n current_user.taxi_count = 1\n else\n current_user.taxi_count += 1\n end\n current_user.save\n flash[:success] = \"Vehicle Added Successfully\"\n redirect_to user_taxis_path(current_user)\n else\n render 'new'\n end\n end", "def taxpayers_object(number_of_buyers)\n @taxpayers = Array.new(number_of_buyers) do\n Returns::Lbtt::Party.new(party_type: claim_public? ? 'UNAUTH_CLAIMANT' : 'CLAIMANT')\n end\n end", "def busy_range\n [\n engineering_normal_salary_items,\n engineering_normal_with_tax_salary_items,\n engineering_big_table_salary_items,\n engineering_dong_fang_salary_items\n ].flat_map{|items| items.map{|item| item.salary_table.range} }.sort\n end", "def add_reservation(start_date, end_date)\n @bookings << [start_date, end_date]\n end", "def build_estimate_tax\n estimate_line_items.each do |line|\n add_tax_line(line)\n end\n end", "def tax_money_owed\n if update_taxable <= 43953 && update_taxable >= 0\n update_taxable * 0.15\n elsif update_taxable >= 43954 && update_taxable <=87907\n (43953*0.15) + ((update_taxable-43953) * 0.22)\n elsif update_taxable >= 87908 && update_taxable <=136270\n (43953*0.15)+ (48363*0.22) + (update_taxable * 0.26)\n elsif update_taxable >= 136270\n (43953*0.15)+ (48363*0.22)+ (43954*0.26) + (update_taxable * 0.29)\n else\n update_taxable \n end\n end", "def tax\n \"#{price}\".to_i * 0.09 \n end", "def tax_calc\n tax = @quantity * @price * @taxe\n end", "def tax\n 0.0\n end", "def set_qty_range\n @qty_range = QtyRange.find(params[:id])\n end", "def allocation_range\n (@iprange or @subnet).to_range\n end", "def auto_range(direction); end", "def request_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_tax_invoice\").body)\n @attributes = response['items']\n true\n end", "def tax(amount)\n if amount <= 240\n 0\n elsif amount <= 480\n amount * 0.15\n else\n amount * 0.28\n end\nend", "def add_taxes(amt, good_tax, import_tax)\n amt += good_tax + import_tax\n amt.round(2)\n end", "def add_tax(tax)\n tax_breakdown(tax)[0]\n end", "def create\n\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequest.new('missing parameter(s)') if params[:tax_rate_action].nil? || params[:tax_rate_action][:tax_rate].blank? || params[:tax_rate_action][:settlement_id].blank?\n\n settlement = Settlement::Settlement.find_by_id(params[:tax_rate_action][:settlement_id])\n tax_rate = params[:tax_rate_action][:tax_rate].to_f\n \n raise NotFoundError.new ('Settlement with id #{params[:tax_rate_action][:settlement_id]} not Found.') if settlement.nil?\n raise ForbiddenError.new('tried to set tax rate on a foreign settlement.') unless settlement.owner == current_character\n raise BadRequestError.new('settlement does not own the region.') unless settlement.owns_region?\n raise ForbiddenError.new ('tax rate out of range.') if tax_rate < 0.05 || tax_rate > 0.15\n raise ForbiddenError.new ('no tax rate change possible at the moment') unless settlement.tax_rate_change_possible?\n\n settlement.tax_rate = tax_rate\n settlement.tax_changed_at = Time.now\n settlement.save\n \n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def allocate\n if @allocated_ranges.empty?\n add_leading_range\n elsif @allocated_ranges.first.first == 0\n extend_leading_range\n else\n add_leading_range\n end\n end", "def set_Tax(value)\n set_input(\"Tax\", value)\n end", "def vdate_taxcomputation_amount\n \n if(taxOnAggregateInc && !vdate_is_valid_amount_range?(taxOnAggregateInc))\n errors.add(taxOnAggregateInc,'Tax Payable on Aggregate Income is out of valid range.')\n end\n \n if(rebateOnAgriInc && !vdate_is_valid_amount_range?(rebateOnAgriInc))\n errors.add(rebateOnAgriInc,'Rebate on Net Agricultural Income is out of valid range.')\n end\n \n if(totalTaxPayable && !vdate_is_valid_amount_range?(totalTaxPayable))\n errors.add(totalTaxPayable,'Total Tax Payable is out of valid range.')\n end\n \n if(surchargeOnTaxPayable && !vdate_is_valid_amount_range?(surchargeOnTaxPayable))\n errors.add(surchargeOnTaxPayable,'SurCharge on Total Tax is out of valid range.')\n end\n \n if(educationCess && !vdate_is_valid_amount_range?(educationCess))\n errors.add(educationCess,'Education Cess is out of valid range.')\n end\n \n if(grossTaxLiability && !vdate_is_valid_amount_range?(grossTaxLiability))\n errors.add(grossTaxLiability,'Gross Tax Liability is out of valid range.')\n end\n \n if(section89 && !vdate_is_valid_amount_range?(section89))\n errors.add(section89,'Relief under Section 89 is out of valid range.')\n end\n \n if(section90and91 && !vdate_is_valid_amount_range?(section90and91))\n errors.add(section90and91,'Relief under Section 90/91 is out of valid range.')\n end\n \n if(netTaxLiability && !vdate_is_valid_amount_range?(netTaxLiability))\n errors.add(netTaxLiability,'Net Tax Liability is out of valid range.')\n end\n \n if(intrstPayUs234A && !vdate_is_valid_amount_range?(intrstPayUs234A))\n errors.add(intrstPayUs234A,'Interest Payable u/s 234A is out of valid range.')\n end\n \n if(intrstPayUs234B && !vdate_is_valid_amount_range?(intrstPayUs234B))\n errors.add(intrstPayUs234A,'Interest Payable u/s 234B is out of valid range.')\n end\n \n if(intrstPayUs234C && !vdate_is_valid_amount_range?(intrstPayUs234C))\n errors.add(intrstPayUs234C,'Interest Payable u/s 234C is out of valid range.')\n end\n \n if(totalIntrstPay && !vdate_is_valid_amount_range?(totalIntrstPay))\n errors.add(totalIntrstPay,'Total Interest Payable u/s 234 is out of valid range.')\n end \n \n if(totTaxPlusIntrstPay && !vdate_is_valid_amount_range?(totTaxPlusIntrstPay))\n errors.add(totTaxPlusIntrstPay,'Tatal Tax and Interest on delayed tax is out of valid range.')\n end \n \nend", "def create_new_booking_oct(customer, space)\n new_booking = Booking.new\n new_booking.user = customer\n new_booking.space = space\n new_booking.date_start = DateTime.strptime(\"10/14/2019\", \"%m/%d/%Y\")\n new_booking.date_end = DateTime.strptime(\"10/14/2019\", \"%m/%d/%Y\")\n return new_booking\nend", "def tt_range\n ARange.new(ttstart_at, ttend_at)\n end", "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "def set_taxi\n @taxi = Taxi.find(params[:id])\n end", "def create\n @qty_range = QtyRange.new(qty_range_params)\n\n respond_to do |format|\n if @qty_range.save\n format.html { redirect_to @qty_range, notice: \"Qty range was successfully created.\" }\n format.json { render :show, status: :created, location: @qty_range }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @qty_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def book(start_at, end_at)\n l, r = start_at, end_at-1\n insert(l, r)\n @@max\n end", "def tax_index\n\n end", "def make_booking!(start_time, end_time)\n starthour = Time.parse(start_time).strftime(\"%k:%M\")\n endhour = Time.parse(end_time).strftime(\"%k:%M\")\n startmonth = Time.parse(start_time).strftime(\"%B\" )\n endmonth = Time.parse(end_time).strftime(\"%B\")\n startday = Time.parse(start_time).strftime(\"%d\")\n endday = Time.parse(end_time).strftime(\"%d\")\n \n if is_available?(start_time, end_time)\n @parking_space[:bookings].push({start_time: start_time, end_time: end_time})\n puts \"Your parking has been booked for €#{calculate_price(start_time, end_time)}\"\n else\n if days_between(start_time, end_time) == 0\n puts \"There are no spaces available on #{startday}#{ordinal(startday)} #{startmonth} from #{starthour} to #{endhour}.\"\n else \n puts \"There are no spaces available from #{startday}#{ordinal(startday)}, #{startmonth} - #{endday}#{ordinal(endday)}, #{endhour}.\"\n end\n end\n\n puts \"\"\nend", "def tax_change\n owner = correct_owner_id\n tax ={\n :tax1_enabled => 1,\n :tax2_enabled => Confline.get_value2(\"Tax_2\", owner).to_i,\n :tax3_enabled => Confline.get_value2(\"Tax_3\", owner).to_i,\n :tax4_enabled => Confline.get_value2(\"Tax_4\", owner).to_i,\n :tax1_name => Confline.get_value(\"Tax_1\", owner),\n :tax2_name => Confline.get_value(\"Tax_2\", owner),\n :tax3_name => Confline.get_value(\"Tax_3\", owner),\n :tax4_name => Confline.get_value(\"Tax_4\", owner),\n :total_tax_name => Confline.get_value(\"Total_tax_name\", owner),\n :tax1_value => Confline.get_value(\"Tax_1_Value\", owner).to_d,\n :tax2_value => Confline.get_value(\"Tax_2_Value\", owner).to_d,\n :tax3_value => Confline.get_value(\"Tax_3_Value\", owner).to_d,\n :tax4_value => Confline.get_value(\"Tax_4_Value\", owner).to_d,\n :compound_tax => Confline.get_value(\"Tax_compound\", owner).to_i\n }\n\n tax[:total_tax_name] = \"TAX\" if tax[:total_tax_name].blank?\n tax[:tax1_name] = tax[:total_tax_name].to_s if tax[:tax1_name].blank?\n\n case params[:u].to_i\n when 1\n users = User.find(:all, :include => [:tax], :conditions => [\"owner_id = ?\", owner])\n for user in users do\n user.assign_default_tax(tax, {:save => true})\n end\n Confline.set_default_object(Tax, owner, tax)\n flash[:status] = _('User_taxes_set_successfully')\n when 2\n Cardgroup.set_tax(tax, session[:user_id])\n flash[:status] = _('Cardgroup_taxes_set_successfully')\n when 3\n Voucher.set_tax(tax)\n flash[:status] = _('voucher_taxes_set_successfully')\n else\n dont_be_so_smart\n end\n\n if owner == 0\n redirect_to :action => 'settings' and return false\n else\n redirect_to :action => 'reseller_settings' and return false\n end\n end", "def creat_age_range(ageRange)\n age_range = ageRange.split(\"-\")\n min_age = age_range[0].to_i\n max_age = age_range[1].to_i\n AgeRange.create(:min_age => min_age, :max_age => max_age)\nend", "def ship_address_tax_update\n if ship_address and (ship_address_id_changed? or ship_address.changed?)\n create_avalara_tax_adjustment\n end\n end", "def range\n @fuel_capacity * @fuel_efficiency\n end", "def tax\n\t\t@value * 0.16\n\tend", "def calcuate_tax\n @price * 0.12\n end", "def tax_share_12\n tax_share(tax12)\n end", "def create_new_booking_sep(customer, space)\n new_booking = Booking.new\n new_booking.user = customer\n new_booking.space = space\n new_booking.date_start = DateTime.strptime(\"09/01/2019\", \"%m/%d/%Y\")\n new_booking.date_end = DateTime.strptime(\"09/02/2019\", \"%m/%d/%Y\")\n return new_booking\nend", "def professional_tax_master_params\n params.require(:professional_tax_master).permit(:base_component, :min_amount, :max_amount, :basis_actual_amount, :company_location_id, :for_month, :march_amount, :effective_from, :effective_to, :is_active, :is_confirm)\n end", "def tax_1\n get_or_build_tax_for_key(\"tax_1\")\n end", "def spouse_prior_year_agi(intake, tax_year)\n\n if tax_year < 2021 && !ENV['TEST_SCHEMA_VALIDITY_ONLY']\n raise \"spouse_prior_year_agi only works for current tax year\"\n end\n\n intake.spouse_prior_year_agi_amount || 0\n end", "def ticket_tax(accounting_element)\n\t \taccounting_element[:taxes][:tax][:@amount]\n\t 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 tax_share_6\n tax_share(tax6)\n end", "def tax\n price.to_f * 0.09\n end", "def setup_range(date)\n diff = date.wday - self.class.windex(start_wday)\n @first = date - (diff + ((diff < 0) ? DAYS : 0))\n @last = @first + DAYS - 1\n end", "def make_reservation(range)\n\t\t\troom = room_finder(range).first\n\t\t\tnew_reservation = Hotel::Reservation.new(room, range)\n\t\t\t@reservations << new_reservation\n\t\t\troom.reservations << new_reservation\n\n\t\t\treturn new_reservation\n\t\tend", "def create\n @tax_code = TaxCode.new(tax_code_params)\n @tax_code.organization = current_organization\n respond_to do |format|\n if @tax_code.save\n format.html { redirect_to tax_codes_url, notice: 'tax code period was successfully created.' }\n else\n @accounting_periods = current_organization.accounting_periods.where('active = ?', true)\n flash.now[:danger] = \"#{t(:failed_to_create)} #{t(:tax_code)}\"\n format.html { render action: 'new' }\n end\n end\n end", "def tax_params\n params.require(:tax).permit(:tax_name, :description, :percentage, :tax_category, :tax_type_id, :organization_id, :child_tax=>[])\n end", "def add_tax min_income, rate\r\n return false if min_income.nil?\r\n return false if rate.nil?\r\n\r\n new_tax = {min_income: min_income, rate: rate}\r\n\r\n # find the insertion point for the new tax\r\n index_to_insert_after = nil\r\n @taxes.each_index do |index|\r\n if @taxes[index][:min_income] <= min_income\r\n index_to_insert_after = index\r\n end\r\n end\r\n\r\n # empty taxes case\r\n if index_to_insert_after.nil?\r\n @taxes.insert 0, new_tax\r\n return true\r\n end\r\n\r\n # compare the equal case\r\n old_tax = @taxes[index_to_insert_after]\r\n if old_tax[:min_income] == new_tax[:min_income]\r\n @taxes[index_to_insert_after] = new_tax\r\n else\r\n @taxes.insert index_to_insert_after+1, new_tax\r\n end\r\n\r\n return true\r\n end", "def tax_share(tax)\n tax.to_f / price\n end", "def create\n @itinerary = Itinerary.find(params[:itinerary_id])\n @transaction = @itinerary.transactions.build\n authorize! :create, @transaction\n\n @unpaid_line_items = @itinerary.line_items.where(paid: false)\n @transaction.line_items = @unpaid_line_items\n @transaction.tax = @transaction.pre_tax_total * selected_conference.tax_rate\n @transaction.payment_method = params[:payment_method]\n\n if @transaction.save\n redirect_to itinerary_transaction_path(@itinerary, @transaction)\n else\n #TODO there isn't any user input that could cause this action to fail, so probably apologize and send the developer an email..\n end\n end", "def taxes\n calculation = BigDecimal.new(\"0\")\n absolutely_priced? ? base_price = sales_price : base_price = gross_price\n calculation = ( (base_price - rebate) / BigDecimal.new(\"100.0\")) * tax_class.percentage\n end", "def tax_rate(region_id, time = Time.zone.now)\n TaxRate.for_region(region_id).at(time).active.order('start_date DESC').first\n end", "def create\n @purchase_order = PurchaseOrder.create_order(params, @company.id, @current_user, @financial_year.year.name)\n # @purchase_order.build_tax\n respond_to do |format|\n if @purchase_order.save\n VoucherSetting.next_purchase_order_write(@company)\n @purchase_order.update_attributes(:total_amount=>@purchase_order.amount)\n @purchase_order.register_user_action(request.remote_ip, 'created')\n format.html { redirect_to(@purchase_order, :notice => 'Purchase order was successfully created.') }\n format.xml { render :xml => @purchase_order, :status => :created, :location => @purchase_order }\n else\n @purchase_order.purchase_order_number = VoucherSetting.next_purchase_order_number(@company)\n @purchase_order.purchase_order_line_items.each do |line_item|\n (2-line_item.purchase_order_taxes.size).times{ line_item.purchase_order_taxes.build }\n end\n @voucher_setting = VoucherSetting.find_by_company_id_and_voucher_type(@company.id, 6)\n @from_accounts = TransactionType.fetch_from_accounts(@company.id,'purchases')\n @to_accounts = Product.get_purchase_products(@company.id)\n @tax_accounts = TransactionType.fetch_to_accounts(@company.id, 'tax')\n @projects = @company.projects.active\n @other_charge_accounts = Account.get_other_expense_on_purchase_accounts(@company)\n @vendor_account_heads = AccountHead.get_customer_and_vendor_account_heads(@company.id)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_default_car_slots(ref_time_for_week)\n days_in_schedule = Set.new(self.default_car_schedule)\n week_begin = ref_time_for_week.beginning_of_week\n for week_offset in 0..6\n dayname = DAYNAMES[week_offset]\n d = week_begin.advance(:days => +week_offset)\n CarSlot.create(\n :user => self,\n :start_time => d,\n :end_time => d.end_of_day(),\n :reserved_fee => self.default_car_slot_fees[dayname][CarSlot::RESERVED],\n :cancelled_fee => self.default_car_slot_fees[dayname][CarSlot::CANCELLED],\n :status => days_in_schedule.include?(dayname) ? CarSlot::RESERVED : CarSlot::UNASSIGNED\n )\n end\n end", "def reserve(*args)\n @reservations << Reservation.new(self, *args)\n end", "def qty_range_params\n params.require(:qty_range).permit(:name, :value)\n end", "def range\n @fuel * MILES_PER_GALLON\n end", "def price_setter(min, max)\n price_range = []\n (min..max).step(5) { |x| price_range.push(x) }\n return price_range.sample\nend", "def taxes\n wizard_step(STEPS)\n end", "def init_vendor_legitimate_interest(ranged:)\n @vendor_legitimate_interest = VendorSectionBuilder.build(is_ranged_encoding: ranged)\n @vendor_legitimate_interest\n end", "def tax_2\n get_or_build_tax_for_key(\"tax_2\")\n end", "def create\n @invoice_tax = InvoiceTax.new(params[:invoice_tax])\n\n respond_to do |format|\n if @invoice_tax.save\n format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully created.' }\n format.json { render json: @invoice_tax, status: :created, location: @invoice_tax }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_tax.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_range(iRange)\n super\n end", "def tenders_adv(start, num)\n\nend", "def deliver(start_address, end_address)\n route = (end_address) - (start_address)\n if route < quota\n pay = 0.25 * route - 2\n else\n pay = 0.25 * route + (route - quota) * (0.25)\nend\n\n@experience += route\n@earnings += pay\nend", "def set_taxes\n @taxes = Tax.find(params[:id])\n end", "def set_tax(status, base_total, tax_rate)\n if status == true\n amt = compute_tax(base_total, tax_rate)\n round_tax(amt)\n else\n 0.0\n end\n end", "def create\n @inventory_template = InventoryTemplate.new(params[:inventory_template])\n # @inventory_template.restaurant = current_owner.restaurant\n\n @intervals = []\n 24.times do |h| \n 4.times do |m| \n if h<10 and m!=0\n @intervals << \"0#{h}:#{m*15}\" \n elsif h<10 and m==0\n @intervals << \"0#{h}:00\" \n elsif h>=10 and m!=0\n @intervals << \"#{h}:#{m*15}\" \n elsif h>=10 and m==0\n @intervals << \"#{h}:0#{m*15}\" \n else\n @intervals << \"#{h}:#{m*15}\" \n end\n end\n end\n @intervals << \"24:00\"\n\n @intervals.each do |interval| \n quan = params[:inventory_template][:quantity_available][\"#{@intervals.index(interval)}\".to_s]\n unless interval == \"24:00\" or quan.to_i == 0\n \n @inventory_template = InventoryTemplate.new(inventory_template_group_id: params[:inventory_template][:inventory_template_group_id])\n # @inventory_template = InventoryTemplate.new(name: params[:inventory_template][:name])\n # @inventory_template.restaurant = current_owner.restaurant\n # @inventory_template.primary = params[:inventory_template][:primary]\n \n @inventory_template.start_time = interval\n @inventory_template.end_time = @intervals[@intervals.index(interval)+1]\n @inventory_template.quantity_available = quan\n\n @inventory_template.save\n end \n end \n\n redirect_to :back,\n notice: 'Inventory Template was successfully created.'#inventory_templates_path\n end", "def set_tax\n @tax = Tax.find(params[:id])\n end", "def set_tax\n @tax = Tax.find(params[:id])\n end", "def calc_t1(price, tip, tax)\n tax_amount = price * tax\n tip_amount = price * tip\n price + tip_amount + tax_amount\nend", "def tax_bracket\n Employee.all.select do |employee|\n if employee.salary >= self.salary-1000 && employee.salary <= self.salary+1000\n employee.salary\n end\n end\n end", "def compute_tax(item_price, tax_rate)\n item_price * tax_rate\n end", "def restaurant_must_be_within_capacity\n unless self.restaurant.is_available?(self.begin_time, self.people)\n errors.add(:begin_time, \"is not available for \" + pluralize(self.people, \"person\"))\n end\n end", "def index\n @qty_ranges = QtyRange.all\n end", "def unit_tax\n tax = Money.new(0)\n tax_classes.each do |tax_class|\n class_tax = @rounding_strategy.round(tax_class.rate * unit_amount)\n tax += class_tax\n end\n tax\n end", "def price_range(obj)\n if obj != nil && obj.sharespaces.count > 0\n if obj.sharespaces.order(cost: :desc).first.cost == 0.0 or nil\n \"Free\"\n else\n \"From $#{obj.sharespaces.order(cost: :desc).first.cost.round(2)}\"\n end\n\n else\n \"No sharespaces yet.\"\n end\n end", "def create_zero_tier\n ManageIQ::Showback::Tier.create(:tier_start_value => 0, :tier_end_value => Float::INFINITY, :rate => self)\n end", "def index\n @incoming_service_taxes = IncomingServiceTax.new.index(params[:start_date], params[:end_date])\n end", "def billable_allocation\n if (billing_rate && billing_rate>0)\n if on_demand\n return 20;\n else\n return percentage_allocation;\n end\n else\n return 0 \n end\n end", "def retirement_range\n #large simulation\n (1..30)\n end", "def create\n # Вызвать такси\n @order_number = Taxirequest.call_a_taxi(params[:taxirequest])\n # Разместить заявку на такси в таблице taxirequests\n @taxirequest = Taxirequest.add_request(params[:taxirequest], session[:employee_id], @order_number)\n #@taxirequest = Taxirequest.new(params[:taxirequest])\n\n respond_to do |format|\n if @taxirequest.save\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully created.'+@response }\n format.json { render json: @taxirequest, status: :created, location: @taxirequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: taxirequest.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def vt_range\n ARange.new(vtstart_at, vtend_at)\n end", "def set_quarter_income_tax\n @quarter_income_tax = QuarterIncomeTax.find(params[:id])\n end", "def add_range(left, right)\n \n end", "def add_range(left, right)\n \n end", "def region_range(i, opts={})\r\n refresh opts\r\n (@memlist[i][0]..(@memlist[i][1]+@memlist[i][0]))\r\n end", "def booking_place!(number)\n @trains[number.to_sym].wagons[0].booking_place_by_wagon\n end", "def vacant_slots(from, to)\n\n end", "def create\n get_current_user\n @types = Type.find_by_typename('invoice_terms')\n @terms = 'none'\n \n @terms = @types.type_value_string \n \n \n @shipments = Invoice.get_ready_shipments(@current_user.id, params[:customer_id], params[:start_date], params[:stop_date])\n @count = 0\n \n @shipments.each do |sh|\n @invoice = Invoice.new(params[:invoice])\n @invoice.shipment_id = sh.id\n @invoice.ship_amount = sh.ship_amount\n @invoice.ship_charge = sh.shipping_charge\n @invoice.total_amount = sh.ship_amount.to_f + sh.shipping_charge.to_f\n @types = Type.find_by_typename('invoice_number')\n \n @invno = @types.type_value_integer + 1\n @types.type_value_integer = @invno\n @types.save\n \n @invoice.invoice_number = @invno\n @invoice.invoice_status = 'NEW'\n @invoice.invoice_terms = @terms\n @invoice.invoice_date = Date.today.to_date\n @invoice.user_id = @current_user.id \n @count += 1\n @invoice.save\n \n @shipment = Shipment.find(sh.id)\n @shipment.ship_status = 'invoiced'\n @shipment.save\n end\n\n respond_to do |format|\n message = @count.to_s + ' - Invoice(s) were successfully created.'\n format.html { redirect_to('/invoice_generator', :notice => message) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n\n end\n end", "def addTaxes(accountProject, currency, totalAmount)\n\t\tprojectTaxes = accountProject.wk_acc_project_taxes\n\t\tprojectTaxes.each do |projtax|\n\t\t\tinvItem = @invoice.invoice_items.new()\n\t\t\tinvItem.name = projtax.tax.name\n\t\t\tinvItem.rate = projtax.tax.rate_pct.blank? ? 0 : projtax.tax.rate_pct\n\t\t\tinvItem.project_id = accountProject.project_id\n\t\t\tinvItem.currency = currency\n\t\t\tinvItem.quantity = nil\n\t\t\tinvItem.amount = (invItem.rate/100) * totalAmount\n\t\t\tinvItem.item_type = 't'\n\t\t\tinvItem.modifier_id = User.current.id\n\t\t\tinvItem.save()\n\t\tend\n\tend", "def date_range_integrity\n super\n\n # TODO: remove this after tie-in to Settings\n return\n\n open_enrollment_term_maximum = Settings.aca.shop_market.open_enrollment.maximum_length.months.months\n if open_enrollment_term.end > (open_enrollment_term.begin + open_enrollment_term_maximum)\n errors.add(:open_enrollment_term, \"may not exceed #{open_enrollment_term_maximum} months\")\n end\n\n open_enrollment_term_earliest_begin = effective_term.begin - open_enrollment_term_maximum\n if open_enrollment_term.begin < open_enrollment_term_earliest_begin\n errors.add(:open_enrollment_begin_on, \"may not begin more than #{open_enrollment_term_maximum} months sooner than effective date\") \n end\n\n initial_application_earliest_start_date = effective_term.begin + Settings.aca.shop_market.initial_application.earliest_start_prior_to_effective_on.months.months\n if initial_application_earliest_start_date > TimeKeeper.date_of_record\n errors.add(:effective_term, \"may not start application before #{initial_application_earliest_start_date.to_date} with #{effective_term.begin} effective date\")\n end\n\n if !['canceled', 'suspended', 'terminated','termination_pending'].include?(aasm_state)\n benefit_term_minimum = Settings.aca.shop_market.benefit_period.length_minimum.year.years\n if end_on != (effective_term.begin + benefit_term_minimum - 1.day)\n errors.add(:effective_term, \"application term period should be #{duration_in_days(benefit_term_minimum)} days\")\n end\n end\n end", "def reserved\n @book = Book.find(params[:book_id])\n @reservation = Reservation.new(\n user_id: current_user.id,\n book_id: @book.id,\n price: @book.price\n )\n @reservation.save!\n end" ]
[ "0.5994364", "0.5947343", "0.59292084", "0.5676179", "0.5608662", "0.55748254", "0.55671656", "0.5541891", "0.5539141", "0.5490904", "0.5461911", "0.54490584", "0.54376036", "0.54068834", "0.53668654", "0.5360255", "0.5356661", "0.53511155", "0.5331436", "0.5314998", "0.5302976", "0.530077", "0.5288594", "0.5274382", "0.52593654", "0.52519476", "0.5240938", "0.52372235", "0.523491", "0.52330166", "0.52330166", "0.52286494", "0.5225098", "0.52180135", "0.52163184", "0.52096933", "0.52095526", "0.5208904", "0.52043265", "0.5198216", "0.5193613", "0.5191793", "0.5189159", "0.5168959", "0.5167838", "0.5158682", "0.51582503", "0.5144899", "0.514302", "0.5142183", "0.5137613", "0.51341206", "0.51172787", "0.5116787", "0.5112964", "0.511065", "0.5108319", "0.5105414", "0.5096062", "0.50927436", "0.5088479", "0.50854105", "0.50845844", "0.507901", "0.5078009", "0.5077471", "0.50686526", "0.50584763", "0.5042699", "0.5041757", "0.5040242", "0.5032271", "0.5031257", "0.5027566", "0.5021541", "0.5020873", "0.5020873", "0.50207555", "0.50115365", "0.5004049", "0.49958816", "0.4993122", "0.49855384", "0.49807444", "0.49746838", "0.4972371", "0.49692878", "0.49620393", "0.49619547", "0.4960193", "0.49497184", "0.49474746", "0.49474746", "0.49462548", "0.49460107", "0.49458557", "0.49425027", "0.49341384", "0.492868", "0.4928287" ]
0.5163432
45
show pick_up and drop_off address on new booking map
def show_new_booking_map @pickup_address = Geocoder.search(params[:pick_up_addr]).first @dropoff_address = Geocoder.search(params[:drop_off_addr]).first @hash = Gmaps4rails.build_markers(@pickup_address) do |user, marker| marker.lat user.latitude marker.lng user.longitude marker.infowindow "PickUp Addr: "+params[:pick_up_addr] marker.picture({ "url" => "/assets/img/ico/map/ico_location_mark_a.png", "width" => 36, "height" => 36 }) end @hash1 = Gmaps4rails.build_markers(@dropoff_address) do |user, marker| marker.lat user.latitude marker.lng user.longitude marker.infowindow "DropOff Addr: "+params[:drop_off_addr] marker.picture({ "url" => "/assets/img/ico/map/ico_location_mark_b.png", "width" => 36, "height" => 36 }) end @loc_distance = Geocoder::Calculations.distance_between(params[:pick_up_addr], params[:drop_off_addr], :units=> :km).round(1) respond_to do |format| format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showpickup_address(booking_id)\n pa = PickupAddress.where(:booking_id => booking_id).last\n pa.address rescue \"\"\n end", "def showdropoff_address(booking_id)\n pa = DropoffAddress.where(:booking_id => booking_id).last\n pa.address rescue \"\"\n end", "def get_address\n booking = Booking.where(user_id: current_user.id).last\n pick_up_addr = PickupAddress.where(:booking_id => booking.id).last\n drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last\n hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address}\n respond_to do |format|\n format.json { render :json => hash.to_json, :status => 200 }\n end\n end", "def pick_address_from_list\n params.each_key do |key|\n next unless key.start_with? 'pick_address'\n\n index = key.to_s.delete_prefix('pick_address_').to_i\n\n @show_manual_address = true\n @address_read_only = true\n @address_summary = AddressSummary.new\n @address_detail = @address_list[index]\n break\n end\n end", "def shipping_address\n [name_tb.value,address1_tb.value,address2_tb.value,city_tb.value,state_tb.value,country_select.first_selected_option.text,zip_tb.value,phone_tb.value,power_adapter_select.first_selected_option.text]\n end", "def address\n \"%s %s %s %s\"%([self.prefecture_code,self.address_city,self.address_street,self.address_building])\n end", "def show\n @maps = MapsService.new\n @listing.depart_maps_id = @maps.get_address(@listing.depart_maps_id)\n @listing.dest_maps_id = @maps.get_address(@listing.dest_maps_id)\n end", "def show\n @user = current_user\n @offer = Offer.find(params[:id])\n @offer_prizes = @offer.prizes\n @offer_clients = ClientsOffer.find_all_by_offer_id(params[:id])\n\n address = @offer.branch.address\n @latitude = address.latitude\n @longitude = address.longitude\n\n addresses = Array.new\n addresses.push(address)\n @json = @offer.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "def gmaps4rails_address\n addr = if state and state.name.present?\n \"#{address_1}, #{city}, #{state.name} #{zip_code}\"\n elsif (address_1)\n \"#{address_1}, #{raw_seed}\"\n else\n \"1856 Stevenson Ave, Clearwater, Florida 33755\"\n end\n puts \"gmap input:#{addr}\"\n addr\n end", "def completeAddress\n\t\tprint \"#{streetAddress},\" \n\t\tprint \"#{cityName},\" \n\t\tprint \"#{countryName}\"\n\tend", "def address\n \"#{self.building} #{return_data_format(self.street)} #{self.zipcode}\"\n end", "def display_full_address\n [floor, full_address].join(' ')\n end", "def show\n\n @client = Yelp::Client.new\n\n @request = Location.new(\n :term => @event.topPrefs,\n :zipcode => @event.zip,\n :limit => \"3\"\n #:category_filter => @yelp_search.category_filter,\n #:radius_filter => @yelp_search.radius_filter,\n )\n\n @response = @client.search(@request)\n @businesses = @response.to_h[\"businesses\"]\n end", "def full_address\n \"#{region}, #{district}, #{street_type} #{street_name}, д. #{house_number} кв. #{apartment}\"\n end", "def filling_address_info\n\t#find and select address type=House\n find(:id, 'Address_Type_Select').click\n find(\"option[value='House']\").click\n\t#find and fill out Street Address\n find(:id, 'Street').click\n fill_in('Street Address', :with => '9750 Jones Branch Dr')\n\t#find and fill out City\n\tfind(:id, 'City').click\n\tfill_in('City', :with => 'McLean')\n\t#find and select State=VA\n\tselect('VA', from: 'Region')\n\tfind(:id, 'Postal_Code').click\n\tfill_in('Zip Code', :with => '22107-0002')\nend", "def show\n @superpower = Superpower.find(params[:id])\n @bookings = Booking.where(superpower_id: params[:id])\n @booking = Booking.new\n @power = Superpower.geocoded #returns flats with coordinates\n\n @markers = @power.map do |flat|\n {\n lat: flat.latitude,\n lng: flat.longitude\n }\n end\n # @bookings = @superpower.bookings\n end", "def gmaps4rails_address\n #describe how to retrieve the address from your model, if you use directly a db column, you can dry your code, see wiki\n \"#{self.address}, #{self.town}, #{self.province}\"\n end", "def location_bar\n\tresult = Geocoder.search(\"#{params['latitude']},#{params['longitude']}\")\n\taddress = result.first.data[\"formatted_address\"]\n\trender html: address\nend", "def pickup_locations\n # Borrow Direct requests need to provide a library-specific BD code, provided here\n bd_codes = {\n '7c5abc9f-f3d7-4856-b8d7-6712462ca007' => 'F', # Africana\n 'ab1fce49-e832-41a4-8afc-7179a62332e2' => 'I', # Catherwood ILR\n 'b232d619-3441-4fd0-b94c-210002e1fbec' => 'G', # Annex\n '041d6c8d-20a1-4fd7-8588-458286782aea' => 'B', # Law\n '4752a822-380b-446c-860f-bccf641d7118' => 'C', # Mann\n '1a072083-330f-4e1b-afa6-1ef15e24e3c3' => 'Q', # Math\n 'e2f7ad76-ef2a-454f-8fd4-712caaa0f72b' => 'O', # Uris\n '23b28dd9-cd7b-4ac1-a19a-6f4d3fce77d8' => 'E', # Vet\n '86932cca-3b71-4d29-b0e9-0680b1fffabf' => 'H', # Fine Arts\n '8eba8e43-90ae-4be5-b786-1282474301b0' => 'A', # Geneva\n 'f4b8e9e3-831b-44eb-aafe-20f583c555a1' => 'K', # Management\n 'd6756e21-b828-4a0f-9346-2a10633c3b7a' => 'J', # Math\n '1eb3510f-c403-44bf-b3ce-cf693b20ba56' => 'L', # Music\n '760beccd-362d-45b6-bfae-639565a877f2' => 'D', # Olin\n 'debc685c-e905-48d3-9571-bff4742e7249' => 'M', # Ornithology\n '4752a822-380b-446c-860f-bccf641d7118' => 'P', # Contactless pickup - Mann (?)\n '1a072083-330f-4e1b-afa6-1ef15e24e3c3' => 'Q' # Contactless pickup - Math (?)\n }\n\n # Retrieve a list of service points from FOLIO\n url = \"#{ENV['OKAPI_URL']}/service-points?limit=1000\"\n begin\n token = CUL::FOLIO::Edge.authenticate(ENV['OKAPI_URL'], ENV['OKAPI_TENANT'], ENV['OKAPI_USER'], ENV['OKAPI_PW'])[:token]\n headers = {\n 'X-Okapi-Tenant' => ENV['OKAPI_TENANT'],\n 'x-okapi-token' => token,\n :accept => 'application/json',\n }\n response = RestClient.get(url, headers)\n if response.code == 200\n points = JSON.parse(response.body)['servicepoints']\n points.sort_by! { |p| p['discoveryDisplayName'] }\n # As per discussion with Andy Horbal (1/12/22), the criteria to display a service\n # point to the user as a pickup location are:\n # 1. pickupLocation == true\n # 2. discoveryDisplayName != 'Staff Use Only' (used to indicate internal SPs for request routing)\n # 3. discoveryDisplayName doesn't start with 'Special Program Delivery'\n points.select! do |p|\n p['pickupLocation'] &&\n p['discoveryDisplayName'] != 'Staff Use Only' &&\n !(p['discoveryDisplayName'] =~ /^Special Program Delivery/)\n end\n result = points.map do |p|\n {\n name: p['discoveryDisplayName'],\n id: p['id'],\n bd_code: bd_codes[p['id']]\n }\n end\n Rails.logger.debug \"mjc12test6: results: #{result}\"\n return result\n end\n rescue RestClient::ExceptionWithResponse => err\n Rails.logger.debug \"Requests: Couldn't retrieve list of service points (#{err})\"\n return []\n end\n\n # [\n # { name: 'Africana', id: '7c5abc9f-f3d7-4856-b8d7-6712462ca007', bd_code: 'F' },\n # # { name: 'Annex Reading Room Use Only', id: '91f726ff-cbb1-4d60-821e-543ec1e91cc5', bd_code: ''},\n # { name: 'Catherwood ILR', id: 'ab1fce49-e832-41a4-8afc-7179a62332e2', bd_code: 'I'},\n # { name: 'Contactless Pickup - Annex', id: 'b232d619-3441-4fd0-b94c-210002e1fbec', bd_code: 'G'},\n # # { name: 'Contactless Pickup - Law', id: '041d6c8d-20a1-4fd7-8588-458286782aea', bd_code: 'B'},\n # { name: 'Contactless Pickup - Mann', id: '4752a822-380b-446c-860f-bccf641d7118', bd_code: 'P'},\n # { name: 'Contactless Pickup - Math', id: '1a072083-330f-4e1b-afa6-1ef15e24e3c3', bd_code: 'Q'},\n # # { name: 'Contactless Pickup - Ornithology', id: 'd2248b50-9388-4b40-83e2-b2d1200e112c', bd_code: ''},\n # { name: 'Contactless Pickup - Uris Tower', id: 'e2f7ad76-ef2a-454f-8fd4-712caaa0f72b', bd_code: 'O'},\n # { name: 'Contactless Pickup - Vet College community only', id: '23b28dd9-cd7b-4ac1-a19a-6f4d3fce77d8', bd_code: 'E'},\n # # { name: 'Faculty Department Office', id: 'a27d5cda-4810-4b58-874c-1fe1955829e3', bd_code: ''},\n # # { name: 'Fine Arts', id: '86932cca-3b71-4d29-b0e9-0680b1fffabf', bd_code: 'H'},\n # #{ name: 'Geneva Circulation', id: '8eba8e43-90ae-4be5-b786-1282474301b0', bd_code: 'A'},\n # { name: 'Law Circulation', id: '8d40f52a-02cf-4753-b423-0615d4c98479', bd_code: ''},\n # # { name: 'Management', id: 'f4b8e9e3-831b-44eb-aafe-20f583c555a1', bd_code: 'K'},\n # { name: 'Mann', id: '872beba0-1bdf-4870-95f3-8781baddc02e', bd_code: 'C'},\n # { name: 'Math', id: 'd6756e21-b828-4a0f-9346-2a10633c3b7a', bd_code: 'J'},\n # { name: 'Music', id: '1eb3510f-c403-44bf-b3ce-cf693b20ba56', bd_code: 'L'},\n # # { name: 'Nestlé', id: '8e4f5d73-2f77-4906-8d6a-329fc79c5994', bd_code: 'L'},\n # # { name: 'Olin', id: '760beccd-362d-45b6-bfae-639565a877f2', bd_code: 'D'},\n # # { name: 'Ornithology Circulation Desk', id: 'debc685c-e905-48d3-9571-bff4742e7249', bd_code: 'M'},\n # #{ name: 'Uris Clock Tower', id: 'cce94bc5-bb31-4054-96d2-260ba832ef2a'}\n # ]\n end", "def business_details_page_change_business_address(postcode: 'BS1 5AH',\n address: 'HARMSEN GROUP, TRIODOS BANK, DEANERY ROAD, BRISTOL, BS1 5AH')\n\n fill_in 'sPostcode', with: postcode\n click_button 'find_address'\n select address\n business_details_page_submit_business_details_page\n end", "def gmaps4rails_address\n \"#{address1}, #{address2}, #{city}, #{state}, #{zipcode}\"\n end", "def full_address\n addr = []\n addr << country.try(:name) if show_country\n addr << (state.try(:name).presence || state_name) if show_state\n addr << address1\n addr.compact.join(', ')\n end", "def business_details_page_enter_ltd_business_details_postcode_lookup_and_submit(companyNo: '10926928',\n companyName: 'Test Company', postcode: 'BS1 5AH',\n address: 'NATURAL ENGLAND, HORIZON HOUSE, DEANERY ROAD, BRISTOL, BS1 5AH')\n\n fill_in 'registration_company_no', with: companyNo\n fill_in 'registration_companyName', with: companyName\n fill_in 'sPostcode', with: postcode\n click_button 'find_address'\n select address\n business_details_page_submit_business_details_page\n end", "def create_full_address\n \"#{address_line1}, #{city}, #{state} #{zip}\"\n end", "def address_detail\n \"#{province.try :name}#{city.try :name}#{district.try :name}#{address}\"\n end", "def gmaps4rails_address\n \t\"#{address}, #{city}, #{state}\"\n end", "def address_book_name\n end", "def travel_and_places; end", "def add_address # rubocop:disable Metrics/AbcSize\n return unless @bib.place.any?\n\n reg = @bib.place[0].region[0].name if @bib.place[0].region.any?\n addr = [@bib.place[0].name, @bib.place[0].city, reg]\n @item.address = addr.compact.join(\", \")\n end", "def addresses\n h2 :addresses\n @record.addresses.empty? ? p('-') : addresses_table\n gap\n end", "def fill_in_with_multiple_addresses!\n expect(page).to have_content(CHOOSE_EXISTING)\n page.first('#button-new-address').trigger('click')\n fill_in_checkout_address!\n page.first('.addresses__address-use a').trigger('click')\n end", "def address\n address = \"#{self.street_address}, #{self.city}, #{self.country}\"\n \n end", "def show\n @hash = Gmaps4rails.build_markers(@check_point) do |check_point, marker|\n marker.lat check_point.latitude\n marker.lng check_point.longitude\n marker.infowindow check_point.address\n marker.json({title: check_point.address})\n end\n end", "def gmaps4rails_address\n \"#{city}, #{state}\"\nend", "def full_address\n \"#{address}, #{suburb}, #{state}, #{postcode}\"\n end", "def gmaps4rails_address\n\t\t\"#{self.street}, #{self.city}, #{self.country}\" \n\tend", "def gmaps4rails_address\n \"#{street_address}, #{postcode}, UK\"\n end", "def gmaps4rails_address\n \"#{street_address}, #{postcode}, UK\"\n end", "def address_html(item)\n html = \"\"\n \thtml += \"#{item[:address1]}<br />\"\n \tif item[:address2].present?\n \t\thtml += \"#{item[:address2]}<br />\"\n \tend\n \tif item[:address3].present?\n \t\thtml += \"#{item[:address3]}<br />\"\n \tend\n \thtml += \"#{item[:city]} \"\n \tif item[:state].present?\n \t\thtml += \" #{item[:state]} \"\n \tend\n \thtml += \"#{item[:postal]}<br />\"\n \thtml += country_name(item[:country])\n end", "def display_address\n address_list = []\n address_list << city unless city.blank?\n address_list << state unless state.blank?\n address_list << country unless country.blank?\n address_list.join(\", \")\n end", "def full_address\n return \"#{@address}, #{@apart} #{@city} #{@state}, 60611\"\n end", "def full_address\n [landmark_name, city, country].compact.join(', ')\n end", "def fill_in_checkout_address!\n expect(page).to have_content(IDENTITY)\n\n fill_in 'address[fname]', with: '薇'\n fill_in 'address[lname]', with: '李'\n fill_in 'address[mobile]', with: '13802049742'\n fill_in 'address[pid]', with: '11000019790225207X'\n\n # loop until page.all(:css, '#address_province option')[1]\n # page.all(:css, '#address_province option')[1].select_option\n # loop until page.all(:css, '#address_city option')[1]\n # page.all(:css, '#address_city option')[1].select_option\n # loop until page.all(:css, '#address_district option')[1]\n # page.all(:css, '#address_district option')[1].select_option\n\n fill_in 'address[full_address]', with: STREET\n\n # fill_in 'address[zip]', with: '300222'\n\n page.first('input[type=submit]').trigger('click')\n\n expect(page).to have_content(CHOOSE_EXISTING)\n end", "def gmaps4rails_address\n \"#{self.street}, #{self.city}, #{self.country}\" \n end", "def address\n [province_c, county_c, town_c].join(',')\n end", "def address_params\n end", "def address\n puts \"Your address is #{@city}, #{@province}\"\n end", "def pickup_or_dropoff\n if buyer_pickup?\n location = buyer_pickup_location\n \"pickup at #{location.address}, #{location.city}, #{location.state} #{location.zip}\"\n else\n \"delivered direct to customer\"\n end\n end", "def address\n\t\t\taddress = [self.address_1, self.try(:address_2), \"#{self.city} #{self.try(:state)}\", \"#{self.try(:zip)}\"].compact\n\t\t\taddress.delete(\"\")\n\t\t\taddress.join(\"<br/>\")\n\t\tend", "def delivery_address\n\t\tadd=Partay.get('http://shoponline.tescolotus.com/api/v1/Customer/', :headers => {'Content-Type' => 'application/json', 'language' => 'en-gb', 'region' => 'TH', 'userId' => access_token })\n\t\tresponse_address=JSON(add)\n\t\tself.address_info(JSON(response_address)[\"address\"][\"name\"])\n\tend", "def full_street_address\n return \"#{bAddress1}, #{bCity}, #{bState}\"\n end", "def build_address(venue)\n vname = venue['name']\n add1 = venue['address1']\n add2 = venue['address2']\n city = venue['city']\n postal_code = venue['postalCode']\n address = [add1, add2].reject { |i| i.nil? }.join ', '\n\n unless !vname || vname.nil?\n address = \"#{vname}\"\n end\n \n unless !city || city.nil?\n address = \"#{address} - #{city}\"\n end\n\n unless !postal_code || postal_code.nil?\n address = \"#{address} #{postal_code}\"\n end \n\n glink = \"\"\n \n if add1 && city && postal_code\n gmap = \"#{add1} #{add2} #{city} #{postal_code}\".squeeze(' ').gsub(/[\\s]/, '+')\n glink = \"<a class=\\\"event-map\\\" href=\\\"https://www.google.com/maps/search/#{gmap}\\\">Map</a>\"\n end\n\n [address, glink]\nend", "def address\n return \"\" unless [city, state, state_code].all?(&:present?)\n \"#{city}, #{state}(#{state_code})\"\n end", "def full_address\n \"#{address1} #{address2} #{city},#{state} #{postal_code} #{country}\"\n end", "def display_address(type)\n [self.send(\"#{type}_city\"), self.send(\"#{type}_state\")].compact.uniq.join(\", \")\n #address_list << send.(\"#{type}_city\") unless send.(\"#{type}_city\").blank?\n #address_list << send.(\"#{type}_state\") unless send.(\"#{type}_state\").blank?\n #address_list << send.(\"#{type}_country\") unless send.(\"#{type}_country\").blank?\n #address_list.join(\", \")\n end", "def full_order_to_address\n ship_address.address1 + ' ' + ship_address.address2\n end", "def set_completed_address\n if self.street && self.number\n address = \"#{ self.street }, #{ self.number }\"\n\n unless self.complement.blank?\n address += \", #{ self.complement }\"\n end\n\n if self.neighborhood\n address += \", #{ self.neighborhood }\"\n end\n\n if self.city && self.city.state\n address += \", #{ self.city.name } - #{ self.city.state.name }\"\n end\n\n address += \" - Brasil\"\n\n self.completed = address\n end\n end", "def set_for_postcode_search\n @show_manual_address = false\n @address_read_only = false\n @address_summary.postcode = ''\n @address_detail = Address.new(default_country: params[:address][:default_country])\n end", "def address_for_geocode\n add = []\n add << self.address_1\n add << self.address_2 if self.address_2.present?\n add << self.address_3 if self.address_3.present?\n add << self.city if self.city.present?\n add << self.region if self.region.present?\n add << self.postcode if self.postcode.present?\n add << (self.country.present? ? self.country : 'United Kingdom')\n add.join(', ')\n end", "def full_address\n \"#{address}, #{city}, #{state}, #{zip}\"\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 ship_to_address(options)\n for setting in [:first_name, :last_name, :company, :city, :state, :zip, :country] do\n if options[setting] then\n add_field 'x_ship_to_' + setting.to_s, options[setting]\n end\n end\n raise 'must use :address1 and/or :address2' if options[:address]\n add_field 'x_ship_to_address', (options[:address1].to_s + ' ' + options[:address2].to_s).strip\n end", "def geoAddress\n\n self.address + \",\" +self.region.name\n\n end", "def property_display_address_street_comma_with_county\n dets = self['address_details']\n \"#{dets['address_line_1']}, #{dets['city']}, #{dets['county']} COUNTY, #{dets['state'][0..1]}, #{dets['zip_code']}\".upcase\n end", "def show\n #@location = Location.find(params[:id])\n @user=User.find_by_id(params[:user_id])\n @location = Location.find_by_id(params[:id])\n a = @location.address \n \n \n @array_rest = Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n # @array_amusementpark_camp= Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n # @array_shopping = Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n\n @json = @array_rest.to_json\n #@json = array_rest.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n \n end \n \n end", "def full_address\n\t\t\"#{street}, #{postal_code}, #{city}, #{country}\"\n\tend", "def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end", "def to_html\n if address_2.blank?\n \"<div>#{address_1.strip()}</div><div>#{city}, #{state} #{zip}</div>\".html_safe\n else\n \"<div>#{address_1.strip()}</div><div>#{address_2}</div><div>#{city}, #{state} #{zip}</div>\".html_safe\n end\n end", "def billing_address(params={})\n add_field(mappings[:billing_address][:zip], params[:zip])\n add_field(mappings[:billing_address][:country], lookup_country_code(params[:country]))\n \n address = [params[:address1], params[:address2], params[:city], params[:state]].compact\n add_field('address', address.join('&#10;'))\n end", "def gmaps4rails_address\n \"#{address}, #{city_state_zip}\"\n end", "def my_pickups\n\t @select = \"pickups\"\n\t pick_bookings = Booking.find(:all, :conditions => ['status != ? and accepted_by = ?', 2, 0] )\n\t progress_bookings = Booking.find(:all, :conditions => ['accepted_by = ?', current_user.id] )\n\t @bookings = pick_bookings.concat(progress_bookings).uniq\n\t render :partial => \"pickups\"\n\tend", "def pickup_locations\n response_hash[\"PickupLocation\"] && response_hash[\"PickupLocation\"].collect {|h| h[\"PickupLocationDescription\"] }\n end", "def location_detail\n [self.city, self.state].join(\", \")\n end", "def show\r\n\t\trender_result(\r\n\t\t\tdata: @addr_country,\r\n\t\t\tmeta: {}\r\n\t\t)\r\n\tend", "def gmaps4rails_infowindow\n if occupied\n \"Room Name:#{name} <br>Room Number:#{room_number}<br>Status:Occupied<br> Description: #{description}\"\n else\n \"Room Name:#{name} <br>Room Number:#{room_number}<br>Status:Avaliable<br> Description: #{description}\"\n end\n end", "def details\n\t\"#{assigned_to} - #{status} - #{start_date} - #{description} - #{location} - #{Client.find(client_id).name}\"\nend", "def fake_address\n {\n first_name: 'Jack',\n last_name: 'Macdowall',\n company_name: 'Macdowalls',\n line_1: '1225 Invention Avenue',\n line_2: 'Birmingham',\n postcode: 'B21 9AF',\n county: 'West Midlands',\n country: 'UK'\n }\n end", "def full_address\n \"#{street_address}, #{city}, #{ISO3166::Country.new(country_code.upcase).name}\"\n end", "def getVendorAddress(profile)\n\t\tprofile.address+' '+profile.city+ ', '+profile.state\n\tend", "def show\n @booking = @boat.bookings.build(user: current_user)\n @booking.start_time = Time.zone.tomorrow + 9.hours\n @booking.end_time = Time.zone.tomorrow + 18.hours\n @booking.people_on_board = 1\n #TODO disable also booked(accepted) days\n end", "def show\n @user = current_user\n @bandtogether = Bandtogether.new\n @bandtogether.concert = Concert.find(params[:id])\n @concerts = Concert.find(params[:id]) #@concerts may also be found using the set_concert method provided by scaffolding\n @pindrop = Gmaps4rails.build_markers(@concerts) do |concert, marker|\n marker.lat concert.latitude\n marker.lng concert.longitude\n marker.infowindow concert.address\n end\n end", "def check_addresses\n\n if location = @found_params.entities.detect {|entity| entity.name == \"from\"} || @ride.start_address\n if @ride.start_address\n address = @ride.start_address\n else\n address = geocode(location.value)\n end\n\n @ride.start_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @start_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n @time = UberService.new(@ride).time_estimates\n @time = @time / 60 if @time.class == Fixnum\n\n end\n\n if location = @found_params.entities.detect {|entity| entity.name == \"to\"} || @ride.end_address\n if @ride.end_address\n address = @ride.end_address\n else\n address = geocode(location.value)\n end\n\n @ride.end_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @end_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n end\n\n if (location = @found_params.entities.detect {|entity| entity.name == \"address\"}) && (@ride.end_address || @ride.start_address)\n\n address = geocode(location.value)\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n nice_address = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n if @ride.start_address\n @ride.end_address = address\n @end_address_nice = nice_address\n else\n @ride.end_address = address\n @start_address_nice = nice_address\n end\n\n @ride.save\n end\n\n if [email protected]_address.nil? && [email protected]_address.nil?\n @price = UberService.new(@ride).price_estimates\n end\n end", "def show\n @estate = Estate.find(params[:id])\n @estates = Estate.all\n @hash = Gmaps4rails.build_markers(@estate) do |estate, marker|\n marker.lat estate.latitude\n marker.lng estate.longitude\n marker.infowindow estate.description\nend\n end", "def add_address(post, options)\n if address = options[:billing_address] || options[:address]\n post[:ci_billaddr1] = address[:address1]\n post[:ci_billaddr2] = address[:address2] if address[:address2]\n post[:ci_billcity] = address[:city]\n post[:ci_billstate] = address[:state]\n post[:ci_billzip] = address[:zip]\n post[:ci_billcountry] = address[:country]\n end\n\n if address = options[:shipping_address]\n post[:ci_shipaddr1] = address[:address1]\n post[:ci_shipaddr2] = address[:address2] if address[:address2]\n post[:ci_shipcity] = address[:city]\n post[:ci_shipstate] = address[:state]\n post[:ci_shipzip] = address[:zip]\n post[:ci_shipcountry] = address[:country]\n end\n end", "def address\n\t [inst_add1, inst_add2, inst_city, inst_state, inst_zip].compact.join(\", \")\n\tend", "def show\n @bus = Bus.find(params[:id])\n @stops = @bus.stops.order('stop_number ASC')\n @h = Hash.new\n @h[:lat] = @bus.current_lat\n @h[:lng] = @bus.current_lan\n @h[:infowindow] = \"Driver Email: \" + @bus.user.email + \"<br>Bus Number: \"+ @bus.bus_number + \"<br>\" + @bus.description + \"<br>Bus Starting Point\"\n @hash = Gmaps4rails.build_markers(@stops) do |s, marker|\n marker.lat s.latitude\n marker.lng s.longitude\n marker.infowindow s.name\n end\n @points = []\n @points << @h\n @hash.each do |h|\n @points << h\n end\n end", "def ship_to_address\n all = {}\n for key_out in [:city, :last_name, :first_name, :country, :zip, :address]\n all[key_out] = unescape params['x_ship_to_' + key_out.to_s]\n end\n \n all\n end", "def secondary_address; end", "def full_address\n [self.address, \"Madrid\", \"Spain\"].compact.join(\", \") if self.address\n end", "def shipping_address_edit\n @shipping_address = retrieve_shipping_address(@subscription_id)\n @country_codes = get_country_codes\n end", "def get_biz_names_addresses_coordinates\n @request_businesses.shift(2).map{|business|{name: business[\"name\"], address: business[\"vicinity\"], latitude: business[\"geometry\"][\"location\"][\"lat\"], longitude: business[\"geometry\"][\"location\"][\"lng\"]}}\n end", "def pickup_list(from, to, rental_location_code=nil, include_journal=false)\n\n # Get reservations\n\n conditions = {:date_from.gte => from,\n :date_from.lte => to,\n :status => [:confirmed, :in_progress, :done]}\n conditions.store(:rental_location_code, rental_location_code) if rental_location_code\n \n data = BookingDataSystem::Booking.all(\n :conditions => conditions,\n :order => [:date_from.asc, :time_from.asc]).map do |item|\n product = item.booking_lines.inject('') do |result, b_l|\n result << b_l.item_id\n b_l.booking_line_resources.each do |b_l_r|\n result << ' - '\n result << (b_l_r.booking_item_reference.nil? ? 'NO ASIGNADO' : b_l_r.booking_item_reference)\n result << ' '\n end\n result\n end\n extras = item.booking_extras.inject('') do |result, b_e|\n result << b_e.extra_description\n result << \"(#{b_e.quantity}) \"\n result\n end\n {id: item.id, date_from: item.date_from.to_date.to_datetime, time_from: item.time_from, pickup_place: item.pickup_place, product: product,\n status: item.status, customer: \"#{item.customer_name} #{item.customer_surname}\", customer_phone: item.customer_phone, customer_mobile_phone: item.customer_mobile_phone,\n customer_email: item.customer_email, flight: \"#{item.flight_airport_origin} #{item.flight_company} #{item.flight_number} #{item.flight_time}\",\n total_pending: item.total_pending, extras: extras, notes: item.notes, days: item.days, rental_location_code: item.rental_location_code}\n end\n \n # Include journal\n \n if include_journal\n journal_calendar = ::Yito::Model::Calendar::Calendar.first(name: 'booking_journal')\n event_type = ::Yito::Model::Calendar::EventType.first(name: 'booking_pickup')\n journal_events = ::Yito::Model::Calendar::Event.all(\n :fields => [:id, :from, :description],\n :conditions => {:from.gte => from, :from.lt => to+1, event_type_id: event_type.id,\n :calendar_id => journal_calendar.id},\n :order => [:from.asc]).map.each do |journal_event|\n {id: '.', date_from: journal_event.from.to_date.to_datetime,\n time_from: journal_event.from.strftime('%H:%M'), pickup_place: '', product: journal_event.description,\n status: '', customer: '', customer_phone: '', customer_mobile_phone: '',\n customer_email: '', flight: '', total_pending: 0, extras: '', notes: '', days: 0}\n end\n data.concat(journal_events)\n end\n\n data.sort! do |x, y|\n comp = x[:date_from] <=> y[:date_from]\n if comp.zero?\n begin\n Time.parse(x[:time_from]) <=> Time.parse(y[:time_from])\n rescue\n comp\n end\n else\n comp\n end\n end\n\n return data\n\n end", "def show\n # @dj_profiles = DjProfile.all\n @bookings = Booking.all\n @booking = Booking.new\n end", "def gmaps_info\n {\n title: name,\n address: location.address\n }\n end", "def full_address\n [area, city, country].compact.join(', ')\n end", "def format_address\n street + \", \" + zip\n end", "def geolocate\n \"#{self.address}\"', '\"#{self.state}\"', '\"#{self.zipcode}\"\n end", "def full_address\n \"#{address1}, #{address2}, #{city}, #{state}, #{zipcode}\"\nend", "def populate_address_data\n @address_summary = AddressSummary.new(search_params)\n @address_detail = Address.new(address_params)\n end", "def full_address\n return\"#{self.client},#{self.rep_address_one} #{self.rep_address_two},#{self.city},#{self.state},#{self.zipcode}\"\n end" ]
[ "0.67744863", "0.65876126", "0.65671104", "0.63637066", "0.6055136", "0.6049782", "0.60411626", "0.59734213", "0.594067", "0.5938259", "0.59177", "0.59027946", "0.5878054", "0.5865389", "0.5864325", "0.58348703", "0.57920045", "0.57724124", "0.57297826", "0.57114345", "0.57033396", "0.56869096", "0.5652188", "0.56496227", "0.5645415", "0.56177604", "0.5615114", "0.560646", "0.56018716", "0.55848414", "0.5577446", "0.5571935", "0.55650145", "0.5563109", "0.55617726", "0.5552243", "0.55458224", "0.55458224", "0.5544881", "0.5542773", "0.5538658", "0.5536449", "0.55268013", "0.55223465", "0.5480711", "0.5480107", "0.5475567", "0.54747266", "0.5473677", "0.5467641", "0.5461116", "0.5451903", "0.54471105", "0.5438724", "0.54333365", "0.543126", "0.5430819", "0.5429655", "0.5422438", "0.5410673", "0.5405275", "0.5402553", "0.5399203", "0.5398024", "0.539557", "0.5385966", "0.53799963", "0.5379045", "0.53726393", "0.53678", "0.5366185", "0.53660053", "0.5365279", "0.5364947", "0.53617597", "0.5354378", "0.53456813", "0.5333448", "0.533028", "0.5327511", "0.5326955", "0.5325656", "0.53167146", "0.53092986", "0.53084034", "0.530765", "0.5307394", "0.5300669", "0.52919847", "0.52814597", "0.5278366", "0.52699226", "0.52674043", "0.52662325", "0.52654725", "0.5262849", "0.5262241", "0.52608293", "0.52591586", "0.52590126" ]
0.63521314
4
recurrent pick_up and drop_off address
def get_address booking = Booking.where(user_id: current_user.id).last pick_up_addr = PickupAddress.where(:booking_id => booking.id).last drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address} respond_to do |format| format.json { render :json => hash.to_json, :status => 200 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_drop_off\n @bus1.pick_up(@person)\n assert_equal(1, @bus1.number_passengers())\n @bus1.drop_off(@person)\n assert_equal(0, @bus1.number_passengers())\n end", "def preselect_existing_address\n return unless can_preselect_address?\n\n selected_address = temp_addresses.detect { |address| address[\"uprn\"].to_s == existing_address.uprn }\n self.temp_address = selected_address[\"uprn\"] if selected_address.present?\n end", "def set_pickup\n @pickup = Pickup.find(params[:id])\n end", "def updatePlannedPickUpTime(pickUpTime)\n plannedTime = getTripPlannedTime() ;\n dropOffTime = (plannedTime ? plannedTime.dropOff : nil) ;\n updateTripPlannedTime(Trip.new(pickUpTime, dropOffTime)) ;\n end", "def pickup!\n raise NotImplementedError, \"Subclasses must implemenet :pickup!\"\n end", "def update_state\r\n case @state\r\n when STATE_PICK\r\n @ip1.copy! @ip\r\n Sketchup::set_status_text \"[WALL] Click for end of wall\"\r\n Sketchup::set_status_text \"Length\", SB_VCB_LABEL\r\n Sketchup::set_status_text \"\", SB_VCB_VALUE\r\n @state = STATE_PICK_NEXT\r\n\twhen STATE_PICK_NEXT\r\n\t\tself.draw_wall\r\n\t\treset\r\n end\r\nend", "def set_uber_pickup\n @uber_pickup = UberPickup.find(params[:id])\n end", "def toggle_pickup\n p = Package.find(params[:id])\n \n if p.picked_up \n p.picked_up = false\n p.clerk_accepted_id = nil\n p.datetime_accepted = nil\n \n if p.save\n flash[:notice] = \"Package was marked as not picked up.\"\n redirect_to packages_path\n else\n flash[:warning] = \"There was an error in marking this package as not picked up.\"\n redirect_to package_path p\n end\n else\n p.picked_up = true\n p.clerk_accepted_id = current_clerk.id\n p.datetime_accepted = Time.now.to_datetime\n if p.save\n flash[:notice] = \"Package was marked as picked up.\"\n redirect_to packages_path # or to the resident sign-up page if they arent opted in?\n else\n flash[:warning] = \"There was an error in marking this package as picked up.\"\n redirect_to package_path p\n end\n end\n end", "def toggle_picked_up\n @order = Order.find(params[:id]).toggle_pickup!\n redirect_back fallback_location: '/order_seasons/' + params[:id] + \"/orders\"\n end", "def updatePlannedDropOffTime(dropOffTime)\n plannedTime = getTripPlannedTime() ;\n pickUpTime = (plannedTime ? plannedTime.pickUp : nil) ;\n updateTripPlannedTime(Trip.new(pickUpTime, dropOffTime)) ;\n end", "def pick_address_from_list\n params.each_key do |key|\n next unless key.start_with? 'pick_address'\n\n index = key.to_s.delete_prefix('pick_address_').to_i\n\n @show_manual_address = true\n @address_read_only = true\n @address_summary = AddressSummary.new\n @address_detail = @address_list[index]\n break\n end\n end", "def backlog; end", "def backlog; end", "def reap; end", "def pick_up_from_stop(bus_stop)\n for passenger in bus_stop.get_queue_copy()\n pick_up(passenger)\n end\n bus_stop.clear_queue # the bus stop is responsible for doing this\n end", "def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end", "def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end", "def dropOff(simulator)\n end", "def pickup_url\n @pickup_url\n end", "def set_drop_off\n @drop_off = DropOff.find(params[:id])\n end", "def check_down; end", "def pickup?\n @status == STATUS_PICKUP\n end", "def on_state_timeup(state_id)\n end", "def onRButtonDown(flags, x, y, view)\r\n ph = view.pick_helper\r\n ph.do_pick x,y\r\n ent = ph.best_picked\r\n focus_control\r\n end", "def rep_address\n wizard_address_step(STEPS)\n end", "def check_pickups\n @game_state.pickups.select { |pickup| pickup.collides?(self) }.each do |pickup|\n pickup.apply!(self)\n @game_state.pickups.delete(pickup)\n end\n end", "def onRButtonDown(flags, x, y, view)\n ph = view.pick_helper\n ph.do_pick x,y\n ent = ph.best_picked\n focus_control\n end", "def pickUp(simulator)\n end", "def rolldown\n\t\t\tpush [:swap]\n\t\t\tdip\n\t\t\tswap\n\t\tend", "def allowed_to_wait_to_clear_pickup?\n true # Currently, transition is always allowed.\n end", "def across_pool_state\n super\n end", "def select_address(address, user_or_order, bill_or_ship)\n item_selector = address_radio_selector(address, user_or_order, bill_or_ship)\n choose(item_selector[1..-1]) # Skip '#' character in ID string using 1..-1\n end", "def borrowed\n self.decrement!(:availability)\n end", "def leeway; end", "def leeway; end", "def restore_pop\n\nend", "def previous_autolist; end", "def step_up(address)\n client = direct_client(address)\n start = Mongo::Utils.monotonic_time\n loop do\n begin\n client.database.command(replSetStepUp: 1)\n break\n rescue Mongo::Error::OperationFailure => e\n # Election failed. (125)\n if e.code == 125\n # Possible reason is the node we are trying to elect has deny-listed\n # itself. This is where {replSetFreeze: 0} should make it eligible\n # for election again but this seems to not always work.\n else\n raise\n end\n\n if Mongo::Utils.monotonic_time > start + 10\n raise e\n end\n end\n end\n reset_server_states\n end", "def change_address\n @change_address || @inputs.keys.first\n end", "def process_up\n Input.update\n deactivate\n call_handler(:up)\n end", "def fill_in_address_personal_order\n # if not on the cart page, go there\n (URI.parse(current_url).path == '/cart') ? nil : (visit '/cart')\n # click checkout to start address process\n all(:xpath, '//button[@id=\"checkout-link\"]')[0].click # \"Checkout\"\n #select personal order\n choose 'order_retail_staff_order_detail_attributes__destroy_1'\n # fill in billing/contact info\n fill_in_billing_info_macro(FactoryGirl.create(:bill_address))\n #use same shipping as billing address\n check 'order_use_billing'\n # continue to shipping\n click_button I18n.t('actions.save_and_continue_to_delivery') # \"Continue to Shipping\"\nend", "def test_pick_up\n @bus1.pick_up(@person)\n assert_equal(1, @bus1.number_passengers())\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def extra_state; end", "def pickups\n @users.map { |u| u.pickup }.uniq\n end", "def initialize(opts = {})\n @addr = opts[:addr] || '0x20'\n @i2cbus = opts[:i2cbus] || 1\n @int = opts[:int] || nil\n @stub = opts[:stub]\n @state = read_state\n @pins = Array.new(8) {|i| Pin.new self, i }\n @rsm = Mutex.new\n @on_change_blocks = []\n @q_check_state = Queue.new\n\n return if @stub\n\n # FIXME event can be missed between firing these\n # probably could be fixed by doing read after setting up a hook\n if @int\n system(\"gpio -g mode #{@int} in\")\n Catcher.thread(\"check state\") do\n loop do\n @q_check_state.pop\n sleep 0.3 # let gpio wfi command start\n puts \"double check\"\n prev_state = nil\n decide = nil\n new_state = nil\n @rsm.synchronize do\n prev_state = @state\n puts \"GO prev_state #{prev_state}\"\n @state = read_state\n new_state = @state\n puts \"GO new state #{@state}\"\n decide = (@state != prev_state)\n end\n if decide #@state != prev_state # in case many PCFs are connected to single interrupt\n Catcher.thread \"pcf on change blocks\" do\n #puts \"##{@number} change!: #{prev_state} -> #{new_state} GOT ONE =====\"\n @on_change_blocks.each {|b| b.call(prev_state,new_state) }\n end\n end\n end\n end\n\n Catcher.thread(\"pin listen\") do\n begin\n loop do\n @q_check_state.push true\n `gpio -g wfi #{@int} both`\n prev_state = nil\n decide = nil\n new_state = nil\n @rsm.synchronize do\n prev_state = @state\n puts \"prev_state #{prev_state}\"\n #sleep 0.01\n @state = read_state\n new_state = @state\n puts \"new state #{@state}\"\n decide = (@state != prev_state)\n end\n if decide #@state != prev_state # in case many PCFs are connected to single interrupt\n Catcher.thread \"pcf on change blocks\" do\n puts \"##{@number} change!: #{prev_state} -> #{new_state}\"\n @on_change_blocks.each {|b| b.call(prev_state, new_state) }\n end\n end\n end\n rescue Exception => e\n puts \"SHIT #{e}\"\n end\n end\n end\n end", "def enter_pending; end", "def pickup_locations\n # Borrow Direct requests need to provide a library-specific BD code, provided here\n bd_codes = {\n '7c5abc9f-f3d7-4856-b8d7-6712462ca007' => 'F', # Africana\n 'ab1fce49-e832-41a4-8afc-7179a62332e2' => 'I', # Catherwood ILR\n 'b232d619-3441-4fd0-b94c-210002e1fbec' => 'G', # Annex\n '041d6c8d-20a1-4fd7-8588-458286782aea' => 'B', # Law\n '4752a822-380b-446c-860f-bccf641d7118' => 'C', # Mann\n '1a072083-330f-4e1b-afa6-1ef15e24e3c3' => 'Q', # Math\n 'e2f7ad76-ef2a-454f-8fd4-712caaa0f72b' => 'O', # Uris\n '23b28dd9-cd7b-4ac1-a19a-6f4d3fce77d8' => 'E', # Vet\n '86932cca-3b71-4d29-b0e9-0680b1fffabf' => 'H', # Fine Arts\n '8eba8e43-90ae-4be5-b786-1282474301b0' => 'A', # Geneva\n 'f4b8e9e3-831b-44eb-aafe-20f583c555a1' => 'K', # Management\n 'd6756e21-b828-4a0f-9346-2a10633c3b7a' => 'J', # Math\n '1eb3510f-c403-44bf-b3ce-cf693b20ba56' => 'L', # Music\n '760beccd-362d-45b6-bfae-639565a877f2' => 'D', # Olin\n 'debc685c-e905-48d3-9571-bff4742e7249' => 'M', # Ornithology\n '4752a822-380b-446c-860f-bccf641d7118' => 'P', # Contactless pickup - Mann (?)\n '1a072083-330f-4e1b-afa6-1ef15e24e3c3' => 'Q' # Contactless pickup - Math (?)\n }\n\n # Retrieve a list of service points from FOLIO\n url = \"#{ENV['OKAPI_URL']}/service-points?limit=1000\"\n begin\n token = CUL::FOLIO::Edge.authenticate(ENV['OKAPI_URL'], ENV['OKAPI_TENANT'], ENV['OKAPI_USER'], ENV['OKAPI_PW'])[:token]\n headers = {\n 'X-Okapi-Tenant' => ENV['OKAPI_TENANT'],\n 'x-okapi-token' => token,\n :accept => 'application/json',\n }\n response = RestClient.get(url, headers)\n if response.code == 200\n points = JSON.parse(response.body)['servicepoints']\n points.sort_by! { |p| p['discoveryDisplayName'] }\n # As per discussion with Andy Horbal (1/12/22), the criteria to display a service\n # point to the user as a pickup location are:\n # 1. pickupLocation == true\n # 2. discoveryDisplayName != 'Staff Use Only' (used to indicate internal SPs for request routing)\n # 3. discoveryDisplayName doesn't start with 'Special Program Delivery'\n points.select! do |p|\n p['pickupLocation'] &&\n p['discoveryDisplayName'] != 'Staff Use Only' &&\n !(p['discoveryDisplayName'] =~ /^Special Program Delivery/)\n end\n result = points.map do |p|\n {\n name: p['discoveryDisplayName'],\n id: p['id'],\n bd_code: bd_codes[p['id']]\n }\n end\n Rails.logger.debug \"mjc12test6: results: #{result}\"\n return result\n end\n rescue RestClient::ExceptionWithResponse => err\n Rails.logger.debug \"Requests: Couldn't retrieve list of service points (#{err})\"\n return []\n end\n\n # [\n # { name: 'Africana', id: '7c5abc9f-f3d7-4856-b8d7-6712462ca007', bd_code: 'F' },\n # # { name: 'Annex Reading Room Use Only', id: '91f726ff-cbb1-4d60-821e-543ec1e91cc5', bd_code: ''},\n # { name: 'Catherwood ILR', id: 'ab1fce49-e832-41a4-8afc-7179a62332e2', bd_code: 'I'},\n # { name: 'Contactless Pickup - Annex', id: 'b232d619-3441-4fd0-b94c-210002e1fbec', bd_code: 'G'},\n # # { name: 'Contactless Pickup - Law', id: '041d6c8d-20a1-4fd7-8588-458286782aea', bd_code: 'B'},\n # { name: 'Contactless Pickup - Mann', id: '4752a822-380b-446c-860f-bccf641d7118', bd_code: 'P'},\n # { name: 'Contactless Pickup - Math', id: '1a072083-330f-4e1b-afa6-1ef15e24e3c3', bd_code: 'Q'},\n # # { name: 'Contactless Pickup - Ornithology', id: 'd2248b50-9388-4b40-83e2-b2d1200e112c', bd_code: ''},\n # { name: 'Contactless Pickup - Uris Tower', id: 'e2f7ad76-ef2a-454f-8fd4-712caaa0f72b', bd_code: 'O'},\n # { name: 'Contactless Pickup - Vet College community only', id: '23b28dd9-cd7b-4ac1-a19a-6f4d3fce77d8', bd_code: 'E'},\n # # { name: 'Faculty Department Office', id: 'a27d5cda-4810-4b58-874c-1fe1955829e3', bd_code: ''},\n # # { name: 'Fine Arts', id: '86932cca-3b71-4d29-b0e9-0680b1fffabf', bd_code: 'H'},\n # #{ name: 'Geneva Circulation', id: '8eba8e43-90ae-4be5-b786-1282474301b0', bd_code: 'A'},\n # { name: 'Law Circulation', id: '8d40f52a-02cf-4753-b423-0615d4c98479', bd_code: ''},\n # # { name: 'Management', id: 'f4b8e9e3-831b-44eb-aafe-20f583c555a1', bd_code: 'K'},\n # { name: 'Mann', id: '872beba0-1bdf-4870-95f3-8781baddc02e', bd_code: 'C'},\n # { name: 'Math', id: 'd6756e21-b828-4a0f-9346-2a10633c3b7a', bd_code: 'J'},\n # { name: 'Music', id: '1eb3510f-c403-44bf-b3ce-cf693b20ba56', bd_code: 'L'},\n # # { name: 'Nestlé', id: '8e4f5d73-2f77-4906-8d6a-329fc79c5994', bd_code: 'L'},\n # # { name: 'Olin', id: '760beccd-362d-45b6-bfae-639565a877f2', bd_code: 'D'},\n # # { name: 'Ornithology Circulation Desk', id: 'debc685c-e905-48d3-9571-bff4742e7249', bd_code: 'M'},\n # #{ name: 'Uris Clock Tower', id: 'cce94bc5-bb31-4054-96d2-260ba832ef2a'}\n # ]\n end", "def reset\n @assigned = false\n end", "def take_off!\n\t\t@flying = true\n\t\tself\n\tend", "def getPickUpTime()\n @tripViaPoint.pickUp.time ;\n end", "def grab!; @grabbed = true; end", "def drop_off_package package_id\n return false if package_id.nil?\n current = self.package\n if current and self.status == CONSTANT['BOX_DELIVERING']\n current.status = CONSTANT['PACKAGE_WAITING_FOR_DELIVERY']\n self.status = CONSTANT['BOX_IDLE']\n self.package = nil\n self.access.clear\n self.save!\n current.save!\n Logging.log_manual_action self, current\n elsif current\n return false\n end\n if self.status == CONSTANT['BOX_IDLE']\n package = Package.find package_id\n return false if package.nil?\n prev_box = package.box\n if prev_box\n package.status = CONSTANT['PACKAGE_WAITING_FOR_DROP_OFF']\n package.save!\n Logging.log_manual_action prev_box, package\n prev_box.status = CONSTANT['BOX_IDLE']\n prev_box.package = nil\n # save it later if the new assignment is successful\n end\n return false if package.status != CONSTANT['PACKAGE_WAITING_FOR_DROP_OFF'].to_i\n package.box_id = self.id\n package.status = CONSTANT['PACKAGE_ENROUTE_DROP_OFF']\n if package.save\n self.status = CONSTANT['BOX_RETURNING']\n if self.save\n pin = self.access.generate_pin\n if pin\n package.user.send_drop_off_pin pin\n Logging.log_manual_action self, package\n if prev_box\n prev_box.access.clear\n prev_box.save!\n end\n return true\n end\n end\n end\n end\n return false\n end", "def store_cherry_pick_state; end", "def store_cherry_pick_state; end", "def onLButtonDown(flags,x,y,view)\n [email protected]\n ParametricCopy::run(pickpoint)\n Sketchup.send_action(\"selectSelectionTool:\")\n end", "def update_state(record, bang)\n record.send(\"#{machine.attribute}=\", @options[:to])\n bang ? record.save! : record.save\n end", "def correct_pickup\n @user = current_user\n @pickup = Pickup.find(params[:id])\n redirect_to(root_url) unless @pickup.user_id == @user.id\n end", "def robin; end", "def address=(val)\n old = @address\n @address = val\n [@got, @plt, @symbols].compact.each do |tbl|\n tbl.each_pair { |k, _| tbl[k] += val - old }\n end\n @one_gadgets&.map! { |off| off + val - old }\n end", "def pending_pickup?\n @is_pending_pickup\n end", "def pick_up\n\n slow_type(\"\\nHere's what's in #{find_room_by_id(@current_room_id).name}:\\n\")\n\n current_cell_items.each do |item_id|\n item = find_item_by_id(item_id)\n puts \"#{item.name}\" unless @inventory.include?(item.item_id) || item.show_item == false || item.class == Person\n end\n \n pick_up = TTY::Prompt.new\n\n choices = []\n current_cell_items.each do |item_id|\n item = find_item_by_id(item_id)\n choices << { name: item.name, value: item.item_id } unless @inventory.include?(item.item_id) || item.show_item == false || item.class == Person\n end\n \n input = pick_up.select(slow_type(\"\\nWhat would you like to pick up?\\n\"), choices)\n\n # RUN PICK UP RULES TO CHECK IF WE CAN PICK IT UP\n\n if current_cell_items.include?(input) && [email protected]?(input)\n pick_up_checks(input)\n\n else current_cell_items.include?(input) && [email protected]?(input)\n put_item_in_inventory(input)\n end\n end", "def drop_item; self['DropItem'] = 1 end", "def pickup(options = {})\n Request::Pickup.new(@credentials, options).process_request\n end", "def address; end", "def address; end", "def address; end", "def address; end", "def off(pin=@pin)\n super(pin)\n end", "def setup_rem_state\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n c = @acts[2] || 100\n c = c/100.0 if c.integer?\n if area_flag\n target_array.each do |t|\n if chance(c)\n t.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(t)\n end\n end\n return\n end\n return unless target\n if chance(c)\n target.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(target)\n end\n end", "def default_back_up( current_results, cur_user )\n\t\t#the the current_results number of items is less than 20 is the reason why we're in here\n\t\tusername = cur_user.email\n\t\ttarget_country = cur_user.lives_in \n\t\tuser_traveled_list = cur_user.has_been_to\n\t\tarray_string = get_name_list( user_traveled_list )\n\t\tmatch_exp = \"(user)-[:lives_in]->(country:Country)<-[lives_in]-(user2),(user2)-[:has_been_to]->(traveled_list:Country) \"\n\t\twhere_exp = \"country.name = '#{target_country.name}' AND traveled_list.name IN #{array_string} AND user2.email <> '#{username}'\"\n\t\tback_up_matches = User.query_as(:users).match(user2: User).match(\"#{match_exp}\").where(\"#{where_exp}\").return('user2.uuid').to_a\n\n\t\tcurrent_results = current_results.to_a\n\t\tid_list = Array.new\n\n\t\tcurrent_results.each do |current_item|\n\t\t id_list << current_item.uuid\n\t\tend\n\n\t\tcurrent_results.concat(back_up_matches)\n\n\t\twhere_exp = \"users.email <> '#{username}'\"\n\t\tif current_results.length < 10\n\n\t\t default = User.query_as(:users).where(\"#{where_exp}\").proxy_as(User, :users).paginate(:page => params[:page], per_page: 10, return: :'distinct users')\n\t\t return default\n\t\telse\n\t\t where_exp << \"AND users.uuid IN #{id_list}\"\n\t\t join_match = User.query_as(:users).where(\"#{where_exp}\").proxy_as(User, :users).paginate(:page => params[:page], per_page: 10, return: :'distinct users')\n\t\t return join_match\n\t\tend\n\tend", "def take\n @dummy_num -= 1\n refresh\n end", "def pull; end", "def rollup\n\t\t\tswap\n\t\t\tpush [:swap]\n\t\t\tdip\n\t\tend", "def got_address(_)\n self.getting = false\n connect!\n end", "def before_address\n @order.bill_address ||= current_user.try(:bill_address).try(:clone) || Address.new(:country => default_country)\n @order.ship_address ||= current_user.try(:ship_address).try(:clone) || Address.new(:country => default_country)\n end", "def recall; end", "def initialize(pick_up, drop_off, distance, cost, driver, passenger)\n @pick_up = pick_up\n @drop_off = drop_off\n @distance = distance\n @cost = cost\n\n # ⭐️ belongs to driver\n @driver = driver\n\n # ⭐️ belongs to passenger\n @passenger = passenger\n\n @@all << self\n end", "def reset(view)\n # This variable keeps track of which point we are currently getting\n @state = 0\n \n # Display a prompt on the status bar\n Sketchup::set_status_text(\"Select Stretch Start Point\", SB_PROMPT)\n \n # clear the InputPoints\n @ip1.clear\n @ip2.clear\n \n if( view )\n view.tooltip = nil\n view.invalidate if @drawn\n end\n \n @drawn = false\n @dragging = false\n \tSketchup.active_model.commit_operation\n \tif @initial_comp_selected == false \n \t\tSketchup.active_model.selection.clear()\n \t\t@ci = nil\n \tend\t\n end", "def check_down=(_arg0); end", "def pickup_delay=(v) self['PickupDelay'] = v end", "def my_drop_orders\n return Order.where(:status => 'washed', :dropper_id => self.id) if self.pickup_boy?\n end", "def resetp(oldp,newp,notify=false)\n end", "def pickup_or_dropoff\n if buyer_pickup?\n location = buyer_pickup_location\n \"pickup at #{location.address}, #{location.city}, #{location.state} #{location.zip}\"\n else\n \"delivered direct to customer\"\n end\n end", "def unsettled; @receiver_impl.getUnsettled; end", "def borrower\n end", "def roll(pins_knocked_down)\n \nend", "def onLButtonDown(flags, x, y, view)\n # When the user clicks the first time, we switch to getting the\n # second point. When they click a second time we create the line\n if( @state == 0 )\n @ip1.pick view, x, y\n if( @ip1.valid? )\n @state = 1\n Sketchup::set_status_text $exStrings.GetString(\"Select second end\"), SB_PROMPT\n @xdown = x\n @ydown = y\n end\n else\n # create the line on the second click\n if( @ip2.valid? )\n self.create_geometry(@ip1.position, @ip2.position,view)\n self.reset(view)\n end\n end\n \n # Clear any inference lock\n view.lock_inference\nend", "def package_picked_up\n self.status = CONSTANT['BOX_IDLE']\n package = self.package\n package.user.send_picked_up_notification #TODO\n package.status = CONSTANT['PACKAGE_DONE_DELIVERY']\n if package.save\n self.package = nil\n if self.save\n if self.access.clear\n return true\n end\n end\n end\n return false\n end", "def states; end", "def recup_handle\n\t\t\n\tend", "def jump_back\n @banned_points[@path.last.hash] = @path.pop\n @current_point = @path.last || (@path << @start_vector).last\n @current_cost = get_cost @current_point\n @banned_points.delete @start_vector.hash\n @initial_run = true\n if @debug_level > 1\n puts \"Jumping back\"\n puts \"Banning #{@banned_points.last.inspect}\"\n end\n end", "def choose(choices)\n choices.each { |choice|\n # avoid any duplicate positions\n if @free.delete( choice ) then\n callcc { |fk|\n @back << fk\n return choice\n }\n @free.unshift choice\n end\n }\n failure\n end", "def backtrack(input_elist)\n\n\t\telist = Marshal.load(Marshal.dump(input_elist))\n\n\t\t# sort events based on slack\n\t\telist.sort! do |event1, event2|\n\t\t\tget_slack(event1) <=> get_slack(event2)\n\t\tend\n\t\t\n\t\t# find next event to assign (the one with the least slack) and remove from event list\n\t\tcurr_event = elist.delete_at(0)\n\n\t\t# make array of all possible start times for current event\n\t\tstart_vals = []\n\t\tcurr_event.times.each do |t|\n\t\t\tfor i in t[0]..(t[1]-curr_event.length)\n\t\t\t\tstart_vals.push(i)\n\t\t\tend\n\t\tend\n\t\tputs \"starting #{curr_event.name}, all times: #{curr_event.times}\"\n\t\t# try each assigning each possible value until one works\n\t\tstart_vals.each do |v1|\n\t\t\tv2 = v1+curr_event.length\n\t\t\tcurr_event.times=([[v1,v2]])\n\n\t\t\t# uses 1 room for the chosen time value\n\t\t\t# make an array containing every room that is available for the entire chosen time bracket\n\t\t\tintersect = @availability[v1]\n\t\t\tfor i in (v1+1)...v2\n\t\t\t\tintersect = intersect & @availability[i]\n\t\t\tend\n\t\t\tputs \"looking for room for #{curr_event.name} from #{v1} to #{v2}. Available: #{intersect}\"\n\t\t\t#puts \"available times for next event: #{elist[0].times}\"\n\t\t\t# assign curr_event to the first room in the array of available rooms\n\t\t\tunless intersect.empty?\n\t\t\t\t# variable to store name of room; used later if chosen time value fails\n\t\t\t\tcurr_room = intersect[0]\n\n\t\t\t\t@roomhash[curr_room].push(curr_event)\n\n\t\t\t\t# this room becomes unavailable for every hour in the chosen time bracket\n\t\t\t\tfor i in v1...v2\n\t\t\t\t\t@availability[i].delete(curr_room)\n\t\t\t\tend\n\n\t\t\t\tputs \"trying #{curr_event.name} from #{v1} to #{v2} in #{curr_room}\"\n\t\t\telse\n\t\t\t\t# no available room; skip the rest of this iteration of the loop\n\t\t\t\tnext\n\t\t\tend\n\t\t\t\n\t\t\t# base case - have assigned values to every event from original list\n\t\t\tif elist.empty?\n\t\t\t\treturn [curr_event]\n\t\t\tend\n\t\t\t\n\t\t\t# store current state of events list, to revert back to later if this path fails\n\t\t\ttemp_elist = Marshal.load(Marshal.dump(elist))\n\n\t\t\t# check for host conflicts - a host can't be at 2 events at the same time\n\t\t\telist.each do |e|\n\t\t\t\tcurr_event.hosts.each do |h|\n\t\t\t\t\t# for each event, if it shares a host with curr_event\n\t\t\t\t\tif e.hosts.include?(h)\n\t\t\t\t\t\ttrim_times(e,v1,v2)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\t# re-sort & check slack; if any events have a negative amount of slack, this time assignment doesn't work\n\t\t\telist.sort! do |event1, event2|\n\t\t\t\tget_slack(event1) <=> get_slack(event2)\n\t\t\tend\n\t\t\t\n\t\t\tif get_slack(elist[0]) >= 0\n\n\t\t\t\t# this time assignment works; recursively call backtrack algorithm to assign a time to the next event in the list\n\t\t\t\tresult = backtrack(elist)\n\t\t\t\treturn result + [curr_event] unless result==\"fail\"\n\t\t\tend\n\t\t\t\n\t\t\t# didn't return success in if statements; remove v from potential start times,\n\t\t\t# remove curr_event from room hash, reset room availability, un-trim altered times\n\t\t\t# for i in v1..v2\n\t\t\t# \t@availability[i] += 1\n\t\t\t# end\n\t\t\tfor i in v1...v2\n\t\t\t\t@availability[i].push(curr_room)\n\t\t\tend\n\t\t\troomhash[curr_room].delete(curr_event)\n\t\t\telist = Marshal.load(Marshal.dump(temp_elist))\n\t\tend\n\n\t\t# went through all recursive calls without returning a success\n\t\tputs \"returning fail on #{curr_event.name}\"\n\t\treturn \"fail\"\n\tend" ]
[ "0.59913915", "0.54354763", "0.5411594", "0.5289057", "0.52543163", "0.5247747", "0.5221226", "0.51953673", "0.5114895", "0.51058376", "0.5054755", "0.5032971", "0.5032971", "0.5018826", "0.49849388", "0.4968024", "0.4968024", "0.49610198", "0.49473", "0.49436817", "0.49205196", "0.49144307", "0.49137083", "0.49096742", "0.48950166", "0.4891094", "0.4884791", "0.48587376", "0.4856337", "0.48548758", "0.48411432", "0.4838658", "0.4831037", "0.4822771", "0.4822771", "0.48167092", "0.48143902", "0.4810509", "0.48029768", "0.4772903", "0.4762151", "0.47601253", "0.47552195", "0.47552195", "0.47552195", "0.47552195", "0.47552195", "0.47552195", "0.47552195", "0.47552195", "0.47445652", "0.47362167", "0.47350612", "0.4731911", "0.47157684", "0.471184", "0.4704846", "0.46967858", "0.46959376", "0.4692904", "0.46897015", "0.46897015", "0.46815556", "0.4673829", "0.46648023", "0.46617183", "0.46601558", "0.46523455", "0.46507877", "0.46492642", "0.46414477", "0.46400958", "0.46400958", "0.46400958", "0.46400958", "0.46348074", "0.46299177", "0.4626266", "0.4622913", "0.4617016", "0.46126148", "0.46068275", "0.46066278", "0.46043837", "0.4603408", "0.46006092", "0.45999652", "0.45977473", "0.4590957", "0.45885652", "0.45882344", "0.45871946", "0.45813805", "0.45786285", "0.4578015", "0.4574473", "0.45698926", "0.45643824", "0.45589146", "0.45571935", "0.45419973" ]
0.0
-1
handling booking parameters of booking tab
def booking_params params[:booking][:user_id] = current_user.id vehicle_type_id = params[:booking][:vehicle_preferences_attributes].first[1][:vehicle_type_id] pickup_date = params[:booking][:pickup_datetime] pickup_time = params[:booking][:pickup_time] dropoff_date = params[:booking][:return_pickup_datetime] dropoff_time = params[:booking][:dropoff_time] pickup_addr = params[:booking][:pickup_addresses_attributes].first[1][:address] params[:booking][:taxi_info_id] = booking_texi(vehicle_type_id, pickup_date, pickup_time, dropoff_date, dropoff_time, pickup_addr) params.require(:booking).permit(:dropoff_address, :via_address, :number_of_bags, :number_of_passengers, :booked_hours, :flight_info, :recurrent_type,:passenger_name, :passenger_phone_no, :passenger_email, :pickup_datetime, :return_pickup_datetime, :pickup_time, :dropoff_time, :user_id, :taxi_info_id, :vehicle_preferences_attributes => [:number_of_vehicle, :booking_id, :vehicle_type_id], :pickup_addresses_attributes => [:address, :booking_id], :dropoff_addresses_attributes => [:address, :booking_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def booking_params\n params[:booking]\n end", "def booking_params\n if ['index', 'destroy'].include?(params[:action])\n params.permit(:booking)\n else\n params.require(:booking).permit(:date_in, :date_out, :hotel_id,:user_id,:status)\n end\n\n end", "def show_booking_screen\n @arrival_date = params[\"arrival_date\"] || \"12/25/2012\" \n @departure_date = params[\"departure_date\"] || \"12/30/2012\"\n rooms = JSON.parse(params[\"rooms\"])\n params[\"number_of_rooms\"] = rooms.size\n room_info1 = params[\"room_info1\"]\n room_info2 = params[\"room_info2\"]\n room_detail = JSON.parse(params[\"room_detail\"])\n hotel_id = params[\"id\"]\n # reconvert into hash\n @room = JSON.parse(params[\"room\"])\n @money_sign = params[\"money_sign\"]\n @room_detail = room_detail[\"descriptionLong\"].to_s\n @room_detail_short = room_detail[\"description\"].to_s\n @cancellationPolicy = params[\"cancellation_policy\"].to_s\n book_room = JSON.parse(params[\"book_info\"])\n @number_of_rooms = rooms.size\n @noti_fee = book_room[\"checkInInstructions\"]\n @hotel_name = book_room[\"hotelName\"]\n @hotel_id = book_room[\"hotelId\"]\n @room_info = params[\"room_info\"]\n @hotel_rating = params[\"hotel_rating\"]\n @address = params[\"address\"]\n @city = params[\"city\"]\n @stateProvinceCode = params[\"stateProvinceCode\"]\n @countryCode = params[\"countryCode\"]\n @bed_types = hotel_service.get_bed_type(@room[\"BedTypes\"])\n @smoking_preferences = SMOKING_PREFERRNCES\n @credit_card_types = CREDIT_CARD_TYPES\n @check_in_time = params[\"check_in_time\"]\n @check_out_time = params[\"check_out_time\"]\n end", "def booking_params\n params.fetch(:booking, {})\n end", "def booking_params\n params.require(:booking).permit(:status, :destination_id,:price, :number_guests, :start_date, :end_date, :accommodation_id)\n end", "def booking_params\n params.require(:booking).permit(:start_day, :end_day, :hikers_nb, :user_id, :refuge_id, :status, :payment, :amount)\n end", "def booking_params\n if params['booking'].nil?\n {}\n else\n params.require(:booking).permit(:date_in, :date_out, :comment, :no_persons)\n end\n end", "def booking_params\n params.fetch(:booking).permit(:checkin, :checkout, :occupancy)\n end", "def booking_params\n params.require(:booking).permit(:status, :seatsToBook, :username, :tourname, :user_id, :tour_id, :mode_of_booking)\n end", "def booking_params\n params.require(:booking).permit(\n :ad_item_id, :starts_at, :ends_at, :ends_at_date,\n :ends_at_time, :starts_at_date, :starts_at_time, :status,\n :user_payment_card_id\n )\n end", "def booking_params\n params.require(:booking).permit(:no_of_seats, :user_id, :tour_id, :option)\n end", "def booking_params\n params.require(:booking)\n .permit(:user_id, :hotel_id, :room_id, :check_in_date, :check_out_date, :stay_description)\n end", "def booking_params\n params.require(:booking).permit(:seller_id, :buyer_id, :room_id, :first_name, :last_name,\n :email, :phone, :duration, :guest, :subtotal, \n :service_fee, :total, :room_name, :room_title, :status, :paid,\n :check_in, :check_out, :start_date, :booking_code, :payment_method)\n end", "def booking_params\n params.require(:booking).permit(:booking_reference, :institution, :ticket_type, :access_req, :catering, :certificate, :attended, :dietary_req, :conference_id, :user_id)\n end", "def booking_params\n params.permit(:start_time, :finish_time, :description, :room_id, :room_colour)\n end", "def booking_params\n params.require(:booking).permit(:user_id, :room_id, :book_date, :timespot_id)\n end", "def booking_params\n params.require(:booking).permit(:bookingStartDate, :bnookigEndDate, :user_id, :book_id)\n end", "def booking_params\n params.permit(:date, :name, :description,\n :beginning_hour, :ending_hour)\n end", "def booking_params\n params.permit(:user_id, :job_id, :acceptance)\n end", "def booking_params\n params.fetch(:booking, {}).permit(:user_id, :seat_id, :start_at, :end_at)\n end", "def booking_params\n params.require(:booking).permit(:booking_date, :user_id, :description)\n end", "def booking_params\n params.require(:booking).permit(:campground_id, :client_id, :status, :arrival_date, :departure_date)\n end", "def booking_params\n params.require(:booking).permit( :check_in, :checkout, :service_id)\n end", "def booking_params\n params.fetch(:booking, {})\n end", "def booking_params\n params.fetch(:booking).permit(:customer_id,:tour_id,:seats_booked,:preference)\n end", "def booking_params\n params.require(:booking).permit(:date_check_in, :date_check_out,\n :total_price, :status, :description)\n end", "def booking_params\n params.require(:booking).permit(:interval, :name)\n end", "def booking_params\n params.require(:booking).permit(:cut, :wash, :colour)\n end", "def booking_params\n params.require(:booking).permit(:user_id, :home_id, :start_date, :end_date, :price)\n end", "def booking_params\n params.require(:booking).permit(:book_name, :book_date, :tour_name, :book_price, :book_ticket_num,:book_amount,:package_id,:user_id,:status,:tax,:total_amount,:other)\n end", "def booking_params\n params.require(:booking).permit(:calendar_id, :slot_id)\n end", "def booking_params\n params.require(:booking).permit(:fan_id, :user_id, :start_date, :end_date, :status)\n end", "def booking_params\n params.require(:booking).permit(:room_id, :name, :string, :bookday, :date, :starttime, :endtime)\n end", "def booking_params\n params.require(:booking).permit(:start_date, :end_date, :price, :room_id)\n end", "def booking_params\n params.require(:booking).permit(:start_time, :end_time, :price, :parking_space_id, :user_id)\n end", "def booking_params\n params.require(:booking).permit(:start_date, :end_date, :user_id, :room_id, :is_confirmed, :price)\n end", "def booking_params\n params.require(:booking).permit(:roomno, :booked_user, :starttime, :endtime)\n end", "def booking_params\n params.require(:booking).permit(:showtime_id, :title, :first_name, :last_name, :phone_number)\n end", "def booking_params\n \n params.require(:booking).permit(:start_time, :end_time, :date)\n end", "def booking_params\n params.require(:booking).permit(:day, :slot)\n end", "def set_booking_info\n @booking_info = BookingInfo.find(params[:id])\n end", "def booking_params\n params.require(:booking).permit(:number_of_adults, :number_of_children, :price_id, :sale_id, :agent_id, :comment, :progress)\n end", "def booking_params\n params.require(:booking).permit(:expert_id, :time, :duration, :rate_per_hour, :location, :charge_identifier)\n end", "def booking_params\n params.permit(\n :start_time,\n :end_time,\n :date,\n :room_id,\n :user_id\n )\n end", "def booking_params\n params.require(:booking).permit(:beginning, :end, :name, :email, :catering, :seats, :sunset, :sunrise)\n end", "def booking_params\n params.require(:booking).permit(:schedule_id, :_id)\n end", "def booking_params\n params.require(:booking).permit(:time, :needs_supplies, :hours, :price)\n end", "def booking_params\n params.require(:booking).permit(:reference)\n end", "def booking_params\n params.require(:booking).permit(:room_id, :room_type_id, :customer_id, :check_in_date, :check_out_date, :total_price, :num_of_adults, :num_of_children)\n end", "def booking_params\n params.require(:booking).permit(:pnr, :seats, :seatclass, :dateofjourney, :source, :destination, :flight_id)\n end", "def booking_params\n params.require(:booking).permit(:conference_room_id, :status, :start_time, :end_time)\n end", "def booking_params\n params.require(:booking).permit(:day, :function_id, :identification, :name, :email)\n end", "def booking_params\n params.require(:booking).permit(:lesson_date, :start_at, :end_at)\n end", "def booking_params\n params.require(:booking).permit(:starts_at, :ends_at, :record)\n end", "def booking_complete\r\n\tend", "def booking_params\n params.require(:booking).permit(:member_id, :staff_id, :start_datetime, :end_datetime)\n end", "def set_booking\n @booking = Booking.find(params[:booking_id]) if params[:booking_id]\n end", "def booking_params\n params.require(:booking).permit(:driver_name, :license_plate_number, :space_number, :start_time, :finish_time, :cost)\n end", "def booking_params\n params.require(:booking).permit(:start_date, :end_date)\n end", "def set_booking\n #@booking = Booking.find(params[:id])\n #@booking = Booking.using(CURRENT_LOCATION.to_sym).find(params[:id])\n @booking = Booking.using(get_random_location.to_sym).find(params[:id])\n end", "def booking_params\n params.require(:booking).permit(:user_id, :room_id, :booking_start_time, :email)\n end", "def booking_params\n params.require(:booking).permit(:cost, :inDate, :outDate, :numOfGuests)\n end", "def booking_params\n params.require(:booking).permit(:user_id, :cancel, :slot_ids[])\n end", "def booking_params\n params.require(:booking).permit(:coupon_code, :user_id, :movie_id, :total_fee, :seat_count)\n end", "def booking_params\n params.require(:booking).permit(:start_date, :end_date)\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def booking_params\n params.require(:bookings).permit(:LoginName, :DoctorName, :AvailableDate, :Timings ,:Patient , :Doctor)\n end", "def fg_booking_params\n params.require(:fg_booking).permit(:user_id, :booking)\n end", "def set_booking\n @booking = booking.find(params[:id])\n end", "def booking_params\n params.require(:booking).permit(:timefrom, :timeto, :user_id, :team_id, :room_id)\n end", "def set_booking_detail\n @booking_detail = BookingDetail.find(params[:id])\n end", "def booking_info_params\n params.require(:booking_info).permit(:User_Name, :email, :Ticket_Type, :No_Of_Tickets, :Advance)\n end", "def booking_params\n params.require(:booking).permit(:user_id, :restaurant_id, :date, :time)\n end", "def booking_params\n params.require(:booking).permit(:user_id, :datareserva, :horareserva, :descricao).merge(user: current_user)\n end", "def booking_detail_params\n params.require(:booking_detail).permit(:customer_name, :customer_address, :customer_contact, :customer_pan, :customer_adhar, :site_id, :flat_id, :booking_charges, :vat, :service_tax, :loan_possible, :agreement_cost, :registration_fees, :final_sale_deed_fees, :stamp_duty, :other_charges)\n end", "def set_booking\n @booking = Booking.find(params[:id])\n @item = Item.find(params[:item_id])\n end", "def booking_params\n params.require(:booking).permit(:kode_pesawat, :nama, :no_id, :no_telp, :nama_pesawat, :bandara_asal, :bandara_tujuan, :tgl_berangkat, :konfirmasi)\n end", "def booking_params\n params.require(:booking).permit(:check_in, :check_out, :total_amount, :rental_amount, :service_fee)\n end", "def booking_params\n params_new = params.require(:booking).permit(:start_date, :end_date)\n params_new[:listing_id] = params[:listing_id].to_i\n if params_new[:listing_id] == 0\n params_new[:listing_id] = Booking.find(params[:id]).listing_id\n end\n params_new[:customer_id] = session[:customer_id]\n return params_new\n end", "def booking_params\n\t\tparams.require(:booking).permit(:timeslot_id, :size)\n\tend", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end" ]
[ "0.7540592", "0.72203285", "0.7195991", "0.7069011", "0.7047531", "0.7029437", "0.70106757", "0.69961333", "0.6982345", "0.6970114", "0.6962022", "0.69605994", "0.6954737", "0.6951022", "0.6935218", "0.69285244", "0.69266385", "0.69034845", "0.6886282", "0.68806916", "0.68758386", "0.68746424", "0.6862537", "0.68514395", "0.68461263", "0.6829237", "0.68237936", "0.6822572", "0.68072325", "0.68038356", "0.6787633", "0.67745996", "0.67675775", "0.6764489", "0.67601407", "0.67514145", "0.67509633", "0.67396855", "0.6735652", "0.6729197", "0.6728179", "0.6723311", "0.6719764", "0.67143095", "0.67092115", "0.67024994", "0.67019814", "0.6697752", "0.6692932", "0.66901493", "0.6676971", "0.6658968", "0.66401386", "0.66341174", "0.66335034", "0.66289806", "0.6618998", "0.66176313", "0.66130733", "0.6588044", "0.65805984", "0.6577087", "0.6570389", "0.6559668", "0.6540317", "0.65202844", "0.65202844", "0.65202844", "0.65202844", "0.65202844", "0.65202844", "0.65202844", "0.65202844", "0.65202844", "0.65164936", "0.65122515", "0.65096104", "0.65032023", "0.6501348", "0.64982027", "0.6498017", "0.6494555", "0.64878577", "0.64832294", "0.6482365", "0.6462122", "0.6455478", "0.6453714", "0.64392376", "0.64392376", "0.64392376", "0.64392376", "0.64392376", "0.64392376", "0.64392376", "0.64392376", "0.64392376", "0.64392376", "0.64392376", "0.64392376" ]
0.68247545
26
GET /plants/1 GET /plants/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def index\n @plants = Plant.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @plants }\n end\n end", "def index\n @plants = @project.plants\n end", "def index\n respond_to do |format|\n\n @plants = Plant.order('lower(name) ASC').paginate(page: params[:page])\n format.html { render :html => @plants } # index.html.erb\n if params[:page].present?\n @jsonPlants = Plant.order('lower(name) ASC').paginate(page: params[:page], per_page: params[:per_page])\n else\n @jsonPlants = Plant.all\n end\n\n @jsonPlantsDub = [:Plant]\n\n if params[:name].present?\n @jsonPlants.each do |p|\n if !p.name.downcase.include?(params[:name].downcase)\n @jsonPlantsDub << p\n end\n end\n end\n\n @jsonPlants -= @jsonPlantsDub\n format.json { render :json => {admin: admin?, count: @plants.total_entries, plants: @jsonPlants} }\n end\n end", "def index\n @plants = Plant.all\n end", "def index\n @user_plants = UserPlant.where(user: current_user)\n render json: @user_plants,\n include: { plant: { only: [:name, :water, :light_indoors, :light_outdoors] } },\n except: [:updated_at, :created_at, :user_id]\n end", "def show\n plant = Plant.find(params[:id])\n render json: {status: 'SUCCESS', message:'Show a plant.', data: plant}, status: :ok\n end", "def index\n @plants = Plant.all\n end", "def show\n @user = current_user\n @individual_plants = @user.individual_plants\n end", "def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end", "def show\n @pony = Pony.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pony }\n end\n end", "def show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end", "def show\n @plant = Plant.includes(\n :common_names, :harvests, :drawbacks, :habits, \n :habitats, :light_tolerances, :moisture_tolerances, \n :roles, :root_patterns).find(params[:id])\n\n render :json => @plant, :include => [\n :common_names, :harvests, :drawbacks, :habits, \n :habitats, :light_tolerances, :moisture_tolerances, \n :roles, :root_patterns]\n end", "def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end", "def index\n @tenants = keystone.tenants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tenants }\n end\n end", "def show\n \n @plant = Plant.find(params[:id])\n \n @back_url = plants_path\n @back_label = \"Plants\"\n \n @plant_comments = PlantComment.where(:plant_id => params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plant }\n end\n end", "def show\n @prayers = Prayer.all\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end", "def index\n @applicants = Applicant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicants }\n end\n end", "def show\n @plant = Plant.find(params[:id])\n end", "def show\n @plate = Plate.find(params[:id])\n\n render json: @plate\n end", "def show\n @pokeparty = Pokeparty.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def show\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patent }\n end\n end", "def show\n @analyst = Analyst.find(params[:id])\n\n render json: @analyst\n end", "def Plan_Paciente\n id = params[:id]\n plan_paciente = PlanPaciente.find_by_sql(\"SELECT nombre FROM plan_pacientes where laboratorio_id= #{id}\")\n render json: plan_paciente\n end", "def show\n @pinit = Pinit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinit }\n end\n end", "def index\n @tenants = Tenant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tenants }\n end\n end", "def show\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end", "def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end", "def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def show\n @claimant = Claimant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @claimant }\n end\n end", "def index\n @plans = Plan.all\n\n render json: @plans\n end", "def show\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plannegocio }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n if not check_logged_in then\n return\n end\n \n ###NEED TO SEE WHAT THIS IS FOR\n if params[:plants] then\n @plant = Plant.find(JSON.parse(params[:plants])[0])\n else\n @plant = Plant.new\n end\n \n @garden_id = params[:garden_id]\n @plant_id = params[:plant_id]\n \n #@plant.personal_plants.build\n #@plant.personal_plants[0].personal_plant_waterings.build\n \n @plants = Plant.all\n @personal_plant = PersonalPlant.new\n @personal_plant[:garden_id] = @garden_id\n @personal_plant[:plant_id] = @plant_id\n #@a = render_to_string action: \"options\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_plant }\n end\n end", "def show\n @aspirant = Aspirant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @aspirant }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end", "def index\n @room_plants = RoomPlant.all\n end", "def show\n render json: @parish\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @backend_planet = Backend::Planet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backend_planet }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def index\n @parishes = Parish.all\n\n render json: @parishes\n end", "def show\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def show\n render json: @pizza\n end", "def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end", "def show\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @punt }\n end\n end", "def show\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipante }\n end\n end", "def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def index\n\n @goals = Goal.by_person_as_student(current_user.person)\n @goals = @goals.by_plan(params[:plan_id]) if params[:plan_id].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @pruning = Pruning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pruning }\n end\n end", "def show\n render json: @pet\n end", "def show\n @precinct = Precinct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @precinct }\n end\n end", "def show\n @party = Party.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @party }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end", "def index\n @grants =\n if @company\n @company.grants(params[:filter_by], params[:sort_by], params[:desc])\n else\n Grant.kept.order(name: :asc)\n end\n\n headers[\"Total\"] = @grants.count\n headers[\"Per-Page\"] = params[:per_page]\n\n render json: (params[:page] == 'all' ? @grants : paginator(@grants)), has_type: false\n end", "def InfoPlanPaciente\n \tid = params[:id]\n @plan_paciente = TipoPlan.find_by_sql(\"select descripcion FROM tipo_plans where plan_paciente_id = #{id} and tipo = 'Paciente'\")\n render json: @plan_paciente\n end", "def show\n @pet = Pet.find_by(id: params[:id])\n if @pet\n render json: @pet\n else\n render json: {}, status: 404\n end\n end", "def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end", "def show\n @planner = Planner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planner }\n end\n end", "def show\n @politicalcommittee = Politicalcommittee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @politicalcommittee }\n end\n end", "def show\n @pem = Pem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pem }\n end\n end", "def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end", "def index\n @pugs = Pug.all\n\n render json: @pugs\n end", "def show\n @tenant = Tenant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenant }\n end\n end", "def show\n @applicant = Applicant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicant }\n end\n end", "def show\n @applicant = Applicant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicant }\n end\n end", "def show\n @applicant = Applicant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicant }\n end\n end", "def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end", "def show\n @lunchplan = Lunchplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lunchplan }\n end\n end", "def show\n @protein = Protein.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protein }\n end\n end", "def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end", "def show\n goal = Goal.find(params[:id])\n render json: goal,status: :ok\n end", "def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end", "def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end", "def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end", "def show\n @pinglun = Pinglun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinglun }\n end\n end", "def show\n @parliament = Parliament.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parliament }\n end\n end", "def show\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer_request }\n end\n end", "def show\n render json: @plan\n end", "def show\n @porter = Porter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @porter }\n end\n end", "def show\n @plantype = Plantype.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plantype }\n end\n end", "def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end", "def show\n @popularty = Popularty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @popularty }\n end\n end", "def show\n @preguntum = Preguntum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preguntum }\n end\n end", "def show\n @portion = Portion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @portion }\n end\n end", "def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end", "def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end", "def show\n # @passenger = Passenger.find(:name => params[:id])\n # render :json => @passenger\n end", "def show\n @dart = Dart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dart }\n end\n end", "def show\n\t\t@pharmacy = Pharmacy.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @pharmacy }\n\t\tend\n\tend", "def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pet }\n end\n end", "def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pet }\n end\n end", "def show\n @pembelian = Pembelian.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pembelian }\n end\n end", "def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end", "def show\n @antler = Antler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: AntlerPresenter.new(@antler) }\n end\n end", "def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plans }\n end\n end", "def show\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @propose }\n end\n end" ]
[ "0.7626426", "0.7559377", "0.7494183", "0.69456923", "0.67404145", "0.6738881", "0.6736135", "0.6680127", "0.6663009", "0.6593484", "0.65574867", "0.64715606", "0.64597154", "0.6404637", "0.63969845", "0.6395302", "0.6357955", "0.632299", "0.6296218", "0.6293668", "0.6291755", "0.6284504", "0.62823427", "0.6278304", "0.62589884", "0.62486094", "0.6239238", "0.62248003", "0.62248003", "0.6221395", "0.6218286", "0.6191792", "0.6187073", "0.61866176", "0.61866176", "0.61838585", "0.6182944", "0.6154131", "0.61536646", "0.6149166", "0.6143822", "0.6139694", "0.61396474", "0.61394596", "0.6137201", "0.61320764", "0.61276746", "0.61275256", "0.61264545", "0.61261815", "0.61230016", "0.61150813", "0.6113827", "0.61034656", "0.60997546", "0.60873234", "0.6084662", "0.60821843", "0.60788125", "0.60778457", "0.60775423", "0.6075009", "0.6072123", "0.60718393", "0.60660756", "0.6065598", "0.60543704", "0.6047172", "0.6047063", "0.6047063", "0.6047063", "0.60303867", "0.6024716", "0.6009291", "0.6006856", "0.60068077", "0.599527", "0.59952354", "0.5995142", "0.59865135", "0.59832877", "0.5978604", "0.5964425", "0.5957263", "0.5951939", "0.59511584", "0.59480894", "0.5947719", "0.5940961", "0.59389514", "0.59354484", "0.5933256", "0.5928881", "0.5927259", "0.59239125", "0.59239125", "0.59187114", "0.59150815", "0.59133285", "0.59112275", "0.59109336" ]
0.0
-1
POST /plants POST /plants.json
def create @plant = @garden.plants.new(plant_params) respond_to do |format| if @plant.save format.html { redirect_to garden_plant_path(@garden, @plant), notice: 'Plant was successfully created.' } format.json { render action: 'show', status: :created, location: @plant } else format.html { render action: 'new' } format.json { render json: @plant.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n plant = Plant.create(plant_params)\n render json: plant, status: :created\n end", "def create\n @plant = current_user.plants.create(plant_params)\n if @plant.valid?\n redirect_to plant_path(@plant)\n else\n render :new, status: :unprocessable_entity\n end\n end", "def create\n if not check_logged_in then\n return\n end\n\n @personal_plant = PersonalPlant.new(params[:personal_plant])\n \n respond_to do |format|\n if @personal_plant.save\n format.html { redirect_to \"/gardens/\"+@personal_plant.garden[:id].to_s, notice: 'Personal plant was successfully created.' }\n format.json { render json: \"/gardens/\"+@personal_plant.garden[:id].to_s, status: :created, location: @personal_plant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_plant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pregnancy }\n else\n format.html { render action: 'new' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n if not check_logged_in then\n return\n end\n \n ###NEED TO SEE WHAT THIS IS FOR\n if params[:plants] then\n @plant = Plant.find(JSON.parse(params[:plants])[0])\n else\n @plant = Plant.new\n end\n \n @garden_id = params[:garden_id]\n @plant_id = params[:plant_id]\n \n #@plant.personal_plants.build\n #@plant.personal_plants[0].personal_plant_waterings.build\n \n @plants = Plant.all\n @personal_plant = PersonalPlant.new\n @personal_plant[:garden_id] = @garden_id\n @personal_plant[:plant_id] = @plant_id\n #@a = render_to_string action: \"options\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_plant }\n end\n end", "def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end", "def create\n @room_plant = RoomPlant.new(room_plant_params)\n\n if @room_plant.save\n render :show, status: :created, location: @room_plant\n else\n render json: @room_plant.errors, status: :unprocessable_entity\n end\n end", "def create\n @planting = Planting.new(planting_params)\n\n respond_to do |format|\n if @planting.save\n format.html { redirect_to @planting, notice: 'Planting was successfully created.' }\n format.json { render :show, status: :created, location: @planting }\n else\n format.html { render :new }\n format.json { render json: @planting.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @plants = @project.plants\n end", "def create\n @painel = Painel.new(painel_params)\n\n respond_to do |format|\n if @painel.save\n format.html { redirect_to @painel, notice: 'Painel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @painel }\n else\n format.html { render action: 'new' }\n format.json { render json: @painel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @tenancy = Tenancy.new(tenancy_params)\n\n respond_to do |format|\n if @tenancy.save\n format.html { redirect_to @tenancy, notice: 'Tenancy was successfully created.' }\n format.json { render :show, status: :created, location: @tenancy }\n else\n format.html { render :new }\n format.json { render json: @tenancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \tauthorize! :create, @palestrante\n @palestrante = Palestrante.new(params[:palestrante])\n\n respond_to do |format|\n if @palestrante.save\n format.html { redirect_to @palestrante, :flash => { :notice => \"Palestrante cadastrado com sucesso!\"} }\n format.json { render json: @palestrante, status: :created, location: @palestrante }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palestrante.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contestant = Contestant.new(contestant_params)\n #@contestant.user_id = current_user.id \n @contestant.pageant_id = @pageant.id\n \n respond_to do |format|\n if @contestant.save\n format.html { redirect_to @pageant, notice: 'Contestant was successfully created.' }\n format.json { render :show, status: :created, location: @contestant }\n else\n format.html { render :new }\n format.json { render json: @contestant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plantation = @farm.plantations.new(plantation_params)\n\n respond_to do |format|\n if @plantation.save\n format.html { redirect_to farm_plantations_path(@farm), notice: 'Vous avez bien planté ce légume.' }\n format.json { render :show, status: :created, location: @plantation }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @plantation.errors, status: :unprocessable_entity }\n end\n end\n end", "def tenants_post(opts = {})\n data, _status_code, _headers = tenants_post_with_http_info(opts)\n return data\n end", "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def create\n @pharmacy = Pharmacy.new(pharmacy_params)\n respond_to do |format|\n if @pharmacy.save\n format.json { render :show, status: :created, location: @pharmacy }\n else\n format.json { render json: @pharmacy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aspirant = Aspirant.new(params[:aspirant])\n\n respond_to do |format|\n if @aspirant.save\n format.html { redirect_to @aspirant, :notice => 'Аспирант успешно создан.' }\n format.json { render :json => @aspirant, :status => :created, :location => @aspirant }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @aspirant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @plundering = Plundering.new(plundering_params)\n\n respond_to do |format|\n if @plundering.save\n format.html { redirect_to @plundering, notice: 'Plundering was successfully created.' }\n format.json { render action: 'show', status: :created, location: @plundering }\n else\n format.html { render action: 'new' }\n format.json { render json: @plundering.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @plants = Plant.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @plants }\n end\n end", "def create\n @plataform = Plataform.new(plataform_params)\n\n respond_to do |format|\n if @plataform.save\n format.html { redirect_to @plataform, notice: 'Plataform was successfully created.' }\n format.json { render :show, status: :created, location: @plataform }\n else\n format.html { render :new }\n format.json { render json: @plataform.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patrimony = Patrimony.new(patrimony_params)\n\n respond_to do |format|\n if @patrimony.save\n format.html { redirect_to @patrimony, notice: 'Patrimony was successfully created.' }\n format.json { render :show, status: :created, location: @patrimony }\n else\n format.html { render :new }\n format.json { render json: @patrimony.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patent = Patent.new(params[:patent])\n\n respond_to do |format|\n if @patent.save\n format.html { redirect_to @patent, notice: 'Patent was successfully created.' }\n format.json { render json: @patent, status: :created, location: @patent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if not check_logged_in then\n return\n end\n \n if params[:plant][:id] then\n @personal_plant = PersonalPlant.new(params[:plant][:personal_plants_attributes][\"0\"])\n @personal_plant[:plant_id] = params[:plant][:id]\n \n respond_to do |format|\n if @personal_plant.save\n format.html { redirect_to @personal_plant, notice: 'Personal plant was successfully created.' }\n format.json { render json: @personal_plant, status: :created, location: @personal_plant }\n else\n format.html { render controller: \"personal_plant\", action: \"new\" }\n format.json { render json: @personal_plant.errors, status: :unprocessable_entity }\n end\n end\n else\n @plant = Plant.new(params[:plant])\n \n #@plant.personal_plants[0].save\n respond_to do |format|\n if @plant.save\n #I BELIEVE THIS GO_TO IS NOT RELEVENT ANYMORE, BUT NOT SURE\n @go_to = @plant\n \n if @plant[:created_from_user] then\n @go_to = new_personal_plant_path + '?plant_id=' + @plant[:id].to_s\n end\n\n if params[:plant][:created_from_garden_id].length > 0 then\n @go_to = new_personal_plant_path + '?garden_id=' + params[:plant][:created_from_garden_id] + CGI.unescapeHTML('&plant_id=') + @plant[:id].to_s\n end\n\n format.html { redirect_to @go_to, notice: 'Plant was successfully created.' }\n format.json { render json: @plant, status: :created, location: @plant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plant.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @peran = Peran.new(peran_params)\n\n respond_to do |format|\n if @peran.save\n format.html { redirect_to @peran, notice: 'Peran was successfully created.' }\n format.json { render :show, status: :created, location: @peran }\n else\n format.html { render :new }\n format.json { render json: @peran.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pantry = current_user.pantries.new(\n pantry_params.merge({ user_id: current_user.id }) \n )\n\n respond_to do |format|\n if @pantry.save\n format.html { redirect_to @pantry }\n format.json\n else\n format.html { render :new }\n format.json { render json: @pantry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @applicant = Applicant.new(params[:applicant])\n\n respond_to do |format|\n if @applicant.save\n format.json { render json: @applicant, status: :created, location: @applicant }\n else\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patrimony = Patrimony.new(patrimony_params)\n\n respond_to do |format|\n if @patrimony.save\n format.html { redirect_to patrimonies_url, notice: 'Patrimony was successfully created.' }\n format.json { render :show, status: :created, location: @patrimony }\n else\n format.html { render :new }\n format.json { render json: @patrimony.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pet = Pet.new(pet_params)\n @pet.administrators << current_user\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @grantee = Grantee.new(grantee_params)\n\n respond_to do |format|\n if @grantee.save\n format.html { redirect_to @grantee, notice: 'Grantee was successfully created.' }\n format.json { render :show, status: :created, location: @grantee }\n else\n format.html { render :new }\n format.json { render json: @grantee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prayer = Prayer.new(params[:prayer])\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render json: @prayer, status: :created, location: @prayer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pedestrian = Pedestrian.new(pedestrian_params)\n\n respond_to do |format|\n if @pedestrian.save\n format.html { redirect_to @pedestrian, notice: 'Pedestrian was successfully created.' }\n format.json { render :show, status: :created, location: @pedestrian }\n else\n format.html { render :new }\n format.json { render json: @pedestrian.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @claimant = Claimant.new(params[:claimant])\n\n respond_to do |format|\n if @claimant.save\n format.html { redirect_to @claimant, notice: 'Claimant was successfully created.' }\n format.json { render json: @claimant, status: :created, location: @claimant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @claimant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meal_plan = MealPlan.new(meal_plan_params)\n\n respond_to do |format|\n if @meal_plan.save\n format.html { redirect_to @meal_plan, notice: 'Meal plan was successfully created.' }\n format.json { render :show, status: :created, location: @meal_plan }\n else\n format.html { render :new }\n format.json { render json: @meal_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def create\n @paise = Paise.new(params[:paise])\n\n respond_to do |format|\n if @paise.save\n format.html { redirect_to @paise, notice: 'Paise was successfully created.' }\n format.json { render json: @paise, status: :created, location: @paise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tenant = Tenant.new(tenant_params)\n authorize @tenant\n # @tenant.apartment_id = params[:apartment_id]\n # @tenant.apartment_id = @apartment.id\n @tenant.apartment = @apartment\n @tenant.save\n redirect_to apartment_path(@apartment)\n\n\n # respond_to do |format|\n # if @tenant.save\n # format.html { redirect_to @tenant, notice: 'tenant was successfully created.' }\n # format.json { render :show, status: :created, location: @tenant }\n # else\n # format.html { render :new }\n # format.json { render json: @tenant.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @panel_plan = Panel::Plan.new(params[:panel_plan])\n\n respond_to do |format|\n if @panel_plan.save\n format.html { redirect_to(@panel_plan, :notice => 'Plan was successfully created.') }\n format.json { render :json => @panel_plan, :status => :created, :location => @panel_plan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end", "def create\n @paciente = Paciente.new(params[:paciente])\n \n respond_to do |format|\n if @paciente.save\n format.html { redirect_to pacientes_path, notice: 'Paciente criado com sucesso.' }\n format.json { render json: @paciente, status: :created, location: @paciente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @panier = @farm.paniers.new(panier_params)\n\n respond_to do |format|\n if @panier.save\n format.html { redirect_to farm_paniers_path(@farm.slug), notice: 'Vous avez bien créé un nouveau panier.' }\n format.json { render :show, status: :created, location: @farm.slug }\n else\n format.html { render :new }\n format.json { render json: @panier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @peralatan = Peralatan.new(peralatan_params)\n\n respond_to do |format|\n if @peralatan.save\n format.html { redirect_to @peralatan, notice: 'Peralatan was successfully created.' }\n format.json { render :show, status: :created, location: @peralatan }\n else\n format.html { render :new }\n format.json { render json: @peralatan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paciente = Paciente.new(paciente_params)\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente was successfully created.' }\n format.json { render :show, status: :created, location: @paciente }\n else\n format.html { render :new }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mealplan = Mealplan.new(mealplan_params)\n\n respond_to do |format|\n if @mealplan.save\n format.html { redirect_to @mealplan, notice: 'Mealplan was successfully created.' }\n format.json { render :show, status: :created, location: @mealplan }\n else\n format.html { render :new }\n format.json { render json: @mealplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @papel = Papel.new(params[:papel])\n\n respond_to do |format|\n if @papel.save\n format.html { redirect_to @papel, notice: 'Papel was successfully created.' }\n format.json { render json: @papel, status: :created, location: @papel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @papel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(params[:plan])\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def create\n @paise = Paise.new(paise_params)\n\n respond_to do |format|\n if @paise.save\n format.html { redirect_to @paise, notice: 'Paise was successfully created.' }\n format.json { render :show, status: :created, location: @paise }\n else\n format.html { render :new }\n format.json { render json: @paise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n @rabbit = @pregnancy.rabbit\n @cage = @rabbit.cage\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Inizio gravidanza registrato' }\n format.json { render :show, status: :created, location: @pregnancy }\n else\n format.html { render :new }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @colony_ant = ColonyAnt.new(colony_ant_params)\n\n respond_to do |format|\n if @colony_ant.save\n format.html { redirect_to @colony_ant, notice: 'Colony ant was successfully created.' }\n format.json { render :show, status: :created, location: @colony_ant }\n else\n format.html { render :new }\n format.json { render json: @colony_ant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tenant = keystone.create_tenant({:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n \n format.html { redirect_to @tenant, :notice => 'Tenant was successfully created.' }\n format.json { render :json => @tenant, :status => :created, :location => @tenant }\n \n end\n end", "def create\n @accountant = Accountant.new(accountant_params)\n\n respond_to do |format|\n if @accountant.save\n format.html { redirect_to @accountant, notice: 'Accountant was successfully created.' }\n format.json { render :show, status: :created, location: @accountant }\n else\n format.html { render :new }\n format.json { render json: @accountant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @care_plan = CarePlan.new(care_plan_params)\n\n if @care_plan.save\n render json: @care_plan, status: :created, location: @care_plan\n else\n render json: @care_plan.errors, status: :unprocessable_entity\n end\n end", "def create\n @pengembalian = Pengembalian.new(pengembalian_params)\n\n respond_to do |format|\n if @pengembalian.save\n format.html { redirect_to @pengembalian, notice: 'Pengembalian was successfully created.' }\n format.json { render :show, status: :created, location: @pengembalian }\n else\n format.html { render :new }\n format.json { render json: @pengembalian.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prayer = Prayer.new(prayer_params)\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render :show, status: :created, location: @prayer }\n else\n format.html { render :new }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @servant = Servant.new(servant_params)\n\n respond_to do |format|\n if @servant.save\n format.html { redirect_to @servant, notice: 'Servant was successfully created.' }\n format.json { render :show, status: :created, location: @servant }\n else\n format.html { render :new }\n format.json { render json: @servant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paciente = Paciente.new(params[:paciente])\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente registrado com sucesso.' }\n format.json { render json: @paciente, status: :created, location: @paciente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plannegocio = Plannegocio.new(params[:plannegocio])\n\n respond_to do |format|\n if @plannegocio.save\n format.html { redirect_to @plannegocio, notice: 'Plannegocio was successfully created.' }\n format.json { render json: @plannegocio, status: :created, location: @plannegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plannegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end", "def create\n @permcl = Permcl.new(permcl_params)\n\n respond_to do |format|\n if @permcl.save\n format.html { redirect_to @permcl, notice: 'Permcl was successfully created.' }\n format.json { render :show, status: :created, location: @permcl }\n else\n format.html { render :new }\n format.json { render json: @permcl.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pendaftaran = Pendaftaran.new(pendaftaran_params)\n\n respond_to do |format|\n if @pendaftaran.save\n format.html { redirect_to @pendaftaran, notice: \"Pendaftaran was successfully created.\" }\n format.json { render :show, status: :created, location: @pendaftaran }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pendaftaran.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tenant = Tenant.new(tenant_params)\n \n p_id = Property.searchSecond(@tenant.tenantbuildinginfo)\n Property.find_by(id: p_id).tenants << @tenant\n respond_to do |format|\n if @tenant.save\n # if (@tenant.renewal == true)\n # UserMailer.delay(run_at: @tenant.leaseend - 3.months).reminder_email(@tenant)\n # end\n format.html { redirect_to @tenant, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n apartment = Apartment.create(apartment_params)\n render json: apartment\n end", "def plant_params\n params.require(:plant).permit(:name, :profile)\n end", "def create\n @mealplan = Mealplan.new(mealplan_params.merge(user: current_user))\n\n respond_to do |format|\n if @mealplan.save\n format.html { redirect_to @mealplan, notice: 'Mealplan was successfully created.' }\n format.json { render :show, status: :created, location: @mealplan }\n else\n format.html { render :new }\n format.json { render json: @mealplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prayer = Prayer.new(prayer_params)\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prayer }\n else\n format.html { render action: 'new' }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pony = Pony.new(params[:pony])\n\n respond_to do |format|\n if @pony.save\n t = Tweet.create(:status =>\"Ya llegue al mundo magico de ponies\", :pony_id => @pony[:id])\n\n format.html { redirect_to @pony, notice: 'Pony was successfully created.' }\n format.json { render json: @pony, status: :created, location: @pony }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pony.errors, status: :unprocessable_entity }\n end\n \n\n end\n end", "def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def tenants_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IdentityApi.tenants_post ...\"\n end\n # resource path\n local_var_path = \"/tenants\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tenant')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IdentityApi#tenants_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @platoon = Platoon.new(platoon_params)\n\n respond_to do |format|\n if @platoon.save\n format.html { redirect_to @platoon, notice: 'Platoon was successfully created.' }\n format.json { render action: 'show', status: :created, location: @platoon }\n else\n format.html { render action: 'new' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n respond_to do |format|\n\n @plants = Plant.order('lower(name) ASC').paginate(page: params[:page])\n format.html { render :html => @plants } # index.html.erb\n if params[:page].present?\n @jsonPlants = Plant.order('lower(name) ASC').paginate(page: params[:page], per_page: params[:per_page])\n else\n @jsonPlants = Plant.all\n end\n\n @jsonPlantsDub = [:Plant]\n\n if params[:name].present?\n @jsonPlants.each do |p|\n if !p.name.downcase.include?(params[:name].downcase)\n @jsonPlantsDub << p\n end\n end\n end\n\n @jsonPlants -= @jsonPlantsDub\n format.json { render :json => {admin: admin?, count: @plants.total_entries, plants: @jsonPlants} }\n end\n end", "def create\n @plant_soil = PlantSoil.new(plant_soil_params)\n\n respond_to do |format|\n if @plant_soil.save\n format.html { redirect_to @plant_soil, notice: 'Plant soil was successfully created.' }\n format.json { render :show, status: :created, location: @plant_soil }\n else\n format.html { render :new }\n format.json { render json: @plant_soil.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tenant = Tenant.new(params[:tenant])\n\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to @tenant, notice: 'Tenant was successfully created.' }\n format.json { render json: @tenant, status: :created, location: @tenant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ponderacion = Ponderacion.new(ponderacion_params)\n\n respond_to do |format|\n if @ponderacion.save\n format.html { redirect_to @ponderacion, notice: 'Ponderacion was successfully created.' }\n format.json { render :show, status: :created, location: @ponderacion }\n else\n format.html { render :new }\n format.json { render json: @ponderacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end", "def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end", "def create\n @agency = Agency.new(agency_params)\n\n if @agency.save\n render json: @agency, status: :created, location: @agency\n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def create\n @mealplan_meal = MealplanMeal.new(mealplan_meal_params)\n\n respond_to do |format|\n if @mealplan_meal.save\n format.html { redirect_to @mealplan_meal, notice: 'Mealplan meal was successfully created.' }\n format.json { render :show, status: :created, location: @mealplan_meal }\n else\n format.html { render :new }\n format.json { render json: @mealplan_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @papel = Papel.new(papel_params)\n\n respond_to do |format|\n if @papel.save\n format.html { redirect_to @papel, notice: 'Papel foi criado com sucesso' }\n format.json { render :show, status: :created, location: @papel }\n else\n format.html { render :new }\n format.json { render json: @papel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pax = Pax.new(pax_params)\n\n respond_to do |format|\n if @pax.save\n format.html { redirect_to @pax, notice: 'Pax was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pax }\n else\n format.html { render action: 'new' }\n format.json { render json: @pax.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @policeman = Policeman.new(policeman_params)\n\n respond_to do |format|\n if @policeman.save\n format.html { redirect_to @policeman, notice: \"Policía creado con éxito.\" }\n format.json { render :show, status: :created, location: @policeman }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @policeman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pigeon = current_user.pigeons.new(pigeon_params)\n\n respond_to do |format|\n if @pigeon.save\n format.html { redirect_to @pigeon, notice: 'Pigeon was successfully created.' }\n format.json { render :show, status: :created, location: @pigeon }\n else\n format.html { render :new }\n format.json { render json: @pigeon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pst = Pst.new(params[:pst])\n @pst.user_id = current_user.id\n respond_to do |format|\n if @pst.save\n format.html { redirect_to @pst, :notice => 'Post was successfully created.' }\n format.json { render :json => @pst, :status => :created, :location => @pst }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pst.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @poligon = Poligon.new(poligon_params)\n\n respond_to do |format|\n if @poligon.save\n format.html { redirect_to admin_path, notice: 'Poligon was successfully created.' }\n format.json { render :show, status: :created, location: @poligon }\n else\n format.html { render :new }\n format.json { render json: @poligon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tenant = Tenant.new(tenant_params)\n\n respond_to do |format|\n if @tenant.save\n redirect_to tenants_dashboard_path\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plantype = Plantype.new(params[:plantype])\n\n respond_to do |format|\n if @plantype.save\n format.html { redirect_to @plantype, notice: 'Plantype was successfully created.' }\n format.json { render json: @plantype, status: :created, location: @plantype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plantype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prayer_request = PrayerRequest.new(params[:prayer_request])\n\n respond_to do |format|\n if @prayer_request.save\n format.html { redirect_to @prayer_request, notice: 'PrayerRequest was successfully created.' }\n format.json { render json: @prayer_request, status: :created, location: @prayer_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @penjualan = Penjualan.new(params[:penjualan])\n\n respond_to do |format|\n if @penjualan.save\n format.html { redirect_to @penjualan, notice: 'Penjualan was successfully created.' }\n format.json { render json: @penjualan, status: :created, location: @penjualan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @penjualan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paradigm_praat = ParadigmPraat.new(paradigm_praat_params[:paradigm_praat])\n\n respond_to do |format|\n if @paradigm_praat.save\n format.html { redirect_to @paradigm_praat, notice: 'Paradigm praat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @paradigm_praat }\n else\n format.html { render action: 'new' }\n format.json { render json: @paradigm_praat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @puntaje = Puntaje.new(params[:puntaje])\n\n respond_to do |format|\n if @puntaje.save\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully created.' }\n format.json { render json: @puntaje, status: :created, location: @puntaje }\n else\n atributos\n format.html { render action: \"new\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prayer_request = PrayerRequest.new(params[:prayer_request])\n\n respond_to do |format|\n if @prayer_request.save\n format.html { redirect_to prayer_requests_path, notice: 'Prayer request was successfully created.' }\n format.json { render json: @prayer_request, status: :created, location: @prayer_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @perk = Perk.new(perk_params)\n authorize @perk\n\n respond_to do |format|\n if @perk.save\n format.html { redirect_to perks_path, notice: 'Perk was successfully created.' }\n format.json { render :show, status: :created, location: @perk }\n else\n format.html { render :new }\n format.json { render json: @perk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pain_amount = PainAmount.new(pain_amount_params)\n\n respond_to do |format|\n if @pain_amount.save\n format.html { redirect_to @pain_amount, notice: 'Pain amount was successfully created.' }\n format.json { render :show, status: :created, location: @pain_amount }\n else\n format.html { render :new }\n format.json { render json: @pain_amount.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spawner = Spawner.new(spawner_params)\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.save\n format.html { redirect_to @spawner, notice: 'Spawner was successfully created.' }\n format.json { render json: @spawner, status: :created, location: @spawner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pokeparty = Pokeparty.new(params[:pokeparty])\n\n respond_to do |format|\n if @pokeparty.save\n format.html { redirect_to @pokeparty, notice: 'Pokeparty was successfully created.' }\n format.json { render json: @pokeparty, status: :created, location: @pokeparty }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pokeparty.errors, status: :unprocessable_entity }\n end\n end\n end", "def validator_captive_portal(args = {}) \n post(\"/profiles.json/captiveportal/\", args)\nend" ]
[ "0.6902806", "0.6719342", "0.64493144", "0.61954564", "0.6145679", "0.6139447", "0.61214685", "0.60941553", "0.6040986", "0.6024834", "0.60134804", "0.595717", "0.5945627", "0.59392214", "0.5935888", "0.5934618", "0.58955294", "0.58821785", "0.5847297", "0.58405566", "0.5838712", "0.58224404", "0.58165425", "0.5814772", "0.58140725", "0.5794327", "0.5789559", "0.57855815", "0.5783558", "0.5774681", "0.57739764", "0.57624066", "0.5756823", "0.575494", "0.57371384", "0.5733694", "0.57330906", "0.57224375", "0.57176006", "0.571702", "0.5714062", "0.5709969", "0.57066613", "0.57064843", "0.56967896", "0.5691562", "0.56878483", "0.56874114", "0.5680644", "0.5666642", "0.5665275", "0.5664855", "0.5663161", "0.56630224", "0.5659335", "0.5657919", "0.5657243", "0.5645181", "0.56430584", "0.56425685", "0.5640407", "0.56396234", "0.5629541", "0.56287134", "0.56261957", "0.5622747", "0.5622198", "0.560821", "0.5608069", "0.55974716", "0.55928445", "0.5586009", "0.55811745", "0.5579481", "0.55758977", "0.5575313", "0.5574675", "0.5573733", "0.55723137", "0.55714405", "0.55696356", "0.5565603", "0.556307", "0.55627906", "0.5556666", "0.5555508", "0.55485374", "0.5547836", "0.55466735", "0.5542627", "0.5536116", "0.55321276", "0.5531668", "0.5527154", "0.55226666", "0.55202395", "0.55109566", "0.5510315", "0.5510195", "0.5507645" ]
0.68420595
1
PATCH/PUT /plants/1 PATCH/PUT /plants/1.json
def update respond_to do |format| if @plant.update(plant_params) format.html { redirect_to garden_plant_path(@garden, @plant), notice: 'Plant was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @plant.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def update\n if not check_logged_in then\n return\n end\n\n @plant = Plant.find(params[:id])\n\n respond_to do |format|\n if @plant.update_attributes(params[:plant])\n format.html { redirect_to @plant, notice: 'Plant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @painel.update(painel_params)\n format.html { redirect_to @painel, notice: 'Painel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @painel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @pony = Pony.find(params[:id])\n\n respond_to do |format|\n if @pony.update_attributes(params[:pony])\n format.html { redirect_to @pony, notice: 'Pony was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pony.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n if @papel.update_attributes(params[:papel])\n format.html { redirect_to @papel, notice: 'Papel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @papel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plant.update(plant_params)\n format.html { redirect_to @plant, notice: 'Your Swap whas been updated!' }\n format.json { render :show, status: :ok, location: @plant }\n else\n format.html { render :edit }\n format.json { render json: @plant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @prayer_request.update_attributes(params[:prayer_request])\n format.html { redirect_to @prayer_request, notice: 'Prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_plant\n @plant.deleted = false\n\n respond_to do |format|\n if set_attributes_from_filemaker(@plant)\n format.json do\n render status: :created,\n json: {\n id: @plant.id,\n botanical_name: @plant.botanical_name,\n alternative_names: @plant.alternative_names,\n updated_at: @plant.updated_at,\n visible: ([email protected]).to_s\n }\n end\n else\n format.json do\n render json: @plant.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pax.update(pax_params)\n format.html { redirect_to @pax, notice: 'Pax was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pax.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @claimant = Claimant.find(params[:id])\n\n respond_to do |format|\n if @claimant.update_attributes(params[:claimant])\n format.html { redirect_to @claimant, notice: 'Claimant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @claimant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patrimony.update(patrimony_params)\n format.html { redirect_to @patrimony, notice: 'Patrimony was successfully updated.' }\n format.json { render :show, status: :ok, location: @patrimony }\n else\n format.html { render :edit }\n format.json { render json: @patrimony.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patrimony.update(patrimony_params)\n format.html { redirect_to @patrimony, notice: 'Patrimony was successfully updated.' }\n format.json { render :show, status: :ok, location: @patrimony }\n else\n format.html { render :edit }\n format.json { render json: @patrimony.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @my_prayer_request.update_attributes(params[:my_prayer_request])\n format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @placa.update(placa_params)\n format.html { redirect_to @placa, notice: 'Placa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @placa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \tauthorize! :update, @palestrante\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n if @palestrante.update_attributes(params[:palestrante])\n format.html { redirect_to @palestrante, notice: 'Palestrante alterado com sucesso!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @palestrante.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if not check_logged_in then\n return\n end\n\n @personal_plant = PersonalPlant.find(params[:id])\n\n session[:reload] = true\n \n respond_to do |format|\n if @personal_plant.update_attributes(params[:personal_plant])\n format.html { redirect_to @personal_plant, notice: 'Personal plant was successfully updated.' }\n format.json { head :no_content } else\n format.html { render action: \"edit\" }\n format.json { render json: @personal_plant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plataform.update(plataform_params)\n format.html { redirect_to @plataform, notice: 'Plataform was successfully updated.' }\n format.json { render :show, status: :ok, location: @plataform }\n else\n format.html { render :edit }\n format.json { render json: @plataform.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n if @plannegocio.update_attributes(params[:plannegocio])\n format.html { redirect_to @plannegocio, notice: 'Plannegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plannegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update\n # if ((@[email protected]_date).cover?(params[:plant][:foreman_start_date]))\n respond_to do |format|\n # if @plant.foreman_id.eql?(params[:plant][:foreman_id])\n if @plant.update(plant_params)\n\n format.html {redirect_to \"/projects/#{@project.id}/plants\", notice: 'Plant was successfully updated.'}\n format.json {render :show, status: :ok, location: @plant}\n else\n format.html {render :edit}\n format.json {render json: @plant.errors, status: :unprocessable_entity}\n end\n\n end\n\n end", "def update\n respond_to do |format|\n if @planting.update(planting_params)\n format.html { redirect_to @planting, notice: 'Planting was successfully updated.' }\n format.json { render :show, status: :ok, location: @planting }\n else\n format.html { render :edit }\n format.json { render json: @planting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n pastry = Pastry.find(params[:id])\n pastry.update(pastry_params)\n render json: pastry\n end", "def update\n @proposal = listing.proposals.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @plant = current_user.plants.find(params[:id])\n end", "def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def update\n respond_to do |format|\n if @tenancy.update(tenancy_params)\n format.html { redirect_to @tenancy, notice: 'Tenancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenancy }\n else\n format.html { render :edit }\n format.json { render json: @tenancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @p1.update(p1_params)\n format.html { redirect_to @p1, notice: 'P1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @p1 }\n else\n format.html { render :edit }\n format.json { render json: @p1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @colony_ant.update(colony_ant_params)\n format.html { redirect_to @colony_ant, notice: 'Colony ant was successfully updated.' }\n format.json { render :show, status: :ok, location: @colony_ant }\n else\n format.html { render :edit }\n format.json { render json: @colony_ant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @applicant.update(applicant_params)\n format.html { redirect_to @applicant, notice: 'Applicant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @applicant.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", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pine.update(pine_params)\n format.html { redirect_to @pine, notice: 'Pine was successfully updated.' }\n format.json { render :show, status: :ok, location: @pine }\n else\n format.html { render :edit }\n format.json { render json: @pine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servant.update(servant_params)\n format.html { redirect_to @servant, notice: 'Servant was successfully updated.' }\n format.json { render :show, status: :ok, location: @servant }\n else\n format.html { render :edit }\n format.json { render json: @servant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pallet.update(pallet_params) # SQL\n format.html { redirect_to @pallet, notice: 'Pallet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pallet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @ppl.update(ppl_params)\n format.html { redirect_to :back, notice: 'Ppl was successfully updated.' }\n format.json { render :show, status: :ok, location: @ppl }\n else\n format.html { render :edit }\n format.json { render json: @ppl.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end", "def update\n @backend_planet = Backend::Planet.find(params[:id])\n\n respond_to do |format|\n if @backend_planet.update_attributes(params[:backend_planet])\n format.html { redirect_to @backend_planet, notice: 'Planet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @backend_planet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pokeparty = Pokeparty.find(params[:id])\n\n respond_to do |format|\n if @pokeparty.update_attributes(params[:pokeparty])\n format.html { redirect_to @pokeparty, notice: 'Pokeparty was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pokeparty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan }\n format.json { respond_with_bip(@plan) }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @papel.update(papel_params)\n format.html { redirect_to @papel, notice: 'Papel foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @papel }\n else\n format.html { render :edit }\n format.json { render json: @papel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @politically_exposed_person.update(politically_exposed_person_params)\n format.html { redirect_to politically_exposed_people_url,\n notice: 'Politically exposed person was successfully updated.' }\n format.json { render :show, status: :ok, location: @politically_exposed_person }\n else\n format.html { render :edit }\n format.json { render json: @politically_exposed_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n if @paise.update_attributes(params[:paise])\n format.html { redirect_to @paise, notice: 'Paise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @protein_complex = ProteinComplex.find(params[:id])\n\n respond_to do |format|\n if @protein_complex.update_attributes(params[:protein_complex])\n format.html { redirect_to @protein_complex, notice: 'Protein complex was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @protein_complex.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente])\n format.html { redirect_to \"/administrador/pacientes\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Orçamento instantâneo atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @applicant.update(applicant_params)\n format.html { redirect_to admin_applicant_path(@applicant), notice: 'Applicant was successfully updated.' }\n format.json { render :show, status: :ok, location: @applicant }\n else\n format.html { render :edit }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plantation.update(plantation_params)\n format.html { redirect_to farm_plantations_path(@farm), notice: 'Plantation was successfully updated.' }\n format.json { render :show, status: :ok, location: @plantation }\n else\n format.html { render :edit }\n format.json { render json: @plantation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(update_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n respond_to do |format|\n if @pacient.update(pacient_params)\n format.html { redirect_to @pacient, notice: 'Pacient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pacient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pizzatopping.update(pizzatopping_params)\n format.html { redirect_to @pizzatopping, notice: 'Pizzatopping was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pizzatopping.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plundering.update(plundering_params)\n format.html { redirect_to @plundering, notice: 'Plundering was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plundering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @applicant = Applicant.find(params[:id])\n\n respond_to do |format|\n if @applicant.update_attributes(params[:applicant])\n format.html { redirect_to admin_url(current_user.id), notice: 'Applicant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pet_true.update(pet_true_params)\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prim.update(prim_params)\n format.html { redirect_to @prim, notice: 'Prim was successfully updated.' }\n format.json { render :show, status: :ok, location: @prim }\n else\n format.html { render :edit }\n format.json { render json: @prim.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @applicant = Applicant.find(params[:id])\n\n respond_to do |format|\n if @applicant.update_attributes(params[:applicant])\n format.html { redirect_to @applicant, notice: 'Applicant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @applicant.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 @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to root_path, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dart = Dart.find(params[:id])\n\n respond_to do |format|\n if @dart.update_attributes(params[:dart])\n format.html { redirect_to @dart, notice: 'Dart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @panier.update(panier_params)\n format.html { redirect_to @panier, notice: 'Panier was successfully updated.' }\n format.json { render :show, status: :ok, location: @panier }\n else\n format.html { render :edit }\n format.json { render json: @panier.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @panier.update(panier_params)\n format.html { redirect_to @panier, notice: 'Panier was successfully updated.' }\n format.json { render :show, status: :ok, location: @panier }\n else\n format.html { render :edit }\n format.json { render json: @panier.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @paradigm_praat.update(paradigm_praat_params)\n format.html { redirect_to @paradigm_praat, notice: 'Paradigm praat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paradigm_praat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente])\n format.html { redirect_to @paciente, notice: 'Paciente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_plant = TestPlant.find(params[:id])\n\n respond_to do |format|\n if @test_plant.update_attributes(params[:test_plant])\n format.html { redirect_to(:action => :index, :notice => UPDATE_MSG) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_plant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lunchplan = Lunchplan.find(params[:id])\n\n respond_to do |format|\n if @lunchplan.update_attributes(params[:lunchplan])\n format.html { redirect_to @lunchplan, :notice => 'Lunchplan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lunchplan.errors, :status => :unprocessable_entity }\n end\n end\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 @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render json: {\"message\" => \"Pet was successfully updated\", \"success\" => true, \"data\" => @pet}, status: :created, location: @pet }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proposal.update(proposal_params)\n format.html { redirect_to :back, notice: 'La proposition a été modifiée.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prayer.update(prayer_params)\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { render :show, status: :ok, location: @prayer }\n else\n format.html { render :edit }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @panier.update(panier_params)\n format.html { redirect_to farm_panier_path(@farm.slug, @panier), notice: 'Panier mis à jour.' }\n format.json { render :show, status: :ok, location: @panier }\n format.js {}\n else\n format.html { render :edit }\n format.json { render json: @panier.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.6417405", "0.63763666", "0.6347557", "0.6264377", "0.62427336", "0.6241535", "0.62391424", "0.623645", "0.6227365", "0.6192443", "0.6180778", "0.6176146", "0.6170411", "0.61692363", "0.61692363", "0.61692363", "0.61605185", "0.615469", "0.6097303", "0.6097303", "0.6093931", "0.6077101", "0.60680294", "0.6066431", "0.6066151", "0.6033831", "0.60219336", "0.6015258", "0.6009001", "0.5997865", "0.5997865", "0.5978813", "0.59777486", "0.5977549", "0.5970909", "0.5959059", "0.5957073", "0.59404767", "0.5937895", "0.5924964", "0.5920153", "0.59140396", "0.5904484", "0.59023315", "0.59009147", "0.5899195", "0.5892595", "0.58909845", "0.58902067", "0.5889599", "0.58885473", "0.5886562", "0.5882361", "0.5880506", "0.5878849", "0.5872524", "0.587174", "0.58706605", "0.58693224", "0.5865548", "0.5858326", "0.5857322", "0.5856245", "0.58536744", "0.58533716", "0.58514094", "0.5848896", "0.5848262", "0.5848161", "0.5848161", "0.58441955", "0.5837492", "0.5833979", "0.58332556", "0.58323324", "0.5831056", "0.58309716", "0.58289135", "0.58257425", "0.58257425", "0.58245677", "0.5822867", "0.58189845", "0.5817513", "0.5816678", "0.581231", "0.5811751", "0.5811751", "0.58107", "0.5809241", "0.5808664", "0.5805718", "0.5804157", "0.5803569", "0.5802926", "0.5796663", "0.5792936", "0.5792858", "0.5787785", "0.5787718" ]
0.6388268
1
DELETE /plants/1 DELETE /plants/1.json
def destroy @plant = @garden.plants.find(params[:id]) @plant.destroy respond_to do |format| format.html { redirect_to @garden, notice: 'Plant deleted.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n if not check_logged_in then\n return\n end\n @plant = Plant.find(params[:id])\n @plant.destroy\n\n respond_to do |format|\n format.html { redirect_to plants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if not check_logged_in then\n return\n end\n @personal_plant = PersonalPlant.find(params[:id])\n @personal_plant.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_plants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_plant = TestPlant.find(params[:id])\n @test_plant.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_plants_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n UserPlant.destroy(params[:id])\n end", "def destroy\n @plant.destroy\n respond_to do |format|\n format.html { redirect_to plants_url, notice: 'Your Swap was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aspirant = Aspirant.find(params[:id])\n @aspirant.destroy\n\n respond_to do |format|\n format.html { redirect_to aspirants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @claimant = Claimant.find(params[:id])\n @claimant.destroy\n\n respond_to do |format|\n format.html { redirect_to claimants_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @plant.destroy\n respond_to do |format|\n format.html { redirect_to plants_url, notice: 'Plant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n @plant = Plant.find(params[:id])\n if @plant.user != current_user\n return render text: 'Not Allowed', status: :forbidden\n end\n\n @plant.destroy\n redirect_to plants_path\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @painel.destroy\n respond_to do |format|\n format.html { redirect_to painels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pax.destroy\n respond_to do |format|\n format.html { redirect_to paxes_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 @pony = Pony.find(params[:id])\n @pony.destroy\n\n respond_to do |format|\n format.html { redirect_to ponies_url }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @colony_ant.destroy\n respond_to do |format|\n format.html { redirect_to colony_ants_url, notice: 'Colony ant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant = Applicant.find(params[:id])\n @applicant.destroy\n\n respond_to do |format|\n format.html { redirect_to applicants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant = Applicant.find(params[:id])\n @applicant.destroy\n\n respond_to do |format|\n format.html { redirect_to applicants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_plan.destroy\n respond_to do |format|\n format.html { redirect_to applicant_food_plans_path(@applicant.id), notice: 'Food plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end", "def destroy\n @applicant.destroy\n respond_to do |format|\n format.html { redirect_to applicants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plantation.destroy\n respond_to do |format|\n format.html { redirect_to farm_plantations_url(@farm), notice: 'Plantation enlevée.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pharmacy.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @papel = Papel.find(params[:id])\n @papel.destroy\n\n respond_to do |format|\n format.html { redirect_to papels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plannegocio = Plannegocio.find(params[:id])\n @plannegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to plannegocios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patrimony.destroy\n respond_to do |format|\n format.html { redirect_to patrimonies_url, notice: 'Patrimony was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patrimony.destroy\n respond_to do |format|\n format.html { redirect_to patrimonies_url, notice: 'Patrimony was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenant = Tenant.find(params[:id])\n @tenant.destroy\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patent = Patent.find(params[:id])\n @patent.destroy\n\n respond_to do |format|\n format.html { redirect_to patents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @planting.destroy\n respond_to do |format|\n format.html { redirect_to plantings_url, notice: 'Planting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n\n respond_to do |format|\n format.html { redirect_to paciente_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \tauthorize! :destroy, @palestrante\n @palestrante = Palestrante.find(params[:id])\n @palestrante.destroy\n\n respond_to do |format|\n format.html { redirect_to palestrantes_url }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @mealplan = Mealplan.find(params[:id])\n @mealplan.destroy\n respond_to do |format|\n format.html { redirect_to mealplans_url, notice: 'Mealplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mealplan.destroy\n respond_to do |format|\n format.html { redirect_to mealplans_url, notice: 'Mealplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ppl.destroy\n respond_to do |format|\n format.html { redirect_to URI(request.referer || '').path, notice: 'Ppl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @placa.destroy\n respond_to do |format|\n format.html { redirect_to placas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grant = Grant.find(params[:id])\n @grant.destroy\n\n respond_to do |format|\n format.html { redirect_to grants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @plantype = Plantype.find(params[:id])\n @plantype.destroy\n\n respond_to do |format|\n format.html { redirect_to plantypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n name = @tenant.name\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url, notice: name + ' was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n\n respond_to do |format|\n format.html { redirect_to pacientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @policy.destroy\n respond_to do |format|\n format.html { redirect_to policys_url }\n format.json { render json: { status: 200 } }\n end\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def destroy\n @cpanel_mall.destroy\n respond_to do |format|\n format.html { redirect_to cpanel_malls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plant_soil.destroy\n respond_to do |format|\n format.html { redirect_to :back , notice: 'Plant soil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pinglun = Pinglun.find(params[:id])\n @pinglun.destroy\n\n respond_to do |format|\n format.html { redirect_to pingluns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_plan.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end", "def destroy\n @plantilla = Plantilla.find(params[:id])\n @plantilla.destroy\n\n respond_to do |format|\n format.html { redirect_to(plantillas_url) }\n format.xml { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n Planet.delete(params[:id])\n redirect_to \"/planets\"\n end", "def destroy\n @patrocinio = Patrocinio.find(params[:id])\n @patrocinio.destroy\n\n respond_to do |format|\n format.html { redirect_to patrocinios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @pantry.destroy\n respond_to do |format|\n format.html { redirect_to pantry_url, notice: 'pantry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @servant.destroy\n respond_to do |format|\n format.html { redirect_to servants_url, notice: 'Servant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @backend_planet = Backend::Planet.find(params[:id])\n @backend_planet.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_planets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_plan.destroy\n respond_to do |format|\n format.html { redirect_to meal_plans_url, notice: 'Meal plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @puntaje = Puntaje.find(params[:id])\n @puntaje.destroy\n\n respond_to do |format|\n format.html { redirect_to puntajes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @panel_plan = Panel::Plan.find(params[:id])\n @panel_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(panel_plans_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @cerveja = Cerveja.find(params[:id])\n @cerveja.destroy\n\n respond_to do |format|\n format.html { redirect_to cervejas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pacient.destroy\n respond_to do |format|\n format.html { redirect_to pacients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @portal.destroy\n respond_to do |format|\n format.html { redirect_to portals_url, notice: \"Portal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end", "def destroy\n pet = @user.pets.find(params[:id])\n pet.destroy\n render json: pet\n end", "def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/administrador/pacientes\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @paise = Paise.find(params[:id])\n @paise.destroy\n\n respond_to do |format|\n format.html { redirect_to paises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @applicant.destroy\n respond_to do |format|\n format.html { redirect_to applicants_url, notice: 'Applicant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant.destroy\n respond_to do |format|\n format.html { redirect_to applicants_url, notice: 'Applicant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant.destroy\n respond_to do |format|\n format.html { redirect_to applicants_url, notice: 'Applicant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant.destroy\n respond_to do |format|\n format.html { redirect_to applicants_url, notice: 'Applicant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant.destroy\n respond_to do |format|\n format.html { redirect_to applicants_url, notice: 'Applicant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenancy.destroy\n respond_to do |format|\n format.html { redirect_to tenancies_url, notice: 'Tenancy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @antenne = Antenne.find(params[:id])\r\n @antenne.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to antennes_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @pantry.destroy\n respond_to do |format|\n format.html { redirect_to pantries_url, notice: \"Pantry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @planner = Planner.find(params[:id])\n @planner.destroy\n\n respond_to do |format|\n format.html { redirect_to planners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pol.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n if @diet.destroy\n head :no_content, status: 200\n else\n render json: @diet.errors, status: 405\n end\n end", "def destroy\n @plan.destroy\n\n head :no_content\n end", "def destroy\n @hydrant = Hydrant.find(params[:id])\n @hydrant.destroy\n\n respond_to do |format|\n format.html { redirect_to(hydrants_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to test_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @immigrant = Immigrant.find(params[:id])\n @immigrant.destroy\n\n respond_to do |format|\n format.html { redirect_to immigrants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def destroy\n @prayer = Prayer.find(params[:id])\n @prayer.destroy\n\n respond_to do |format|\n format.html { redirect_to prayers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prayer = Prayer.find(params[:id])\n @prayer.destroy\n\n respond_to do |format|\n format.html { redirect_to prayers_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7304276", "0.72435623", "0.7090649", "0.70646024", "0.7037072", "0.7020316", "0.69914526", "0.6966658", "0.6936882", "0.68521255", "0.6838", "0.68047786", "0.67268914", "0.6722232", "0.6717373", "0.6710692", "0.6681807", "0.6676933", "0.6676933", "0.66657996", "0.66657", "0.6661329", "0.66549516", "0.6647335", "0.66265523", "0.66230035", "0.6620205", "0.6620205", "0.6617579", "0.6616017", "0.6615712", "0.6605221", "0.6596483", "0.65941066", "0.6589467", "0.65871817", "0.6582574", "0.65750986", "0.65750986", "0.65701", "0.6552622", "0.6550395", "0.6546812", "0.6543011", "0.65423924", "0.6540645", "0.6533811", "0.6525064", "0.6524257", "0.6523509", "0.65209025", "0.6517617", "0.65136963", "0.6510778", "0.650926", "0.6508589", "0.6503452", "0.6502723", "0.6493463", "0.64934593", "0.64926964", "0.64893246", "0.64889556", "0.64880013", "0.64871496", "0.64848685", "0.6480062", "0.64778507", "0.6477236", "0.64760935", "0.6473874", "0.64733416", "0.64715075", "0.64682657", "0.6464157", "0.64543164", "0.6451711", "0.64485735", "0.64485735", "0.64485735", "0.64460903", "0.64452463", "0.6444532", "0.6444532", "0.6444532", "0.6444532", "0.6444532", "0.64387125", "0.64352214", "0.6432231", "0.64292127", "0.64285517", "0.64278156", "0.6424798", "0.64185995", "0.641585", "0.6413986", "0.6412852", "0.64100516", "0.64100516" ]
0.75170726
0
Use callbacks to share common setup or constraints between actions.
def set_garden @garden = Garden.find(params[:garden_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def plant_params params.require(:plant).permit(:garden_id, :plant_image, :family, :variety, :seed_source, :quantity, :notes, :plant_date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289145", "0.62875307", "0.6280997", "0.62420976", "0.62388235", "0.6216686", "0.62122375", "0.6208949", "0.619173", "0.6176307", "0.6173907", "0.6170346", "0.616111", "0.6150513", "0.6150023", "0.61446756", "0.6120429", "0.6112975", "0.6104845", "0.6102966", "0.6087884", "0.6079323", "0.60699135", "0.60602236", "0.60191786", "0.60170597", "0.60100305", "0.6009527", "0.60052776", "0.60052776", "0.600042", "0.5999317", "0.59933805", "0.5991528", "0.5991221", "0.5990094", "0.5979497", "0.5966058", "0.5958738", "0.59579456", "0.5957759", "0.5956938", "0.5951788", "0.59511644", "0.59423065", "0.59373474", "0.59361076", "0.59361076", "0.59331447", "0.5928005", "0.5924882", "0.5924011", "0.59169155", "0.5908037", "0.5907541", "0.59061426", "0.59056246", "0.5897408", "0.58960444", "0.58951247", "0.5893136", "0.5892312", "0.5890385", "0.58853275", "0.58801144", "0.58784765", "0.5872648", "0.58682626", "0.5867028", "0.58661693", "0.586578", "0.58643955", "0.5863193", "0.58609086", "0.5859997", "0.5858935", "0.5858632", "0.5853379", "0.5852741", "0.584806", "0.5847703" ]
0.0
-1
This method will allow me to check the password attempt A new password object will be created(but not saved) comparing the current password_digest to the pasword attempt's digest
def is_password?(password_attempt) BCrypt::Password.new(password_digest).is_password?(password_attempt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end", "def validate_password(challenge)\n actual = BCrypt::Password.new(password_digest)\n actual == challenge\n end", "def is_password?(password_attempt)\n BCrypt::Password.new(password_digest).is_password?(password_attempt)\n end", "def is_password?(password)\n obj = Password.new(self.password_digest)\n obj.is_password?(password)\n end", "def password_check\n return self.encrypted_password==BCrypt::Engine.hash_secret(self.password_verify, self.salt)\n end", "def already_has_password?\n !self.password_digest.blank?\n end", "def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end", "def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end", "def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end", "def password\n @password ||= Password.new(password_digest)\n end", "def password_object\n Password.new(password_hash)\n end", "def is_password?(password)\n BCrypt::Password.new(self.password_digest) == password\n end", "def set_password_digest()\n\t\tself.password_digest = Password.create(self.password)\n\tend", "def passwords_match?\n context.user.password == context.password\n end", "def check_password(password_provided)\n BCrypt::Engine.hash_secret(password_provided, self.password_salt) == self.password\n end", "def has_password? (submitted_password)\n password_digest == encrypt(submitted_password)\n end", "def valid_password?(password)\n if self.legacy_password_hash.present?\n if ::Digest::MD5.hexdigest(password).upcase == self.legacy_password_hash.upcase\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end", "def validate_password(password)\n return false unless @digest_parts.any? # RUBY\n\n @a1 = ::Digest::MD5.hexdigest(@digest_parts['username'] + ':' + @realm + ':' + password)\n validate\n end", "def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end", "def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end", "def password_match\n if password != confirm_password\n errors.add(:password, \"doesn't match\")\n end\n end", "def password_changed?\n orig_pw_hash = self.instance_variable_get(:@old_password_hash)\n self.new_record? || (!orig_pw_hash.nil? && orig_pw_hash != self.password_hash)\n end", "def guess_password(attempt)\n SlowEquality.str_eql?(REAL_PASSWORD, attempt)\n end", "def password?(password_candidate)\r\n\t\t@password_hash == User.calculate_hash(password_candidate)\r\n\tend", "def valid_password?(password); end", "def hash_password\n return if password.blank?\n self.password_hash = Password.create(password)\n end", "def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n sha1_password = Digest::SHA1.hexdigest(\"--#{password_salt}--#{password}--\")\n return false unless sha1_password == encrypted_password\n logger.info \"User #{email} is using the old password hashing method, updating attribute.\"\n self.password = password # = BCrypt::Password.create(sha1_password)\n true\n end\n end", "def check_pw pw\n (encrypt pw) == (self[:password])\n end", "def check_password(password, hash)\n BCrypt::Password.new(hash) == password\n end", "def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n false\n end\n end", "def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n false\n end\n end", "def password\n @password = Password.new(password_hash) unless password_hash.blank?\n end", "def valid_password?(attempted_password)\n return false if attempted_password.blank? || send(crypted_password_field).blank?\n\n before_password_verification\n\n crypto_providers = [crypto_provider] + transition_from_crypto_providers\n crypto_providers.each_with_index do |encryptor, index|\n # The arguments_type of for the transitioning from restful_authentication\n arguments_type = (act_like_restful_authentication? && index == 0) ||\n (transition_from_restful_authentication? && index > 0 && encryptor == Authlogic::CryptoProviders::Sha1) ?\n :restful_authentication : nil\n\n if encryptor.matches?(send(crypted_password_field), *encrypt_arguments(attempted_password, arguments_type))\n # If we are transitioning from an older encryption algorithm and the password is still using the old algorithm\n # then let's reset the password using the new algorithm. If the algorithm has a cost (BCrypt) and the cost has changed, update the password with\n # the new cost.\n if index > 0 || (encryptor.respond_to?(:cost_matches?) && !encryptor.cost_matches?(send(crypted_password_field)))\n self.password = attempted_password\n save(false)\n end\n\n after_password_verification\n\n return true\n end\n end\n\n false\n end", "def digest\n cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST :\n BCrypt::Engine.cost\n BCrypt::Password.create(self, cost: cost)\n end", "def valid_password?(password)\n if self.respond_to?('legacy_password_hash') && self.legacy_password_hash.present?\n if BCrypt::Password.new(self.legacy_password_hash) == password\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend", "def correct_password?(params)\n self.current_password = params[:user][:current_password]\n self.password == self.current_password\n end", "def authenticate(password)\n BCrypt::Password.new(self.password_digest) == password\n end", "def has_password?(submitted_password)\n self.password == encrypt(submitted_password)\n end", "def validate_new_password\n if new_record? and self.read_attribute(:crypted_password).to_s.blank? and !@password_updated\n errors.add :password, :blank\n elsif @password_updated\n if @password.to_s.size < 4\n errors.add :password, :invalid_password\n elsif @password.to_s != @password_confirmation.to_s\n errors.add :password, :no_match_password\n end\n end\n end", "def has_password?(password)\n user_password = self.password_digest\n encrpyted_password = BCrypt::Password.new(user_password)\n encrpyted_password.is_password?(password)\n end", "def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end", "def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end", "def verify_password(password)\n hash_password(password) == @password_hash\n end", "def match_password_hash\n\n evaluated_password_e = Admin.get_encrypted_password(@password, @login_salt_d)\n return incorrect_login_error('am_l_pa_5') unless (evaluated_password_e == @admin.password)\n\n success\n end", "def passwords_match\n if self.password_changed? && !(self.password == self.password_confirmation)\n self.errors.add(:team, I18n.t('team.passwords_dont_match'))\n end\n end", "def pass\n @pass ||= Password.new(self.password)\n end", "def is_valid_password?(password)\n\t\tself.password == BCrypt::Engine.hash_secret(password, self.password)\n\tend", "def password=(new_password)\n @password = Password.create(new_password)\n self.digest_password = @password\n end", "def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end", "def match_current_password_hash\n\n evaluated_password_e = Admin.get_encrypted_password(@current_password, @login_salt_d)\n\n return error_with_data(\n 'am_l_cp_7',\n 'Change Password Error',\n '',\n GlobalConstant::ErrorAction.default,\n {},\n {current_password: 'Invalid Password'}\n ) unless (evaluated_password_e == @admin.password)\n\n success\n end", "def hash_new_password\n self.password = BCrypt::Password.create(@new_password)\n end", "def password_changed?\n Candidate.password_changed?(password)\n # !valid_password?(Event::Other::INITIAL_PASSWORD)\n end", "def valid_password?; end", "def valid_password?\r\n self.errors.push [:password, \"cannot be blank\"] if plain_password.blank?\r\n self.errors.push [:password, \"does not match\"] if plain_password != confirm_password\r\n \r\n if self.errors.present?\r\n false\r\n else\r\n require 'digest'\r\n self.password = Digest::MD5.hexdigest(plain_password)\r\n true\r\n end\r\n end", "def password\n if password_digest\n @password ||= BCrypt::Password.new(password_digest)\n else\n nil\n end\n end", "def authenticate(test_password)\n if BCrypt::Password.new(self.password_digest) == test_password\n self\n else\n false\n end\n end", "def password\n password = @prompt.mask(\"Enter password: \", required: true)\n if password == @current_user.password\n true\n else\n puts \"Password is invalid.\"\n sleep(1)\n false\n end\n end", "def get_password\n status = true\n while status == true\n @password = @@prompt.mask(\"Create a password with at least 5 character\") do |q|\n q.validate(/[a-z\\ ]{5,15}/)\n end\n @password_2 = @@prompt.mask(\"Retype your password\") do |q|\n q.validate(/[a-z\\ ]{5,15}/)\n end\n if @password == @password_2\n system(\"clear\")\n status = false \n break\n else @password != @password_2\n puts \"Wrong password, try again\".colorize(:red)\n status = true\n end\n end\n end", "def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end", "def has_password? pass\n WodaHash.digest(self.pass_salt + pass).to_hex.downcase == pass_hash.downcase\n end", "def hash_new_password\n self.password = BCrypt::Password.create(@new_password)\n end", "def is_password?(password)\n # the following is_password? is not the current is_password that's being defined\n # it's an instance method of BCrypt::Password.new(self.password_disgest)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end", "def has_password?(submitted_password)\n #compare encrypted_password with the encrypted version of submitted password.\n password == submitted_password\n end", "def password_digest(password); end", "def password_update?(new_pass)\n return false if current_resource.info['rep:password'].end_with?(\n hash_generator(new_pass)\n )\n true\n end", "def validate_previous_password\n\n return validation_error(\n 'um_cp_vpp_1',\n 'invalid_api_params',\n ['password_same'],\n GlobalConstant::ErrorAction.default\n ) if @user.password == @new_e_password\n\n success\n\n end", "def check_password(pass, hash)\n DjangoHash.parse(hash).check_password(pass)\n end", "def password_match?\n self.password == self.password_confirmation\n end", "def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end", "def hasSamePassword?(submittedPassword)\n encrypted_password == encryptUsingSalt(submittedPassword)\n end", "def get_password\n self.reload\n Password.new(self.password)\n end", "def hash_password # We'll call this method in the seed file; from https://gist.github.com/mdang/7b6097cc13b07db82c78\n if password.present?\n self.password_digest = BCrypt::Password.create(password)\n end\n end", "def check_password!\n if self.password != password_confirmation\n false\n end \n end", "def test_password\n p1 = \"mypassword123\"\n p2 = \"mypassword1234\"\n s1 = Password.update(p1)\n assert_equal(true, Password.check(p1,s1), \"Password was not stored correctly\")\n assert_equal(false, Password.check(p2,s1), \"Password check is broken\")\n\tend", "def password?\n !password_digest.blank?\n end", "def valid_pass?(test_pass)\n Encrypt::Password.validatePassword test_pass, password\n end", "def authenticates?(password)\r\n self.password == Crypto::digest(password)\r\n end", "def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end", "def password\n @password ||= Password.new(self.hashed_password)\n end", "def valid_password?(password_input)\n if using_old_validation?\n Devise.secure_compare(cakephp_password_digest(password_input), self.old_password).tap do |validated|\n if validated\n self.password = password_input\n self.old_password = nil\n self.save(:validate => false)\n end\n end\n else\n super(password_input)\n end\n end", "def exist_password\n if not self.password\n errors.add(:password,\"you are missing password\")\n end\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def valid_password? password\r\n self.password === Digest::MD5.hexdigest(password)[0..19]\r\n end", "def valid_password?(incoming_password)\n password_digest(incoming_password) == self.encrypted_password\n end", "def validate_password(email, password)\n password_for_email = $db.execute(\"SELECT password_digest FROM users WHERE email = ?\", email)[0][\"password_digest\"]\n p \"validating password\"\n if BCrypt::Password.new(password_for_email) == password\n p \"password match\"\n return true\n else\n p \"password not match\"\n return false\n end\nend" ]
[ "0.73229575", "0.7279151", "0.7199799", "0.7168252", "0.71405554", "0.71181184", "0.706325", "0.706325", "0.7051116", "0.6977497", "0.69660085", "0.6958755", "0.69585586", "0.6944173", "0.69436115", "0.6935888", "0.693142", "0.6917615", "0.6857313", "0.6857313", "0.6825218", "0.6822348", "0.68214077", "0.6818627", "0.68171525", "0.68036383", "0.6800847", "0.6784167", "0.6784105", "0.6783061", "0.6783061", "0.67792606", "0.6755913", "0.67522895", "0.67439127", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6737805", "0.6733824", "0.67174387", "0.67151874", "0.67118806", "0.6703185", "0.6698355", "0.66922987", "0.66922987", "0.66892093", "0.6687116", "0.66790444", "0.66767246", "0.6676563", "0.6673683", "0.6670294", "0.66667753", "0.6661832", "0.665996", "0.66478485", "0.664419", "0.66338235", "0.6620947", "0.6616966", "0.66142696", "0.6613468", "0.6611879", "0.6611656", "0.6611344", "0.66083175", "0.6606772", "0.6594246", "0.65884256", "0.6587504", "0.65815526", "0.65756017", "0.656295", "0.65509385", "0.6547806", "0.6540797", "0.6530066", "0.65300465", "0.65232694", "0.6520495", "0.65177554", "0.6516887", "0.6515908", "0.65139043", "0.6508718", "0.6508718", "0.6508502", "0.6508457", "0.6493734" ]
0.7249801
2
The equal sign next to password will allow us to set a password value directly instead of having to pass it as a parameter Self within the method refers to every instance of a user
def password=(password) @password = password self.password_digest = BCrypt::Password.create(password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password=(password)\n @password = password\n end", "def password=(new_password); end", "def set_password_field(password)\n end", "def password=(should); end", "def set_password(pass)\n self.user_password = User.crypt(pass)\n end", "def password=(value)\n @password = value\n end", "def password=(value)\n\t\t\t@password = value\n\t\tend", "def password(value = nil)\n value ? @password = value : @password\n end", "def password= passwd\n return unless passwd\n new_salt = User.fresh_salt\n self.passworddate = Date.today.to_s\n self.salt = new_salt\n self.send(:write_attribute, :password, User.password_hash(passwd.to_s, new_salt))\n end", "def password=(new_password)\n @password = new_password\n end", "def password_field=(plaintext)\n if plaintext != self.password\n self.password = Digest::SHA1.hexdigest(plaintext)[0..39] \n end\n end", "def set_password(v)\n @password = v\n # returns v\n end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(password)\n # This method sets @password equal to the argument given\n # so that the appropriate validation can happen\n @password = password\n # This method also encrypts the argument given\n # and saves it as this user's password_digest\n self.password_digest = BCrypt::Password.create(password)\n end", "def password=(val)\n return if val.blank?\n attribute_set(:salt, Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{name}--\")) if new?\n attribute_set(:crypted_password, val.encrypt(self.salt))\n end", "def password=(new_pw)\n @password = Password.create(new_pw)\n self.password_hash = @password\n end", "def pass=(new_password)\n self.password = Password.create(new_password)\n end", "def password_set(password)\n self.password.set password\n self.passwordconfirm.set password\n end", "def password=(password)\n@password = password\nif password.present?\ngenerate_salt\nself.hashed_password = self.class.encrypt_password(password, salt)\nend\nend", "def password=(password)\n@password = password\nif password.present?\ngenerate_salt\nself.hashed_password = self.class.encrypt_password(password, salt)\nend\nend", "def password=(pwd)\n @password = pwd\n create_new_salt\n self.password_hash = User.encrypted_password(self.password, self.password_salt) \n end", "def user_password=(password) # virtual attribute\n @user_password = password\n if password.present?\n make_pass_salt\n self.enc_pass = self.class.make_enc_pass(password, pass_salt)\n end\n end", "def set_password\n @password = Password.last\n @new_password = Password.new\n end", "def password=(pass)\n @password = pass = password_confirmation\n self.password_hash = Digest::SHA256.hexdigest(pass)\n #Salt!\n #self.salt = User.random_string(10) if !self.salt?\n #self.password_hash = User.encrypt(@password, self.salt)\nend", "def password= new_password\n @password = new_password\n end", "def password= password\n @password = password\n encrypt_password!\n end", "def password=(password)\n @password = password\n if password.present?\n generate_salt\n self.hashed_password = self.class.encrypt_password(password, salt)\n end\nend", "def password=(arg)\n raise ArgumentError, \"password expected a string, not a #{arg.class}\" unless arg.is_a?(String)\n @password=arg\n end", "def generate_password\n self.password = \"1234\"\n end", "def password=(pwd) # define password = pwd(arg)?\n # set password_digest column to encrypted version of user's pwd.\n self.password_digest = BCrypt::Password.create(pwd)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def password; end", "def password; end", "def password; end", "def password; end", "def password; end", "def password; end", "def password\n\n end", "def password\n end", "def password\n end", "def add_password(password)\n @password = password\n end", "def set_password; nil; end", "def password=(password)\n self.password_digest = BCrypt::Password.create(password)\n @password = password #why is this line necessary?\n end", "def set_password=(new_password)\n self.password = Password.create(new_password)\n self.save\n end", "def password(value)\n @config[:password] = value\n end", "def password=(str)\n @password = str\n self.password_digest = User.digest(str)\n end", "def old_password=(string)\n end", "def password \n @password \n end", "def password= password\n @password = password\n\n self.password_digest = BCrypt::Password.create password\n end", "def set_default_password\r\nself.password = :random\r\nend", "def password=(new_password)\n @password = Password.create(new_password)\n self.password_hash = @password\n end", "def password=(new_password)\n @password = Password.create(new_password)\n self.password_hash = @password\n end", "def passwd\r\n @password = \"12345\"\r\n end", "def password=(pw)\n @password = pw\n if pw and pw.size > 0\n self.salt = rand(100000000)\n self.hashed_password = Member.hashed_password(pw, self.salt)\n end\n end", "def password=(new_password)\n @raw_password = new_password\n @password = Password.create(new_password)\n self.password_hash = @password\n end", "def password=(value)\n reset_agent\n @password = value\n end", "def password=(value)\n reset_agent\n @password = value\n end", "def password=(value)\n reset_agent\n @password = value\n end", "def password=(new_password)\n @passowrd = Password.create(new_password)\n self.password_hash = @password\n end", "def set_password\n @password = Password.find(params[:id])\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end" ]
[ "0.7945201", "0.7936429", "0.7911718", "0.7854132", "0.78001887", "0.77896094", "0.7750377", "0.77147377", "0.76700145", "0.7643079", "0.7639849", "0.7629075", "0.76205117", "0.76205117", "0.76205117", "0.76205117", "0.762029", "0.7552042", "0.75517905", "0.7536476", "0.7531367", "0.7526244", "0.7526244", "0.7513495", "0.75075513", "0.7483126", "0.74767476", "0.74547243", "0.74475276", "0.7439106", "0.74238735", "0.7420695", "0.74121475", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.7408878", "0.74076104", "0.74076104", "0.7404672", "0.7404672", "0.7404672", "0.7404672", "0.7404672", "0.7404672", "0.7403621", "0.740216", "0.740216", "0.740046", "0.7398781", "0.73952216", "0.7391597", "0.7388907", "0.73886985", "0.737185", "0.73598", "0.7357753", "0.73573494", "0.73485047", "0.73485047", "0.73478806", "0.734519", "0.73404235", "0.73361176", "0.73361176", "0.73361176", "0.73313904", "0.73274225", "0.7318163", "0.7318163", "0.7318163", "0.7318163", "0.7318163" ]
0.0
-1
The list of all updatable properties
def updatable_properties @updatable ||= Set.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_fields\n fieldlist = self.class.required_on_update + @newvalues.to_a - self.class.never_on_update\n @properties.select{|key, value| fieldlist.include?(key)}\n end", "def modified_properties\n return @modified_properties\n end", "def updatable_property name, *args\n property name, *args\n @updatable ||= Set.new\n @updatable << name\n end", "def property_properties\n _property_properties\n end", "def properties\n model.properties\n end", "def properties\n []\n end", "def attribute_properties\n @attribute_properties.dup\n end", "def properties\n _properties\n end", "def added_properties\n\t\treturn @added_properties unless @added_properties.nil?\n\t\tcalculate_changes\n\t\treturn @added_properties\n\tend", "def updatable_attributes\n [:name]\n end", "def properties\n @properties\n end", "def properties\n @properties ||= []\n return((superclass.respond_to?(:properties) ? superclass.properties : []) + @properties)\n end", "def available_properties\n @properties ||= list.properties\n end", "def properties\n @properties\n end", "def writable_columns\n writable_attributes.keys\n end", "def properties\n []\n end", "def attribute_list # :nodoc:\n [:id, :version, :uid, :user, :timestamp, :changeset]\n end", "def attributes\n properties.map do |p|\n [p.name, send(p.getter)] if p.reader_visibility == :public\n end.compact.to_hash\n end", "def properties\n self.class.properties.keys\n end", "def properties\n decorate_with_methods(read_attribute(:properties))\n end", "def get_properties()\n return @properties\n end", "def snapshot_properties\n [\n snapshot_property(\"id\", \"integer\", model.id),\n snapshot_property(\n \"contact_first_name\", \"text\", model.contact_first_name),\n snapshot_property(\"contact_last_name\", \"text\", model.contact_last_name),\n snapshot_property(\n \"contact_middle_name\", \"text\", model.contact_middle_name),\n snapshot_property(\"position\", \"integer\", model.position),\n snapshot_property(\"contact_email\", \"text\", model.contact_email),\n snapshot_property(\"name\", \"text\", model.name),\n snapshot_property(\"initial\", \"text\", model.initial)\n ]\n end", "def properties\n properties = sky_table.get_properties()\n properties.select!{|p| p.transient && p.name.to_s.index(/^__\\w+__$/).nil? }\n return properties\n end", "def properties\n @properties = PropertyList.new(self.prototype) if @properties.nil?\n @properties\n end", "def properties\n properties = []\n relations = self.property_relations\n relations.each do |relationship|\n properties.push relationship.property\n end\n properties\n end", "def properties\n return @properties\n end", "def values_for_properties; end", "def accessors\n @tracked_attrs.keys ||= []\n end", "def attributes_in_database\n mutations_from_database.changed_values\n end", "def edit_users\n return self[:edit_users] unless persisted?\n (self[:edit_users] + (Wayfinder.for(self).ephemera_project&.edit_users || [])).uniq\n end", "def updatable?\n true\n end", "def removed_properties\n\t\treturn @removed_properties unless @removed_properties.nil?\n\t\tcalculate_changes\n\t\treturn @removed_properties\n\tend", "def properties\n @properties ||= {}\n end", "def properties\n return if @properties.empty?\n @properties.uniq.sort\n end", "def updatable\n can_update?\n end", "def properties\n @properties ||= {}\n end", "def modified_properties=(value)\n @modified_properties = value\n end", "def properties\n self.values\n end", "def attribute_list # :nodoc:\n [:id, :version, :uid, :user, :timestamp, :changeset, :tags]\n end", "def transferred_properties; end", "def transferred_properties; end", "def properties\n object = orientdb.get_class_properties self\n {:properties => object['properties'], :indexes => object['indexes']}\n end", "def write_changed_attributes\n @_properties.each do |attribute, value|\n write_property_from_db(attribute, value) if changed_attributes.has_key?(attribute)\n end\n end", "def data_for_update_columns\n {}\n end", "def properties\n self.persistent_class.property_iterator.to_a.inject({}) do |h, value|\n if !value.respond_to?(:getRubyValue)\n h[value.name] = value\n end\n h\n end\n end", "def properties\n @properties ||= {}\n end", "def properties\n @properties ||= {}\n end", "def permitted_attributes\n klass.properties.keys.map(&:to_sym) + %i[id edit_users edit_groups read_groups visibility work_members_attributes]\n end", "def write_changed_attributes\n @_properties.each do |attribute, value|\n write_property_to_db(attribute, value) if changed_attributes.has_key?(attribute)\n end\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def attribute_list\n [:id, :version, :uid, :user, :timestamp, :lon, :lat, :changeset]\n end", "def properties\n map(element_type: :hash) { |v| v.properties }\n end", "def properties\n self.class.properties\n end", "def attributes_to_set\n []\n end", "def indexable_fields\n self.class.props.map { |key| key.to_s }\n end", "def foreign_properties\n to_h.slice(*foreign_keys + foreign_objects)\n end", "def get_properties\n instance_methods.each_with_object([]) { |key, acc| acc << key.to_s.gsub(/=$/, '') if key.match(/\\w=$/) }\n end", "def to_wddx_properties\n @table.keys\n end", "def dirty_attribute_keys\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys\n end", "def attributes\n unless(@attributes)\n @attributes = Hash.new()\n self.properties_.each do |property|\n @attributes[property.name] = property.value\n end\n end\n @attributes\n end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def property_names\n trait[:PROPERTIES].keys\n end", "def props()\n @props\n end", "def properties\n self.class.get_properties\n end", "def attributes\n read_only_attributes.merge read_write_attributes\n end", "def properties\n games.flat_map(&:properties).uniq\n end", "def web_properties\n Management::WebProperty.all(self)\n end", "def transferred_properties\n @properties.transferred_properties\n end", "def public_attributes\n self.attribute_names.select{|a| !Profile::PRIVATE_FIELDS.include?(a)}\n end", "def properties\n component ? component.properties : []\n end", "def custom_properties\n custom_attribute_names\n end", "def property_definitions\n set_attributes_for(PropertyDefinition)\n PropertyDefinition.find(:all)\n end", "def properties\n {}\n end", "def property_names\n @property_names ||= properties.keys\n end", "def properties\n if @property_hash.empty?\n @property_hash = query || {:ensure => :absent}\n @property_hash[:ensure] = :absent if @property_hash.empty?\n end\n @property_hash.dup\n end", "def properties\n if @property_hash.empty?\n @property_hash = query || {:ensure => :absent}\n @property_hash[:ensure] = :absent if @property_hash.empty?\n end\n @property_hash.dup\n end", "def properties\n if @property_hash.empty?\n @property_hash = query || {:ensure => :absent}\n @property_hash[:ensure] = :absent if @property_hash.empty?\n end\n @property_hash.dup\n end", "def properties\n if @property_hash.empty?\n @property_hash = query || { ensure: :absent }\n @property_hash[:ensure] = :absent if @property_hash.empty?\n end\n @property_hash.dup\n end", "def properties\n if @property_hash.empty?\n @property_hash = query || { ensure: :absent }\n @property_hash[:ensure] = :absent if @property_hash.empty?\n end\n @property_hash.dup\n end", "def updatable?(fields=false)\n modifiable? :update, fields\n end", "def properties\n if @property_hash.empty?\n @property_hash = status || {}\n if @property_hash.empty?\n @property_hash[:ensure] = :absent\n else\n @resource.class.validproperties.each do |name|\n @property_hash[name] ||= :absent\n end\n end\n\n end\n @property_hash.dup\n end", "def get_updates\n # TODO Rewrite this properly\n @_original ||= {}\n original_data = {}\n self.class.attributes.each_pair do |name, attrib|\n attrib.set(original_data, @_original[name])\n end\n updates = {}\n original_data.each_pair do |field, value|\n updates[field] = data[field] if data[field] != original_data[field]\n end\n updates\n end", "def properties\n {}\n end", "def properties\n if @property_hash.empty?\n @property_hash = status || {}\n if @property_hash.empty?\n @property_hash[:ensure] = :absent\n else\n @resource.class.validproperties.each do |name|\n @property_hash[name] ||= :absent\n end\n end\n end\n @property_hash.dup\n end", "def index\n @owner_properties = @owner.ownerProperties\n end", "def object_attributes\n []\n end" ]
[ "0.67452586", "0.6656477", "0.64379704", "0.6398018", "0.62315035", "0.6193906", "0.61785704", "0.61513007", "0.61110914", "0.6100965", "0.6099039", "0.60753393", "0.6023469", "0.6021993", "0.5992287", "0.59601694", "0.59458965", "0.5933607", "0.5912656", "0.58987504", "0.5889514", "0.588751", "0.58859", "0.58842796", "0.5868076", "0.5859477", "0.58565855", "0.58544475", "0.58163375", "0.5813612", "0.58053", "0.5776543", "0.57712364", "0.57694435", "0.5767986", "0.5759274", "0.5750836", "0.57299036", "0.5711408", "0.5703566", "0.5703566", "0.57027084", "0.5689821", "0.56766385", "0.5673565", "0.5667333", "0.5667333", "0.5661221", "0.56278014", "0.56275654", "0.56275654", "0.56275654", "0.56275654", "0.56275654", "0.56275654", "0.56275654", "0.56275654", "0.56191266", "0.561855", "0.56086993", "0.5590987", "0.5586868", "0.5578897", "0.55562866", "0.5555036", "0.55542123", "0.5551826", "0.5546998", "0.5546998", "0.5546998", "0.5546998", "0.5546998", "0.5546998", "0.5546998", "0.5546998", "0.5528317", "0.55231565", "0.55210084", "0.5518458", "0.55167997", "0.5516276", "0.55059", "0.54952365", "0.5489671", "0.54739815", "0.54694164", "0.54583955", "0.54550475", "0.5443679", "0.5443679", "0.5443679", "0.54430413", "0.54430413", "0.5438809", "0.5435301", "0.54275537", "0.5425654", "0.54255706", "0.54121625", "0.5410976" ]
0.8273149
0
Add a new updatable property
def updatable_property name, *args property name, *args @updatable ||= Set.new @updatable << name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updatable_properties\n @updatable ||= Set.new\n end", "def add_property(key, value = nil, column_properties = {})\n key = key.to_sym\n unless property? key\n @_values[key] = value\n\n # Include in database columns definition\n @_columns[key] = {} unless column_properties.empty?\n end\n\n @_values[key]\n end", "def add_property(property)\n (@attributes['properties'] ||=[]) << property\n self\n end", "def add_property(prop)\n @properties.push(prop)\n end", "def add_property(name, value)\n TableProperty.new(name, value).tap do |property|\n @properties[name] = property\n end\n end", "def updatable?\n true\n end", "def add_property(property)\n @properties ||= []\n @properties << property\n end", "def assign_property(name, value); end", "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end", "def add_property(x)\n x = Property.create(x)\n safe_add_edge(x, x.opposite, :provable_false)\n safe_add_edge(x.opposite, x, :provable_false)\n safe_add_edge(x, x, :provable_true)\n safe_add_edge(x.opposite, x.opposite, :provable_true)\n x\n end", "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update_field_property(source, property, fields=Hamster::Set[])\n field = source[property]\n # collect previous fields if present\n field.each do |value|\n # add previous fields\n fields = fields.add(value)\n end unless field.nil?\n # reassign fields\n source[property] = fields.to_a\n source\n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def add_properties\n # TODO smart column ordering to ensure always valid by time we get to associations\n save_if_new\n\n property_list = get_each_assoc#current_value.split(Delimiters::multi_assoc_delim)\n\n property_list.each do |pstr|\n\n # Special case, we know we lookup on name so operator is effectively the name to lookup\n find_by_name, find_by_value = get_find_operator_and_rest( pstr )\n\n raise \"Cannot find Property via #{find_by_name} (with value #{find_by_value})\" unless(find_by_name)\n\n property = @@property_klass.find_by_name(find_by_name)\n\n unless property\n property = @@property_klass.create( :name => find_by_name, :presentation => find_by_name.humanize)\n logger.info \"Created New Property #{property.inspect}\"\n end\n\n if(property)\n if(SpreeHelper::version.to_f >= 1.1)\n # Property now protected from mass assignment\n x = @@product_property_klass.new( :value => find_by_value )\n x.property = property\n x.save\n @product.product_properties << x\n logger.info \"Created New ProductProperty #{x.inspect}\"\n else\n @product.product_properties << @@product_property_klass.create( :property => property, :value => find_by_values)\n end\n else\n puts \"WARNING: Property #{find_by_name} NOT found - Not set Product\"\n end\n\n end\n\n end", "def []=(key, value)\n if @_new_props\n @_new_props[key] = value\n else\n super\n end\n end", "def []=(property, value)\n self << Property.new(property, value)\n end", "def bindProperty(propName, propRef = propName)\n prop = OmfEc::Property.new(propName, propRef, nil, true)\n @properties += [prop]\n end", "def add_property(property)\n # Throw error if property is nil\n if property.nil?\n raise StandardError.new(\"Cannot add a nil property\")\n end\n\n # Throw error if property already exists.\n if !@properties[name].nil?\n raise StandardError.new(\"Property already exists: #{property.name}\")\n end\n \n @properties[property.name] = property\n end", "def add_property(property, options={})\n return send_message(SkyDB::Message::AddProperty.new(property, options))\n end", "def write(object, attribute, value)\n result = super\n column = self.attribute.to_sym\n object.changed_columns << column if attribute == :state && owner_class.columns.include?(column) && !object.changed_columns.include?(column)\n result\n end", "def add_detail(property, prop_key, old_value, value)\n details << AlterRecordDetail.new(:property => property, :prop_key => prop_key, :old_value => old_value, :value => value)\n end", "def attribute(*args, **opt)\n add_single_property(*args, **opt)\n end", "def create_localised_property_setter(property)\n property_name = property.name\n class_eval <<-EOS\n def #{property_name}=(value)\n write_localised_attribute('#{property_name}', value)\n end\n EOS\n end", "def relationship_set_property id, name, value\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n\n put_request 'relationship/' + id + '/properties/' + name, value, headers\n end", "def add_property(conn, node, value, type)\n # Check if the same property is already added\n r = conn.get(\"#{node}/properties/#{CGI.escape(type)}\")\n #p r.status\n #p r.body, value\n #puts JSON.parse(value_stored.body)['exception']\n if r.status != 200\n conn.put(\"#{node}/properties/#{CGI.escape(type)}\", \"#{value.match(/\"(.*)\"/)}\", HEADER) \n $load_p += 1\n else\n if r.body == value\n $skip_p += 1\n else\n puts \"WARNING (Property Conflict): #{node}/properties/#{CGI.escape(type)} old: #{r.body} <> new: #{value}\"\n $warn_p += 1\n end\n end\n #puts \"#{node}/properties/#{CGI.escape(type)}\"\nend", "def on_property(attr)\n @attributes << attr\n\n @buffer_targets = true\n end", "def up_via!(property, group)\n #parameter passed a property type?\n return if property.class != Property\n return if group.class != Group\n #get all relationships for this entity via the given group\n relationships = property_relations_via group\n relationship = EntityPropertyRelationship.find_by(entity_id: self.id, property_id: property.id, group_id: group.id)\n #relationship exist?\n return if relationship.nil?\n #already last?\n return if relationship.position == 0\n #relationship after property\n swap = self.property_relations_via(group)[relationship.position - 1]\n #move the property below the passed property up\n swap.update_attribute(:position, swap.position + 1)\n #move the passed property down\n relationship.update_attribute(:position, relationship.position - 1)\n end", "def update issue, property, value\n trigger_listener(issue, [org.ofbiz.core.entity.GenericEntity.new(property, value)])\n end", "def add_property(name)\n Compass::Configuration::ATTRIBUTES.push(name)\n inherited_accessor(name)\n end", "def set_property(key, value)\n end", "def add_properties\n # TODO smart column ordering to ensure always valid by time we get to associations\n product_load_object.save_if_new\n\n property_list = value.to_s.split(multi_assoc_delim)\n\n property_list.each do |property_string|\n\n # Special case, we know we lookup on name so operator is effectively the name to lookup\n\n # split into usable parts ; size:large or colour:red,green,blue\n find_by_name, find_by_value = property_string.split(name_value_delim)\n\n raise \"Cannot find Property via #{find_by_name} (with value #{find_by_value})\" unless(find_by_name)\n\n property = Spree::Property.where(:name => find_by_name).first\n\n unless property\n property = property_klass.create( :name => find_by_name, :presentation => find_by_name.humanize)\n logger.info \"Created New Property #{property.inspect}\"\n end\n\n if(property)\n # Property now protected from mass assignment\n x = product_property_klass.new( :value => find_by_value )\n x.property = property\n x.save\n @product_load_object.product_properties << x\n logger.info \"Created New ProductProperty #{x.inspect}\"\n else\n puts \"WARNING: Property #{find_by_name} NOT found - Not set Product\"\n end\n\n end\n\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def updatable\n can_update?\n end", "def []=(property, value); end", "def update!(**args)\n @web_property_ref = args[:web_property_ref] if args.key?(:web_property_ref)\n end", "def update_attribute\n end", "def property(key, value)\n if @current_attribute.properties.key?(key.to_sym)\n raise \"attribute #{key} already defined\"\n end\n state_depth_must_be(States::ATTRIBUTE)\n @current_attribute.properties[key.to_sym] = value\n end", "def fix_property(new_property, fixed_date)\n\t\t# TODO: these should be executed atmicly\n\t\tcurrent = self.property\n\t\tPropertyFixHistory.create(user: self, new_property: new_property, fixed_date: fixed_date)\n\t\tself.update(property: new_property)\n\tend", "def edit!(properties)\n raise NotImplementedError\n end", "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def method_missing(method, *args, &block)\n attribute = method.to_s\n\n if attribute =~ /=$/ # Define property -- does not have to exist\n attribute = attribute.chop\n self.changed_attributes[attribute] = args[0]\n self.attributes[attribute] = args[0]\n else\n return super unless self.attributes.include?(attribute)\n self.attributes[attribute]\n end \n \n end", "def add_field(field)\n fields[field.name] = field\n\n # first setup the Serializable property, this also creates the\n # initial attr for us\n property_accessor field.name\n # next we'll need to overwrite the writer created by property_accessor,\n # with our field validation one.\n define_field_writer field, field.name\n\n field.name\n end", "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def add_property(name, default = nil)\n add_property_default(name, default)\n attr_accessor(name)\n end", "def add_property(name, default = nil)\n self.add_property_default(name, default)\n attr_accessor(name)\n end", "def set_property(kid, v)\n if @property_description && desc = @property_description[kid]\n if desc.accessible? v\n self[desc.name] = v\n elsif desc.convertable? v\n self[desc.name] = desc.convert v\n else\n raise ArgumentError.new \"#{kid} should be #{desc.type}.\"\n end\n else\n self[kid] = v\n end\n end", "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def modified_properties=(value)\n @modified_properties = value\n end", "def add_property(sym, type, multi)\n unless multi\n @klass.class_eval do\n attr_reader sym\n\n # Setter\n define_method \"#{sym}=\" do |value|\n if type < SDL::Types::SDLSimpleType\n instance_variable_set \"@#{sym}\".to_s, type.new(value)\n else\n instance_variable_set \"@#{sym}\".to_s, value\n end\n end\n end\n else\n # Define accessor method for lists\n @klass.class_eval do\n define_method sym do\n eval \"@#{sym} ||= []\"\n end\n end\n end\n\n @klass.properties << SDL::Base::Property.new(sym, type, @klass, multi)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def set_property(key, value)\n @data[key] = value\n end", "def addProperty(job)\n job['property_blueprints'].push({\"configurable\"=>true,\"name\"=>\"stack\",\"optional\"=>false,\"type\"=>\"string\"})\n return job\nend", "def add_property_parameter(prop_name)\n if self.class.validproperty?(prop_name) && !@parameters[prop_name]\n self.newattr(prop_name)\n return true\n end\n false\n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def before_update\n# @line_item.name = \"foo\"\n end", "def set_property(name, data)\n ensure_valid\n prop = self.class.properties[name]\n raise \"No such property #{name}\" if not prop\n property_cache[name] = prop.set(@model, @path, data)\n end", "def []=(prop, value)\n @prototype.set(prop, value)\n end", "def property(key, value)\n @properties_from_attributes[key.to_sym] = value\n end", "def add_has_delta_field\n logger.info \"Adding #{name}._has_delta audit field...\"\n db.query(\"ALTER TABLE #{audit} ADD `_has_delta` TINYINT NOT NULL DEFAULT 0\")\n end", "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "def has_own_property(property)\n end", "def create_property_setter(property)\n property_name = property.name\n class_eval <<-EOS\n def #{property_name}=(value)\n self['#{property_name}'] = value\n cast_property_by_name('#{property_name}')\n end\n EOS\n\n if property.alias\n class_eval <<-EOS\n alias #{property.alias.to_sym}= #{property_name.to_sym}=\n EOS\n end\n end", "def update_attribute!(key, value)\n instance_variable_set \"@#{key}\", value\n save!\n end", "def []=(property, value)\n if self.class.translation_exists? property\n send(\"#{property}=\", value)\n elsif self.class.transformation_exists? property\n super property, self.class.transformed_property(property, value)\n elsif property_exists? property\n super\n end\n end", "def []=(attribute_name, value)\n raise NoMethodError, \"The attribute #{attribute_name} is undefined\" unless self.class.attributes.has_key? attribute_name\n \n return_value = super(attribute_name, self.class.cast(attribute_name, value))\n\n if self.__owner_object \n # This makes the tableless model compatible with partial_updates:\n # whenever a property in the tableless model is changed, we force the parent/owner object to a changed state\n # by updating it with a new, updated instance of the tableless model\n self.__owner_object.send \"#{self.__serialized_attribute.to_s}=\".to_sym, self\n end\n\n return_value\n end", "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end", "def updatable?(fields=false)\n modifiable? :update, fields\n end", "def attribute(name, *args, **opt)\n add_single_property(name, *args, **opt)\n end", "def update_attr_with_ial(attr, ial); end", "def update!(**args)\n @relation_descriptor = args[:relation_descriptor] if args.key?(:relation_descriptor)\n end", "def add(attribute, value)\n update(attribute => public_send(attribute).dup << value)\n end", "def add_property(key, value = nil, add_to = :props)\n key_node = Niceogiri::XML::Node.new(key)\n\n unless value.nil?\n key_node.write_attr('type', ruby_type_2_prop_type(value.class))\n c_node = value_node_set(value)\n\n if c_node.class == Array\n c_node.each { |c_n| key_node.add_child(c_n) }\n else\n key_node.add_child(c_node)\n end\n end\n read_element(add_to).first.add_child(key_node)\n key_node\n end", "def set_property(key, value)\n new_repr = Representation.new(repr.href,\n repr.properties.merge(key => value),\n repr.all_links,\n repr.hal_client)\n\n self.class.new(new_repr, orig_repr)\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def add_property(name = nil, properties = {})\n node_properties = (@hash[:properties] ||= {})\n if ref = properties.delete(:ref)\n top_level_node.add_ref(ref, self, name)\n end\n node_properties[name] = properties\n end", "def value=(new_value)\n validate(new_value)\n if new_value.nil?\n property_names.each { |name| self[name] = nil }\n else\n property_names.each { |name| self[name] = new_value[name] }\n end\n end", "def <<(obj)\n @datatype_properties << obj\n end", "def is_updatable_by?(agent = nil)\n true\n end", "def set_property( name, value )\n ( @properties ||= Hash.new )[ name ] = value\n end", "def add_attribute_detail(attribute, old_value, value)\n property = alter_for_type == \"ApkBase\" ? 'update' : ''\n add_detail(property, attribute, old_value, value)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "def update_definition(definition) update_attribute(:descriptor, definition) end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def add_points_property(points_gained)\n @points = points_gained\n return @points\nend", "def update!(**args)\n @predicate_encoded_mid = args[:predicate_encoded_mid] if args.key?(:predicate_encoded_mid)\n @property_name = args[:property_name] if args.key?(:property_name)\n @value = args[:value] if args.key?(:value)\n 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 []=(name, value)\n return super(name, value) if name.is_a?(Fixnum)\n name = name.upcase\n\n remove(name)\n\n if value.is_a?(Component) || value.is_a?(Property)\n add(value)\n else\n add(name, value)\n end\n end", "def update(key, descriptor, value)\n raise InvalidAddition.new(\"the provided descriptor cannot be nil\") if descriptor.nil?\n storage[key] = [descriptor, value]\n end" ]
[ "0.6705231", "0.6028638", "0.60149807", "0.60097134", "0.59517425", "0.5933048", "0.59043676", "0.58887565", "0.5829095", "0.5828522", "0.58160406", "0.57781696", "0.57781696", "0.57398236", "0.57256514", "0.5691363", "0.56197745", "0.55551666", "0.55349386", "0.55204296", "0.55113626", "0.55053544", "0.5490534", "0.54850495", "0.54784393", "0.54763097", "0.546168", "0.5453287", "0.543936", "0.5438372", "0.54340106", "0.5433569", "0.5430593", "0.54103595", "0.5391787", "0.5382337", "0.5382337", "0.5382337", "0.5382337", "0.5382337", "0.53820974", "0.5379496", "0.5377447", "0.53634375", "0.536337", "0.53604144", "0.53356457", "0.5324361", "0.5313812", "0.5310862", "0.5297483", "0.5273445", "0.52692837", "0.525464", "0.524786", "0.522284", "0.52028906", "0.5191057", "0.5191057", "0.518753", "0.5186902", "0.51814467", "0.51723534", "0.51702225", "0.5169012", "0.5156161", "0.51393163", "0.513777", "0.51288223", "0.5121255", "0.511916", "0.5102719", "0.50977063", "0.5077397", "0.5076007", "0.5069631", "0.50681", "0.50667006", "0.50563264", "0.50522834", "0.5043843", "0.5037811", "0.5026291", "0.50147855", "0.50147855", "0.50118357", "0.50114554", "0.50097984", "0.5003153", "0.50026184", "0.5001992", "0.4999841", "0.49952123", "0.49942878", "0.49942878", "0.49937034", "0.49918643", "0.4984911", "0.49846995", "0.498347" ]
0.7993935
0
GET /comments GET /comments.json
def index @comments = Comment.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n client.get(\"/#{id}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n render json: @post.comments\n end", "def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end", "def comments; rest_query(:comment); end", "def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end", "def index\n @comments = Comment.all\n render json: @comments\n end", "def show\n user = User.find_by({token: env['HTTP_TOKEN']})\n render json: user.comments.find(params[:id])\n end", "def show\n # comment = Comment.find_comment\n render json: @comment\n end", "def index\n comments = @project.comments\n render json: comments\n end", "def show\n @comments = @post.comments\n respond_to do |format|\n format.html\n format.json\n end\n end", "def comments(options={})\n parse_comments(request(singular(id) + \"comments\", options))\n end", "def index\n @comments = DiscussionComment.all\n render json: @comments\n end", "def show\n comment = Comment.find(params[:id])\n render json: comment, status: 200\n end", "def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def all_comments\n render :json => User.find(params[:user_id]).comments\n end", "def index\n #@comments = Comment.all\n comments = @blog.comments\n render json: comments, status: :ok\n end", "def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end", "def show\n @comment = Comment.find(params[:id])\n render json:@comment\n end", "def show\n render json: @comment\n end", "def show\n comment = Comment.find_by(id: params[:id])\n render json: comment\n end", "def show\n render json: comment\n end", "def GetComments id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/comments.json\")\n APICall(params)\n\n end", "def index\n @post = Post.find(params[:post_id])\n @comments = @post.comments\n\n render json: @comments, include: ['user']\n end", "def show\n comment = Comment.find(params[:id])\n render json: comment, status: :ok\n end", "def index\n @comments = Comment.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n if params[:comment_id].nil?\n render json: {\n comments: @card.comments.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n else\n @comment = Comment.find(params[:comment_id])\n render json: {\n comment: @comment,\n replaies: @comment.replaies.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n end\n end", "def comments(options = {})\n comments_resource(options)\n end", "def show\n @comment = @commentable.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def index\n logger.info(\"comments got index! #{params}\");\n @comments = Comment.find_by_post_id(params[:post_id])\n respond_with @comments\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "def comments(options = {})\n urn = options.delete(:urn)\n path = \"/socialActions/#{urn}/comments\"\n get(path, options)\n end", "def get_comments(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getComments')\n return get(uri)\n end", "def comments(options={})\n self.class.parse_comments(request(singular(user_id) + \"/comments\", options))\n end", "def index\n comments = @post.comments\n render json: { comments: comments }\n #loop through comments and find first and last name by user_id\n #User.find....etc\n end", "def show\n @post = Post.find(params[:id])\n @comments = Comment.where(:post_id => params[:id]).order(\"id desc\")\n @comments = @comments.page(params[:page]).per(20)\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def index\n if params[:_post_id]\n post_comments = PostComment.where(post_id: params[:_post_id])\n render json: post_comments.as_json(\n include: { user: { only: [:name, :id] } },\n except: [:post_id, :user_id]),\n status: :ok\n else\n render json: @current_user.post_comments.as_json(\n include: { post: { only: [:title, :id, :excerpt] } },\n except: [:user_id, :post_id]),\n status: :ok\n end\n end", "def show\n @comment = @posting.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def get_comment(comment_id)\n get(\"comments/#{comment_id}\")\n end", "def show\n @post = Post.find(params[:id])\n @comments = @post.comments.order('created_at DESC')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def comments\n Birdman::ApiPaginatedCollection.new(\"movies/#{id}/comments\")\n end", "def get_comments(parameters = {})\n if @answer_comments_url\n hash,url =request(@answer_comments_url, parameters)\n Comments.new hash, url\n else\n nil\n end\n end", "def show\n render json: { comment: @comment, replaies: @comment.replaies }, status: :ok\n end", "def show\n @comment = Comment.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def index\n @comments = @post.comments.order(created_at: :desc)\n render json: @comments, status: :ok\n\n end", "def index\n @comments = @complaint.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @comments }\n format.js\n end\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.comments, status: :ok\n end", "def index\n @comments = @entry.comments\n respond_with(@comments)\n end", "def show\n logger.info(\"comments got show! #{params}\");\n @comments = Comment.find_by_post_id(params[:post_id])\n respond_with @comments\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n render json: @comment, status: :ok\n\n end", "def comments\n expose Challenge.comments(@oauth_token, params[:challenge_id].strip)\n end", "def show\n @comment = Comment.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n \tend\n end", "def comments_for(url)\n get_data(\"comments/show/#{FORMAT}?url=#{url}\")\n end", "def index\n @comments = Comment.order(\"created_at DESC\")\n render json: @comments, status: :ok\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @comment }\n end\n end", "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @comment }\n end\n end", "def comments(options={})\n parse_comments(request(singular(answer_id) + \"/comments\", options))\n end", "def show\n @comment = Comment.new\n @comments = Comment.get_post_comments @post\n if session[:comment_errors]\n session[:comment_errors].each {|error, error_message| @comment.errors.add error, error_message}\n session.delete :comment_errors\n end\n respond_to do |format|\n format.html\n format.json { render :json => {:post => @post, :comments => @comments, :status => 200} }\n end\n end", "def show\n if @comment.nil?\n render json: {error: \"Not Found\"}, status: :not_found\n else\n render json: @comment, status: :ok\n end\n end", "def comment(options)\n get(\"/content/items/#{options.delete(:item)}/comments/#{options[:id]}\",options)\n end", "def index\n post = Post.find(params[:post_id])\n comments = post.comments.order(updated_at: :desc)\n @comment = Comment.new\n\n @comments = comments.map do |comment|\n {\n content: comment.content,\n created_at: comment.created_at.strftime('%Y-%m-%d %H:%M:%S')\n }\n end\n\n render json: {\n data: {\n comments: @comments,\n new_comment: @comment,\n }\n }\n end", "def comments\n @data['comments']\n end", "def comments\n @data['comments']\n end", "def comments\n @data['comments']\n end", "def details(id, params = {})\n wrike.execute(:get, api_url(\"comments/#{id}\"), params)\n end", "def show\n render json: { blog: @blog, comments: @blog.comments }\n end", "def show\n recipe = Recipe.find_by_id(params[:id])\n\n respond_to do |format|\n if recipe\n @comments = []\n comments = recipe.comments\n for comment in comments\n comment_user = comment.user\n @comments << { :user => comment_user, :profile_picture => comment_user.profile_picture.url, :comment => comment }\n end\n\n format.json { render :json => @comments }\n else\n format.json { render :status => 404, :json => { :message => \"No such Recipe\"}}\n end\n end\n end", "def gist_comments(id)\n get \"/gists/#{id}/comments\"\n end", "def show\n @comments = @servidor.comments.order(\"id DESC\").page(params[:page]).per(3)\n end", "def get_comments_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_comments ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_comments\" if id.nil?\n \n # resource path\n path = \"/Notes/{id}/Comments\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'updated_after_utc'] = opts[:'updated_after_utc'] if opts[:'updated_after_utc']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIComment>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_comments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def comments(options = {})\n options = { query: options } if options.any?\n @party.get(\"forms/#{@id}/comments\", options)['Comments']\n end", "def comments(options={})\n @comments ||= self.class.parse_comments(request(singular(question_id) + \"/comments\", options))\n end", "def moment_comments(moment_id)\n get(\"/v1/moments/#{moment_id}/comments\")\n end", "def show\n @comment = @song.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comment }\n end\n end", "def show\n @post = Post.find(params[:id], include: :comments, order: 'comments.id')\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end" ]
[ "0.85731363", "0.7836477", "0.7836477", "0.75563234", "0.7529806", "0.7521614", "0.74968386", "0.7397085", "0.7301993", "0.72955334", "0.72854245", "0.72738886", "0.7270647", "0.7248709", "0.7243295", "0.7208719", "0.7205121", "0.7185704", "0.7178388", "0.71587324", "0.7157224", "0.71532065", "0.7152587", "0.7122357", "0.71207577", "0.7083375", "0.70684683", "0.7063948", "0.7044328", "0.70437574", "0.7007629", "0.70075166", "0.70075166", "0.70075166", "0.69732296", "0.6969394", "0.69532", "0.6949675", "0.6907273", "0.6903081", "0.6884854", "0.6880599", "0.6865744", "0.68504274", "0.68472934", "0.68333715", "0.6828524", "0.68284374", "0.6824184", "0.6817445", "0.68147194", "0.6810837", "0.67978317", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.6797722", "0.67924494", "0.67889524", "0.6786256", "0.6754828", "0.67517143", "0.6745816", "0.6745816", "0.6745816", "0.6736737", "0.67282385", "0.6711995", "0.6697433", "0.6685946", "0.6672704", "0.6672704", "0.6672704", "0.6668979", "0.6667167", "0.6663966", "0.6662897", "0.6642028", "0.66346335", "0.66331863", "0.66198266", "0.66134864", "0.66134375", "0.66065514" ]
0.0
-1
:nodoc: We need to wrap the run method so we can do things like run a cleanup method if it exists
def run(result, &progress_block) # :nodoc: super_run(result) do |state, name| if state == Test::Unit::TestCase::STARTED cleanup if self.respond_to?(:cleanup) log_start(name) else cleanup if self.respond_to?(:cleanup) log_end(name) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(_); end", "def run(_); end", "def run() end", "def run\n raise \"Not implemented yet.\"\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run\n nil\n end", "def runner; end", "def run; new.run; end", "def run\n end", "def run\n raise NotImplementedError.new(\"The run method must be overridden\")\n end", "def run!\n raise NotImplementedError\n end", "def run\n fail 'Subclass of Util must override Util::run'\n end", "def run()\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n raise ArgumentError, \"You must override this method\"\n end", "def run\n end", "def run\n raise NotImplementedError.new(\"Method 'run' not implemented by '#{self.class.name}'\")\n end", "def run \n each do |runnable|\n if runnable.respond_to?(:run)\n runnable.run\n end\n end\n end", "def run\n raise NotImplementedError\n end", "def run\n raise NotImplementedError\n end", "def run\n raise NotImplementedError\n end", "def run\n raise NotImplementedError\n end", "def run\n raise \"Not implemented for this check.\"\n end", "def run!\n run\n die\n end", "def run\n end", "def run\n end", "def run; raise NotImplementedError; end", "def run; raise NotImplementedError; end", "def run\n raise \"Subclasses must implement this method.\"\n end", "def run\n raise NotImplementedError.new\n end", "def run\n \n end", "def run\n \n end", "def run() \n raise NotImplementedError, \"The #run method must be implemented\"\n end", "def run_failed; end", "def run\n super\n end", "def run\n super\n end", "def run\n raise NotImplementedError, 'Services must implement #run'\n end", "def run\n error \"Implement the run method in subclass #{self.class}\"\n 1\n end", "def _run\n super.tap { reenqueue }\n end", "def run\n catch(:skip) { call }\n finish!\n rescue => e\n fail!\n raise e\n end", "def run!\n raise NotImplemented\n end", "def run\n end", "def run!\n # Ensure the package directory exists and is purged\n purge_directory(package_dir)\n\n instance_eval(&self.class.setup) if self.class.setup\n instance_eval(&self.class.validate) if self.class.validate\n instance_eval(&self.class.build) if self.class.build\n instance_eval(&self.class.clean) if self.class.clean\n\n # Ensure the temporary directory is removed at the end of a successful\n # run. Without removal, successful builds will \"leak\" in /tmp and cause\n # increased disk usage.\n #\n # Instead of having this as an +ensure+ block, failed builds will persist\n # this directory so developers can go poke around and figure out why the\n # build failed.\n remove_directory(staging_dir)\n end", "def run\n raise \"run() Not Implemented on worker #{self.class.name}\"\n end", "def runs; end", "def run\n begin\n started\n result = constantize(object).send(method_name, *args)\n Navvy::Job.keep? ? completed : destroy\n result\n rescue Exception => exception\n failed(exception.message)\n end\n end", "def run\n time_it do\n capture_exceptions do\n self.class.roby_should_run(self, Roby.app)\n super\n end\n end\n self\n end", "def run\n time_it do\n capture_exceptions do\n self.class.roby_should_run(self, Roby.app)\n super\n end\n end\n self\n end", "def perform\n start_instance\n begin; run; rescue; @failed = true; end\n finish_instance\n end", "def run(&block); end", "def main_run\n raise NotImplementedError\n end", "def running; end", "def running; end", "def run(&blk)\n raise NotImplementedError\n end", "def runner(&blk); end", "def runner(&blk); end", "def run\n raise \"A subclass should override the `CLAide::Command#run` method to \" \\\n \"actually perform some work.\"\n end", "def cleanup!\n # This method may be left unimplemented if that is applicable\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def run_exit_tasks!; end", "def run\n begin\n self.class.roby_should_run(self, Roby.app)\n super\n rescue MiniTest::Skip => e\n puke self.class, self.name, e\n end\n end", "def cleanup\n # override and do something appropriate\n end", "def original_run_command; end", "def run\n log \"Nothing to do.\"\n end", "def run\n yield\n end", "def run!\n with_hooks do\n call\n context.called!(self)\n end\n rescue\n context.rollback!\n raise\n end", "def safe_run\n run\n rescue Ohai::Exceptions::Error => e\n @failed = true\n raise e\n rescue => e\n @failed = true\n logger.trace(\"Plugin #{name} threw #{e.inspect}\")\n e.backtrace.each { |line| logger.trace( line ) }\n end", "def cleanup!; end", "def cleanup!; end", "def run\n @run ||= build_data\n end", "def run_interrupted; end", "def runnables; end", "def run\n validate\n setup\n before_sync\n sync\n after_sync\n rescue => e\n on_error(e)\n raise e\n end", "def run(args)\n raise \"not implemented\"\n end", "def executor; end", "def executor; end", "def executor; end", "def run(&block)\n end", "def cleanup\n super\n end", "def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end", "def run\n self.proc.call\n end", "def refork; end", "def runner\n\nend" ]
[ "0.72897696", "0.72897696", "0.7218302", "0.71431446", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6912175", "0.6889371", "0.6796001", "0.679071", "0.6785756", "0.67625695", "0.67325085", "0.67216825", "0.66939455", "0.66939455", "0.66939455", "0.66939455", "0.66939455", "0.66939455", "0.66939455", "0.66854525", "0.6636743", "0.66197944", "0.6615885", "0.66152054", "0.66152054", "0.66152054", "0.66152054", "0.6588416", "0.6544144", "0.65424997", "0.65424997", "0.65341985", "0.65341985", "0.6495866", "0.64930487", "0.64909506", "0.64909506", "0.6482196", "0.6470266", "0.6460768", "0.6460768", "0.64365184", "0.6435423", "0.64177716", "0.64002234", "0.64000094", "0.6395052", "0.6391635", "0.6382993", "0.6380846", "0.63662905", "0.6357579", "0.6357579", "0.6352207", "0.6345256", "0.63405484", "0.6319112", "0.6319112", "0.63104075", "0.6302589", "0.6302589", "0.62930584", "0.6289848", "0.62174594", "0.62174594", "0.62174594", "0.62174594", "0.62097925", "0.6209402", "0.62043023", "0.6197167", "0.6188589", "0.6175563", "0.6173959", "0.6172104", "0.6139953", "0.6139953", "0.6139098", "0.6128157", "0.61239827", "0.6123655", "0.6092489", "0.6090344", "0.6090344", "0.6090344", "0.6085661", "0.60474944", "0.6047411", "0.60412604", "0.6024733", "0.60224414" ]
0.6180866
81
OAuth2 Endpoints Passport exchange Passport Strategy first exchange Insider : Client information from Apps should always be trusted
def create @client = current_client @session = @client.session debug { "SessionsController#create - #{@session.inspect}"} raise "ResourceOwner from token != session.owner" if doorkeeper_token.resource_owner_id != @session.owner.id @client.update_attributes!(client_params) render json: @client, status: :created, serializer: Sso::ClientSerializer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_oauth_tokens\n end", "def oauth_authentication; end", "def authenticate!\n @client = Octokit::Client.new\n url = @client.authorize_url(CLIENT_ID)\n redirect url\nend", "def use_oauth\n\t\t\t\n\t\tend", "def on_simple_outbound\r\n {\"userCredentials\" => {\"accessToken\" => ACCESS_TOKEN}}\r\n end", "def on_simple_outbound\r\n {\"userCredentials\" => {\"accessToken\" => ACCESS_TOKEN}}\r\n end", "def authorize\n\n # redirect to kpass for authorization (and authentication if they're not\n # signed in.)\n # \n \n\n authorize_url = \"#{ENV['KPASS_ENDPOINT']}/oauth/authorize?app_id=#{ENV['KPASS_APP_ID']}\"\n redirect_to authorize_url\n end", "def authorize_endpoint(allow_approval = false)\n \n Rack::OAuth2::Server::Authorize.new do |req, res|\n @client = Oauth2Providable::Client.find_by_identifier(req.client_id) || req.bad_request!\n res.redirect_uri = @redirect_uri = req.verify_redirect_uri!(@client.redirect_uri)\n \n if allow_approval\n if params[:approve].present? && req.response_type == :code\n authorization_code = current_user.authorization_codes.create!(\n :client => @client,\n :account_sid => request.env['rack.session']['session_id'])\n res.code = authorization_code.token\n res.approve!\n else\n req.access_denied!\n end\n else\n @response_type = req.response_type\n end\n \n end\n \n end", "def auth\r\n OAuth2\r\n end", "def fire_eagle_auth_url\n client = if fire_eagle_requested?\n requested_client\n else\n fire_eagle_request!\n end\n client.authorization_url \n end", "def two_factor_auth_client\r\n @two_factor_auth_client ||= TwoFactorAuth::Client.new(config: config)\r\n end", "def auth\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"params=#{params}\",\n \"\" ] if browse_everything_controller_debug_verbose\n # params contains the access code with with the key :code\n provider_session.token = provider.connect(params, provider_session.data, connector_response_url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider_session.token=#{provider_session.token}\",\n \"\" ] if browse_everything_controller_debug_verbose\n provider_session.token\n end", "def create_2f_authorization(client)\n two_factor = Configuration.ask_for_two_factor\n\n create_authorization_token(client, two_factor)\n end", "def client\n OAuth2::Client.new(\n API_KEY, \n API_SECRET, \n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n )\n end", "def client\n OAuth2::Client.new(\n API_KEY, \n API_SECRET, \n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n )\n end", "def client\n OAuth2::Client.new(\n API_KEY,\n API_SECRET,\n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n )\n end", "def oauth_access\n client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret})\n\n request_token = client.request_token\n token = request_token.token\n secret = request_token.secret\n\n puts \"Go to http://www.fitbit.com/oauth/authorize?oauth_token=#{token} and then enter the verifier code below and hit Enter\"\n verifier = gets.chomp\n\n access_token = client.authorize(token, secret, { :oauth_verifier => verifier })\n\n puts \"Verifier is: \"+verifier\n puts \"Token is: \"+access_token.token\n puts \"Secret is: \"+access_token.secret\n\n token = access_token.token\n secret = access_token.secret\n user_id = '3B8C8S'\n\n client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret, :token => token, :secret => secret, :user_id => user_id})\n access_token = client.reconnect(token, secret)\n # Pass client to runner here\n client\n end", "def userauth_request(username, next_service, auth_method, *others); end", "def oauth_handshake\r\n request_proxy = OAuth::RequestProxy.proxy request\r\n\r\n if request_proxy.signature.present?\r\n if request_proxy.token.present?\r\n oauth_required\r\n # 3-legged. Authorized user is current_token.user...\r\n else\r\n verify_oauth_consumer_signature\r\n # 2-legged. Authorized current_client_application?\r\n if @current_client_application\r\n @allow_private_access = @current_client_application.allow_private_access?\r\n @allow_write_access = @current_client_application.allow_write_access?\r\n end\r\n end\r\n elsif request_proxy.consumer_key.present?\r\n if @current_client_application = ClientApplication.\r\n find_by_key(request_proxy.consumer_key)\r\n # 1-legged. For JavaScript widgetry.\r\n @allow_private_access = false\r\n else\r\n invalid_oauth_response :unauthorized, \"Using Invalid Consumer Key\"\r\n false\r\n end\r\n else\r\n invalid_oauth_response :bad_request, \"Missing Required Consumer Key\"\r\n false\r\n end\r\n end", "def authenticate_with(identity, next_service, username); end", "def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code] \n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step \n token = client.auth_code.get_token(code, :redirect_uri => REDIRECT_URI)\n \n #Use token object to create access token for user \n #(this is required so that you provide the correct param name for the access token)\n access_token = OAuth2::AccessToken.new(client, token.token, {\n :mode => :query,\n :param_name => \"oauth2_access_token\",\n })\n \n #Use the access token to make an authenticated API call\n response = access_token.get('https://www.linkedin.com/v1/people/~')\n \n #Print body of response to command line window\n puts response.body\n \n # Handle HTTP responses\n case response\n when Net::HTTPUnauthorized\n # Handle 401 Unauthorized response\n when Net::HTTPForbidden\n # Handle 403 Forbidden response\n end\n end\n end", "def exchange_token(request)\n Rails.logger.debug \"Auth : #{$authorization}\"\n $authorization.code = request.body.read\n $authorization.fetch_access_token!\n $client.authorization = $authorization\n\n # Verify the issued token matches the user and client.\n oauth2 = $client.discovered_api('oauth2','v2')\n tokeninfo = JSON.parse($client.execute(oauth2.tokeninfo,\n :access_token => $client.authorization.access_token,\n :id_token => $client.authorization.id_token).response.body)\n\n # Serialize and store the token in the user's session.\n token_pair = GooglePlusSignInHelper::TokenPair.new\n token_pair.update_token!($client.authorization)\n\n return tokeninfo, token_pair\n end", "def exchange_auth_token\n @id_token = from_client_to_id_token(@client_token)\n render 'exchange_auth_token', formats: 'json', handlers: 'jbuilder'\n end", "def authenticate_request(allow_web_based_client = false)\n Rails.logger.info(\"allow_web_based_client-#{allow_web_based_client}\")\n\n request_parameters = request.request_method == 'GET' ? request.query_parameters : request.request_parameters\n\n service_response = authenticator.new(\n params.merge({\n request_parameters: request_parameters,\n url_path: request.path,\n allow_web_based_client: allow_web_based_client\n })\n ).perform\n\n if service_response.success?\n # Set client id\n params[:client] = service_response.data[:client]\n params[:client_id] = params[:client].id\n\n # Remove sensitive data\n service_response.data = {}\n else\n render_api_response(service_response)\n end\n end", "def authorise\n @oauth_client = OauthClient.find(params[:id])\n\n response = @oauth_client.exchange(params[:code], request.original_url) if params[:code]\n @oauth_client.access_token = response[\"access_token\"]\n @oauth_client.refresh_token = response[\"refresh_token\"]\n @oauth_client.expires_at = response[\"expires_at\"]\n\n respond_to do |format|\n if @oauth_client.save\n format.html { redirect_to oauth_client_path(@oauth_client), notice: 'OAuth client was successfully authorised.' }\n format.json { head :no_content }\n else\n format.html { render action: \"show\", error: 'OAuth client was not successfully authorised.' }\n format.json { render json: @oauth_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def authenticate\n oauth2_client = Qbo.get_client\n callback = Setting.host_name + \"/qbo/oauth_callback/\" \n grant_url = oauth2_client.auth_code.authorize_url(redirect_uri: callback, response_type: \"code\", state: SecureRandom.hex(12), scope: \"com.intuit.quickbooks.accounting\")\n redirect_to grant_url\n end", "def client\n ::DelegatedAuthentication.new(options[:app_id], options[:app_secret], nil, nil, options[:privacy_url], callback_url)\n end", "def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code] \n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step \n token = client.auth_code.get_token(code, :redirect_uri => get_redirect_uri)\n \n #Use token object to create access token for user \n #(this is required so that you provide the correct param name for the access token)\n access_token = OAuth2::AccessToken.new(client, token.token, {\n :mode => :query,\n :param_name => \"oauth2_access_token\",\n })\n \n session[:linkedin_token] = access_token.token\n #Use the access token to make an authenticated API call\n response = access_token.get('https://www.linkedin.com/v1/people/~')\n \n #Print body of response to command line window\n #logger.debug \"test putting string #{response.body}\"\n \n # Handle HTTP responses\n case response\n when Net::HTTPUnauthorized\n # Handle 401 Unauthorized response\n when Net::HTTPForbidden\n # Handle 403 Forbidden response\n end\n end\n end", "def authorize_switch_user\n authenticate_user!\n if params[:response_type].nil?\n params[:response_type] = \"code\"\n end\n @authorizer = OAuth::Provider::Authorizer.new current_user, true, params\n render :text => @authorizer.redirect_uri\n end", "def authenticate_resource_request options = {}\n verifications = {\n client_credential: lambda do |_x|\n ::Signet::OAuth1::Credential.new(\"Client credential key\",\n \"Client credential secret\")\n end\n }\n\n unless options[:two_legged] == true\n verifications.update(\n token_credential: lambda do |_x|\n ::Signet::OAuth1::Credential.new(\"Token credential key\",\n \"Token credential secret\")\n end\n )\n end\n # Make sure all required state is set\n verifications.each do |(key, _value)|\n raise ArgumentError, \"#{key} was not set.\" unless send key\n end\n\n request_components = if options[:request]\n verify_request_components(\n request: options[:request],\n adapter: options[:adapter]\n )\n else\n verify_request_components(\n method: options[:method],\n uri: options[:uri],\n headers: options[:headers],\n body: options[:body]\n )\n end\n method = request_components[:method]\n uri = request_components[:uri]\n headers = request_components[:headers]\n body = request_components[:body]\n\n\n if !body.is_a?(String) && body.respond_to?(:each)\n # Just in case we get a chunked body\n merged_body = StringIO.new\n body.each do |chunk|\n merged_body.write chunk\n end\n body = merged_body.string\n end\n raise TypeError, \"Expected String, got #{body.class}.\" unless body.is_a? String\n\n media_type = nil\n headers.each do |(header, value)|\n media_type = value.gsub(/^([^;]+)(;.*?)?$/, '\\1') if header.casecmp(\"Content-Type\").zero?\n end\n\n auth_hash = verify_auth_header_components headers\n\n auth_token = auth_hash[\"oauth_token\"]\n\n\n unless options[:two_legged]\n return nil if auth_token.nil?\n return nil unless (token_credential = find_token_credential auth_token)\n token_credential_secret = token_credential.secret if token_credential\n end\n\n return nil unless (client_credential =\n find_client_credential auth_hash[\"oauth_consumer_key\"])\n\n return nil unless validate_nonce_timestamp(auth_hash[\"oauth_nonce\"],\n auth_hash[\"oauth_timestamp\"])\n\n if method == (\"POST\" || \"PUT\") &&\n media_type == \"application/x-www-form-urlencoded\"\n request_components[:body] = body\n post_parameters = Addressable::URI.form_unencode body\n post_parameters.each { |param| param[1] = \"\" if param[1].nil? }\n # If the auth header doesn't have the same params as the body, it\n # can't have been signed correctly(5849#3.4.1.3)\n unless post_parameters.sort == auth_hash.reject { |k, _v| k.index \"oauth_\" }.to_a.sort\n raise MalformedAuthorizationError, \"Request is of type application/x-www-form-urlencoded \" \\\n \"but Authentication header did not include form values\"\n end\n end\n\n client_credential_secret = client_credential.secret if client_credential\n\n computed_signature = ::Signet::OAuth1.sign_parameters(\n method,\n uri,\n # Realm isn't used, and will throw the signature off.\n auth_hash.reject { |k, _v| k == \"realm\" }.to_a,\n client_credential_secret,\n token_credential_secret\n )\n\n return nil unless safe_equals? computed_signature, auth_hash[\"oauth_signature\"]\n { client_credential: client_credential,\n token_credential: token_credential,\n realm: auth_hash[\"realm\"] }\n end", "def client\n # Merge in authorize url if supplied\n options.authorize_params[:clientId] = options.client_id\n options.authorize_params[:redirect] = callback_url\n options.client_options[:authorize_url] = options.authorize_url if options.authorize_url.present?\n options.client_options[:site] = options.site if options.site.present?\n\n ::OAuth2::Client.new(\n options.client_id,\n options.client_secret,\n deep_symbolize(options.client_options)\n )\n end", "def create_non_admin_user_authenticate\n post '/users', 'username' => 'testuser', 'password' => 'testpassword', 'email_address' => '[email protected]'\n id_user = last_response.json_body['id']\n digest_authorize 'testuser', 'testpassword'\n id_user\nend", "def signin\n oauth_authorize\n end", "def oauth\n login_at(auth_params[:provider])\n end", "def oauth\n login_at(auth_params[:provider])\n end", "def call(env)\n @request = Request.new(env)\n\n @request.with_valid_request do\n if client_verified?\n env[\"oauth_client\"] = client\n @app.call(env)\n else\n [401, {}, [\"Unauthorized\"]]\n end\n end\n end", "def oauth2callback\n @g_cal_api.oauth2callback\n end", "def authorize\n # Store params in session, if I haven't do it before\n session[:response_type] ||= params[:response_type]\n session[:client_id] ||= params[:client_id]\n session[:client_secret] ||= params[:client_secret]\n session[:state] ||= params[:state]\n logger.debug \"Session response_type: #{session[:response_type]}\"\n logger.debug \"Session client_id: #{session[:client_id]}\"\n logger.debug \"Session client_secret: #{session[:client_secret]}\"\n logger.debug \"Session state: #{session[:state]}\"\n\n unless check_app_auth(session[:client_id], session[:client_secret], session[:response_type], session[:state])\n if signed_in?\n logger.debug \"Signed in\"\n if Settings.multi_application == 'true'\n app = App.where(id: session[:client_id]).first\n # If the user has already authorized the app, reply, else request the authorization\n renew_token = RenewToken.where(app: app, user: current_user).first\n uri = app.redirect_uri\n @name = app.name\n else\n renew_token = RenewToken.where(app: nil, user: current_user).first\n uri = Settings.single_application_mode_url + Settings.single_application_mode_path\n @name = Settings.single_application_mode_name\n end\n logger.debug(\"Renew token: #{renew_token}\")\n unless renew_token.nil?\n user_token = current_user.generate_token(session[:client_id])\n reply_authorize(session[:response_type], uri, session[:state], user_token, renew_token)\n end\n else\n logger.debug \"Not signed in\"\n redirect_to signin_path\n end\n end\n end", "def authenticate_client\r\n client_id = request.headers['client-id']\r\n client_secret = request.headers['client-secret']\r\n\r\n unless client_id == Rails.application.secrets.api_key && client_secret == Rails.application.secrets.api_secret\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Unauthorized Request'\r\n ), adapter: :json, status: :unauthorized\r\n nil\r\n end\r\n\r\n end", "def get_access\n path = '/v3/oauth/authorize'\n data = \"consumer_key=#{Consumer_key}&code=#{Token}\"\n return pocket_api(path,data)\nend", "def set_oauth2_auth(client, secret, authorize_path, token_path, site = nil)\n FHIR.logger.info 'Configuring the client to use OpenID Connect OAuth2 authentication.'\n @use_oauth2_auth = true\n @use_basic_auth = false\n @security_headers = {}\n options = {\n site: site || @base_service_url,\n authorize_url: authorize_path,\n token_url: token_path,\n raise_errors: true\n }\n client = OAuth2::Client.new(client, secret, options)\n client.connection.proxy(proxy) unless proxy.nil?\n @client = client.client_credentials.get_token\n end", "def request_access_token\n # An `OAuth::Consumer` object can make requests to the service on\n # behalf of the client application.\n\n # Ask service for a URL to send the user to so that they may authorize\n # us.\n request_token = CONSUMER.get_request_token\n authorize_url = request_token.authorize_url\n\n # Launchy is a gem that opens a browser tab for us\n Launchy.open(authorize_url)\n\n # Because we don't use a redirect URL; user will receive a short PIN\n # (called a **verifier**) that they can input into the client\n # application. The client asks the service to give them a permanent\n # access token to use.\n puts \"Login, and type your verification code in\"\n oauth_verifier = gets.chomp\n access_token = request_token.get_access_token(\n :oauth_verifier => oauth_verifier\n )\nend", "def authenticate(client)\n \n end", "def oauth_consumer\n @oauth_consumer\n end", "def test_feature_oauth_token_expires_in_whitelist_client_ids\n # Setup\n @user = setup_user\n\n opts = {\n 'internal_tools' => true,\n 'expires_in' => 3\n }\n\n @internal_tools = setup_user(opts)\n\n headers = { 'Authorization' => \"Bearer #{@internal_tools.oauth_token}\" }\n\n # Step 1\n get \"/usr/#{@user.id}\", {}, headers\n assert_response(@response, :success)\n\n sleep(opts['expires_in'])\n\n # Step 2\n get \"/usr/#{@user.id}\", {}, headers\n assert_response(@response, :success, \"Expected Success for Whitelisted client_id => #{@internal_tools.turtle_client_id} : 'expires_in' => #{opts['expires_in']}\")\n end", "def wepay_authorization_url(redirect_uri)\n WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\nend", "def authenticate_with(identity, next_service, username, key_manager); end", "def api_args\n return @api_args unless @api_args.blank?\n \n @api_args = settings.select_keys(\"client_id\", \"client_secret\")\n\n @api_args[\"response_type\"] = \"code\"\n\n uri = URI(my_addr)\n uri.path = \"/#{app.name}/authCallback\" \n @api_args[\"redirect_uri\"] = uri.to_s\n\n \n @api_args[\"token\"] = access_token if signed_in?\n\n @api_args[\"id\"] = user_entity[\"id\"].to_s if signed_in?\n\n return @api_args\n end", "def exchange!\n\t\treturn false unless authorized?\n\t\treturn false unless oauth10? || verifier==provided_oauth_verifier\n\n\t\tRequestToken.transaction do\n\t\t\taccess_token = user.tokens.where(\n\t\t\t\t\"client_application_id = ? AND type = 'AccessToken' AND invalidated_at IS NULL AND authorized_at IS NOT NULL\",\n\t\t\t\tclient_application.id\n\t\t).first\n\t\t\tif (token != nil)\n\t\taccess_token = AccessToken.create(user: user, client_application: client_application)\n\t\tend\n\t\t\t\n\t\t\tinvalidate!\n\t\t\taccess_token\n\t\tend\n\tend", "def exchange_code(authorization_code)\n\t\tclient_secrets = Google::APIClient::ClientSecrets.load(CLIENT_SECRET_PATH)\n client = client_secrets.to_authorization \n client.update!(redirect_uri: 'postmessage')\n client.code = authorization_code\n \n\t begin\n\t # client.authorization.fetch_access_token!\n\t client.fetch_access_token!\n\t return client\n\t rescue Signet::AuthorizationError\n\t raise CodeExchangeError.new(nil)\n\t end\n\tend", "def new_client_application\n OAuth2::Client.new(caller_service.client_id, caller_service.client_secret, :site => authorizator_service.site, :raise_errors => false)\n end", "def rest_token_endpoint; end", "def auth_scheme; end", "def gen_auth()\n options = get_options()\n auth = {\"cookie\" => {}, \"authorization\" => {}}\n\n if options.include?(:access_token)\n puts \"Using pre-authenticated access token\"\n puts \"Logging into self service @ #{options[:selfservice_url]}\"\n ss_login_req = RestClient::Request.new(\n :method => :get,\n :url => \"#{options[:selfservice_url]}/api/catalog/new_session?account_id=#{options[:account_id]}\",\n :headers => {\"Authorization\" => \"Bearer #{options[:access_token]}\"}\n )\n ss_login_resp = ss_login_req.execute\n auth[\"authorization\"] = {\"Authorization\" => \"Bearer #{options[:access_token]}\"}\n return auth\n end\n\n if options.include?(:refresh_token)\n # OAuth\n puts \"Logging into RightScale API 1.5 using OAuth @ #{options[:api_url]}\"\n cm_login_req = RestClient::Request.new(\n :method => :post,\n :payload => URI.encode_www_form({\n :grant_type => \"refresh_token\",\n :refresh_token => options[:refresh_token]\n }),\n :url => \"#{options[:api_url]}/api/oauth2\",\n :headers => {\"X-API-VERSION\" => \"1.5\"}\n )\n cm_login_resp = cm_login_req.execute\n oauth_token = JSON.parse(cm_login_resp.to_s)[\"access_token\"]\n puts \"Logging into self service @ #{options[:selfservice_url]}\"\n ss_login_req = RestClient::Request.new(\n :method => :get,\n :url => \"#{options[:selfservice_url]}/api/catalog/new_session?account_id=#{options[:account_id]}\",\n :headers => {\"Authorization\" => \"Bearer #{oauth_token}\"}\n )\n ss_login_resp = ss_login_req.execute\n auth[\"authorization\"] = {\"Authorization\" => \"Bearer #{oauth_token}\"}\n return auth\n end\n\n if options.include?(:email) && options.include?(:password)\n puts \"Logging into RightScale API 1.5 @ #{options[:api_url]}\"\n cm_login_req = RestClient::Request.new(\n :method => :post,\n :payload => URI.encode_www_form({\n :email => options[:email],\n :password => options[:password],\n :account_href => \"/api/accounts/#{options[:account_id]}\"\n }),\n :url => \"#{options[:api_url]}/api/session\",\n :headers => {\"X_API_VERSION\" => \"1.5\"}\n )\n cm_login_resp = cm_login_req.execute\n\n puts \"Logging into self service @ #{options[:selfservice_url]}\"\n ss_login_req = RestClient::Request.new(\n :method => :get,\n :url => \"#{options[:selfservice_url]}/api/catalog/new_session?account_id=#{options[:account_id]}\",\n :cookies => {\"rs_gbl\" => cm_login_resp.cookies[\"rs_gbl\"]}\n )\n ss_login_resp = ss_login_req.execute\n auth[\"cookie\"] = cm_login_resp.cookies\n return auth\n end\n\n if options.include?([\"instance_token\"])\n raise \"Sorry, don't think we can authenticate with SS using an instance token\"\n end\n raise \"No auth methods found\"\nend", "def initialize(options={})\n # Client auth configuration\n @flow = options[:flow] || options.keys.first.to_s || 'web'\n fdata = options[@flow.to_sym] || options[@flow]\n @client_id = fdata[:client_id] || fdata[\"client_id\"]\n @client_secret = fdata[:client_secret] || fdata[\"client_secret\"]\n @redirect_uris = fdata[:redirect_uris] || fdata[\"redirect_uris\"]\n @redirect_uris ||= [fdata[:redirect_uri] || fdata[\"redirect_uri\"]].compact\n @javascript_origins = (\n fdata[:javascript_origins] ||\n fdata[\"javascript_origins\"]\n )\n @javascript_origins ||= [fdata[:javascript_origin] || fdata[\"javascript_origin\"]].compact\n @authorization_uri = fdata[:auth_uri] || fdata[\"auth_uri\"]\n @authorization_uri ||= fdata[:authorization_uri]\n @token_credential_uri = fdata[:token_uri] || fdata[\"token_uri\"]\n @token_credential_uri ||= fdata[:token_credential_uri]\n\n # Associated token info\n @access_token = fdata[:access_token] || fdata[\"access_token\"]\n @refresh_token = fdata[:refresh_token] || fdata[\"refresh_token\"]\n @id_token = fdata[:id_token] || fdata[\"id_token\"]\n @expires_in = fdata[:expires_in] || fdata[\"expires_in\"]\n @expires_at = fdata[:expires_at] || fdata[\"expires_at\"]\n @issued_at = fdata[:issued_at] || fdata[\"issued_at\"]\n end", "def client\n if current_account && current_account.fb_token\n FBGraph::Client.new(:client_id => $api_key,:secret_id =>$secret_key,:token=>current_account.fb_token) \n else\n FBGraph::Client.new(:client_id => $api_key,:secret_id =>$secret_key) \n end\n\n # OAuth2::Client.new($api_key, $secret_key, :site => 'https://graph.facebook.com')\n end", "def client_secret; end", "def oauth_v2_exchange(options = {})\n raise ArgumentError, 'Required arguments :client_id missing' if options[:client_id].nil?\n raise ArgumentError, 'Required arguments :client_secret missing' if options[:client_secret].nil?\n post('oauth.v2.exchange', options)\n end", "def authorize(user,pass)\n @uri.path += 'auth'\n @uri.query = \"user=\" + user + \"&pass=\" + pass\n response = @caller.request_get(@uri)\n raise RestApiCallerError::AuthorizationError unless response.code == '200'\n @token = JSON.parse(response.body)[\"token\"]\n raise RestApiCallerError::AuthorizationError unless @token\n end", "def body\n {:client_id => client_id, :grant_type => :password}\n end", "def request_token\n username = @credentials['username']\n password = @credentials['password']\n # app_name = @credentials['app_name']\n app_name = @credentials['app_name']\n vendor_name = @credentials['vendor_name']\n bus_num = @credentials['bus_num']\n scope = @credentials['scope']\n\n payload_hash = {\n 'grant_type' => 'password',\n 'username' => username,\n 'password' => password,\n 'scope' => scope\n }\n\n # The user name for inContact's API takes the form\n # app_api_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\" + \":\" + \"#{bus_num}\"\n api_app_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\"\n\n puts \"Authorizing... \\n\"\n\n # Specify token URL.\n url = URI('https://api.incontact.com/InContactAuthorizationServer/Token')\n # url = URI('https://api-c71.nice-incontact.com/InContactAuthorizationServer/Token')\n\n # Create connection object\n connection = Net::HTTP.new(url.host, url.port)\n # At *work*:\n # connection = Net::HTTP.new(url.host, url.port, 'asqproxy.vzbi.com', 80)\n # For *Fiddler*\n # connection = Net::HTTP.new(url.host, url.port, '127.0.0.1', 8888)\n\n connection.use_ssl = true\n # Uncomment the following line to tell Ruby to ignore invalid security certs.\n # connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Create post object\n post = Net::HTTP::Post.new(url)\n\n # OAuth 2 token requests are usually the 'user' + 'pass' base64 encoded\n post.basic_auth(api_app_name, bus_num)\n\n # get the POST post _fileheaders\n # post['Content-Type'] = 'audio/flac'\n post['Content-Type'] = 'application/json; charset=UTF-8'\n post['Accept'] = 'application/json'\n # \"Accept-Encoding\" => \"gzip, deflate, sdch, br\",\n post['Accept-Encoding'] = 'none'\n post['Connection'] = 'keep-alive'\n\n # Prepare the HTTP message body to be posted with the request.\n # Convert the payload_hash hash to a json string.\n payload = payload_hash.to_json\n # It will be the message body (payload) of the HTTP post.\n post.body = payload\n\n # Make the HTTP post request and store the response.\n # The 'begin' & 'rescue' is an aborted attempt to put\n # error/exception handling around the http post\n # *begin*\n # *rescue* StandardError\n # *end*\n response = connection.request(post)\n\n # http_status_code = response.code.to_i\n http_status_code = response.code.strip\n if http_status_code.chr != '2'\n # Show me http status code\n puts \"/n http_status_code: #{http_status_code}\"\n end\n\n if response.is_a?(Net::HTTPSuccess)\n puts \"response is a Net::HTTPSuccess object\"\n # if response is OK then parese it to a Ruby data structure\n access_token_hash = JSON.parse(response.body)\n # access_token = access_token_hash['access_token']\n end\n\n access_token_hash\n end", "def authenticate\n RestClient::Request.execute(:method => :post,\n :url => @oauth_request,\n :headers => {\n \"Content-Type\" => \"application/json; charset=UTF8\",\n \"X-Accept\" => \"application/json\"\n },\n :payload => {\n :consumer_key => ENV['POCKET_CONSUMER_KEY'],\n :redirect_uri => ENV['REDIRECT_URI']\n })\n end", "def authorize_client session_token\n base_url = \"#{APP_CONFIG['okta_base_url']}/oauth2/v1/authorize\"\n redirect_uri = \"#{APP_CONFIG['okta_openid_redirect_uri']}\"\n client_id = \"#{APP_CONFIG['okta_client_id']}\"\n scopes = [\"openid\", \"email\", \"groups\"].join(\"%20\")\n url = \"#{base_url}?sessionToken=#{session_token}&redirect_uri=#{redirect_uri}&response_type=id_token&client_id=#{client_id}&scope=#{scopes}&response_mode=fragment\"\n\n begin\n HttpClient.get(url)\n rescue HTTParty::RedirectionTooDeep => e\n open_id_token = e.response.header['location']\n end\n open_id_token.split('=').last\n end", "def openid_client_secret=(_arg0); end", "def auth_client(client_id, client_secret, params = {})\n RubyLokaliseApi::OAuth2::Auth.new client_id, client_secret, params\n end", "def client_secret=(_arg0); end", "def authorize_code(authorization_code)\n api_client.authorization.code = authorization_code\n api_client.authorization.fetch_access_token!\n\n result = api_client.execute!(:api_method => settings.oauth2.userinfo.get)\n user = User.first_or_create(:email => result.data.email)\n api_client.authorization.refresh_token = (api_client.authorization.refresh_token || user.refresh_token)\n if user.refresh_token != api_client.authorization.refresh_token\n user.refresh_token = api_client.authorization.refresh_token\n user.save\n end\n session[:user_id] = user.id\nend", "def associate_client_with_token(data_hash)\n\n response = rest_post_call($INTRODUCTIONS_DOMAIN + '/confirm', data_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed to associate client with token: \" + response.body\n end\n\n return response.body\n\nend", "def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n end\nend", "def authorize\n if session[:dc_access_token].nil? or session[:dc_address_for_token] != session[:dc_address] then\n session[:dc_address_for_token] = session[:dc_address]\n redirect \"#{settings.FQDN}/oauth/authorize?client_id=#{settings.api_key}&scope=DC&redirect_uri=#{settings.redirect_url}\"\n else\n redirect '/getDeviceCapabilities'\n end\nend", "def openid_endpoint; end", "def client\n OAuth2::Client.new(api_key,api_secret, :site=>{:url=>'https://graph.renren.com',:response_type=>'code'}, :access_token_url=>'https://graph.renren.com/oauth/token')\n end", "def authenticate!(type = :portal)\n load_consumer_config(type) if oauth_consumer.nil?\n\n @oauth_request = oauth_consumer.get_request_token\n @oauth_authorize_url = oauth_request.authorize_url\n\n @oauth_consumer.instance_eval do\n # The token request reponse is scoped only in the token_request method, but I need to get access to the response\n # headers so that I can pull back the Content-Location header and get the authenticated user URI\n def token_request(http_method, path, token = nil, request_options = {}, *arguments)\n @tr_response = request(http_method, path, token, request_options, *arguments)\n case @tr_response.code.to_i\n\n when (200..299)\n if block_given?\n yield @tr_response.body\n else\n # symbolize keys\n # TODO this could be considered unexpected behavior; symbols or not?\n # TODO this also drops subsequent values from multi-valued keys\n CGI.parse(@tr_response.body).inject({}) do |h,(k,v)|\n h[k.strip.to_sym] = v.first\n h[k.strip] = v.first\n h\n end\n end\n when (300..399)\n # this is a redirect\n @tr_response.error!\n when (400..499)\n raise OAuth::Unauthorized, @tr_response\n else\n @tr_response.error!\n end\n end\n \n # The HTTP response from token_request\n def token_request_response\n @tr_response\n end\n end\n \n oauth_authorize_url\n end", "def step2\n initialize_vars\n url = \"#{@oauth_vars[:token_url]}?code=#{params[:code]}&grant_type=authorization_code&client_id=#{@oauth_vars[:client_id]}&client_secret=#{@oauth_vars[:client_secret]}&response_type=code&redirect_uri=#{@redirect_uri}\"\n rep = JSON.parse(get_json_from_https(url))\n session[:access_token] = rep[\"access_token\"]\n\n do_API_call\n end", "def to_api\n\n results = {\n 'nation_name' => nation_name,\n 'client_app_id' => client_app_id,\n 'client_secret' => client_secret,\n 'redirect_uri' => redirect_uri\n }\n \n end", "def authorize\n end", "def authorize\n end", "def authorize_request\n if request.path_info.include?('clients')\n @current_user = AuthorizeClientApiRequest.new(request.parameters[:client_uuid], request.headers).call[:user]\n elsif request.path_info.include?('apps')\n @current_device = AuthorizeDeviceApiRequest.new(request.parameters[:device_uuid], request.headers).call[:device]\n @current_user = @current_device.user unless @current_device.nil?\n else\n raise(ExceptionHandler::AuthenticationError, Message.unauthorized)\n end\n end", "def callback_phase\n options.client_options[:access_token_path] = \"/oauth/qzoneoauth_access_token?oauth_vericode=#{request['oauth_vericode'] }\" if request['oauth_vericode']\n super\n end", "def doc_auth_oauth2(name, flows)\n add_auth_method name,{\n type: 'oauth2',\n flows: flows\n }\n end", "def openid_client_secret; end", "def rest_token_endpoint=(_arg0); end", "def request_wepay_access_token(code, redirect_uri)\n response = GemsUsage::Application::WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n\n self.create_wepay_account\n end\n end", "def oauth\n request_token = @oauth_consumer.get_request_token\n authorize_url = request_token.authorize_url(:oauth_consumer_key => \n Netflix::Client.consumer_key)\n Launchy.open(authorize_url)\n puts \"Go to browser, a page has been opened to establish oauth\"\n printf \"Pin from Netflix:\"\n pin = gets.chomp\n access_token = request_token.get_access_token(:oauth_verifier => pin)\n end", "def create_washington_auth_request(scope)\n post user_session_path, params: {user: { \n email: users(:washington).email,\n password: \"georgepass\"\n }}\n \n context = {}\n context[\"scope\"] = scope\n context[\"state\"] = SecureRandom.urlsafe_base64(10)\n context[\"code_verifier\"] = SecureRandom.urlsafe_base64(10)\n context[\"client_id\"] = \"http://localhost:12345\"\n context[\"redirect_uri\"] = \"http://localhost:12345/redirect\"\n\n approval_params = {}\n scope.split(\" \").each {|s| approval_params[s] = 1}\n approval_params[\"code_challenge\"] = \n Base64.urlsafe_encode64(\n Digest::SHA256.digest(\n context[\"code_verifier\"])).chomp(\"=\")\n approval_params[\"commit\"] = \"Approve\"\n [\"state\", \"client_id\", \"redirect_uri\"].each do |p|\n approval_params[p] = context[p]\n end\n\n\n post indie_auth_approval_path, params: approval_params\n return context\n end", "def get_request_auth_code_url\n URI.encode(\"https://#{@subdomain}.zendesk.com/oauth/authorizations/new?response_type=code&redirect_uri=#{@redirect_uri}/&client_id=#{@unique}&scope=read%20write\")\n end", "def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n\n #create wepay account\n self.create_wepay_account\n end\nend", "def request_wepay_access_token(code, redirect_uri)\n response = WEPAY.oauth2_token(code, redirect_uri)\n if response['error']\n raise \"Error - \"+ response['error_description']\n elsif !response['access_token']\n raise \"Error requesting access from WePay\"\n else\n self.wepay_access_token = response['access_token']\n self.save\n\n\t#create WePay account\n self.create_wepay_account\n end\nend", "def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end", "def password_auth(opts={})\n url = URI.join(@auth_site, @token_url).to_s\n body = {client_id: @client_id,\n client_secret: @client_secret,\n email: @email,\n password: @password,\n scope: \"read write share\",\n grant_type: \"password\"}.merge(opts)\n\n #ITout.logger.info(\"ITout::OAuth post-ing #{url} with params #{{body: body, headers: headers}}\")\n response = HTTParty.send(:post, url, body: body, headers: headers)\n #ITout.logger.debug(\"ITout::OAuth #{url} response: #{response.code} #{response.body}\")\n\n if response.code == 200 and JSON.parse(response.body)[\"access_token\"] != nil\n @access_token = JSON.parse(response.body)[\"access_token\"]\n else\n raise \"Client failed to get an auth token, response was: \" + response.body\n end\n end", "def authenticator\n Authentication::WebappsRequest::V0\n end", "def auth_client\n raise NOT_IMPLEMENTED_ERROR\n end", "def send_auth_request \n request = AuthorizeRequest.new(:get, action_to_call) do |req|\n req.request_params = params\n end\n request.send_request(Config.url)\n end", "def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end", "def codeExchange(code)\n # Upgrade the code into a token object.\n $authorization.code = code\n $authorization.fetch_access_token!\n $client.authorization = $authorization\n\n # TODO: move into verify_token function\n id_token = $client.authorization.id_token\n encoded_json_body = id_token.split('.')[1]\n\n # Base64 must be a multiple of 4 characters long, trailing with '='\n encoded_json_body += (['='] * (encoded_json_body.length % 4)).join('')\n json_body = Base64.decode64(encoded_json_body)\n body = JSON.parse(json_body)\n\n # You can read the Google user ID in the ID token.\n # \"sub\" represents the ID token subscriber which in our case\n # is the user ID. This sample does not use the user ID.\n gplus_id = body['sub']\n puts \"User ID: \"\n puts gplus_id.inspect\n\n # Serialize and store the token in the user's session.\n token_pair = TokenPair.new\n token_pair.update_token!($client.authorization)\n\n puts token_pair.inspect\nend", "def authorize_user(request_token, oauth_verifier)\n access_token = client.authorize(request_token.token,\n request_token.secret,\n oauth_verifier: oauth_verifier)\n\n # hash rocket syntax for consistency with the info\n client.info.merge('token' => access_token.token,\n 'secret' => access_token.secret)\n end", "def authorize\n if params[:response_type].nil?\n params[:response_type] = \"code\"\n end\n @authorizer = OAuth::Provider::Authorizer.new current_user, true, params\n client_application = ClientApplication.find_by_key(params[:client_id])\n statsd = StatsManager.new\n statsd.feedAuthorizeMetric(current_user, client_application)\n #If this is an auto authentication transparent for end user\n redirect_to @authorizer.redirect_uri\n end", "def get_rest_authentication()\n reader = CSV.open('keys/sf_key.csv')\n client_id = reader.shift[0]\n client_secret = reader.shift[0]\n username = reader.shift[0]\n password = reader.shift[0]\n auth_payload = \"grant_type=password&client_id=#{client_id}\" \\\n \"&client_secret=#{client_secret}\" \\\n \"&username=#{username}&password=#{password}\"\n params = {:accept => 'application/json'}\n @auth_response = RestClient.post $oauth_token_endpoint, auth_payload, params\n auth_json = JSON.parse(@auth_response)\n auth_vals = {\"access_token\" => auth_json[\"access_token\"],\n \"instance_url\" => auth_json[\"instance_url\"]}\n end", "def authorize\n redirect_to 'https://delicious.com/auth/authorize?client_id=' + @client_id.to_s + '&redirect_uri=' + delicious_import_url\n end", "def token_auth(*args, &block); end", "def authenticate\n @discogs = Discogs::Wrapper.new(\"Test OAuth\")\n request_data = @discogs.get_request_token(DISCOGS_API_KEY, DISCOGS_API_SECRET, \"http://127.0.0.1:3000/callback\")\n \n session[:request_token] = request_data[:request_token]\n \n redirect_to request_data[:authorize_url]\n end" ]
[ "0.6560234", "0.64327234", "0.61521095", "0.6107974", "0.6073148", "0.6073148", "0.60122347", "0.6003596", "0.598927", "0.5957799", "0.59501743", "0.5916614", "0.58853847", "0.58667505", "0.58667505", "0.58643615", "0.5848473", "0.58226377", "0.5813317", "0.57771486", "0.57600886", "0.5755912", "0.57458305", "0.5728947", "0.57253057", "0.5710052", "0.57013196", "0.5700911", "0.5694363", "0.56867564", "0.5674151", "0.5669579", "0.5669407", "0.56676006", "0.56676006", "0.5657261", "0.5654891", "0.56543237", "0.5650508", "0.56493723", "0.56481993", "0.564554", "0.56418437", "0.5638876", "0.5627494", "0.5621321", "0.56161", "0.56148744", "0.5613663", "0.5610005", "0.5608065", "0.5606183", "0.5606001", "0.5604269", "0.5594603", "0.5593257", "0.5578722", "0.5573698", "0.5561955", "0.55596256", "0.5559617", "0.55552113", "0.55476105", "0.55342907", "0.55264354", "0.5526136", "0.55242443", "0.55198514", "0.55045414", "0.55037236", "0.5503373", "0.5501674", "0.5500853", "0.5499971", "0.549685", "0.5492397", "0.5492397", "0.54826605", "0.54778624", "0.5472823", "0.54663616", "0.5465845", "0.5464029", "0.5457108", "0.54499185", "0.54499125", "0.54466647", "0.54460514", "0.54437", "0.54398865", "0.54311246", "0.5429037", "0.54218936", "0.54207706", "0.5418457", "0.5416489", "0.5415645", "0.54107887", "0.5403089", "0.540096", "0.5400453" ]
0.0
-1
JSONP endpoint based on Devise session
def id render json: { passport_id: sso_session_id } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n respond_to do |format|\n format.html {\n render\n }\n format.json { \n render :json => {:auth_key => current_user.authentication_token }, \n :callback => params[:callback] \n }\n end\n end", "def show\n @session = Session.find(params[:id])\n session = project_one_session(@session)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { session: session }, :except => exceptions }\n format.js { render json: { session: session }, :except => exceptions, :callback => params[:callback] }\n end\n end", "def JsonP(json, params)\n callback = params.delete('callback') # jsonp\n\n if callback\n content_type :js\n response = \"#{callback}(#{json})\"\n else\n content_type :json\n response = json\n end\n\n response\nend", "def show\n render json: @session_resource\n end", "def well_known\n render json: {\n authorization_endpoint: \"#{root_url}oauth/authorize\",\n token_endpoint: \"#{root_url}oauth/token\",\n introspection_endpoint: \"#{root_url}oauth/introspect\",\n revocation_endpoint: \"#{root_url}oauth/revoke\",\n scopes_supported: ['user/*.read', 'user/*.write', 'user/*.*'],\n capabilities: ['launch-standalone']\n }\n end", "def v3\n jsc = JsConnectV3.new\n\n # 1. Configure your client ID and secret.\n jsc.set_client_id \"123\"\n jsc.set_secret \"123\"\n\n # 2. Set details of the current user or mark the connection as a guest.\n if @signed_in\n jsc.set_unique_id \"123\"\n jsc.set_name \"John Ruby\"\n jsc.set_email \"[email protected]\"\n jsc.set_photo_url \"\"\n else\n jsc.set_guest true\n end\n\n # 3. Get the redirect URL.\n begin\n url = jsc.generate_response_location self.params\n redirect_to url, :status => 302\n rescue StandardError => e\n # There could be an error too. Make sure to output an appropriate response.\n response.status = 400\n response.content_type = \"text/plain\"\n render :js => e.message\n end\n end", "def render_jsonp(obj, status = 200, options = {})\n super(obj, status, options.merge({request: request}))\n end", "def render_jsonp obj, status = 200, options = {}\n options.reverse_merge! :json => obj, :status => status, :callback => params[:callback]\n render options\n end", "def to_api\n\n results = {\n 'nation_name' => nation_name,\n 'client_app_id' => client_app_id,\n 'client_secret' => client_secret,\n 'redirect_uri' => redirect_uri\n }\n \n end", "def logged_in\n return bad_request unless request.format.json? or request.format.js?\n @response = {:logged_in => logged_in?}\n json_response\n end", "def index\n params[:response_type] ||= 'code'\n\n raise pre_auth.error_response.body.to_s unless pre_auth.authorizable?\n valid_request = validates_devise_authentication?\n crypt = ActiveSupport::MessageEncryptor.new(Rails.application.secrets.secret_key_base)\n @session_data = crypt.encrypt_and_sign(session.to_hash.to_json)\n return if valid_request\n\n render json: { error: I18n.t('devise.failure.not_found_in_database', authentication_keys: 'email') },\n status: :unauthorized\n end", "def logged_in\n return bad_request unless request.format.json? or request.format.js?\n @response = { logged_in: logged_in? }\n render_cross_origin_json\n end", "def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end", "def show\n render :json => @secret_key.to_json({})\n end", "def rest_token_endpoint; end", "def get_json\n params = {}\n params['access_token'] = EXPA.client.get_updated_token\n uri = URI(url_current_person)\n uri.query = URI.encode_www_form(params)\n force_get_response(uri)\n end", "def jsonp_response(json)\n [\n 200, # HTTP OK\n {'Content-Type' => 'text/javascript; charset=utf-8'},\n (params[:callback] || '') + '(' + JSON.generate(json) + ');'\n ]\n end", "def show \n user = User.find_by(id: session[:user_id])\n if user\n render json: user\n else \n render {error: \"Not authorized\"}, status: :unauthorized\n end\n end", "def json\n\t\t\tsession.resource_url do\n\t\t\t\t# Get the request info\n\t\t\t\tcontent = @session.context.response.body\n\t\t\t\t\n\t\t\t\t# Create new JSON lexer\n\t\t\t\tjsonobj = {}.from_json(JSON::Lexer.new(content))\n\t\t\t\t# Decode request\n\t\t\t\tr = nil\n\t\t\t\terror = nil\n\t\t\t\t# Verify that it is for an allowed method\n\t\t\t\t# Call Method\n\t\t\t\tparams = jsonobj[Cparams] ? jsonobj[Cparams] : []\n\t\t\t\t\n\t\t\t\tbegin\n\t\t\t\t\tif json_methods.include?(jsonobj[Cmethod].to_sym)\n\t\t\t\t\t\tr = params.size < 1 ?\n\t\t\t\t\t\t\tself.__send__(jsonobj[Cmethod]) :\n\t\t\t\t\t\t\tself.__send__(jsonobj[Cmethod], *jsonobj[Cparams])\n\t\t\t\t\tend\n\t\t\t\trescue Exception => e\n\t\t\t\t\terror = e.to_s\n\t\t\t\tend\n\t\t\t\t# Return Resource\n\t\t\t\tIowa::Resource.new(format_repsonse( r, error, jsonobj[Cid] || Cdefault ),Ctext_javascript)\n\t\t\tend\n\t\tend", "def current_user_signed_in\n respond_to do |format|\n format.js { render :json => current_user }\n end\n end", "def show\n #logger.debug( cookies.inspect )\n logger.debug( \"Authorization header: #{request.headers['Authorization']}\" )\n @session = Session.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml\n format.json do\n render :json => {\n :session => {\n :token => @session.token,\n :link => {\n :rel => 'session',\n :uri => session_path(@session)\n }\n }\n }\n end\n end\n end", "def login\n\t\trespond_to do |format|\n\t\t\tformat.js {}\n\t\tend\n\tend", "def json_show_signed_user\n\n @current_user = current_user\n respond_to do |format|\n #format.json { render json: @current_user.as_json(only:[:id,:username]), status: :ok}\n if @current_user.nil?\n format.json { render json: 'user not found' , status: :not_found }\n else\n format.json { render json: @current_user.as_json(only:[:id,:username]), status: :ok}\n end\n\n\n end\n end", "def auth_info\n render :action => 'auth_info.json', :layout => false\n end", "def show\n user = User.find_by(id: session[:user_id])\n if user\n render json: user, status: :ok\n else\n render json: {errors: \"Not authorized\"}, status: :unauthorized\n end\n end", "def return_response(response, jsonp)\n\n\tif(jsonp.nil?)\n\t\tcontent_type = \"application/json\"\n\t\tJSON.pretty_generate({\"response\" => {\"results\" => response, \"count\" => response.count}})\n\telse\n\t\tcontent_type = \"text/javascript\"\n\t\tjsonp + \"(\" + JSON.pretty_generate({\"response\" => {\"results\" => response, \"count\" => response.count}}) + \")\"\n\tend\nend", "def auth_endpoint_callback\n Rails.logger.debug \"------ Entering auth_endpoint_callback ------\"\n\n @organization = Organization.find(params[:org])\n\n session[\"access_token\"] = @organization.authorization_server.\n request_access_token(request, callback_url)\n redirect_to organization_records_path(@organization)\n end", "def token_callback\n # puts \"INTAGRAM CLIENT response ACCESS TOKEN ???? #{params.inspect}\"\n if params[:access_token]\n session[:instagram_access_token] = params[:access_token]\n # puts \"INTAGRAM SESSION TOKEN #{params[:access_token].inspect}\"\n\n end\n respond_to do |format|\n format.html {redirect_to profile_path }\n # redirect_to :back, :params => params[:url_params]\n end\n end", "def session_endpoint_public(_options)\n nil\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def index\n @sessions = active_conference.sessions.order('title')\n @tags = @sessions.tag_counts_on(:tags)\n \n sessions = @sessions.collect { |s| project_one_session(s) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { sessions: sessions }, :except => exceptions }\n format.js { render json: { sessions: sessions }, :except => exceptions, :callback => params[:callback] }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def connectURL\n\t\t\"http://beta.stoffiplayer.com/auth/#{provider}\"\n\tend", "def user_account_data\n \n render :json => {\n :csrf => form_authenticity_token,\n :burntAfter => Time.now + 30.days, # Current recommended max life\n :canPost => user_signed_in?,\n :signedIn => user_signed_in?\n }, \n :callback => params[:callback]\n end", "def auto_login\n render json: logged_in_user\n end", "def create\n self.resource = warden.authenticate!(auth_options)\n sign_in(resource_name, resource)\n \n respond_to do |format|\n format.json {\n render :json => {\n :user => current_user,\n :status => :ok,\n :authentication_token => current_user.authentication_token\n }\n }\n end\n end", "def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end", "def auto_login\n render json: @user\n end", "def auto_login\n render json: @user\n end", "def auto_login\n render json: @user\n end", "def my_profile\n render json: { user: current_user}\n end", "def auth_callback_test\n # render(:json=>request.env['omniauth.auth'].to_json)\n end", "def rest_endpoint; end", "def show\n @polling_session = PollingSession.find(params[:id])\n @polls = @polling_session.polls\n authorize! :read, PollingSession\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @polling_session }\n end\n end", "def index\n # 1. Get your client ID and secret here. These must match those in your jsConnect settings.\n client_id = \"123\"\n secret = \"123\"\n\n # 2. Grab the current user from your session management system or database here.\n signedIn = true # this is just a placeholder\n\n # YOUR CODE HERE.\n\n # 3. Fill in the user information in a way that Vanilla can understand.\n user = {}\n\n if signedIn\n # CHANGE THESE FOUR LINES.\n user[\"uniqueid\"] = \"123\"\n user[\"name\"] = \"John Ruby\"\n user[\"email\"] = \"[email protected]\"\n user[\"photourl\"] = \"\"\n end\n\n # 4. Generate the jsConnect string.\n begin\n jsResponse = JsConnect.getJsConnectResponse user, self.params, client_id, secret, Digest::SHA1\n\n rescue StandardError => e\n # 4a. You should handle an error and render out an appropriate response.\n jsResponse = JsConnect::Response.new 400, \"text/plain\", e.message\n end\n # To use the jsConnect v2 protocol only use:\n # json = JsConnect.getJsConnectString user, self.params, client_id, secret, secure, Digest::SHA1\n\n if jsResponse.status == 302\n redirect_to jsResponse.content, :status => jsResponse.status\n else\n response.status = jsResponse.status\n response.content_type = jsResponse.content_type\n render :js => jsResponse.content\n end\n end", "def respond_with_auth(provider)\n params[:href] = \"/auth/#{provider}\"\n respond_to do |format|\n format.js { render provider, :layout => false }\n format.html { render :template => 'social/auth' }\n end\n end", "def authenticate\n respond_to do |format|\n format.js { render nothing: true, status: 401 if current_user.nil? }\n format.html { redirect_to root_url if current_user.nil? }\n end\n end", "def my_current_user\n render json: current_user\n end", "def show\n authorize @producer\n render json: @producer\n end", "def auth\n\n @user = current_user\n render json: @user\n \n end", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def show\n print(\"@jwt_payload = \" + @jwt_payload['seq'].to_s)\n render json: {'abc':'abc'}, status: :ok\n end", "def show\n # byebug\n user = User.find_by(id: session[:user_id])\n render json: user\n end", "def index\n @callback = session[:callback]\n @payload = session[:payload]\n end", "def index\n # Once someone signs in, hand things over to the angular page\n if current_user && user_signed_in?\n #@post = Post.all\n respond_to do |format|\n format.json { render json: Post.all }\n format.html\n end\n\n else\n redirect_to new_user_session_path\n end\n end", "def web\n _auth(false)\n end", "def create\n respond_to do |format| \n format.html { super }\n format.json { \n warden.authenticate!(:scope => resource_name, :recall => \"#{controller_path}#new\")\n render :status => 200, :json => {:success => true, :redirect_to => session[:user_return_to] || after_sign_in_path_for(:user)} \n } \n end\n end", "def unauthenticated\n render_json status: :unauthorized\n end", "def user\n render json: current_user\n end", "def on_simple_outbound\r\n {\"userCredentials\" => {\"accessToken\" => ACCESS_TOKEN}}\r\n end", "def on_simple_outbound\r\n {\"userCredentials\" => {\"accessToken\" => ACCESS_TOKEN}}\r\n end", "def show\n session[:oauth] = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, SITE_URL + '/callback?event_id='+params[:id])\n @auth_url = session[:oauth].url_for_oauth_code(:permissions=>\"email, user_events, friends_events, rsvp_event\") \n puts session.to_s + \"<<< session\"\n \n\n @event = Event.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n render json: @api_user\n end", "def signed_get_request url\n token=jwt_get_signature url\n HTTParty.get('http://localhost:5000'+url,\n headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\"\n }\n )\n end", "def login(email, password)\n post api_v1_user_session_path, \n headers: { 'CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json' },\n params: { email: email, password: password }.to_json\nend", "def callback\n auth = build_auth\n respond_to do |format|\n if logged_in?\n add_identity_to_current_user(auth)\n welcome_user(current_user)\n format.html { redirect_logged_in_user }\n format.json { render_jsend_success(:logged_in) }\n else\n user = find_or_create_user_from_auth(auth)\n if user\n user.remember_me! if session.delete(:remember_me)\n if user.connected?\n setup_new_user(user, auth)\n format.html { redirect_to_signup_flow_entry_point }\n format.json { render_jsend_success(:connected, new_profile_data(user, auth)) }\n elsif user.registered?\n setup_existing_user(user)\n format.html { redirect_after_onboarding_check(user, request.env['omniauth.origin']) }\n format.json { render_jsend_success(:registered) }\n else\n notify_visitor_user_creation_failed(user)\n format.html { redirect_after_auth(request.env['omniauth.origin'] || login_path) }\n format.json { render_jsend(error: :user_creation) }\n end\n else\n format.html { redirect_to(login_path) }\n format.json { render_jsend(error: :no_user) }\n end\n end\n end\n end", "def session_enduser\n session[:enduser] = params[:enduser]\n\n respond_to do |format|\n format.json { head :ok }\n end\n end", "def show\n begin\n if m = params[:id].match(/([^\\.]+)/)\n uid = m.captures.first\n else\n uid = params[:id]\n end\n sso_session = params[:session]\n\n # Check if session is valid\n @valid_session = (!uid.blank? && !sso_session.blank? && User.where(uid:uid,sso_session:sso_session).count > 0)\n\n # Build response\n response_hash = {\n valid: @valid_session,\n recheck: 3.minutes.from_now.utc\n }\n\n logger.info(\"INSPECT: session_hash => #{response_hash}\")\n\n render json: response_hash\n rescue Exception => e\n logger.error(e)\n raise e\n end\n end", "def show\n authorize @user\n render json: @user\n end", "def show\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n begin\n obj = User.find(params[:id])\n response.status = 200\n render json: obj\n rescue ActiveRecord::RecordNotFound => e\n response.status = 404\n render json: {}\n rescue Exception => e\n response.status = 500\n render json: e\n end\n\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n if @current_user and @current_user == @user\n format.json { render json: @user }\n else\n format.json { render :json => @user, :except => [:perishable_token, :persistence_token, :email, :single_access_token, :last_login_ip, :current_login_ip, :crypted_password, :password_salt] }\n end\n end\n end", "def logged_in\n #checks to see if a current user is available \n \n if @current_user\n render json: {\n logged_in: true,\n user: @current_user\n }\n else \n render json: {\n logged_in: false\n }\n end \n\n end", "def ping\n render json: {logged_in: true, user: current_user.id}\n end", "def get_usr_info\n d = DistanceService.new\n d.get_usr_location(params[:usr_location])\n @user_info = $redis.hgetall('user')\n render json: @user_info\n # byebug\n # respond_to do |format|\n # format.js {render layout: false}\n # end\n\n end", "def authenticate_request\n render :json => { :error => :unauthorized }, :status => :unauthorized unless current_user\n end", "def show\n @signature = Signature.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @signature, :callback => params[:callback] }\n end\n end", "def oauth_authentication; end", "def authenticate\n# byebug\n return true if public_action?\n if request.format.json?\n authenticate_token || render_json_unauthorized\n else\n authenticate_user!\n end\n end", "def get_access\n path = '/v3/oauth/authorize'\n data = \"consumer_key=#{Consumer_key}&code=#{Token}\"\n return pocket_api(path,data)\nend", "def call\n\t\tJsonWebToken.encode(user_id: user.id) if user\t\n\tend", "def show\n # token = request.headers['Authentication'].split(' ')[1]\n # payload = JWT.decode(token)\n # user = User.find(payload['user_id'])\n # if user\n # render json: user\n # else \n # render json: { message: 'Error', user: 'Could not get user from token' }\n # end\n end", "def signOn()\n begin\n response_xml = HTTParty.get(SIGNON_URL,\n headers: { \"Content-Type\" => \"application/json\", \n \"Authorization\" => \"Basic #{encode_token(identity_token)}\"},\n verify: false,:timeout => 60 )\n encode_token(response_xml)\n rescue Exception => ex\n return \"invalid session token\"\n end\n end", "def oauth\n if params[:code]\n token_response = get_user_tokens(params[:code])\n signup_or_login(token_response)\n end\n\n render json: params\n end", "def get_session\n if session[:user_id].present? && session[:user_name].present?\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name]}\n render :json=>@result\n else \n @result = {flag:false}\n render :json=>@result\n end\n end", "def show\n @user=User.find(params[:id])\n if @user\n render json: @user\n else\n render json: {\"message\":\"Incorrect JWT token\"}\n end\n end", "def preflight; end", "def show\t\t\n\t\t# response to the JSON\n\t\trender json: { success: true, response: @profile.as_json },:status=>200\t \n\tend", "def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end", "def authenticate_current_user\n render json: {}, status: :unauthorized if get_current_user.nil?\n end", "def show\n patient = get_patient(@body[\"token\"])\n if patient != @patient\n render json: {message: \"failed to authenticate\"}, status: :unprocessable_entity\n else\n render :json => {\n id: @patient.id,\n email: @patient.email,\n firstName: @patient.first_name,\n lastName: @patient.last_name,\n birthday: @patient.birthday,\n sex: @patient.sex,\n height: @patient.height,\n weight: @patient.weight,\n token: get_token(@patient)\n }\n end\n end", "def get_current_user\n respond_to do |format|\n format.json {\n\n if @current_user \n render :json => @current_user\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def show\n @ykt_session = YktSession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ykt_session }\n end\n end", "def web_session()\n get(:signed, {:method => \"auth.getWebSession\"})\n end", "def call\n JsonWebToken.encode(user_id: api_user.id) if api_user\n end", "def show \n render json: @current_user\n end", "def url\n PagSeguro.site_url(\"v2/authorization/request.jhtml?code=#{code}\") if code\n end", "def call(env)\n # remove the callback and _ parameters BEFORE calling the backend, \n # so that caching middleware does not store a copy for each value of the callback parameter\n request = Rack::Request.new(env)\n callback = request.params.delete(@callback_param)\n env['QUERY_STRING'] = env['QUERY_STRING'].split(\"&\").delete_if{|param| param =~ /^(_|#{@callback_param})/}.join(\"&\")\n \n status, headers, response = @app.call(env)\n if callback\n response = pad(callback, response)\n headers['Content-Length'] = response.first.bytesize.to_s\n headers['Content-Type'] = 'application/javascript;charset=utf-8'\n end\n [status, headers, response]\n end", "def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end", "def auto_login\n render json: @user\n end" ]
[ "0.66655207", "0.62987924", "0.61211914", "0.6096706", "0.60541505", "0.6046555", "0.60135597", "0.5978105", "0.59197277", "0.5888756", "0.58740205", "0.5854477", "0.5854377", "0.58528525", "0.5837395", "0.583535", "0.58328754", "0.58169", "0.57637763", "0.57604194", "0.5744211", "0.5723162", "0.569967", "0.56945574", "0.56786054", "0.5649581", "0.56225955", "0.56068057", "0.5592331", "0.55900705", "0.5581443", "0.5579929", "0.557583", "0.55677", "0.55647105", "0.5561475", "0.5561437", "0.55532885", "0.55532885", "0.55502635", "0.5549075", "0.5548984", "0.5536192", "0.55359787", "0.5524079", "0.5518849", "0.54997945", "0.5493633", "0.5490318", "0.5482923", "0.54818183", "0.54818183", "0.54771626", "0.54707384", "0.54705024", "0.54631764", "0.5462422", "0.5462311", "0.545659", "0.5454654", "0.544742", "0.544742", "0.5420572", "0.54167134", "0.5416075", "0.5414377", "0.54109395", "0.54105955", "0.53966933", "0.5393954", "0.53914946", "0.53847176", "0.53835887", "0.5375665", "0.53748584", "0.5368857", "0.5360975", "0.53575575", "0.5356495", "0.53556985", "0.53525245", "0.5351696", "0.5348601", "0.5346539", "0.5345128", "0.53450936", "0.5344676", "0.5342474", "0.533815", "0.53345317", "0.5328255", "0.53250337", "0.53230304", "0.5321244", "0.5313788", "0.5311274", "0.5310243", "0.5305687", "0.5305219", "0.53039134" ]
0.54014283
68
Passport verification Session exists (browser/insider) return passport state Sessionless (iphone/outsider) Returns passport
def show @session = Sso::Session.find(sso_session_id) render json: @session, serializer: Sso::SessionSerializer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_session\n data = { :account => Encryptor.encrypt({:id => id, :phone => phone, :password => password}.to_json, :key => $secret_key) }\n\n response = RestClient.post \"#{$service_url}/api/account/check_session\", data, { :content_type => :json, :accept => :json }\n\n JSON.parse(response)\n rescue => error\n { :session => false }\n end", "def verify_session\n render status: 200, json: {error: false}\n end", "def valid_session\n {\n :user_id => AUTHENTICATED_USER_ID,\n }\n end", "def valid_session?\n return Sessions.is_valid?(session[:session_id]) \nend", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end" ]
[ "0.6734302", "0.64541", "0.6420031", "0.6388748", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727" ]
0.0
-1
Retrieve a stored value from a given `key`
def [](key) @raw[utf8(key)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(key)\n self[key]\n end", "def get(key)\n @hash.get(key)\n end", "def get(key)\n @hash[key]\n end", "def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end", "def getValue(key)\r\n \r\n return @aHash[key]\r\n end", "def get_value (key)\r\n @redis.get key\r\n end", "def get(key)\n return @data[key.to_s]\n end", "def value(key)\n @hash[key]\n end", "def get(key); end", "def get(key); end", "def get(key); end", "def get(key); end", "def get(key)\n end", "def fetch_value( oid, key )\n\t\toid = normalize_oid( oid )\n\t\tkey = normalize_key( key )\n\t\tdata = @storage[ oid ] or return nil\n\n\t\treturn data[ key ]\n\tend", "def fetch(key)\n result.fetch(key)\n end", "def get(key)\n @first.get(key)\n end", "def get(key)\n position = search(key)\n return nil if (key <=> @keys[position]) != 0\n @values[position]\n end", "def get(key)\n run_hook(:before_get, key)\n value = db[key]\n run_hook(:after_get, key, value)\n value\n end", "def get(key)\n index = key_index(key)\n if( index )\n self.values.get(index)\n else\n nil\n end\n end", "def get(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key \n return ele[1]\n end\n end\n end", "def get(key)\n get_all(key).first\n end", "def get( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && get_k( key )\n end", "def get(key)\n end", "def get(key)\n return do_get(key, false)\n end", "def [](key)\n @monitor.synchronize do\n _, value = get(key)\n value\n end\n end", "def obtain!(key)\n raise \"Missing key #{key}\" unless @hash.key?(key)\n @hash[key]\n end", "def get(key)\n @manager.retrieve(key)\n end", "def get_by_key(key)\n @store_[key] || YakvdConstants.key_not_found\n end", "def get(key)\n \n end", "def get(key)\n db.get(key)\n end", "def _get(key)\r\n\t\treturn _get_with_connection(@connection, @store_name, key, true)\r\n end", "def get_item(key)\n self[key]\n end", "def [](key)\n fetch(key)\n end", "def fetch(key); end", "def generic_get(key)\n data[key]\n end", "def get_key_value(key)\n if v = storage.get(key.object_id)\n return key.object_id, v\n end\n storage.get_candidates(key.hash).find do |k,v|\n candidate_key = get_object(k) or next\n candidate_key.eql? key\n end\n end", "def get(key)\n @map[key]\n end", "def [](key)\n find_value(key)\n end", "def get(key)\n index = key_index(key)\n if( index )\n @i_values.get(index)\n else\n nil\n end\n end", "def find(key)\n # TODO(himanshujaju) - possible improvement by not checking for contains.\n if contains?(key)\n return @key_data[key].value\n end\n\n return nil\n end", "def get(key)\n value = @data[key]\n validate!(key, value)\n end", "def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend", "def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend", "def get_key(key)\n return self.has_key?(key) ? self[key] : nil\n end", "def get(key)\n @cache[key]\n end", "def get(key)\n node = get_rec(@root, key, 0)\n return nil if node.nil?\n return node.value\n end", "def get key\n storage[key]\n end", "def lookup(key)\n if key_pair = pair(key, hash(key))\n key_pair[1]\n end\n end", "def get(key)\n key = normalize(key) or return\n table[key]\n end", "def get(key)\n @cache[key]\n end", "def get key; call key; end", "def []( key )\n hash = load_hash\n hash[key]\n end", "def get_key_value_\n @redis.hget @url, 'key'\n end", "def get(key)\n self.map_var.each do |pair|\n return pair[1] if pair[0] == key\n end\n nil\n end", "def fetch(*key); end", "def get(key)\n node_for(key).get(key)\n end", "def get(key)\n return nil unless @items.key?(key)\n @items[key].call\n end", "def get(key)\n @semaphore.synchronize do\n return @hashed_storage[key]&.value\n end\n end", "def get(key)\n _get_from_params(key) || _get_from_values(key)\n end", "def get(key)\n (self.data ||= {})[key.to_s]\n end", "def [](key)\n @lock.synchronize do\n rkey = ref_key(key)\n @values[rkey] if rkey\n end\n end", "def get(key)\n self.data[key] && self.data[key][:value]\n end", "def get(key)\r\n\t\treturn nil if !key\r\n\t\t# Get the hash of our key\r\n\t\tindex = key.hash % @size\r\n\t\t# If location in array is empty then return nil otherwise find the \r\n\t\t# key and return associated value from the list\r\n\t\treturn nil if !@arr[index]\r\n\t\treturn @arr[index].find(key)\r\n\tend", "def [](key)\n\t\t\traise_on_undeclared(key)\n\t\t\treturn @storage[key]\n\t\tend", "def get(key)\n response = request(:get, uri(key))\n if response.status == 200\n data = MultiJson.load(response.body)\n if data.is_a?(Array)\n data.each_with_object({}) do |e, acc|\n acc[e[S_KEY]] = e[S_VALUE]\n end\n else\n data[S_VALUE]\n end\n else\n nil\n end\n end", "def get(key)\n self.send(key)\n end", "def [](key)\n self.get(key)\n end", "def get(key)\n @@list[key]\n end", "def get(key, default=nil)\n find = KeyValue.find_by_key(key)\n find ? find.value : default\n end", "def get(key)\n response = db.get_item(@table_name, {'HashKeyElement' => {'S' => key}})\n get_item_from_body(response.body)\n end", "def get_from_key(key)\n @bucket_key_map[key]\n end", "def read(key)\n @cache[key]\n end", "def get_from_key(key)\n @bucket_key_map[key]\n end", "def fetch(key)\n mon_synchronize do\n node = @hash[key]\n break unless node\n\n touch(node)\n node.value\n end\n end", "def get(key)\n data = request_data(:get, key_uri(key))\n return nil unless data\n if nodes = data[S_NODE][S_NODES]\n nodes.each_with_object({}) do |node, acc|\n acc[node[S_KEY]] = node[S_VALUE]\n end\n else\n data[S_NODE][S_VALUE]\n end\n end", "def find_by_key(key)\n by_key[key]\n end", "def find_by_key(key)\n by_key[key]\n end", "def find(key)\n if !contains?(key)\n return nil\n end\n\n @semaphore.synchronize {\n @internal_clock += 1\n previous_data = @key_data[key]\n update_access_time_locked(key, @internal_clock, previous_data.access_time)\n\n return previous_data.value\n }\n end", "def get(key)\n if @data.has_key?(key)\n return @data[key]\n else\n return false\n end\n end", "def get(key)\n Lib.get @path, @no_follow, key.to_s\n end", "def get(key)\n i = key.hash % @table.size\n node = @table[i]\n while node\n return node.value if key == node.key\n node = node.next\n end\n nil\n end", "def get(key)\n mon_synchronize do\n perform [\"get\", key]\n end\n end", "def get(key)\n mon_synchronize do\n perform [\"get\", key]\n end\n end", "def get key\n deserialize backend.get key.to_s rescue nil\n end", "def get(key)\n ensure_connected\n json_to_value(redis_handler.get key.to_s)\n end", "def get(key)\n node = _get(@root, key)\n return nil unless node\n node.value\n end", "def get(key)\n node = @cache[key]\n return -1 if node.nil?\n move_to_head(node)\n node.value\n end", "def fetch(key)\n if key.empty?\n return @value\n end\n child = @children[key.shift]\n if child\n child.fetch(key)\n else\n return nil\n end\n end", "def get(key)\n v = Nvmkv::kv_get(@kv_id, @pool_id, key)\n return (v != nil ? NVMKVValue.new(v) : nil)\n end", "def get_data(key) \n return @data[key]\n end", "def get(key)\n @content[key]\n end", "def get(key)\n @content[key]\n end", "def read_from_hash(hash, key)\n # return the correct value using the hash and key parameters\n hash[key]\nend", "def get(key)\n node = node_for_key(key)\n node.read(&@block)\n end", "def grab(*key)\n synchronize do\n @data.get(*key)\n end\n end", "def fetch(key, value = nil)\n if read = self[key]\n return read\n end\n block_given? ? yield(key) : value\n end", "def [](key)\n\n lookup(key.to_s)\n end", "def get_single_key(key)\n key = @size+key if key < 0\n r = @results[key]\n unless r.nil? && key < @size\n r\n else\n retrieve_for_index(key)\n @results[key]\n end\n end", "def get_value(collection, key)\n @data[collection][key]\n end", "def get key\n @redis.get key\n end", "def [](key)\n result = (db_data ? db_data[key.to_s] : nil)\n result ||= raw_data.has_key?(key.to_s) ? raw_data[key.to_s] : self.send(key.to_s, nil); nil\n result\n end" ]
[ "0.828755", "0.8140361", "0.8138523", "0.8110371", "0.8025281", "0.8020805", "0.7993248", "0.7978211", "0.79378587", "0.79378587", "0.79378587", "0.79378587", "0.7860705", "0.7829985", "0.78287375", "0.78061444", "0.78035533", "0.7777323", "0.77565044", "0.7743377", "0.7739921", "0.77384436", "0.77275336", "0.77225155", "0.76830095", "0.7673058", "0.76730233", "0.76517826", "0.7620768", "0.7616693", "0.76030785", "0.7598663", "0.75966257", "0.7591836", "0.7566393", "0.7557311", "0.7533278", "0.750287", "0.7486463", "0.7479661", "0.7436954", "0.74309194", "0.74309194", "0.7412411", "0.740002", "0.73962003", "0.7387967", "0.7385882", "0.7378385", "0.73746955", "0.73746794", "0.73698", "0.7359482", "0.7334796", "0.7315694", "0.7303242", "0.72928035", "0.7290465", "0.72819656", "0.72740334", "0.72712743", "0.7264156", "0.72521585", "0.7244312", "0.72358894", "0.7234717", "0.7217478", "0.72164273", "0.72120816", "0.7211193", "0.7209377", "0.7200832", "0.7193881", "0.7181485", "0.71603805", "0.71590966", "0.71590966", "0.7158606", "0.71577907", "0.71566653", "0.71504325", "0.7147298", "0.7147298", "0.7146689", "0.71403664", "0.71349925", "0.71222275", "0.711277", "0.7109344", "0.71032095", "0.7094648", "0.7094648", "0.70902663", "0.7087882", "0.7083341", "0.708232", "0.70749784", "0.70746666", "0.7073309", "0.7072469", "0.7071924" ]
0.0
-1
Removes all keyvalue pairs from `self`.
def clear @raw.clear self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup!\n self.reject! { |k, v| v.empty? }\n end", "def remove_empty_fields\n self.each_pair do |k, v|\n if self[k].class == Hash\n self[k] = self[k].remove_empty_fields\n else\n self.delete(k) if v.to_s == \"\"\n end\n end\n self\n end", "def clear\n set_hash.each { |regexp, hash| hash.clear }\n end", "def clear\n keys.each do |k|\n Jeapie.instance_variable_set(\"@#{k}\", nil)\n end\n end", "def clear\n @hash.clear\n self\n end", "def clear\n @lock.synchronize do\n @values.clear\n @references_to_keys_map.clear\n end\n end", "def clear\n @values.each { |v| v.deleted = true }\n end", "def clear\n @values.clear\n end", "def remove_all\n store = @store\n @store = {}\n store.values.map(&:last)\n end", "def remove_all\n synchronized { @hash = {} }\n end", "def pop\n delete @data.keys.pop\n end", "def cleanse\n select { |_k, v| v }\n end", "def clear\n with(keys: EMPTY_ARRAY)\n end", "def clear\n @attributes = Hash.new { |hash, key| hash[key] = {} }\n end", "def pop_values()\n value_hash.values.each { |val_vec| val_vec.pop }\n end", "def clear\n @redis.delete_matched(\"#{@key}:*\")\n end", "def delete_specific_values( pairs )\n\t\tself.log.debug \" hash-delete...\"\n\n\t\t# Ensure the value exists, and its values converted and cached, as\n\t\t# the delete needs Ruby object instead of string comparison\n\t\tpairs.each do |key, vals|\n\t\t\tnext unless self[ key ]\n\t\t\tself.log.debug \" deleting %p: %p\" % [ key, vals ]\n\n\t\t\t@values[ key ].delete_if {|val| vals.include?(val) }\n\t\tend\n\tend", "def reject!\n self.each do |key, value|\n self.delete[key] if yield(key, value)\n end\n return self\n end", "def reject!\n self.each do |key, value|\n self.delete[key] if yield(key, value)\n end\n return self\n end", "def clear\n @data = {}\n @next_keys = {}\n end", "def remove_empties(h)\n h.delete_if do |_k, v|\n v == '∅∅∅'\n end\n\n h.each_pair do |_k, v|\n remove_empties(v) if v.is_a?(Hash)\n end\n\n h.delete_if do |_k, v|\n v.is_a?(Hash) && v.empty?\n end\n end", "def clean\n synchronized { @hash.delete_if { |_key, value| expired?(value) } }\n end", "def clear!\n @key_registry = {}\n self\n end", "def remove_params(params)\n self.tap do |u|\n u.query_values = (u.query_values || {}).tap do |qv|\n params.each do |key, value|\n qv.delete key\n end\n end\n if u.query_values.empty?\n u.query_values = nil\n end\n end\n end", "def clear\n hashed.clear\n list.clear\n end", "def clear\n @hash_tags.clear\n end", "def clear\n @hash.del\n @index.del\n end", "def sweep\n @accessed_keys.each { |k| @values.delete k }\n @accessed_keys = []\n end", "def sweep!\n Array(flagged).each { |key| values.delete(key) }\n flagged.clear\n end", "def clear_all(key)\n _mutex.synchronize do\n _store[key] = {}\n end\n end", "def clear_options\n @entries = {}\n end", "def clear_changes!\n remove_instance_variable(:@original_hash) if defined?(@original_hash)\n end", "def clear!\n @key_files = []\n @known_identities = nil\n self\n end", "def clear\n heroku.remove_all_keys\n display \"All keys removed.\"\n end", "def clear\n heroku.remove_all_keys\n display \"All keys removed.\"\n end", "def cleanup!(content)\n content.each do |key, value| \n cleanup!(value) if value.is_a? Hash\n content.delete(key) if value.blank?\n end\n end", "def discard! *keys\n keys.each {|k| delete k }\n self\n end", "def clear\n @by_id.values.each{|x| x.clear }\n end", "def delete_all\n store.delete(KEY)\n self\n end", "def cleanup\n datas[:model_feature_values].each_pair { |model_key, feature_values| \n model = Model.find(model_key)\n feature_keys = []\n model.features_list { |feature| feature_keys << feature.key }\n values(model).delete_if { |feature_key, value| !feature_keys.include?(feature_key) }\n }\n end", "def clear_options\r\n\t\tself.option_values.clear\r\n\tend", "def delete_all\n Nvmkv.kv_delete_all(@kv_id)\n end", "def cleanup\n keys = redis.keys(raw_data_key('*')) + redis.keys(data_key('*'))\n multi do\n keys.each{|key| redis.del(key)}\n end\n super\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 delete_all\n self.store.delete_keys(find_keys)\n end", "def clean!\n if @keys.size > Cache.max_size\n @keys = @keys[(Cache.max_size/2)[email protected]]\n reject! { |key, value| [email protected]?(key) }\n end\n end", "def select!\n self.each do |key, value|\n self.delete[key] unless yield(key, value)\n end\n return self\n end", "def select!\n self.each do |key, value|\n self.delete[key] unless yield(key, value)\n end\n return self\n end", "def clear_properties\n @filter_hash.delete(:cifilterproperties)\n end", "def delete!\n values.delete!\n end", "def clear!\n fields.each { |tag, field| self.__send__(\"#{field.name}=\", nil) }\n end", "def clear\n @redis.del @options[:key_name]\n end", "def clear\n @redis.del @options[:key_name]\n end", "def reset! key = nil\n if key.nil?\n @values.clear\n else\n key = ::Kernel.String(key).to_sym\n @values.delete key\n end\n self\n end", "def clean_unwanted_keys(hash)\r\n ignored_keys = [:only_path, :use_route]\r\n hash.dup.delete_if{|key,value| ignored_keys.include?(key)}\r\n end", "def clear_all\n data.delete_all\n self\n end", "def clear(options = nil)\n @hash.destroy\n end", "def reset_all\n @params.each_key {|k| reset(k.to_s)}\n @params = {}\n end", "def unset_value(key)\n database.delete(key)\n removed_keys << key\n end", "def strip_hash_of_keys(array_of_keys_to_strip)\n self.keys.each do |k|\n strip = false\n array_of_keys_to_strip.each do |i|\n if i.class == Regexp\n strip = true if k =~ i\n else\n strip = true if k == i\n end\n end\n\n if strip\n self.delete(k)\n else\n if self[k].class == Hash\n self[k] = self[k].strip_hash_of_keys(array_of_keys_to_strip)\n elsif self[k].class == Array\n self[k].each do |h|\n h = h.strip_hash_of_keys(array_of_keys_to_strip) if h.class == Hash\n end\n end\n end\n end\n self\n end", "def clear(opts={})\n attribs = normalize_attribute_list opts[:attributes]\n except = opts[:except]\n if attribs\n if opts[:index]\n idx = opts[:index]\n values = @attributes[idx]\n if values\n attrs = except ? (values.keys-attribs) : attribs\n attrs.each {|a| values.delete(a)}\n @attributes[idx] = nil if values.empty?\n end\n else\n @attributes.each_with_index do |values,idx|\n if values\n attrs = except ? (values.keys-attribs) : attribs\n attrs.each {|a| values.delete(a)}\n @attributes[idx] = nil if values.empty?\n end\n end\n end\n while @attributes[-1].nil? && @attributes.size > 0 do\n @attributes.pop\n end\n else\n initialize\n end\n end", "def trim\n self.select { |_k, v| v.present? }\n end", "def initialize\n super\n keys.each do |key|\n set(key, self.class::UNSET_VALUE)\n end\n end", "def remove_empties_from_hash(old_hash)\n new_hash = {}\n old_hash.each do |key, value|\n next if value.nil? || value == '' || value == [] || value == {}\n new_hash[key] = value.is_a?(Hash) ? remove_empties_from_hash(value) : value\n end\n \n return new_hash\n end", "def compact!\n keys = []\n self.each { |k, v| keys << k if v.include? '*' }\n keys.each { |k| self[k] = [] }\n end", "def _refresh_set_values(hash)\n @deserialized_values.clear if @deserialized_values\n super\n end", "def remove(key)\n a_hash[key] = nil\n end", "def clear\n synchronize_block do\n @data.clear\n @key_access_store.clear\n end\n end", "def clear\n all_keys = keys\n return 0 if all_keys.empty?\n\n # Delete all keys\n del(*all_keys)\n end", "def compact_hash(hash)\n hash.delete_if { |key, value| value.blank? }\n end", "def clear_attributes\n @attributes = nil\n end", "def clear_tags\n keys_to_remove = extra_config_keys\n\n spec_hash =\n keys_to_remove.map {|key| { :key => key, :value => '' } }\n\n spec = RbVmomi::VIM.VirtualMachineConfigSpec(\n :extraConfig => spec_hash\n )\n @item.ReconfigVM_Task(:spec => spec).wait_for_completion\n end", "def hashie_stringify_keys!\n keys.each do |k|\n self[k.to_s] = delete(k) unless String === k\n end\n self\n end", "def remove_all_keys\n\t\tdelete(\"/user/keys\")\n\tend", "def remove_all_keys\n\t\tdelete(\"/user/keys\")\n\tend", "def delete_keys!(*keys)\r\n\t\tkeys.each do |k| \r\n\t\t\tself.delete(k)\r\n\t\tend \r\n\t\tself\r\n\tend", "def clear\n with_redis { |redis| redis.del(@set_key) }\n end", "def clear\n @mutex.synchronize do\n @tuples.clear\n @objects.clear\n @catdata.clear\n end\n self\n end", "def unset(key)\n update(key) { |option| @data.delete(option.name) }\n end", "def rm(key)\n options.values.collect do |option| \n if option.key == key \n unregister(option)\n else\n nil\n end\n end.compact\n end", "def clear\n validate_arguments!\n\n action(\"Removing all SSH keys\") do\n api.delete_keys\n end\n end", "def reset! key = nil\n if key.nil?\n @values.each_key { |k| reset! k }\n else\n key = ::Kernel.String(key).to_sym\n if @schema.default? key\n @values[key] = @schema.default key\n @values[key].reset! if Configuration.config? @values[key]\n elsif @values.key? key\n @schema.warn! \"Key #{key.inspect} has not been added, but has a value.\" \\\n \" Removing the value.\"\n @values.delete key\n else\n @schema.warn! \"Key #{key.inspect} does not exist. Nothing to reset.\"\n end\n end\n self\n end", "def clear\n self.configuration = {}\n end", "def stringify_keys!\n keys.each do |key|\n self[key.to_s] = delete key\n end\n self\n end", "def remove(key); end", "def compact!\n delete_if { |k, v| v.nil? }\n end", "def remove_all()\n @items.clear()\n end", "def remove_by\n synchronized do\n @hash.each_key do |k|\n @hash.delete(k) if yield(k)\n end\n end\n end", "def finalizer(hash)\n proc { @keys.delete(hash) }\n end", "def reset\n (@settings||{}).each do |name,instance| \n remove_setter(name)\n remove_getter(name)\n remove_boolean_getter(name)\n instance.destroy\n end\n @settings = Hash.new\n end", "def my_hash_deletion_method!(source, thing_to_delete)\nsource.reject! {|k,v| k == thing_to_delete}\np source\nend", "def remove!(*keys)\n keys.each{|key| self.delete(key) }\n self\n end", "def clear\n @@fields.each do |field|\n self.instance_variable_set(\"@\"+field.to_s,nil)\n end\n end", "def delete_keys! list\n if list.is_a? Array\n list.map{|k| self.delete k}\n else\n self.delete list\n end\n self\n end", "def clear_attributes\n self.attribute_names.clear\n self.public_attribute_names.clear\n self.protected_attribute_names.clear\n\n true\n end", "def deep_clean(data)\r\n proc = Proc.new { |k, v|\r\n if v.kind_of?(Hash) && !v.empty?\r\n v.delete_if(&proc)\r\n nil\r\n end\r\n v.nil? || v.empty?\r\n }\r\n hash.delete_if(&proc)\r\n end", "def clear\n self.map.clear\n end", "def purge!\n @map = {}\n end", "def clean_up(attr_values_hash_of_hash)\n\t\tattr_values = Hash.new\n\t\tattr_values_hash_of_hash.each do |bad_key,good_hash|\n\t\t\tattr_values.merge!(good_hash)\n\t\tend\n\t\treturn attr_values\n\tend", "def stringify_keys!\r\n keys.each do |key|\r\n self[key.to_s] = delete(key)\r\n end\r\n self\r\n end", "def clear\n if warning?\n warn(\"This operation can run for a very long time if the namespace contains lots of keys! \" +\n \"It should be used in tests, or when the namespace is small enough \" +\n \"and you are sure you know what you are doing.\")\n end\n\n batch_size = 1000\n\n if supports_scan?\n cursor = \"0\"\n begin\n cursor, keys = scan(cursor, count: batch_size)\n del(*keys) unless keys.empty?\n end until cursor == \"0\"\n else\n all_keys = keys(\"*\")\n all_keys.each_slice(batch_size) do |keys|\n del(*keys)\n end\n end\n end" ]
[ "0.72865564", "0.6979874", "0.682195", "0.6734593", "0.6729228", "0.6694518", "0.6661533", "0.66526616", "0.66008806", "0.6592267", "0.6575835", "0.6532649", "0.65251887", "0.65058804", "0.6482117", "0.64808905", "0.6468398", "0.64671004", "0.64671004", "0.64598936", "0.63897276", "0.63780904", "0.6324111", "0.6292201", "0.62851983", "0.62832695", "0.6280039", "0.6274292", "0.62678427", "0.62321854", "0.6226499", "0.62148803", "0.6200019", "0.6133801", "0.6133801", "0.60864747", "0.6071961", "0.6071299", "0.6061846", "0.6040556", "0.60267144", "0.60253775", "0.60224926", "0.60052884", "0.5990005", "0.59872526", "0.5959936", "0.5959936", "0.59595746", "0.5937222", "0.59312093", "0.59204006", "0.59204006", "0.59135187", "0.59092295", "0.5905154", "0.5904729", "0.5890833", "0.5884446", "0.58831173", "0.58723295", "0.587061", "0.5865206", "0.5848557", "0.58478343", "0.58466923", "0.58371645", "0.58283126", "0.5815188", "0.5809621", "0.5805729", "0.57890457", "0.57830864", "0.5749524", "0.5749524", "0.57488346", "0.57374585", "0.5734519", "0.5729999", "0.5720106", "0.5716281", "0.57154393", "0.57116467", "0.5701714", "0.57015854", "0.56968105", "0.5693603", "0.56925833", "0.568348", "0.56820047", "0.56810606", "0.5675093", "0.5663016", "0.5655369", "0.5653215", "0.5648743", "0.5644345", "0.56429166", "0.5638334", "0.56357443", "0.5632989" ]
0.0
-1
Calls the given block once for each key in the hash, passing the keyvalue pair as parameters. If no block is given, an `Enumerator` is returned instead.
def each return enum_for(__method__) unless block_given? @raw.each_pair do |key, value| yield key, value end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n hash.each(&block)\n end", "def each(&block)\n @hash.each {|k,v| block.call k,v }\n end", "def each(&block)\n @hash.each(&block)\n end", "def each(*args, &block)\n @hash.each(*args, &block)\n end", "def each_pair(&block)\n @hash.each_pair(&block)\n end", "def each\n @hash.each do |k, v|\n yield k, v\n end\n end", "def each(&block)\n keys.each(&block)\n end", "def each_hash\n if block_given?\n while row = next_hash\n yield row\n end\n else\n self.enum_for(:each_hash)\n end\n end", "def each\n @hash.each_key { |o| yield(o) }\n self\n end", "def each( &block ) # :yield: member, value\n\t\t\[email protected]( &block )\n\t\tend", "def each()\n @hash.each do |k, v|\n yield k, self[k]\n end\n end", "def each\n @internal_hash.each { |k,_| yield k }\n end", "def each\n\n return unless block_given?\n self.to_h.each { |k, v| yield(k, v) }\n end", "def each(&block)\n self.keys.each{|k| block.call([k, self[k]])}\n self\n end", "def each_key(&block)\n keys.each(&block)\n end", "def call\n if hash?\n return iterate_hash { |*args, **opts| yield(*args, **opts) }\n end\n\n iterate { |*args, **opts| yield(*args, **opts) }\n end", "def each_value(&block)\n self.keys.each{|k| block.call(self[k])}\n self\n end", "def each_value_for_hash(params, &block)\n case params\n when Hash then params.each { |_k, v| each_value_for_hash(v, &block) }\n when Array then params.each { |v| each_value_for_hash(v, &block) }\n else\n yield params\n end\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def each_key(&block)\n self.keys.each{|k| block.call(k)}\n self\n end", "def each(&block)\n to_h.each(&block)\n end", "def each(&block)\n @items.each_key(&block)\n self\n end", "def each(&blk)\n enum = Enumerator.new do |y|\n @converted.each {|k, v| y.yield(k,v) }\n @hash.each {|k,v| y.yield(k, self.move_value(k)) }\n end\n if blk.nil?\n enum\n else\n enum.each do |k,v|\n blk.call(k,v)\n end\n end\n end", "def each_key\n return enum_for(__method__) unless block_given?\n @raw.each_key do |key|\n yield key\n end\n self\n end", "def each(&block)\n @key_users.each_value(&block)\n end", "def each\n return to_enum(:each) unless block_given?\n @entry.each { |key, value| yield [key, value] }\n end", "def each(&block)\n return to_enum :each unless block_given?\n @data.keys.each(&block)\n end", "def each_entry\n if block_given?\n @keys.each { |key| yield @entries[key] } \n else\n enum_for(:each_entry) \n end\n end", "def each\n pos = hash_size\n hoff0 = @hashes[0]\n while pos < hoff0\n key, value = *read_entry(pos)\n yield(key,value)\n pos += key.length + value.length + hashref_size\n end\n end", "def each_pair(&_block)\n path = path_to('/')\n\n case result = http_get(path, query:'recurse')\n when String\n result = json_parse(result)\n when 404\n return # no keys!\n end\n\n unless result.is_a?(Array)\n raise CMDB::Error.new(\"Consul 'GET #{path}': expected Array, got #{all.class.name}\")\n end\n\n result.each do |item|\n key = slash_to_dot(item['Key'])\n key.sub(@useless,'')\n next unless item['Value']\n value = json_parse(Base64.decode64(item['Value']))\n validate!(key, value)\n yield(key, value)\n end\n\n result.size\n end", "def each\n each_pair do |key, value|\n yield [key, value]\n end\n self\n end", "def each_hash &block\n @songs.each &block\n end", "def each(&blk)\n to_h.each(&blk)\n end", "def each_key(&block); end", "def each\n if block_given?\n @data.each do |k, v|\n yield k, v\n end\n else\n @data.each\n end\n end", "def each_value(key)\n return to_enum(:each_value, key) unless block_given?\n\n each_pair do |k,v|\n yield v if k == key\n end\n end", "def iteration_hash(data_hash = self.data, &block)\n yield data_hash\n cid = data_hash[:__cid__]\n code = Codes[cid]\n code.in.each do |input|\n next if !data_hash[input].is_a?(Hash)\n # -- recursive -- #\n iteration_hash(data_hash[input], &block)\n # -- recursive -- #\n end\n end", "def each(&proc)\n # When key and value are expected separately. Should actually be calling each_pair anyway\n if proc.arity == 2\n each_pair(proc)\n else\n enum = getMapNames\n while enum.has_more_elements\n key = enum.next_element\n proc.call [key, getObject(key)]\n end\n end\n end", "def each(&block)\n @by_name.values.each(&block)\n end", "def each_pair(&block)\n return to_enum(__callee__) unless block_given?\n @parameters.each_pair do |key, value|\n yield [key, convert_hashes_to_parameters(key, value)]\n end\n\n self\n end", "def each(&block)\n block or return enum_for(__method__) { size }\n @hash.each_key(&block)\n self\n end", "def each_key\n @keys.values.each do |k|\n yield k\n end\n end", "def each_pair(&block)\n @entries.each_pair(&block)\n end", "def each(container, &block)\n container.map { |key, value| [key, value.call] }.each(&block)\n end", "def each_pair(&_block)\n @data.each_pair do |key, value|\n validate!(key, value)\n yield(key, value)\n end\n end", "def each\n store.each { |(key, value)| yield key, value }\n end", "def each(&block)\n @@commands.each do |key, value|\n yield key => value\n end\n end", "def each(&_block)\n iterator = BlockIterator.new(self)\n\n until iterator.current_hash == Block::GENESIS_PREV_HASH\n block = iterator.next\n yield(block)\n end\n end", "def each(&blk)\n list.each do |key|\n yield key, get(key)\n end\n end", "def each\n index = 1\n while index <= self.keys.get_length\n key = self.keys.get(index)\n value = self.values.get(index)\n yield key , value\n index = index + 1\n end\n self\n end", "def each\n @data.each {|key, value| yield key, value}\n end", "def each\n return @services.each_key unless block_given?\n\n @services.each_key { |key| yield key }\n end", "def each_key_value(*values)\n each_key do |sym|\n value = values.shift\n\n raise ArgumentError, \"Missing key argument for #{sym.inspect}\" unless value\n raise ArgumentError, \"Empty key value for #{sym}\" if value.empty?\n\n yield sym, value\n end\n\n raise ArgumentError, \"Extra key arguments\" unless values.empty?\n end", "def each(&block)\n @values.each(&block)\n end", "def each_value\n each { |k, v| yield v }\n end", "def each_value\n each { |k, v| yield v }\n end", "def each_key(container, &block)\n container.each_key(&block)\n end", "def each\n index = 0\n while index < @i_keys.get_length\n key = @i_keys.get(index)\n value = @i_values.get(index)\n yield key , value\n index = index + 1\n end\n self\n end", "def each(&block)\n @index.each do |key, start_length|\n block.call([key, self[key]])\n end\n end", "def each_value(&block)\n return to_enum(:each_value) unless block_given?\n @parameters.each_pair do |key, value|\n yield convert_hashes_to_parameters(key, value)\n end\n\n self\n end", "def each(&blk) data.each{ |k,v| blk.call(k,v) } ; end", "def each(&block)\n @monitor.synchronize do\n expire!\n @stash.map { |key, entry| [key, entry.value] }.each(&block)\n end\n end", "def each(&block)\n interfaces_hash.each_value(&block)\n end", "def each_function(&block)\n if block_given?\n @function_hash.each_value(&block)\n self\n else\n @function_hash.values\n end\n end", "def each\n keys = self.keys\n keys.each do |key|\n # here is the magic that gives us the key and value of the handset\n # all the way up to the fallbacks end. \n # Call the pass block with the key and value passed\n yield key, self[key]\n end\n end", "def each\r\n record = @head\r\n while record\r\n yield record[:key], record[:value]\r\n record = record[:next]\r\n end\r\n end", "def each(&block)\n @db.each_key{|key|yield key, @db[key]}\n end", "def each\n @values_map.each do |key, value|\n yield key, value\n end\n end", "def each(&block)\n @values.each(&block)\n self\n end", "def each(&block)\n value.each(&block)\n end", "def each(options={}, &block)\n end", "def each(&blk)\n @values.each(&blk)\n end", "def each\n copy = self_new { |a, b| compare(a, b) }\n @keys[1..size].each { |key| copy.insert key }\n\n yield copy.delete until copy.is_empty?\n end", "def each\n get_objects.each {|key, value| yield key, value }\n end", "def each(&blk)\n _values.each(&blk)\n end", "def each(&block)\n @entries.each(&block)\n end", "def each_pair(&block)\n\t\t@name_table.each do |k|\n\t\t\tblock.call(k, self.v[k])\n\t\tend\n\tend", "def each(&block)\n @by_id.values.each(&block)\n end", "def foobar(numbers, &block)\n if block_given?\n numbers.each do |key, value|\n block.call(key, value)\n end\n end\nend", "def each(&block)\r\n fail \"Forbidden operation\" if @char_set.default\r\n\r\n if block_given?\r\n @char_set.each do |key, value|\r\n block.call(key) if value\r\n end\r\n else\r\n self.to_enum(:each)\r\n end\r\n end", "def each_pair(&proc)\n enum = getMapNames\n while enum.has_more_elements\n key = enum.next_element\n proc.call key, getObject(key)\n end\n end", "def each\n return to_enum(:each) unless block_given?\n loop do\n pair = next_pair\n break if pair.nil?\n yield(pair[0], pair[1])\n end\n end", "def each\n original.each do |key, value|\n yield key, value\n end\n end", "def each_pair(&block); end", "def each\r\n\t record = @head\r\n\t while record.next && record.next != @tail\r\n\t\t record = record.next\n\t\t record.values.each{|value| yield record.key, value }\r\n\t end\r\n end", "def each(&block)\n each_element(block) if @json_hash\n end", "def each(&block)\n self.entries.each(&block)\n end", "def each_key(&block)\n config.resolver.each_key(_container, &block)\n self\n end", "def each( &block )\n @data.keys.each do |method|\n value = send method\n yield method, value\n end\n end", "def each &block\n if block_given?\n @credentials.each(&block)\n else\n @credentials.each\n end\n end", "def each\n each_node do |node|\n yield(node_key(node), node_value(node))\n end \n end", "def each\n each_node do |node|\n yield(node_key(node), node_value(node))\n end \n end", "def each\n return to_enum :each unless block_given?\n\n loop do\n items = instance_exec(&@proc)\n\n items.each do |item|\n yield item\n end\n\n break if items.empty?\n end\n end", "def each &block\n @entries.each &block\n end", "def each_value(&block)\n @db.each_key{|key|yield @db[key]}\n end", "def each &block\n return enum_for(:each) unless block_given?\n if multiple?\n @value.each(&block)\n else\n yield @value\n end\n end", "def each(&block)\n if block_given?\n @fog_wrapper.each do |key|\n yield file(key)\n end\n else\n to_enum(:each)\n end\n end", "def each_key\n keys.sort.each {|key| yield key}\n end", "def each(key, &block)\n if @value\n yield(key, @value)\n end\n @children.each do |letter, child|\n child.each(key + letter, &block)\n end\n end" ]
[ "0.8046937", "0.8010828", "0.7942713", "0.756059", "0.75390995", "0.7518694", "0.75044554", "0.7473204", "0.73918426", "0.73157436", "0.7315615", "0.73091584", "0.72909814", "0.72860295", "0.72446823", "0.71660346", "0.71633285", "0.7125818", "0.7098365", "0.7098365", "0.7092104", "0.7056994", "0.6944952", "0.6914413", "0.6897247", "0.68941766", "0.68850005", "0.6845483", "0.6843303", "0.682442", "0.675753", "0.671589", "0.66911983", "0.66841084", "0.6654352", "0.66475475", "0.66238743", "0.657575", "0.6526695", "0.6525411", "0.65129274", "0.6511491", "0.65087724", "0.64987373", "0.6491487", "0.64889914", "0.646362", "0.644461", "0.6439396", "0.6427113", "0.6422216", "0.641293", "0.64110273", "0.64088404", "0.6393257", "0.63748074", "0.63748074", "0.6374777", "0.6372663", "0.6367846", "0.6319934", "0.63197964", "0.6312538", "0.63107026", "0.63003534", "0.6285157", "0.62741035", "0.62692267", "0.6261382", "0.6248251", "0.6242331", "0.62391543", "0.62299716", "0.6227681", "0.62205184", "0.62046295", "0.62033737", "0.61805767", "0.6172875", "0.61676466", "0.6162673", "0.6156999", "0.6155156", "0.61496305", "0.6146743", "0.6143914", "0.6132717", "0.6128389", "0.6127072", "0.61195856", "0.61148983", "0.61119604", "0.61119604", "0.6111479", "0.60983443", "0.60977", "0.6086199", "0.6085007", "0.60832363", "0.6066287" ]
0.6900659
24
Calls the given block once for each key in the hash, passing the key as a parameter. If no block is given, an `Enumerator` is returned instead.
def each_key return enum_for(__method__) unless block_given? @raw.each_key do |key| yield key end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n hash.each(&block)\n end", "def each(&block)\n @hash.each(&block)\n end", "def each(&block)\n @hash.each {|k,v| block.call k,v }\n end", "def each_key(&block)\n keys.each(&block)\n end", "def each\n @hash.each_key { |o| yield(o) }\n self\n end", "def each(&block)\n keys.each(&block)\n end", "def each_key(&block)\n self.keys.each{|k| block.call(k)}\n self\n end", "def each(*args, &block)\n @hash.each(*args, &block)\n end", "def each\n @internal_hash.each { |k,_| yield k }\n end", "def each\n @hash.each do |k, v|\n yield k, v\n end\n end", "def each_hash\n if block_given?\n while row = next_hash\n yield row\n end\n else\n self.enum_for(:each_hash)\n end\n end", "def each()\n @hash.each do |k, v|\n yield k, self[k]\n end\n end", "def each(&block)\n @items.each_key(&block)\n self\n end", "def each(&block)\n self.keys.each{|k| block.call([k, self[k]])}\n self\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def each_pair(&block)\n @hash.each_pair(&block)\n end", "def each( &block ) # :yield: member, value\n\t\t\[email protected]( &block )\n\t\tend", "def call\n if hash?\n return iterate_hash { |*args, **opts| yield(*args, **opts) }\n end\n\n iterate { |*args, **opts| yield(*args, **opts) }\n end", "def each\n\n return unless block_given?\n self.to_h.each { |k, v| yield(k, v) }\n end", "def each_key(&block); end", "def each(&block)\n to_h.each(&block)\n end", "def each_key\n @keys.values.each do |k|\n yield k\n end\n end", "def each(&block)\n @key_users.each_value(&block)\n end", "def each_entry\n if block_given?\n @keys.each { |key| yield @entries[key] } \n else\n enum_for(:each_entry) \n end\n end", "def each_key(container, &block)\n container.each_key(&block)\n end", "def each_value(&block)\n self.keys.each{|k| block.call(self[k])}\n self\n end", "def each(&block)\n return to_enum :each unless block_given?\n @data.keys.each(&block)\n end", "def each_hash &block\n @songs.each &block\n end", "def each\n pos = hash_size\n hoff0 = @hashes[0]\n while pos < hoff0\n key, value = *read_entry(pos)\n yield(key,value)\n pos += key.length + value.length + hashref_size\n end\n end", "def each(&block)\n block or return enum_for(__method__) { size }\n @hash.each_key(&block)\n self\n end", "def each\n return @services.each_key unless block_given?\n\n @services.each_key { |key| yield key }\n end", "def each(&_block)\n iterator = BlockIterator.new(self)\n\n until iterator.current_hash == Block::GENESIS_PREV_HASH\n block = iterator.next\n yield(block)\n end\n end", "def each\n return enum_for(__method__) unless block_given?\n @raw.each_pair do |key, value|\n yield key, value\n end\n self\n end", "def each(&blk)\n to_h.each(&blk)\n end", "def each\n return to_enum(:each) unless block_given?\n @entry.each { |key, value| yield [key, value] }\n end", "def iteration_hash(data_hash = self.data, &block)\n yield data_hash\n cid = data_hash[:__cid__]\n code = Codes[cid]\n code.in.each do |input|\n next if !data_hash[input].is_a?(Hash)\n # -- recursive -- #\n iteration_hash(data_hash[input], &block)\n # -- recursive -- #\n end\n end", "def each(&block)\n @index.each do |key, start_length|\n block.call([key, self[key]])\n end\n end", "def each_key\n keys.sort.each {|key| yield key}\n end", "def each(&blk)\n enum = Enumerator.new do |y|\n @converted.each {|k, v| y.yield(k,v) }\n @hash.each {|k,v| y.yield(k, self.move_value(k)) }\n end\n if blk.nil?\n enum\n else\n enum.each do |k,v|\n blk.call(k,v)\n end\n end\n end", "def each_value(key)\n return to_enum(:each_value, key) unless block_given?\n\n each_pair do |k,v|\n yield v if k == key\n end\n end", "def each_key(&block)\n config.resolver.each_key(_container, &block)\n self\n end", "def each_pair(&_block)\n path = path_to('/')\n\n case result = http_get(path, query:'recurse')\n when String\n result = json_parse(result)\n when 404\n return # no keys!\n end\n\n unless result.is_a?(Array)\n raise CMDB::Error.new(\"Consul 'GET #{path}': expected Array, got #{all.class.name}\")\n end\n\n result.each do |item|\n key = slash_to_dot(item['Key'])\n key.sub(@useless,'')\n next unless item['Value']\n value = json_parse(Base64.decode64(item['Value']))\n validate!(key, value)\n yield(key, value)\n end\n\n result.size\n end", "def each_value_for_hash(params, &block)\n case params\n when Hash then params.each { |_k, v| each_value_for_hash(v, &block) }\n when Array then params.each { |v| each_value_for_hash(v, &block) }\n else\n yield params\n end\n end", "def each\n each_pair do |key, value|\n yield [key, value]\n end\n self\n end", "def each\n if block_given?\n @data.each do |k, v|\n yield k, v\n end\n else\n @data.each\n end\n end", "def each(&blk)\n list.each do |key|\n yield key, get(key)\n end\n end", "def each(&block)\n @@commands.each do |key, value|\n yield key => value\n end\n end", "def each(&block)\n @db.each_key{|key|yield key, @db[key]}\n end", "def each\n copy = self_new { |a, b| compare(a, b) }\n @keys[1..size].each { |key| copy.insert key }\n\n yield copy.delete until copy.is_empty?\n end", "def each\n store.each { |(key, value)| yield key, value }\n end", "def each(&block)\n @by_name.values.each(&block)\n end", "def each\n @data.each {|key, value| yield key, value}\n end", "def each(key, &block)\n if @value\n yield(key, @value)\n end\n @children.each do |letter, child|\n child.each(key + letter, &block)\n end\n end", "def each(&block)\n interfaces_hash.each_value(&block)\n end", "def each(&block)\n each_element(block) if @json_hash\n end", "def each(*key)\n objects(*key).each\n end", "def each(options={}, &block)\n end", "def each(container, &block)\n container.map { |key, value| [key, value.call] }.each(&block)\n end", "def each(&block)\n @entries.each(&block)\n end", "def each(&blk) data.each{ |k,v| blk.call(k,v) } ; end", "def each(&block)\n self.entries.each(&block)\n end", "def each\n index = 1\n while index <= self.keys.get_length\n key = self.keys.get(index)\n value = self.values.get(index)\n yield key , value\n index = index + 1\n end\n self\n end", "def each_key\n\t record = @head\r\n\t while record.next && record.next != @tail\r\n\t\t record = record.next\n\t\t yield record.key\r\n\t end\r\n end", "def each\n keys = self.keys\n keys.each do |key|\n # here is the magic that gives us the key and value of the handset\n # all the way up to the fallbacks end. \n # Call the pass block with the key and value passed\n yield key, self[key]\n end\n end", "def each(&proc)\n # When key and value are expected separately. Should actually be calling each_pair anyway\n if proc.arity == 2\n each_pair(proc)\n else\n enum = getMapNames\n while enum.has_more_elements\n key = enum.next_element\n proc.call [key, getObject(key)]\n end\n end\n end", "def each(&block)\n if block_given?\n @fog_wrapper.each do |key|\n yield file(key)\n end\n else\n to_enum(:each)\n end\n end", "def each(&block)\n @by_id.values.each(&block)\n end", "def hash_each_delayed(hash, delay, &blk)\n EM::Synchrony.add_timer(delay) do\n if hash.size > 0\n pair = hash.shift\n begin\n blk.call(pair[0], pair[1])\n rescue => e\n error(\"hash_each Error: \", e)\n end\n hash_each(hash, delay, &blk)\n end\n end\n end", "def each\n index = 0\n while index < @i_keys.get_length\n key = @i_keys.get(index)\n value = @i_values.get(index)\n yield key , value\n index = index + 1\n end\n self\n end", "def each(&block)\n call_client(:each, &block)\n end", "def each_function(&block)\n if block_given?\n @function_hash.each_value(&block)\n self\n else\n @function_hash.values\n end\n end", "def each (&block)\n\n @items.each { |i| block.call(i) }\n end", "def each &block\n @entries.each &block\n end", "def each_pair(&_block)\n @data.each_pair do |key, value|\n validate!(key, value)\n yield(key, value)\n end\n end", "def nested_keys(&block)\n Enumerator.new do |y|\n to_a.each do |k,v|\n y.yield k\n v.nested_keys { |nk| y.yield(nk) } if v.is_a?(Hash)\n end\n end.each(&block)\n end", "def each_pair(&block)\n @entries.each_pair(&block)\n end", "def each\n return to_enum :each unless block_given?\n\n loop do\n items = instance_exec(&@proc)\n\n items.each do |item|\n yield item\n end\n\n break if items.empty?\n end\n end", "def each(&block)\n return super(&block) unless @lazy_loading && @processors.any?\n self.keys.each { |k| block.(k, self[k]) }\n end", "def each\r\n record = @head\r\n while record\r\n yield record[:key], record[:value]\r\n record = record[:next]\r\n end\r\n end", "def each(&block)\r\n fail \"Forbidden operation\" if @char_set.default\r\n\r\n if block_given?\r\n @char_set.each do |key, value|\r\n block.call(key) if value\r\n end\r\n else\r\n self.to_enum(:each)\r\n end\r\n end", "def each()\n hijos.each() do |v|\n yield v\n end\n end", "def each &block\n end", "def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end", "def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end", "def each(&block)\n @items.each(&block)\n end", "def each(&block)\n @monitor.synchronize do\n expire!\n @stash.map { |key, entry| [key, entry.value] }.each(&block)\n end\n end", "def block_by_hash(_hsh)\n raise NotImplementedError\n end", "def block(_hash)\n raise Sibit::NotSupportedError, 'block() doesn\\'t work here'\n end", "def each(&_block)\n yield(entry)\n end", "def each(&block)\n items.each &block\n end", "def each(&block)\n items.each &block\n end", "def each\n\t\tmust_be_in_synchronize_block\n\t\teach_pair do |key, server|\n\t\t\tyield server\n\t\tend\n\tend", "def sscan_each(key, **options, &block); end", "def each_key(&block)\n ODBM.Fail ErrAdapterInterfaceNotImplement, \"each_key\"\n end", "def each(&block) \n current = @head\n \n while current\n block.call(current.value)\n current = current.successor\n end\n end", "def each\n each_node do |node|\n yield(node_key(node), node_value(node))\n end \n end", "def each\n each_node do |node|\n yield(node_key(node), node_value(node))\n end \n end", "def each\n original.each do |key, value|\n yield key, value\n end\n end", "def each( &block )\n @data.keys.each do |method|\n value = send method\n yield method, value\n end\n end" ]
[ "0.7865592", "0.775081", "0.7693306", "0.748823", "0.7442418", "0.7399876", "0.7295237", "0.7238419", "0.7228679", "0.72066975", "0.71726716", "0.7139497", "0.7070028", "0.7029381", "0.6981385", "0.6981385", "0.69748366", "0.6904482", "0.68985206", "0.6894795", "0.6828259", "0.6786999", "0.6744867", "0.66736954", "0.6630941", "0.65546393", "0.65258574", "0.651838", "0.6508074", "0.6504418", "0.650389", "0.6487235", "0.6475005", "0.64673626", "0.6415104", "0.6397637", "0.63877845", "0.63791645", "0.63668925", "0.6351781", "0.6343828", "0.63359684", "0.63172936", "0.6297571", "0.6240187", "0.62240195", "0.61918795", "0.6163735", "0.6132819", "0.6129322", "0.61087155", "0.610523", "0.60864526", "0.60789835", "0.60785925", "0.6050184", "0.60232335", "0.6022888", "0.6000972", "0.5999489", "0.598884", "0.5969052", "0.59558165", "0.5951155", "0.5949954", "0.5934696", "0.59305465", "0.59282595", "0.59275734", "0.5923662", "0.5922542", "0.5919213", "0.59172326", "0.59131926", "0.59111303", "0.59045744", "0.58946294", "0.58734894", "0.5870974", "0.5869344", "0.5866312", "0.5858969", "0.5857167", "0.5853362", "0.5853362", "0.5853256", "0.58523625", "0.58520573", "0.5840231", "0.58334494", "0.5832391", "0.5832391", "0.5828727", "0.582825", "0.5821366", "0.58062345", "0.57885563", "0.57885563", "0.578853", "0.5782043" ]
0.7110123
12
Calls the given block once for each key in the hash, passing the value at the respective key as a parameter. If no block is given, an `Enumerator` is returned instead.
def each_value return enum_for(__method__) unless block_given? @raw.each_value do |value| yield value end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n hash.each(&block)\n end", "def each(&block)\n @hash.each {|k,v| block.call k,v }\n end", "def each(&block)\n @hash.each(&block)\n end", "def each( &block ) # :yield: member, value\n\t\t\[email protected]( &block )\n\t\tend", "def each(*args, &block)\n @hash.each(*args, &block)\n end", "def each_hash\n if block_given?\n while row = next_hash\n yield row\n end\n else\n self.enum_for(:each_hash)\n end\n end", "def each_pair(&block)\n @hash.each_pair(&block)\n end", "def each\n @hash.each do |k, v|\n yield k, v\n end\n end", "def each(&block)\n keys.each(&block)\n end", "def each_value(&block)\n self.keys.each{|k| block.call(self[k])}\n self\n end", "def each\n @hash.each_key { |o| yield(o) }\n self\n end", "def each_value_for_hash(params, &block)\n case params\n when Hash then params.each { |_k, v| each_value_for_hash(v, &block) }\n when Array then params.each { |v| each_value_for_hash(v, &block) }\n else\n yield params\n end\n end", "def each(&block)\n self.keys.each{|k| block.call([k, self[k]])}\n self\n end", "def each()\n @hash.each do |k, v|\n yield k, self[k]\n end\n end", "def each\n\n return unless block_given?\n self.to_h.each { |k, v| yield(k, v) }\n end", "def each\n @internal_hash.each { |k,_| yield k }\n end", "def each(&block)\n to_h.each(&block)\n end", "def each_key(&block)\n keys.each(&block)\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def call\n if hash?\n return iterate_hash { |*args, **opts| yield(*args, **opts) }\n end\n\n iterate { |*args, **opts| yield(*args, **opts) }\n end", "def each(&blk)\n enum = Enumerator.new do |y|\n @converted.each {|k, v| y.yield(k,v) }\n @hash.each {|k,v| y.yield(k, self.move_value(k)) }\n end\n if blk.nil?\n enum\n else\n enum.each do |k,v|\n blk.call(k,v)\n end\n end\n end", "def each(&block)\n @items.each_key(&block)\n self\n end", "def each_key(&block)\n self.keys.each{|k| block.call(k)}\n self\n end", "def each(&block)\n @key_users.each_value(&block)\n end", "def each(&block)\n return to_enum :each unless block_given?\n @data.keys.each(&block)\n end", "def each\n return enum_for(__method__) unless block_given?\n @raw.each_pair do |key, value|\n yield key, value\n end\n self\n end", "def each\n return to_enum(:each) unless block_given?\n @entry.each { |key, value| yield [key, value] }\n end", "def each\n pos = hash_size\n hoff0 = @hashes[0]\n while pos < hoff0\n key, value = *read_entry(pos)\n yield(key,value)\n pos += key.length + value.length + hashref_size\n end\n end", "def each_key\n return enum_for(__method__) unless block_given?\n @raw.each_key do |key|\n yield key\n end\n self\n end", "def each_entry\n if block_given?\n @keys.each { |key| yield @entries[key] } \n else\n enum_for(:each_entry) \n end\n end", "def each(&blk)\n to_h.each(&blk)\n end", "def each_value(key)\n return to_enum(:each_value, key) unless block_given?\n\n each_pair do |k,v|\n yield v if k == key\n end\n end", "def each_hash &block\n @songs.each &block\n end", "def each_pair(&_block)\n path = path_to('/')\n\n case result = http_get(path, query:'recurse')\n when String\n result = json_parse(result)\n when 404\n return # no keys!\n end\n\n unless result.is_a?(Array)\n raise CMDB::Error.new(\"Consul 'GET #{path}': expected Array, got #{all.class.name}\")\n end\n\n result.each do |item|\n key = slash_to_dot(item['Key'])\n key.sub(@useless,'')\n next unless item['Value']\n value = json_parse(Base64.decode64(item['Value']))\n validate!(key, value)\n yield(key, value)\n end\n\n result.size\n end", "def each(&block)\n @by_name.values.each(&block)\n end", "def iteration_hash(data_hash = self.data, &block)\n yield data_hash\n cid = data_hash[:__cid__]\n code = Codes[cid]\n code.in.each do |input|\n next if !data_hash[input].is_a?(Hash)\n # -- recursive -- #\n iteration_hash(data_hash[input], &block)\n # -- recursive -- #\n end\n end", "def each_key(&block); end", "def each\n if block_given?\n @data.each do |k, v|\n yield k, v\n end\n else\n @data.each\n end\n end", "def each\n each_pair do |key, value|\n yield [key, value]\n end\n self\n end", "def each(&block)\n @values.each(&block)\n end", "def each_value\n each { |k, v| yield v }\n end", "def each_value\n each { |k, v| yield v }\n end", "def each(container, &block)\n container.map { |key, value| [key, value.call] }.each(&block)\n end", "def each(&blk)\n list.each do |key|\n yield key, get(key)\n end\n end", "def each(&block)\n block or return enum_for(__method__) { size }\n @hash.each_key(&block)\n self\n end", "def each(&_block)\n iterator = BlockIterator.new(self)\n\n until iterator.current_hash == Block::GENESIS_PREV_HASH\n block = iterator.next\n yield(block)\n end\n end", "def each(&block)\n @index.each do |key, start_length|\n block.call([key, self[key]])\n end\n end", "def each(&block)\n @values.each(&block)\n self\n end", "def each\n store.each { |(key, value)| yield key, value }\n end", "def each_pair(&block)\n @entries.each_pair(&block)\n end", "def each(&block)\n value.each(&block)\n end", "def each(&proc)\n # When key and value are expected separately. Should actually be calling each_pair anyway\n if proc.arity == 2\n each_pair(proc)\n else\n enum = getMapNames\n while enum.has_more_elements\n key = enum.next_element\n proc.call [key, getObject(key)]\n end\n end\n end", "def each(&block)\n @monitor.synchronize do\n expire!\n @stash.map { |key, entry| [key, entry.value] }.each(&block)\n end\n end", "def each(&blk)\n @values.each(&blk)\n end", "def each\n index = 1\n while index <= self.keys.get_length\n key = self.keys.get(index)\n value = self.values.get(index)\n yield key , value\n index = index + 1\n end\n self\n end", "def each(&blk)\n _values.each(&blk)\n end", "def each_value(&block)\n return to_enum(:each_value) unless block_given?\n @parameters.each_pair do |key, value|\n yield convert_hashes_to_parameters(key, value)\n end\n\n self\n end", "def each\n @data.each {|key, value| yield key, value}\n end", "def each_pair(&_block)\n @data.each_pair do |key, value|\n validate!(key, value)\n yield(key, value)\n end\n end", "def each(&block)\n interfaces_hash.each_value(&block)\n end", "def each(&block)\n @by_id.values.each(&block)\n end", "def each\n keys = self.keys\n keys.each do |key|\n # here is the magic that gives us the key and value of the handset\n # all the way up to the fallbacks end. \n # Call the pass block with the key and value passed\n yield key, self[key]\n end\n end", "def each(&block)\n @@commands.each do |key, value|\n yield key => value\n end\n end", "def each(&blk) data.each{ |k,v| blk.call(k,v) } ; end", "def each_pair(&block)\n return to_enum(__callee__) unless block_given?\n @parameters.each_pair do |key, value|\n yield [key, convert_hashes_to_parameters(key, value)]\n end\n\n self\n end", "def each_function(&block)\n if block_given?\n @function_hash.each_value(&block)\n self\n else\n @function_hash.values\n end\n end", "def each\n index = 0\n while index < @i_keys.get_length\n key = @i_keys.get(index)\n value = @i_values.get(index)\n yield key , value\n index = index + 1\n end\n self\n end", "def each_key(container, &block)\n container.each_key(&block)\n end", "def each_value(&block)\n @db.each_key{|key|yield @db[key]}\n end", "def each(&block)\n @db.each_key{|key|yield key, @db[key]}\n end", "def each\r\n record = @head\r\n while record\r\n yield record[:key], record[:value]\r\n record = record[:next]\r\n end\r\n end", "def each_key\n @keys.values.each do |k|\n yield k\n end\n end", "def each &block\n return enum_for(:each) unless block_given?\n if multiple?\n @value.each(&block)\n else\n yield @value\n end\n end", "def each(&block)\n @entries.each(&block)\n end", "def each\n @values_map.each do |key, value|\n yield key, value\n end\n end", "def each\n return @services.each_key unless block_given?\n\n @services.each_key { |key| yield key }\n end", "def each_value(&block)\n values.each(&block)\n end", "def each(&block)\n each_element(block) if @json_hash\n end", "def each(&blk)\n values.each(&blk)\n end", "def foobar(numbers, &block)\n if block_given?\n numbers.each do |key, value|\n block.call(key, value)\n end\n end\nend", "def each(&block) \n current = @head\n \n while current\n block.call(current.value)\n current = current.successor\n end\n end", "def hmap_val(&block)\n self.hmap { |k, v| [k, block.call(v)] }\n end", "def each_key_value(*values)\n each_key do |sym|\n value = values.shift\n\n raise ArgumentError, \"Missing key argument for #{sym.inspect}\" unless value\n raise ArgumentError, \"Empty key value for #{sym}\" if value.empty?\n\n yield sym, value\n end\n\n raise ArgumentError, \"Extra key arguments\" unless values.empty?\n end", "def each(&block)\n table.values.each(&block)\n end", "def each(&block)\n self.entries.each(&block)\n end", "def each_pair(&block)\n\t\t@name_table.each do |k|\n\t\t\tblock.call(k, self.v[k])\n\t\tend\n\tend", "def each(key, &block)\n if @value\n yield(key, @value)\n end\n @children.each do |letter, child|\n child.each(key + letter, &block)\n end\n end", "def each\n copy = self_new { |a, b| compare(a, b) }\n @keys[1..size].each { |key| copy.insert key }\n\n yield copy.delete until copy.is_empty?\n end", "def each &block\n @entries.each &block\n end", "def each_value(&block); end", "def each()\n hijos.each() do |v|\n yield v\n end\n end", "def each\n get_objects.each {|key, value| yield key, value }\n end", "def each( &block )\n @data.keys.each do |method|\n value = send method\n yield method, value\n end\n end", "def each(options={}, &block)\n end", "def each\r\n\t record = @head\r\n\t while record.next && record.next != @tail\r\n\t\t record = record.next\n\t\t record.values.each{|value| yield record.key, value }\r\n\t end\r\n end", "def each(&block)\r\n fail \"Forbidden operation\" if @char_set.default\r\n\r\n if block_given?\r\n @char_set.each do |key, value|\r\n block.call(key) if value\r\n end\r\n else\r\n self.to_enum(:each)\r\n end\r\n end", "def each\n each_node do |node|\n yield(node_key(node), node_value(node))\n end \n end", "def each\n each_node do |node|\n yield(node_key(node), node_value(node))\n end \n end", "def each(&block)\n @values.each {|(n, v)| yield(n, v)}\n self\n end", "def each(&block)\n @v.each &block\n end" ]
[ "0.81592214", "0.804703", "0.8029286", "0.7558101", "0.753966", "0.7535335", "0.75024974", "0.7471396", "0.7417457", "0.7382011", "0.7363745", "0.73050296", "0.72958535", "0.7283866", "0.7219739", "0.7207881", "0.71745884", "0.7150925", "0.714957", "0.714957", "0.7143827", "0.7071578", "0.7003707", "0.6999673", "0.6937494", "0.6928991", "0.6905013", "0.69047415", "0.68928325", "0.6887296", "0.68395525", "0.6769834", "0.6748534", "0.67366344", "0.6725536", "0.6723201", "0.6660286", "0.6637843", "0.6632595", "0.6630603", "0.6620675", "0.6602835", "0.6602835", "0.6572696", "0.65390974", "0.6531972", "0.6516266", "0.65107924", "0.6510394", "0.65087825", "0.6501792", "0.6488973", "0.6472864", "0.6465892", "0.6459448", "0.6455114", "0.64486855", "0.6435416", "0.6434076", "0.6430222", "0.64278585", "0.6418185", "0.6416532", "0.63931614", "0.63871825", "0.6386322", "0.6362682", "0.6344313", "0.63441694", "0.63429713", "0.63421106", "0.6339821", "0.6337255", "0.6332194", "0.63302296", "0.63134336", "0.6282233", "0.6279987", "0.627933", "0.6279234", "0.62766355", "0.62732947", "0.62637043", "0.62561613", "0.6238767", "0.62374", "0.62343675", "0.6233115", "0.6231116", "0.62226063", "0.6217443", "0.621167", "0.619129", "0.61909395", "0.61841565", "0.6180234", "0.6176884", "0.6162851", "0.6162851", "0.61531454", "0.6135398" ]
0.0
-1
GET /users GET /users.xml
def index @title = 'User Directory' @users = User.where('email not ?', nil).order('first_name DESC').paginate(:page => params[:page], :per_page => User.per_page) respond_to do |format| format.html # index.html.erb format.json { render :json => @users } format.xml { render :xml => @users } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_users\n self.class.get('/users')\n end", "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end", "def users\n get('get_users')\n end", "def index\n @users = User.all\n render :xml => @users\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n @title = \"All users\"\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users.to_xml(:except => [:password_digest, :remember_token])}\n end\n end", "def index\r\n @users = User.find(:all)\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @users.to_xml }\r\n end\r\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @users }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n users = get_collection(User) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: 'users', skip_types: 'true') }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def list_users(api_object)\r\n puts \"Current Users:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n names = doc.xpath('users').collect {|e| e.text }\r\n puts names.join(\", \")\r\n puts \"\"\r\nend", "def index\n\t\t@users = User.all\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml\t{ render :xml => @users }\n\t\tend\n\tend", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end", "def index\n @users = User.find(:all, :order => 'name ASC')\n respond_to do |format|\n format.html \n format.xml { @users.to_xml }\n end\n end", "def list\n get('users')['users']\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all()\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all(:order=>:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users.to_xml(\n :dasherize => false, :only => [:id, :name,\n :created_at, :updated_at]) }\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html\n format.xml { render :xml => @users }\n format.json { render :json => @users }\n end\n end", "def index\n users = get_collection(visible_users) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: :users, skip_types: true) }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def index\n authorize! :read, User\n @users = User.find(:all)\n @users ||= []\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def show\n @user = User.find(params[:id])\n render :xml => @user.to_xml(:except => [ :password ])\n end", "def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def users_get_info_response_xml\n <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <users_getInfo_response xmlns=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\"\" list=\"true\">\n\t<user>\n\t <uid>kangtk</uid>\n\t <nickname>康泰克</nickname>\n\t <facebig>http://userface3.51.com/ce/25/kangtk_130.gif?v=20071208033821</facebig>\n\t <sex>1</sex>\n\t <vip>3</vip>\n\t <isconfirm>1</isconfirm>\n\t</user>\n </users_getInfo_response>\n XML\n end", "def show\n @user = User.find(params[:id])\n render :xml => @user\n rescue\n render :nothing => true, :status => :not_found\n end", "def index3\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def users\n \n @users = User.where(:enabled => true)\n @users = @users.where(:role => params[:role].upcase) if params[:role]\n @users = @users.where(:id => params[:id]) if params[:id]\n respond_to do |format|\n format.xml { render :xml => @users.to_xml }\n end\n \n end", "def users\n\t\t\telems = []\n\t\t\tget_resource_link(:users, \"users\", \"user\").each do |data|\n\t\t\t\telems << data\n\t\t\t\t# elems << User.new(data)\n\t\t\tend\n\t\t\telems\n\t\tend", "def index\n @users = User.all\n binding.pry\n require 'net/http'\n result = Net::HTTP.get('makesys.net', '/')\n p result\n end", "def get_users(request); end", "def index\n @user = current_user\n @title = \"Account\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def get_users(options)\n @client.raw('get', '/config/users', options)\n end", "def users(passwords=false)\n if passwords\n doc = request(\"user-list_users\")\n else\n doc = request(\"user-list_users_no_pw\")\n end\n api_error?(doc)\n (doc/:data).inject([]) { |users, user| users << User.new_from_xml(user); users }\n end", "def show\n @user = User.find(params[:id])\n usr = prepare_user(@user);\n respond_to do |format|\n format.xml { render :xml => usr.to_xml }\n end\n end", "def index\n @users = User.all(:order => \"nick, id ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def show \n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.xml { render :xml => @user }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @user }\n end\n end", "def live\n users = WebmasterTools::Verification::Config.authorized_accounts(:live).map(&:last)\n xml = %Q{<?xml version=\"1.0\"?><users><user>#{users.join(\"</user><user>\")}</user></users>}\n render :xml => xml\n end", "def show\n\t\t@user = User.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @user }\n\t\tend\n\tend", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @user.to_xml }\n end\n end", "def show\n @user = nil\n id_or_name = params[:id]\n begin\n @user = User.find(id_or_name)\n rescue\n @user = User.find_by_name(id_or_name)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml {\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! directive_tag=:xml, :encoding=> 'utf-8'\n render :xml => xml.user {|u|\n u.id(@user.id)\n u.name(@user.name)\n u.statuses {|ss|\n @user.statuses.each {|stat|\n ss.status {|s|\n s.id(stat.id)\n s.user_id(stat.user_id)\n s.text(stat.text)\n s.geo_tag(stat.geo_tag)\n s.created_at(stat.created_at)\n }\n }\n }\n }\n }\n end\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def show\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def index\n @users = User.find(:all, :order => :email)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n format.json { render :json => @users }\n end\n end", "def index\n @users = User.all(include: :stats)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { head :ok }\n end\n end", "def show\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @user.to_xml }\r\n end\r\n end", "def show\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend", "def show\n @users = User.all\n json_response(@users)\n end", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def users_list\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('users/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tusers=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['users'].each_element('//user') { |user|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['name']=user.elements['name'].text\n\t\t\t\tentry['admin']=user.elements['admin'].text\n\t\t\t\tentry['lastlogin']=user.elements['lastlogin'].text\n\t\t\t\tusers.push(entry)\n\t\t\t}\n\t\t\treturn users\n\t\tend", "def show\n @user = User.find(params[:id])\n @title = @user.username\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user.to_xml(:except => [:password_digest, :remember_token])}\n end\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @user }\n\t\tend\n\tend", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end" ]
[ "0.7657926", "0.76263535", "0.7490723", "0.7470033", "0.74069935", "0.7387062", "0.7248585", "0.72448206", "0.721343", "0.7211573", "0.7210826", "0.71998477", "0.71764135", "0.71337295", "0.71337295", "0.71337295", "0.7132803", "0.7132208", "0.7130947", "0.7115423", "0.70905775", "0.7085793", "0.7083929", "0.70486325", "0.7046792", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.7024087", "0.70097655", "0.70097655", "0.70097655", "0.69941163", "0.6976239", "0.69745165", "0.6881462", "0.68683046", "0.68680894", "0.68536305", "0.6852045", "0.6845801", "0.68020034", "0.67611986", "0.6758884", "0.67461437", "0.67454886", "0.67451483", "0.6738235", "0.6729717", "0.67045456", "0.668879", "0.6685763", "0.66567296", "0.6656454", "0.6609397", "0.66032255", "0.6594465", "0.6589267", "0.6584507", "0.6574818", "0.6570887", "0.6563008", "0.65458435", "0.6544914", "0.65348834", "0.65275043", "0.6527257", "0.6523976", "0.6515483", "0.65138966", "0.65072095", "0.64988047", "0.6491729", "0.6486157", "0.6485859", "0.64785796", "0.64785796", "0.64737725", "0.6473176", "0.64720213", "0.6471115", "0.64525557", "0.64500517", "0.64500517", "0.64500517", "0.64500517", "0.64500517", "0.64500517", "0.64500517", "0.64500517" ]
0.0
-1
GET /users/1 GET /users/1.xml
def show @user ||= User.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end", "def index\n @users = User.all\n render :xml => @users\n end", "def list_users\n self.class.get('/users')\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @users }\n end\n end", "def index\r\n @users = User.find(:all)\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @users.to_xml }\r\n end\r\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @title = \"All users\"\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users.to_xml(:except => [:password_digest, :remember_token])}\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def show\n @user = User.find(params[:id])\n render :xml => @user\n rescue\n render :nothing => true, :status => :not_found\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def show\n @user = User.find(params[:id])\n usr = prepare_user(@user);\n respond_to do |format|\n format.xml { render :xml => usr.to_xml }\n end\n end", "def index\n @users = User.find(:all, :order => 'name ASC')\n respond_to do |format|\n format.html \n format.xml { @users.to_xml }\n end\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def index\n users = get_collection(User) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: 'users', skip_types: 'true') }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def show\n @user = User.find(params[:id])\n render :xml => @user.to_xml(:except => [ :password ])\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n @users = User.all(:order=>:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users.to_xml(\n :dasherize => false, :only => [:id, :name,\n :created_at, :updated_at]) }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @users = User.all()\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def list_users(api_object)\r\n puts \"Current Users:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n names = doc.xpath('users').collect {|e| e.text }\r\n puts names.join(\", \")\r\n puts \"\"\r\nend", "def index3\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def show\n @user = nil\n id_or_name = params[:id]\n begin\n @user = User.find(id_or_name)\n rescue\n @user = User.find_by_name(id_or_name)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml {\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! directive_tag=:xml, :encoding=> 'utf-8'\n render :xml => xml.user {|u|\n u.id(@user.id)\n u.name(@user.name)\n u.statuses {|ss|\n @user.statuses.each {|stat|\n ss.status {|s|\n s.id(stat.id)\n s.user_id(stat.user_id)\n s.text(stat.text)\n s.geo_tag(stat.geo_tag)\n s.created_at(stat.created_at)\n }\n }\n }\n }\n }\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def users\n get('get_users')\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def show\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show \n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user }\n end\n end", "def index\n\t\t@users = User.all\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml\t{ render :xml => @users }\n\t\tend\n\tend", "def index\n @user = current_user\n @title = \"Account\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def users\n \n @users = User.where(:enabled => true)\n @users = @users.where(:role => params[:role].upcase) if params[:role]\n @users = @users.where(:id => params[:id]) if params[:id]\n respond_to do |format|\n format.xml { render :xml => @users.to_xml }\n end\n \n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @user.to_xml }\n end\n end", "def index\n authorize! :read, User\n @users = User.find(:all)\n @users ||= []\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @users.to_xml }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @user }\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def show\n respond_to do |format|\n format.html\n format.xml { render :xml => @user }\n end\n end", "def index\n @users = User.all\n respond_to do |format|\n format.html\n format.xml { render :xml => @users }\n format.json { render :json => @users }\n end\n end", "def show\n\t\t@user = User.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml\t{ render :xml => @user }\n\t\tend\n\tend", "def show\n @user = User.find(params[:id])\n @title = @user.username\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user.to_xml(:except => [:password_digest, :remember_token])}\n end\n end", "def show\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id]) or raise ActiveRecord::RecordNotFound\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @user.to_xml }\n end\n end", "def index\n users = get_collection(visible_users) || return\n\n respond_to do |format|\n format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: :users, skip_types: true) }\n format.json { render json: users.to_json(only: DEFAULT_FIELDS) }\n end\n end", "def users_get_info_response_xml\n <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <users_getInfo_response xmlns=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\"\" list=\"true\">\n\t<user>\n\t <uid>kangtk</uid>\n\t <nickname>康泰克</nickname>\n\t <facebig>http://userface3.51.com/ce/25/kangtk_130.gif?v=20071208033821</facebig>\n\t <sex>1</sex>\n\t <vip>3</vip>\n\t <isconfirm>1</isconfirm>\n\t</user>\n </users_getInfo_response>\n XML\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end" ]
[ "0.7207235", "0.7114702", "0.7054687", "0.7047563", "0.6916399", "0.6915569", "0.69152325", "0.6889017", "0.6863717", "0.6862916", "0.68537647", "0.6850865", "0.6850865", "0.6850865", "0.6827962", "0.68276834", "0.68265396", "0.68056685", "0.68004096", "0.6785998", "0.6765893", "0.6737409", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.67320967", "0.6716016", "0.6716016", "0.6716016", "0.67145663", "0.67099386", "0.6708908", "0.66774374", "0.66758376", "0.66725326", "0.66608524", "0.6648082", "0.66349167", "0.6629332", "0.66010964", "0.6573766", "0.6568155", "0.6568005", "0.6547923", "0.6533697", "0.6532704", "0.6529746", "0.652832", "0.6516212", "0.6509743", "0.65029085", "0.6500256", "0.64697677", "0.64673316", "0.64655983", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693", "0.64630693" ]
0.0
-1
PUT /Users/1 PUT /Users/1.xml
def update @user = User.find(params[:id]) bSave = true if(bSave) bSave = @user.update_attribute(:bio,params[:user][:bio]) end if(bSave) bSave = @user.update_attribute(:location,params[:user][:location]) end if(bSave) bSave = @user.update_attribute(:first_name,params[:user][:first_name]) end if(bSave) bSave = @user.update_attribute(:last_name,params[:user][:last_name]) end if(bSave) bSave = @user.update_attribute(:name,params[:user][:name]) end if(bSave) bSave = @user.update_attribute(:email,params[:user][:email]) #@user.email = params[:user][:email] #bSave = @user.save end #debugger respond_to do |format| if bSave format.html { redirect_to(@user) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def 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 rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def put!\n request! :put\n end", "def update(args)\n builder.update_rest(type, ref, args, username, password)\n self.elements(true)\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def put(*args)\n request :put, *args\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @user = User.find_by_urlname(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated successfully\"\n format.html { redirect_to user_path(@user) }\n format.xml { head :ok }\n else\n flash[:error] = \"There were problems updating the profile\"\n format.html { render :action => 'edit' }\n format.xml { @user.errors.to_xml }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url, :notice => \"User #{@user.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n @user_name = UserName.find(params[:id])\n\n respond_to do |format|\n if @user_name.update_attributes(params[:user_name])\n format.html { redirect_to(@user_name, :notice => 'User name was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url,:notice => \"User #{@user.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end", "def put(path, options={})\n request :put, path, options\n end", "def update\n @documents_user = DocumentsUser.find(params[:id])\n\n respond_to do |format|\n if @documents_user.update_attributes(params[:documents_user])\n flash[:notice] = 'DocumentsUser was successfully updated.'\n format.html { redirect_to(@documents_user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @documents_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def append_user_info(username, xml); end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(root_path, :notice => 'Usuario alterado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def append_user_info(username, xml)\n end", "def update\n @userinfo = Userinfo.find(params[:id])\n\n respond_to do |format|\n if @userinfo.update_attributes(params[:userinfo])\n flash[:notice] = 'Userinfo was successfully updated.'\n format.html { redirect_to(@userinfo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @userinfo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash.now[:notice] = 'Successfully updated.'\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n flash.now[:error] = 'Could not update. Please see errors below...'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update_user\n @user = User.find(params[:id])\n @user.update(params[:user])\n redirect \"/users/#{@user.id}\"\nend", "def flush\n if exists?\n update_foreman_users('put', get_attribute_from_user('id'))\n else\n update_foreman_users('post')\n end\n end", "def put(*args)\n request(:put, *args)\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, options={})\n send_request 'put', path, options\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(users_url, :notice => 'User has been updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n application.unflattened_attributes = flat_params\n application.user_key = params[:user_key] if params[:user_key]\n\n application.save\n\n respond_with application\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to root_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to user_url(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(users_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to(@user, :notice => 'User was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6658993", "0.63987726", "0.6370967", "0.63224995", "0.6104578", "0.60290873", "0.58474857", "0.58285254", "0.5807006", "0.5779408", "0.5639215", "0.5591483", "0.5571705", "0.5544946", "0.5532271", "0.55310327", "0.55142385", "0.54945296", "0.54808897", "0.545664", "0.54402626", "0.5436869", "0.5436869", "0.5436557", "0.5432926", "0.5424638", "0.54186815", "0.54158276", "0.5409891", "0.5399996", "0.5396631", "0.53782356", "0.5363068", "0.53618735", "0.5359504", "0.53586626", "0.534682", "0.53342444", "0.5312076", "0.5308804", "0.530691", "0.52952933", "0.529356", "0.5292282", "0.5291795", "0.5260985", "0.52557623", "0.52475375", "0.52469844", "0.5241156", "0.5237859", "0.5237859", "0.5237859", "0.52333164", "0.5227924", "0.5225044", "0.52132213", "0.5210874", "0.5210553", "0.5210553", "0.5210553", "0.5210553", "0.5210553", "0.5210553", "0.5210553", "0.5210553", "0.5210553", "0.5210553", "0.52095735", "0.52095735", "0.52095735", "0.52095735", "0.52095735", "0.52095735", "0.52095735", "0.52095735", "0.5202263", "0.5199653", "0.5197935", "0.5194708", "0.51937574", "0.5193691", "0.5193691", "0.5193691", "0.5193691", "0.5193691", "0.5193691", "0.5193691", "0.5193691", "0.5193691", "0.5193691", "0.5193691", "0.5193691", "0.5192682", "0.51902676", "0.5178198", "0.51726663", "0.5168605", "0.51585186", "0.51575994", "0.5153578" ]
0.0
-1
Get a wiki page.
def wikipage(page, subreddit = nil) name = extract_attribute(subreddit, :display_name) path = "/wiki/#{page}.json" path.prepend("/r/#{name}") if subreddit object_from_response :get, path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end", "def get_page\n @html_doc = Nokogiri::HTML(open(\"https://en.wikipedia.org/wiki/2020_NBA_playoffs\"))\n return @html_doc\n end", "def url\n\t\t\"#{base}/wiki/#{page}\"\n\tend", "def wiki_page(name, path = nil, version = nil, exact = true)\n wiki = wiki_new\n path = name if path.nil?\n name = extract_name(name) || wiki.index_page\n path = extract_path(path)\n path = '/' if exact && path.nil?\n\n OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),\n :name => name, :path => path)\n end", "def find_page(title, version = nil, load_content: true)\n page_title, page_dir = page_title_and_dir(title)\n\n if page = wiki.page(title: page_title, version: version, dir: page_dir, load_content: load_content)\n WikiPage.new(self, page)\n end\n end", "def page(wiki, commit)\n blob = self.blob(wiki.repo)\n page = wiki.page_class.new(wiki).populate(blob, self.dir)\n page.version = commit\n page\n end", "def get_page()\n @page = Nokogiri::HTML(open(@url).read)\n end", "def page\n @page ||= retrieve_page\n end", "def page\n @page ||= retrieve_page\n end", "def getPage\n # get specific page from last argument\n page = @arguments[@arguments.length - 1] \n # get url for specific page\n url = \"http://oldschoolrunescape.wikia.com/wiki/#{page}\"\n\n # prints url for debugging\n# puts(url)\n\n # request page\n @page = HTTParty.get(url)\n\n # check to see if this was a valid request\n if @page.include? \"This page does not exist. Mayhaps it should?\"\n # if not valid request, abort \n abort(\"Incorrect input. Make sure you spelling is correct. The syntax is:\\n\\n\\tOSQuery -m This_monster\\n\\nThe first letter of the item must be capitalized with the rest of the letters lowercase, and there must be an underscore between each word with no spaces.\")\n end # -- end check for valid request\n end", "def localized_page\n\t\treturn @page if @page\n\t\tl = langtag(I18n.locale)\n\t\t\n\t\tWikipedia.Configure do\n\t\t\tdomain \"#{l}.wikipedia.org\"\n\t\t\tpath \"w/api.php\"\n\t\tend\n\t\tp = page\n\t\tif p == nil || p.content == nil\n\t\t\tlogger.debug \"defaulting to english\"\n\t\t\tWikipedia.Configure do\n\t\t\t\tdomain \"en.wikipedia.org\"\n\t\t\t\tpath \"w/api.php\"\n\t\t\tend\n\t\t\tp = page\n\t\telse\n\t\t\tlogger.debug \"sending translated\"\n\t\tend\n\t\t@page = p\n\t\t@page\n\tend", "def page\n get_page\n nil\n end", "def load_page\n page_not_found! unless Language.current\n\n @page ||= Language.current.pages.contentpages.find_by(\n urlname: params[:urlname],\n language_code: params[:locale] || Language.current.code\n )\n end", "def view(title=nil, id=nil)\n if title\n encoded = title.split.join(\"_\")\n endpoint = \"https://en.wikipedia.org/w/api.php?action=parse&format=json&prop=wikitext&page=#{encoded}&redirects\"\n elsif id\n encoded = title.split.join(\"_\")\n endpoint = \"https://en.wikipedia.org/w/api.php?action=parse&format=json&prop=wikitext&pageid=#{encoded}\"\n end\n hash = get(endpoint)\n page = hash[\"parse\"][\"wikitext\"].to_s.gsub( '\\n', \"\\n\" )\n tmp = Tempfile.new(\"wik-#{encoded}-\")\n tmp.puts page\n system \"less #{tmp.path}\"\n tmp.close\n tmp.unlink\n return hash\n end", "def show\n @wiki = Wiki.find(params[:id])\n end", "def get_page(opts = {})\n data, _status_code, _headers = get_page_with_http_info(opts)\n data\n end", "def get_page(opts = {})\n data, _status_code, _headers = get_page_with_http_info(opts)\n data\n end", "def get_page(opts = {})\n data, _status_code, _headers = get_page_with_http_info(opts)\n data\n end", "def get_page(opts = {})\n data, _status_code, _headers = get_page_with_http_info(opts)\n data\n end", "def get_page(url)\n @doc = Nokogiri::HTML(open(url))\n end", "def get_page(opts = {})\n data, _status_code, _headers = get_page_with_http_info(opts)\n data\n end", "def get_page(opts = {})\n data, _status_code, _headers = get_page_with_http_info(opts)\n data\n end", "def get_page(opts = {})\n data, _status_code, _headers = get_page_with_http_info(opts)\n data\n end", "def get_page(opts = {})\n data, _status_code, _headers = get_page_with_http_info(opts)\n data\n end", "def get_page(opts = {})\n data, _status_code, _headers = get_page_with_http_info(opts)\n data\n end", "def wiki(project, slug)\n get(\"/projects/#{url_encode project}/wikis/#{slug}\")\n end", "def page(id, params = {})\n get \"pages/#{id}\", {query: params}\n end", "def show\n @wiki_pages = @wiki.wiki_pages.paginate(:page => params[:page]).order(\"title\") #.select(\"id, title, url_title, updated_at\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wiki }\n end\n end", "def show\n @wiki_page = MiniWikiPage.find_by_name(params[:wiki_page])\n\n if !@wiki_page.nil?\n # get revision\n if params[:revision]\n @wiki_revision = @wiki_page.mini_wiki_revisions.first(:conditions => [\"revision=?\",params[:revision]])\n end\n \n # if retreive of revision failed or if no revision requested, get the last revision\n if (params[:revision] && @wiki_revision==nil) || !params[:revision]\n @wiki_revision = @wiki_page.mini_wiki_revision\n end\n \n render :template => 'show'\n else\n redirect_to :action => 'new', :name => params[:wiki_page]\n end\n \n end", "def get_page(query)\n\t# FOR OFFLINE DEVELOPMENT\n\t# uri = BASE_URL + query + \".html\"\n\t# page = Nokogiri::HTML(open(uri))\n\t\n\turi = BASE_URL + query\n\tpage = Nokogiri::HTML(open(uri).read)\n\treturn page\nend", "def get_page_content(page_title)\n response = mediawiki('get_wikitext', page_title)\n case response&.status\n when 200\n response.body.force_encoding('UTF-8')\n when 404\n ''\n end\n end", "def page\n obj\n end", "def get_page_from_url(url)\n site.pages.each do |page|\n if page.url == url then\n return page\n end\n end\n end", "def new\n @page = Page.new\n @document = \"\"\n @title = \"\"\n if !params[:url].nil? then\n #load openwiki page using Hpricot (http://code.whytheluckystiff.net/hpricot/)\n @document = open(params[:url]) { |f| Hpricot f, :fixup_tags => true }\n\n #find the title of the OpenWiki page and populate the field for the editor\n title = (@document/\"h1 a.same\")\n @title = title[0].inner_html unless title[0].nil?\n\n #fix anchors in the html before extracting the body portion\n (@document/\"a\").each do |a|\n if !a.attributes[\"href\"].nil?\n #sometimes the link already has the correct url host and protocol\n a.attributes[\"href\"] = \"http://dcapp01/openwiki/\" + a.attributes[\"href\"] if a.attributes[\"href\"].index( \"http\" ).nil?\n end\n end\n\n #now we should be ready to slice out the relevant body text\n @document = (@document/\"#TeamPortal\").inner_html\n end\n\t\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def wiki_pages(project, on_page = nil)\n opts = {}\n opts[:page] = on_page if on_page\n fetch_all(\"projects/#{project}/features/wiki/pages\", 'pages', opts)\n end", "def page\n @page ||= revision.try(:page)\n end", "def find_or_new_page(title)\n title = start_page if title.blank?\n find_page(title) || WikiPage.new(:wiki => self, :title => Wiki.titleize(title))\n end", "def wiki\n @wiki ||= Smeagol::Wiki.new(wiki_dir)\n end", "def page(path)\n path = normalize_path(path)\n @pages[path]\n end", "def page(permalink)\n\t\t# check if the file exists, return nil if not\n\t\tfile = dir + '/' + permalink + '.md'\n\t\treturn nil unless File.exists? file # bail out if the file doesn't exist\n\t\t\n\t\t# check if we can read content, return nil if not\n\t\tcontent = File.new(file, :encoding => \"UTF-8\").read\n\t\treturn nil if content.nil?\n\t\t\n\t\t# return a new Page instance\n\t\treturn Page.new(content, permalink, self)\n\tend", "def page(permalink)\n\t\t# check if the file exists, return nil if not\n\t\tfile = dir + '/' + permalink + '.md'\n\t\treturn nil unless File.exists? file # bail out if the file doesn't exist\n\t\t\n\t\t# check if we can read content, return nil if not\n\t\tcontent = File.new(file, :encoding => \"UTF-8\").read\n\t\treturn nil if content.nil?\n\t\t\n\t\t# return a new Page instance\n\t\treturn Page.new(content, permalink, self)\n\tend", "def fetch_page(name, options = {})\n fetch('/page/%s' % name, options)\n end", "def show\n @page = Page.find(params[:id])\n # renders a page\n end", "def get_page(url)\n\t\tbegin\n\t\t if not defined? agent\n\t\t \tagent = Mechanize.new\n\t\t end\n\n\t\t return agent.get(url)\n\n\t\trescue Mechanize::ResponseCodeError => e\n\n\t\t # if page couldn't be found, throw an error\n\t\t if e.response_code == \"404\"\n\t\t \traise ArgumentError.new(\n\t\t \t\t\"#{@url} #{NOT_FOUND_ERROR}\"\n\t\t \t\t)\n\t\t else\n\t\t \tthrow\n\t\t end \n\n\t\tend\n\tend", "def get_page(url)\n @log.info(\"Loading page: #{url}\")\n try_three_times do\n page = @agent.get(url)\n page.encoding = 'utf-8' if page.is_a?(Mechanize::Page)\n return page\n end\n end", "def page\n @page_object ||= Page.find(self.page_id)\n rescue\n nil\n end", "def get_wiki(search)\n return Wikipedia::article(search).first\n search = search.split(/\\s+/).map {|w| w.capitalize }.join(' ')\n page = Wikipedia.find(search)\n g = JSON.parse(page.json)\n content = g[\"query\"][\"pages\"].first.last[\"revisions\"].first\n\n\n content = content[\"*\"]\n\n\n wiki = WikiCloth::Parser.new({ data: content })\n\n html = wiki.to_html\n\n doc = Nokogiri::HTML(html)\n doc = doc.xpath(\"//p\").to_s\n doc = Nokogiri::HTML(doc)\n doc = doc.xpath(\"//text()\").to_s\n\n doc = doc.split(\"\\n\")\n\n plaintext = []\n\n doc.each do |d|\n unless d.empty?\n plaintext << d\n end\n end\n\n\n return plaintext\n end", "def get_pages(options = nil)\n @client.raw('get', '/content/pages', options)\n end", "def get_page(id)\n uri = URI.parse(\"#{BaseURI}#{id}\")\n\n Nokogiri::HTML(open(uri))\nend", "def get(page_title)\n form_data = {'action' => 'query', 'prop' => 'revisions', 'rvprop' => 'content', 'titles' => page_title}\n page = make_api_request(form_data).first.elements[\"query/pages/page\"]\n if valid_page? page\n page.elements[\"revisions/rev\"].text || \"\"\n end\n end", "def get_page(page = 1)\n add_actions \"GoToPage(#{page})\"\n end", "def get_page(url, prog_name = self.class)\n begin\n retries ||= 0\n page = Nokogiri::HTML(URI.open(url))\n rescue OpenURI::HTTPError => e\n retry if (retries += 1) < MAX_RETRIES\n logger.error(prog_name) { \"Could not load page '#{url}': #{e.message}\" }\n raise $!\n end\n page\n end", "def page\n self.class.page\n end", "def page\n @page ||= Page.new(browser)\n end", "def get_page(uri)\n agent.get(URI(uri))\n end", "def show\n @page = Page.find(params[:id])\n end", "def find_page(title, options = {})\n @page_found_with_redirect = false\n title = start_page if title.blank?\n title = Wiki.titleize(title)\n page = pages.find_by(\"LOWER(title) = LOWER(?)\", title)\n if page.nil? && options[:with_redirect] != false\n # search for a redirect\n redirect = redirects.where(\"LOWER(title) = LOWER(?)\", title).first\n if redirect\n page = redirect.target_page\n @page_found_with_redirect = true\n end\n end\n page\n end", "def page\n\t\tself.out \"page #{@site}\"\n\t\treturn @site\n\tend", "def page\n\t\t@visited_pages = []\n\t\tlogger.debug \"retreiving page for #{name}\"\n\t\tfind_page(name, false)\n\tend", "def page( lang, path )\n root_page( lang ).descendant( path )\n end", "def get(page)\n case page\n when Model\n page\n when String\n new site.get page\n when Sitepress::Resource\n new page\n else\n raise ModelNotFoundError, \"#{self.inspect} could not find #{page.inspect}\"\n end\n end", "def find_page(title)\n title = normalize_title(title)\n \n store[title + '.md'] or Page.new(:title => title)\n end", "def show\n @wiki = @project.wikis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wiki }\n end\n end", "def get_page(page_number)\n # Find URI that we can work with, if we cannot get the first or the\n # last page URI then there is only one page.\n page_uri = first_page_uri || last_page_uri\n return nil unless page_uri\n\n perform_request(page_uri, page_number)\n end", "def info\n\t\treturn \"\"\n\t\tp = localized_page\n\t\treturn \"\" unless p && p.content\n\t\tlogger.debug \"parsing page #{p.title}\"\n\t\t\t\n\t\t# extract the top-most section (the one before any ToC)\n\t\tc = WikiCloth::Parser.new({ :data => WikiParser::sanitize(p.content) })\n\t\tc = c.sections.first\n\t\t\n\t\tl = I18n.locale\n\t\tret = WikiParser.new({ :data => c }).to_html\n\t\t#I18n.locale = l\n\t\treturn ret\n\tend", "def fetch_page(url, from_page = nil)\n begin\n url = URI(url) unless url.is_a?(URI)\n\n if from_page\n referer = from_page.url\n depth = from_page.depth + 1\n end\n\n response, code, location, response_time = get(url, referer)\n\n aka = nil\n if !url.eql?(location)\n aka = location\n end\n\n return Page.new(url, response.body, code, response.to_hash, aka, referer, depth, response_time)\n rescue\n return Page.new(url)\n end\n end", "def load_page\n @page ||= @mechanize.get(url)\n end", "def show\n provides :xml, :json\n \n @page = Page[:id => params[:id]] || Page[:slug => params[:id]]\n \n if content_type == :html\n render\n else\n display @page\n end\n end", "def page\n # extract :page from defaults? no need using default page?\n @params[:page].to_i > 0 ? @params[:page] : @cfg[:default][:page]\n end", "def get_page(target_url)\n response = @version.domain.request(\n 'GET',\n target_url\n )\n RoomPage.new(@version, response, @solution)\n end", "def get_page(page_number)\n # Find URI that we can work with, if we cannot get the first\n # page URI then there is only one page.\n return nil unless first_page_uri\n params = parse_query URI(first_page_uri).query\n params['page'] = page_number\n\n response = page_request URI(first_page_uri).path, params\n update_page_links response.links\n response\n end", "def page\n nil\n end", "def page\n @proxying ? @page.document : @page\n end", "def show(name)\n\t\tif [email protected]?\n\t\t\tstatus 500\n\t\t\t@name = \"Wiki directory not found\"\n\t\t\t@error = \"We couldn't find the wiki directory your configuration is pointing to.<br/>Fix that, then come back - we'll be happier then.\"\n\t\t\terb :error500\n\t\telse\n\t\t\tif @page = @wiki.page(name)\n\t\t\t\t# may success come to those who enter here.\n\t\t\t\t@name = @page.name\n\t\t\t\t@content = @page.content\n\t\t\t\terb :show\n\t\t\telse\n\t\t\t\tstatus 404\n\t\t\t\t@newpage = name\n\t\t\t\t@name = \"404: Page not found\"\n\t\t\t\terb :error404\n\t\t\tend\n\t\tend\n\tend", "def show(id)\n @page = Page.by_slug(id) || raise(NotFound)\n display @page\n end", "def get_page(name, version='master')\n IO.read(page_path(name, version)) if cache_hit?(name, version)\n end", "def get_page(name, page_number, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_with_http_info(name, page_number, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_page_with_http_info(name, page_number, opts)\n else\n raise\n end\n return data\n end", "def to_page\n page\n end", "def calc_page_and_title_from_wikiword(wiki_word)\n wiki_page_title = wiki_word # as is for now\n page_name = wiki_word.gsub( /\\s*:\\s*/, '/').downcase\n if self.subwiki && !page_name.starts_with?('/') # unless page starts with /, remain in subwiki, so prefix with dir\n page_name = File.join(self.subwiki, page_name)\n end\n page_name = page_name[1..-1] if page_name.starts_with?('/')\n page_name = page_name + HOMEPAGE if page_name.ends_with?('/')\n page_name = page_name.wiki_filename\n page = Page.new(page_name)\n return page, wiki_page_title\n end", "def show\n respond_with(@page = Page.find(params[:id]))\n end", "def show\n @page = HelpPage.find_from_param(params[:id]) \n end", "def page_object\n @page\n end", "def page_object\n @page\n end", "def page(slug_id)\n\t\treturn self.pages.where(:slug => slug_id).first\n\tend", "def get_page(target_url)\n response = @version.domain.request(\n 'GET',\n target_url\n )\n DomainPage.new(@version, response, @solution)\n end", "def show\n if params[:id]\n @page = current_site.pages.find(params[:id])\n else\n @page = current_site.pages.first()\n end\n @post = Post.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "def get_page_from_url(url)\n\t(site.pages + site.posts).each do |page|\n\t\treturn page if page.url == url\n\tend\n\n\treturn nil\nend", "def page\n return nil if element.nil?\n @page ||= element.page\n end", "def get_page(url)\n Hpricot.buffer_size = 262144\n Hpricot(open(url, {\"User-Agent\" => \"Mozilla/5.0 Firefox/3.5\"}))\n end", "def wikipedia_link\n\t\tp = localized_page\n\t\tbase = \"https://#{langtag(I18n.locale)}.wikipedia.org\"\n\t\treturn base unless p && p.title\n\t\t\"#{base}/wiki/#{p.title}\"\n\tend", "def show\n page_id = params[:id]\n @page = ContentPage.find(page_id)\n end", "def get_page\n case page = params[:page].to_i\n when 0; 1\n when (1..POST_PAGES); page\n else POST_PAGES\n end\n end", "def show\n @page = @user.pages.find_by_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "def get_raw_page_content(article_titles)\n query_parameters = { titles: article_titles,\n prop: 'revisions',\n rvprop: 'content' }\n info = mediawiki('query', query_parameters)\n return if info.nil?\n page = info.data['pages']\n page.nil? ? nil : page\n end", "def get_page(target_url)\n response = @version.domain.request(\n 'GET',\n target_url\n )\n WorkspacePage.new(@version, response, @solution)\n end", "def page\n\t\t\teditor.page\n\t\tend", "def page\n\t\tpage = request.path.split(\"/\")[-1]\n\tend", "def show\n @page = @site.pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "def show\n @page = Page.new\n @page = Page.find(params[:id])\n end", "def page\n return @most_recent_page if @most_recent_page && @most_recent_page.on_page?\n\n if @browser.is_a? Watir::Browser\n url = @browser.url\n elsif @browser.is_a? Selenium::WebDriver::Driver\n url = @browser.current_url\n else\n raise SiteObject::BrowserLibraryNotSupportedError, \"Unsupported browser library: #{@browser.class}\"\n end\n\n found_page = nil\n @pages.each do |p|\n if p.url_matcher && p.url_matcher =~ url\n found_page = p\n elsif p.query_arguments && p.url_template.match(url)\n found_page = p\n elsif !p.query_arguments && p.url_template.match(url.split(/(\\?|#)/)[0])\n found_page = p\n end\n\n break if found_page\n end\n\n if found_page && !found_page.required_arguments.empty?\n if hsh = found_page.url_template.extract(url)\n return found_page.new(self, found_page.url_template.extract(url))\n else\n return found_page.new(self, found_page.url_template.extract(url.split(/(\\?|#)/)[0]))\n end\n elsif found_page\n return found_page.new(self)\n else\n return nil\n end\n end" ]
[ "0.720681", "0.70575005", "0.69782513", "0.69630504", "0.69353354", "0.6795602", "0.6795405", "0.67675763", "0.67675763", "0.6732266", "0.67222935", "0.66828233", "0.65933794", "0.65304285", "0.6526571", "0.64633095", "0.64633095", "0.64633095", "0.64633095", "0.64473546", "0.64425826", "0.64425826", "0.64425826", "0.64425826", "0.64425826", "0.6421886", "0.6404056", "0.6323149", "0.63012457", "0.62696", "0.62180364", "0.62150604", "0.62115586", "0.62086046", "0.62078565", "0.6177846", "0.6174783", "0.61254036", "0.61166596", "0.60814494", "0.60814494", "0.60659534", "0.6058565", "0.60274076", "0.60222596", "0.60185087", "0.6015825", "0.6011348", "0.59986055", "0.59937775", "0.5988818", "0.59797984", "0.5977575", "0.5975109", "0.59622335", "0.59610385", "0.59541374", "0.59406257", "0.5936796", "0.59114635", "0.5909664", "0.59089375", "0.5905889", "0.59040993", "0.58749515", "0.5861165", "0.5851148", "0.5850506", "0.5841089", "0.5836655", "0.5830629", "0.5829802", "0.58235353", "0.5813434", "0.5785885", "0.57855743", "0.57772076", "0.57745034", "0.5770304", "0.5763638", "0.575174", "0.5722005", "0.5722005", "0.5721873", "0.57094485", "0.57078826", "0.5707658", "0.57061297", "0.56926894", "0.5690374", "0.56864274", "0.5685096", "0.5678897", "0.56677765", "0.5664231", "0.56639093", "0.5655406", "0.5650143", "0.5637166", "0.5634723" ]
0.70832086
1
Yields translations to block
def each each_locale { |locale| yield Translation.new(self, locale) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translations; end", "def __with_locale__(locale, &block)\n yield\n end", "def each_locale_and_translated_attribute\r\n used_locales.each do |locale|\r\n translated_attribute_names.each do |name|\r\n yield locale, name\r\n end\r\n end\r\n end", "def carry(*attributes,&block)\n attributes.each do |attribute|\n @translations[attribute] = { :title => attribute, }\n if block_given?\n @translations[attribute][:block] = block\n end\n end\n end", "def init_translations; end", "def each_locale(&block)\n self.mounting_point.locales.each do |locale|\n Locomotive::Mounter.with_locale(locale) do\n block.call(locale)\n end\n end\n end", "def with_locales_if_translated(with_locales = nil, &block)\n if instance.respond_to?(:translated_locales) && instance.translated?(:\"#{name}_file_name\")\n # TODO translated_locales are not present any more when this is called via destroy callback (unless 'translates' is defined AFTER 'has_attached_file' in the model class)\n with_locales = instance.translated_locales if with_locales.nil?\n Globalize.with_locales([*with_locales]) { yield }\n else\n yield\n end\n end", "def add_translator( type, &block ) # :yields: type, value\n @translators[ type_name( type ) ] = block\n end", "def render_with_locale(item)\n if item.data[\"locale\"]\n previous_locale = locale\n self.locale = item.data[\"locale\"]\n yield\n self.locale = previous_locale\n else\n yield\n end\n end", "def transliterate(locale = nil)\n I18n.transliterate(self, ({ locale: locale } if locale))\n end", "def inline_translations_for(language)\n translations_for(language, -50)\n end", "def fetch_translations(locale)\n self.translations ||= {}\n return if self.translations[locale]\n\n # Tml.logger.debug(\"Fetching translations for #{label}\")\n\n results = self.application.api_client.get(\n \"translation_keys/#{self.key}/translations\",\n {:locale => locale, :per_page => 10000},\n {:cache_key => Tml::TranslationKey.cache_key(locale, self.key)}\n ) || []\n\n update_translations(locale, results)\n\n self\n rescue Tml::Exception => ex\n self.translations = {}\n self\n end", "def inject_translatable_block\n inject_into_class model_path, class_name, generate_translatable_block\n end", "def with_user_locale\n raise \"No block given\" unless block_given?\n begin\n tmp_locale = I18n.locale\n I18n.locale = profile.language\n yield\n ensure\n I18n.locale = tmp_locale\n end\n end", "def index\n @translations = TRANSLATION_STORE\n end", "def each_locale(include_default_locale = true, &block)\n current_locale = ::Mongoid::Fields::I18n.locale\n _locales = include_default_locale ? self.locales : (self.locales - [self.default_locale])\n\n _locales.each do |locale|\n ::Mongoid::Fields::I18n.with_locale(locale) do\n yield locale, current_locale.to_s == locale.to_s\n end\n end\n end", "def translations\n @translations ||= {}\n end", "def configure(&block)\n block.call @locale\n end", "def each(&block)\n old_raw = @raw\n yield self unless self.nil?\n self.left_sentence.each{|el|block.call el} if self.left_sentence\n while (not old_raw.eql?(@raw)) && (not old_raw.nil?)\n old_raw = @raw\n yield self unless self.nil?\n end\n self.right_sentence.each{|el|block.call el} if (self.right_sentence) && (not @operator.is_negation?)\n while (not old_raw.eql?(self.raw)) && (not old_raw.nil?)\n old_raw = self.raw\n yield self unless self.nil?\n end\n end", "def translations_hash; end", "def progress_dialog\n ProgressDialog.forBlock do |pd|\n super(pd, 'Translating')\n $current_case.with_write_access do\n @items.each_with_index do |item, index|\n break if advance(index, \"Item GUID: #{item.getGuid}\").nil?\n\n translate(item)\n end\n end\n pd.setCompleted\n end\n end", "def chunks_translated\n @chunks_translated ||= chunks.map do |chunk|\n cached, missing = cache.cached_and_missing(chunk)\n if missing.empty?\n cached\n else\n cache.store(chunk, cached, call_api(missing))\n end\n end\n end", "def translations\n ::I18n.backend.instance_eval do\n init_translations unless initialized?\n translations\n end\n end", "def create_translations\n end", "def each\n\t\tyield \"piaza\"\n\t\tyield \"spaghetti\"\n\t\tyield \"salad\"\n\t\tyield \"water\"\n\tend", "def trz(translate:, rotate:)\n self.translate z: translate do\n self.rotate z: rotate do\n yield\n end\n end\n end", "def each\n @body.each do |block|\n yield @resource.send(@encoder, @resource.send(@charsetter, block.to_s))\n end\n end", "def yields\n parsed {\n @yields\n }\n end", "def translate(settings); end", "def locale locale, &block\n def self.it_should_be_translated(selector, translation)\n it \"#{selector} should have translation #{translation}\" do\n response.should have_tag(selector, translation)\n end\n end\n def self.it_should_not_have_missing_translations\n it \"should have everything translated\" do\n response.body.should_not =~ /translation missing|translation_missing/\n end\n end\n \n contexted = context \"with locale #{locale}\", &block\n \n contexted.class_eval <<-BODY\n before(:all) do\n @old_locale = I18n.locale\n I18n.locale = locale\n end\n after(:all) do\n I18n.locale = @old_locale\n end\n BODY\nend", "def translations( params={} )\n translations = get_connections(\"translations\", params)\n return map_connections translations, :to => Facebook::Graph::Generic\n end", "def translate(item)\n @progress.setMainStatusAndLogIt('Translating')\n text = get_original_text(item)\n return nil if text.empty?\n\n translated = ms_translate(text)\n super(item, translated) unless translated.nil? || translated.empty?\n end", "def each_phrase(data=nil, &block)\n\t\t\tself.phrases(data).each {|phrase| yield phrase }\n\t\tend", "def export(data, indent=0)\n target = data[@translate.lang]\n xml = <<EOF\n<?xml version=\"1.0\" encoding=\"#{@translate.options[:encoding]}\"?>\n<!DOCTYPE TS>\n<TS version=\"2.0\" language=\"#{@translate.lang}\">\nEOF\n\n keys = I18n::Translate.hash_to_keys(target).sort\n keys.each do |key|\n value = @translate.find(key, target)\n next unless value\n\n if value.kind_of?(String) || value.kind_of?(Array) || value.kind_of?(Integer)\n fuzzy = (value.to_s.empty?) ? %~ type=\"unfinished\"~ : \"\"\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\n <source>#{::CGI.escapeHTML(@translate.find(key, @translate.default).to_s)}</source>\n <translation#{fuzzy}>#{::CGI.escapeHTML(value.to_s)}</translation>\n </message>\n </context>\nEOF\n else\n fuzzy = ((value[\"flag\"] == \"ok\") or value[\"flag\"].to_s.strip.empty?) ? \"\" : (value[\"flag\"] == \"obsolete\") ? %~ type=\"obsolete\"~ : %~ type=\"unfinished\"~\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\nEOF\n if value[\"file\"] or value[\"line\"]\n xml += <<EOF\n <location filename=\"#{::CGI.escapeHTML(value[\"file\"].to_s)}\" line=\"#{::CGI.escapeHTML(value[\"line\"].to_s)}\" />\nEOF\n end\n xml += <<EOF\n <source>#{::CGI.escapeHTML(value[\"default\"].to_s)}</source>\nEOF\n unless value[\"old_default\"].to_s.empty?\n xml += <<EOF\n <oldsource>#{::CGI.escapeHTML(value[\"old_default\"].to_s)}</oldsource>\nEOF\n end\n unless value[\"extracted_comment\"].to_s.empty?\n xml += <<EOF\n <extracomment>#{::CGI.escapeHTML(value[\"extracted_comment\"].to_s)}</extracomment>\nEOF\n end\n unless value[\"comment\"].to_s.empty?\n xml += <<EOF\n <translatorcomment>#{::CGI.escapeHTML(value[\"comment\"].to_s)}</translatorcomment>\nEOF\n end\n xml += <<EOF\n <translation#{fuzzy}>#{::CGI.escapeHTML(value[\"translation\"].to_s)}</translation>\nEOF\n unless value[\"flag\"].to_s.strip.empty?\n xml += <<EOF\n <extra-po-flags>#{::CGI.escapeHTML(value[\"flag\"].to_s.strip)}</extra-po-flags>\nEOF\n end\n xml += <<EOF\n </message>\n </context>\nEOF\n end\n end\n\n xml += <<EOF\n</TS>\nEOF\n xml\n end", "def index\n @translations = @locale.translations.all(:order => \"raw_key, pluralization_index\")\n end", "def translated\n find_all do |entry|\n entry.translated?\n end\n end", "def translations_for route\n available_locales.map do |locale|\n translate_route(route, locale.dup) #we duplicate the locale string to ensure it's not frozen\n end\n end", "def generate_multilang(site)\n lang = site.data['curr_lang']\n prime_lang = site.config['prime_lang']\n is_localization = prime_lang != lang\n\n Jekyll.logger.info \"Generating translation in '#{lang}'\"\n\n prefix_lang = File.join site.source, \"_langs\", lang\n prefix_prime = File.join site.source, \"_langs\", prime_lang\n\n # Hack to skip processing regular content\n # if we're building a translation.\n if is_localization\n site.static_files = []\n site.pages = []\n end\n\n # prime language pages map url => page\n site.data['primes'] = {}\n # Outer loop over each page of prime_lang and their translations\n site.data['translations'].each do |relpath, locales|\n reldir, name = File.split relpath\n prime_file = File.join(prefix_prime, relpath)\n lang_file = File.join(prefix_lang, relpath)\n\n prime = create_page(site, prime_file, reldir, name, prime_lang, true, !is_localization)\n next unless prime\n\n has_localization = locales.inject({}) { |loc, hl| loc[hl] = true; loc }\n prime.data.merge!(\n 'is_localized' => !locales.empty?,\n 'is_localization' => false,\n 'has_localization' => has_localization)\n\n raise \"Two pages at the same URL #{prime.url}\" if site.data['primes'].key? prime.url\n\n site.data['primes'][prime.url] = prime\n translated_pages = [prime]\n\n # Inner loop over known single page translations from the manifest\n (locales || []).each do |hl|\n hl_file = File.join site.source, \"_langs\", hl, relpath\n page = create_page(site, hl_file, reldir, name, hl, true, hl == lang)\n page.data.merge!('is_localized' => true, 'is_localization' => true)\n translated_pages << page\n end\n\n # Map all the translations for a page on to each other\n translated_pages.each do |page|\n page.data[\"translations\"] = translated_pages\n end\n end\n end", "def translations\n translated_locales = @bindings[:object].translated_locales\n available_locales.collect do |locale|\n translated_locales.include?(locale) ? @bindings[:object].translation_for(locale) : @bindings[:object].translations.new({ locale: locale })\n end\n end", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def main_content\n yield if block_given?\n end", "def each(&block)\n @messages.each(&block)\n end", "def scaffold_translations(the_tree)\n translations = []\n each_head(the_tree) do |tp_word, parent|\n if native_tokipona?(tp_word)\n role = get_role(parent)\n # tp = TokiponaPhrase.find_by(words: principal_tokipona_form(tp_word), role: role) # ACCOUNT FOR ROLE\n tp = TokiponaPhrase.where('words = ?', principal_tokipona_form(tp_word)).find_in_role(role).first\n else\n # make or find proper noun\n tp = TokiponaPhrase.find_or_create_by(words: tp_word.capitalize, role: 'i')\n end\n byebug if tp.nil?\n english_phrase = EnglishPhrase.find_by(tokipona_phrase_id: tp.id)\n\n translations.push(\n tp: tp.words,\n tp_role: tp.role,\n tp_id: tp.id,\n en: english_phrase.nil? ? nil : english_phrase.base_form,\n en_id: english_phrase.nil? ? nil : english_phrase.id\n )\n end\n translations\n end", "def templates(&block)\n instance_eval(&block)\n end", "def run(items)\n return nil if super(items).nil?\n\n url = 'https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to='\n @uri = URI.parse(url + @langs.key(@settings['translation_language']))\n @headers = { 'Ocp-Apim-Subscription-Key' => @settings['api_key'] }\n ['Content-Type', 'Accept'].each { |k| @headers[k] = 'application/json' }\n progress_dialog\n end", "def translated_text(args = {})\n objects = args[:locale].nil? ? translations : for_language(args[:locale])\n objects.collect(&:text)\n end", "def generate_yaml(locale_name, translations)\n yaml = YamlDocument.new(\"config/locales/translation_#{locale_name}.yml\", locale_name)\n each_value [], translations do |parents, value|\n node = parents.inject(yaml[locale_name]) {|node, parent| node[parent]}\n node.value = value\n end\n yaml\n end", "def translate(locale)\n translated_text = ''\n parse do |part|\n case part[:type]\n when :paragraph\n translated_text += locale.translate(part[:paragraph])\n when :empty_line\n translated_text += part[:line]\n else\n raise \"should not reach here: unexpected type: #{type}\"\n end\n end\n translated_text\n end", "def each_template\n if @processed.nil?\n @processed, @rest = templates.keys.partition { |k| k.to_s.include? \".\" }\n end\n\n @processed.each do |k|\n yield k, templates[k]\n end\n\n @rest.each do |k|\n yield k, templates[k]\n end\n end", "def with_locale(locale, &block)\n previous_locale = I18n.locale\n I18n.locale = locale if locale\n \n yield\n \n I18n.locale = previous_locale\n end", "def translatable\n self._translatable[base_name]\n end", "def each(&block) \n reset\n \n while transaction = next_transaction\n yield transaction\n end\n end", "def index\n @blocks = @subdivision.blocks\n @blocks = @blocks.map{|d| {id: d.id, name: d.name[@language]}}\n end", "def show\n @translate\n @uploaded_text = ''\n translation_map = []\n end", "def translations\n OneclickRefernet::Translation.where(key: self.code)\n end", "def seed_page_content_translations!\n I18n.available_locales.each do |locale|\n seed_content_for_locale locale.to_s\n end\n end", "def inside_t1\n yield\n end", "def build_html\n # the first one should not use a locale, for the default:\n generate_all_html_pages\n\n # now translate, if necessary:\n if translation.should_translate?\n translation.prepare\n translation.available_locales.each do |locale|\n translation.current_locale = locale\n generate_all_html_pages\n end\n end\n end", "def texts_translated\n @texts_translated ||= tokens_translated.map do |group|\n group.map { |value, type| type == :text ? value : fix_ascii(value) }.join\n end\n end", "def write\n self.each_locale do |locale|\n self.output_locale\n\n self.snippets.values.each { |snippet| self.write_snippet(snippet) }\n end\n end", "def yield_tag(text); end", "def block_method\n yield(\"Brandon\",\"CS\")\n yield(\"Katie\",\"Econ\")\nend", "def each_file\n return unless block_given?\n\n loc_path = LokaliseRails.locales_path\n Dir[\"#{loc_path}/**/*\"].sort.each do |f|\n full_path = Pathname.new f\n\n next unless file_matches_criteria? full_path\n\n relative_path = full_path.relative_path_from Pathname.new(loc_path)\n\n yield full_path, relative_path\n end\n end", "def do_for_all_messages(&block) \n raise ArgumentError, \"FileHandler#do_for_all_messages expects a code block\" unless block_given? \n @messages_as_text.shuffle!\n @messages_as_text.each_slice(@limit) do |set|\n messages = get_messages(set)\n messages.each { |message| yield(message) }\n end\n end", "def yield_for(symbol)\n haml_concat(content_blocks[symbol].join)\n end", "def translations_for_select\n configuration(:translations).collect{ |translation|\n [translation[:language], translation[:language_code]]\n }\n end", "def flatten_translations(locale, data, escape, subtree); end", "def prepare_translations!\r\n stash.each do |locale, attrs|\r\n if attrs.any?\r\n translation = record.translations.find_by_locale(locale)\r\n translation ||= record.translations.build(:locale => locale)\r\n attrs.each{ |name, value| translation[name] = value }\r\n end\r\n end\r\n reset\r\n end", "def yieldreturn_tag(text); end", "def each(&block)\n txactions.each(&block)\n end", "def each\n sorted_transactions.each do |t|\n yield t if block_given?\n end\n end", "def call_this_block\n yield \"tweet\"\nend", "def call_this_block\n yield \"tweet\"\nend", "def translate!( *args )\n super( *args )\n reset_positions_inside\n end", "def mixblocks2seq!\n # Recurse on the scope.\n self.scope.mixblocks2seq!\n end", "def yield; end", "def index\n @translated_lines = TranslatedLine.all\n end", "def test_block_assignment\n tests = [\n [\"#={code}{hello}+{code}\", \"hello\"],\n [\"#={code}{hello}{+{code}}\", \"hello\"],\n [\"#={code}{%{wlang/dummy}{hello}}{+{code}}\", \"hello\"],\n [\"#={code}{%{wlang/dummy}{+{hello}}}{+{code}}\", \"+{hello}\"]\n ]\n tests.each do |test|\n template, expected = test\n result = template.wlang(nil, \"context-test\")\n assert_equal(expected, result)\n end\n end", "def each_country\n yield(\"Colombia\")\n yield(\"Costa Rica\")\n yield(\"USA\")\nend", "def each_country\n yield(\"Colombia\")\n yield(\"Costa Rica\")\n yield(\"USA\")\nend", "def yield!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 85 )\n\n type = YIELD\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 206:9: 'yield'\n match( \"yield\" )\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__, 85 )\n\n end", "def with_default_locale(&block)\n ::Mongoid::Fields::I18n.with_locale(self.default_locale) do\n yield\n end\n end", "def show_translation\n @translations = load_translations( @locale, @base_locale )\n render :partial => \"i18n_ui/translation_body\", :locals => { :key => params[:key], :tr => @translations[params[:key]]}, :layout => nil\n end", "def load_translations\n super(@load_paths)\n end", "def load_translations\n super(@load_paths)\n end", "def translatable\n self._translatable[base_name] ||= []\n end", "def generate\n I18n.backend.load_translations\n translations = wrap(source_translations)\n I18n.backend.store_translations(destination_locale, translations)\n I18n.available_locales += [destination_locale]\n end", "def content\n @blocks.map {|b| b.render } * EOL\n end", "def index\n\t\t@languages = Language.all\n\t\t@title = t(\"translate.title\")\n\t\trespond_with @languages\n\tend", "def setup_mass_copy_translations\n end", "def translatable_items_links\n AvailableLocale.translatables.map do |t|\n translatable_links(t)\n end.join.html_safe\n end", "def read_languages_from_file(data_file)\n File.open(data_file, 'rb') do |fin|\n until fin.eof\n label, outputs = Marshal.load(fin)\n yield label, outputs\n end\n end\nend", "def iterate resource, &block\n data = YAML.load_file \"#{@path}/#{resource}\" # cached file may be either in YAML or JSON format\n data['items'].each do |i|\n yield(i)\n end\n nil\n end" ]
[ "0.65218854", "0.6201924", "0.61959136", "0.61952144", "0.6055725", "0.5886856", "0.58282363", "0.58015263", "0.57411504", "0.573049", "0.5680819", "0.5674635", "0.56733376", "0.566249", "0.5600197", "0.55918765", "0.5568261", "0.5537879", "0.5523076", "0.55131483", "0.5506383", "0.54996014", "0.5486865", "0.5477315", "0.5477051", "0.54628325", "0.5450488", "0.5439088", "0.54330444", "0.543182", "0.54115504", "0.5395409", "0.53944117", "0.53683716", "0.5362108", "0.5352061", "0.53257364", "0.53132826", "0.53085995", "0.5306393", "0.5306393", "0.5306393", "0.5306393", "0.5306393", "0.5306393", "0.5306393", "0.5306393", "0.53046894", "0.53010064", "0.5290526", "0.52873117", "0.526706", "0.52664995", "0.5261824", "0.5256353", "0.5246576", "0.52463657", "0.5241284", "0.523648", "0.52290523", "0.52286375", "0.5220057", "0.5215165", "0.51988804", "0.519017", "0.518975", "0.5187036", "0.518619", "0.518286", "0.518262", "0.51776916", "0.5167761", "0.5161392", "0.5158315", "0.51545864", "0.5154252", "0.51522326", "0.5150996", "0.512876", "0.512876", "0.5119177", "0.51102316", "0.5106256", "0.5102777", "0.509822", "0.5097725", "0.5097725", "0.5094039", "0.50939995", "0.50810146", "0.50804687", "0.50804687", "0.50785995", "0.50753766", "0.5071021", "0.5054871", "0.50414807", "0.5036005", "0.5034985", "0.5032004" ]
0.7183599
0
List locales available for this backend.
def locales map(&:locale) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locales\n get(\"locales\")[\"locales\"]\n end", "def available_locales\n self.locales.map { |locale| locale.to_sym }\n end", "def available_locales\n evaluate_localization_option!(:available_locales)\n end", "def available_locales\n resource.translations.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def available_locales\n []\n end", "def available_locales\n translations = Dir.glob('config/locales/*').map { |locale| locale.split('/').last.split('.').first }\n locales = []\n translations.each do |t|\n value = (t == 'zh' ? 'zh-CN' : t)\n locales << [LanguageList::LanguageInfo.find(t).name, value]\n end\n locales\n end", "def available_locales; end", "def available_locales; end", "def available_locales\r\n ::LinguaFranca.available_locales\r\n end", "def available_locales\n locales = Language.sorted_by_abbreviation.pluck(:abbreviation).presence if Language.table_exists?\n (locales.presence || [default_locale])\n end", "def locales\n @env.locales\n end", "def available_locales\n init_translations unless initialized?\n translations.inject([]) do |locales, (locale, data)|\n locales << locale unless (data.keys - [:i18n]).empty?\n locales\n end\n end", "def available_locales\n init_names unless init_names?\n names.keys\n end", "def GetLocales params = {}\n\n params = params.merge(path: 'locales.json')\n APICall(params)\n\n end", "def available_locales\n translation_model.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def locales\n locale_counts.keys\n end", "def all_locales\n configatron.full_locales | preferred_locales\n end", "def available_locales\n @available_locales ||= begin\n locales = Set.new\n Array(config[:read]).map do |pattern|\n [pattern, Dir.glob(format(pattern, locale: '*'))] if pattern.include?('%{locale}')\n end.compact.each do |pattern, paths|\n p = pattern.gsub('\\\\', '\\\\\\\\').gsub('/', '\\/').gsub('.', '\\.')\n p = p.gsub(/(\\*+)/) { Regexp.last_match(1) == '**' ? '.*' : '[^/]*?' }.gsub('%{locale}', '([^/.]+)')\n re = /\\A#{p}\\z/\n paths.each do |path|\n locales << Regexp.last_match(1) if re =~ path\n end\n end\n locales\n end\n end", "def available_locales\n @available_locales ||= begin\n locales = Set.new\n @read.map do |pattern|\n [pattern, Dir.glob(pattern % {locale: '*'})] if pattern.include?('%{locale}')\n end.compact.each do |pattern, paths|\n p = pattern.gsub('\\\\', '\\\\\\\\').gsub('/', '\\/').gsub('.', '\\.')\n p = p.gsub(/(\\*+)/) { $1 == '**' ? '.*' : '[^/]*?' }.gsub('%{locale}', '([^/.]+)')\n re = /\\A#{p}\\z/\n paths.each do |path|\n if re =~ path\n locales << $1\n end\n end\n end\n locales\n end\n end", "def index\n @locales = Tolk::Locale.secondary_locales.sort_by(&:language_name)\n end", "def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n locales.map! { |k| k.to_sym }\n locales\n end", "def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n locales.map! { |k| k.to_sym }\n locales\n end", "def localeList\n\t\t\t@locales = []\n\t\t\tbasedir = Dir.new(@basepath)\n\t\t\tbasedir.each do |fn|\n\t\t\t\tif File.file?(@basepath + \"/\" + fn) && fn.split('.')[1] == 'sllf'\n\t\t\t\t\t@locales << File.basename(fn, \".sllf\")\n\t\t\t\tend\n\t\t\tend\n\t\t\t@locales\n\t\tend", "def available_locales_set; end", "def locales\n self.site.locales || []\n end", "def available_locales\n @available_locales ||= self.languages.published\n end", "def locale\n @locales = Ramaze::Tool::Localize.languages.map{ |lang|\n [\n Ramaze::Tool::Localize.localize('locale_menu_descrition', lang),\n Ramaze::Tool::Localize.localize('locale_name', lang),\n lang\n ]\n }\n end", "def locales\n locale_sources.compact.downcase.map {|loc| WorldFlags.locale(loc) unless loc.blank? }\n end", "def enabled_locales\n self[:enabled_locales].split(\",\").map(&:to_sym)\n end", "def enabled_locales\n self[:enabled_locales].split(\",\").map(&:to_sym)\n end", "def available_locales=(locales); end", "def index\n @locales = Locale.all\n end", "def index\n @locales = Locale.all\n end", "def get_locales(defaults=[])\n if self.available_locales.present?\n self.available_locales\n else\n defaults\n end\n end", "def translated_locales\r\n all.distinct(\"locale\").sort{ |x,y| x.to_s <=> y.to_s }.map(&:to_sym)\r\n end", "def locales\n EnvironmentLocaleMethodsFactory.new(self)\n end", "def available_locale_preferences\n [@no_preference] + available_locales\n end", "def used_locales\r\n locales = globalize.stash.keys.concat(globalize.stash.keys).concat(translations.translated_locales)\r\n locales.uniq!\r\n locales\r\n end", "def enabled_locales(app_path = nil)\r\n ::LinguaFranca.enabled_locales(app_path)\r\n end", "def locales(display = :flags)\n c = ''\n # TODO: The checking for entry or tag is primative and does not cover predefined tags\n page = @entry || @tag\n ls = ((display == :locales) || (display == :allflags) ? SemiStatic::Engine.config.localeDomains : SemiStatic::Engine.config.localeDomains.reject{|k, v| k.to_s == I18n.locale.to_s})\n unless ((display == :locales) && (ls.size == 1))\n ls.each{|l, u|\n if u.downcase == 'translate' \n link = \"http://translate.google.com/translate?hl=&sl=auto&tl=#{l}&u=#{url_encode(request.url)}\"\n else\n # If this is a special page, with no tag or entry, then it will not be seoable so just point locales to the root of the alternate locale website\n page.nil? && (link = u)\n end\n if (display == :flags) || (display == :allflags)\n c+= \"<li class='locale #{l}'><a href='#{link || page.hreflang_link(l) || u}'>#{image_tag(\"flags/\" + l + \".png\", :alt => \"locale #{l}\")}</a></li>\".html_safe\n elsif display == :text\n c+= \"<li class='locale #{l}'><a href='#{link || page.hreflang_link(l) || u}'>#{I18n.t(l)}</a></li>\".html_safe\n else\n if session[:locale] == l\n c+= \"<li class='locale #{l} selected'><a href='#{link || page.hreflang_link(l) || u}'>#{l}</a></li>\".html_safe\n else\n c+= \"<li class='locale #{l}'><a href='#{link || page.hreflang_link(l) || u}'>#{l}</a></li>\".html_safe\n end\n end\n }\n end\n c.html_safe\n end", "def locales(website)\n if product_families.size > 0\n @locales ||= product_families.map do |pf|\n pf.find_ultimate_parent.locales(website)\n end.flatten.uniq - locales_where_hidden\n else\n @locales ||= website.list_of_all_locales - locales_where_hidden\n end\n end", "def in_available_locales\n locales = if respond_to?(:available_locales)\n available_locales\n else\n I18n.available_locales\n end\n\n locales.flat_map { |locale| I18n.with_locale(locale) { yield } }\n end", "def list_lang\n call! :list_lang\n end", "def getlist\r\n result = SUPPORTED_LANG_LIST\r\n end", "def discover_locale\n locales = Dir[\"#{locale_dir}/*\"]\n locales.map! { |e| File.basename(e) }\n locales.join(\" \")\n end", "def all_locales\n locales = slugged_attributes\n .map { |attr| send(\"#{attr}_translations\").keys if respond_to?(\"#{attr}_translations\") }\n .flatten.compact.uniq\n locales = I18n.available_locales if locales.empty?\n locales\n end", "def preferred_locales\n read_attribute(\"preferred_locales\").map(&:to_sym)\n end", "def translated_locales\n self.i18n.keys\n end", "def localizations\n @@locales[Locale.code] || {}\n end", "def translations\n translated_locales = @bindings[:object].translated_locales\n available_locales.collect do |locale|\n translated_locales.include?(locale) ? @bindings[:object].translation_for(locale) : @bindings[:object].translations.new({ locale: locale })\n end\n end", "def locales(locale_type)\n locs = Set.new\n\n each_bathing_water do |bw|\n l = bw[locale_type]\n locs << l if l.is_a?(LdaResource)\n end\n\n locs.to_a.sort_by(&:label)\n end", "def index\n @locales = query(LOCALE, :code)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @locales }\n end\n end", "def display_all_languages\n # Interface method\n end", "def get_language_list\n call :get_language_list\n end", "def all_published_locales\n translations.where(published: true).map{|x| x.locale}.uniq.sort\n end", "def supported_locales\n Dir[path_to_cached_locales].map { |path| path =~ /([\\w-]+)\\/timezones\\.yml/ && $1 }\n end", "def getLangs\r\n result = self.class.get '/getLangs', { query:{ key:@@api_key } }\r\n check_result result\r\n end", "def languages\n translations.map(&:language)\n end", "def languages\n get(\"/repos/show/#{owner.login}/#{name}/languages\")['languages']\n end", "def get_locales\n fall_back = [:ru].to_yaml\n locales = CustomSetting.find_or_create_by_name(\"languages\").value || fall_back\n begin\n locales = YAML::load(locales)\n rescue\n locales = YAML::load(fall_back)\n end\n end", "def translations_for_select\n Alchemy::I18n.available_locales.map do |locale|\n [_t(locale, :scope => :translations), locale]\n end\n end", "def track_locales\n I18n.track_locales = true if can_read?('Locale Admin')\n end", "def index\n @locale_associations = LocaleAssociation.all\n end", "def website_locales\n WebsiteLocale.where(locale: self.code)\n end", "def test_available_locales\n locales = %w[ar az bg bs ca cs da de el en en-GB es es-PA et eu fa fi fr gl he hr hu id it ja ko lt lv mk mn nl no pl pt pt-BR ro ru sk sl sq sr sr-YU sv th tr uk vi zh zh-TW]\n assert_equal locales.uniq.sort.map(&:to_sym), MessageCustomize::Locale.available_locales\n end", "def QueryAvailableLocaleIDs()\r\n ret = _invoke(1610743830, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def rtl_locales\n %i[ar]\n end", "def available_locales_initialized?; end", "def QueryAvailableLocaleIDs()\r\n ret = @dispatch._invoke(1610743830, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def available_translations\n missing_locales = Gallifreyian::Configuration.available_locales - translations.map(&:language)\n missing_locales.each do |locale|\n self.translations << Gallifreyian::Translation::I18nKey.new(language: locale)\n end\n self.translations.order_by({:language => :asc})\n end", "def known_locales\n if @known_locales.empty?\n [\n [ 'ja', 'Japanese', 'nplurals=1; plural=0;' ],\n [ 'vi', 'Vietnamese', 'nplurals=1; plural=0;' ],\n [ 'ko', 'Korean', 'nplurals=1; plural=0;' ],\n [ 'en', 'English', 'nplurals=2; plural=(n != 1);' ],\n [ 'de', 'German', 'nplurals=2; plural=(n != 1);' ],\n [ 'nl', 'Dutch', 'nplurals=2; plural=(n != 1);' ],\n [ 'sv', 'Swedish', 'nplurals=2; plural=(n != 1);' ],\n [ 'da', 'Danish', 'nplurals=2; plural=(n != 1);' ],\n [ 'no', 'Norwegian', 'nplurals=2; plural=(n != 1);' ],\n [ 'nb', 'Norwegian Bokmal', 'nplurals=2; plural=(n != 1);' ],\n [ 'nn', 'Norwegian Nynorsk', 'nplurals=2; plural=(n != 1);' ],\n [ 'fo', 'Faroese', 'nplurals=2; plural=(n != 1);' ],\n [ 'es', 'Spanish', 'nplurals=2; plural=(n != 1);' ],\n [ 'pt', 'Portuguese', 'nplurals=2; plural=(n != 1);' ],\n [ 'it', 'Italian', 'nplurals=2; plural=(n != 1);' ],\n [ 'bg', 'Bulgarian', 'nplurals=2; plural=(n != 1);' ],\n [ 'el', 'Greek', 'nplurals=2; plural=(n != 1);' ],\n [ 'fi', 'Finnish', 'nplurals=2; plural=(n != 1);' ],\n [ 'et', 'Estonian', 'nplurals=2; plural=(n != 1);' ],\n [ 'he', 'Hebrew', 'nplurals=2; plural=(n != 1);' ],\n [ 'eo', 'Esperanto', 'nplurals=2; plural=(n != 1);' ],\n [ 'hu', 'Hungarian', 'nplurals=2; plural=(n != 1);' ],\n [ 'tr', 'Turkish', 'nplurals=2; plural=(n != 1);' ],\n [ 'pt_BR', 'Brazilian', 'nplurals=2; plural=(n > 1);' ],\n [ 'fr', 'French', 'nplurals=2; plural=(n > 1);' ],\n [ 'lv', 'Latvian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);' ],\n [ 'ga', 'Irish', 'nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;' ],\n [ 'ro', 'Romanian', 'nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2;' ],\n [ 'lt', 'Lithuanian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'ru', 'Russian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'uk', 'Ukrainian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'be', 'Belarusian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'sr', 'Serbian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'hr', 'Croatian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'cs', 'Czech', 'nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;' ],\n [ 'sk', 'Slovak', 'nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;' ],\n [ 'pl', 'Polish', 'nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'sl', 'Slovenian', 'nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);' ]\n ].each do | array_item |\n key = array_item[0].to_sym\n lang = array_item[1]\n plural_form = array_item[2]\n @known_locales[key] = {}\n @known_locales[key][:lang] = lang\n @known_locales[key][:plural_form] = plural_form\n end\n end\n @known_locales\n end", "def clear_available_locales_set; end", "def enabled_locales=(values)\n languages = values.reject{|x| x.blank?}\n # add default, since it's the configured fallback it must exist\n languages = (languages << I18n.default_locale.to_s).uniq\n self[:enabled_locales] = languages.join(\",\")\n end", "def site_locales\n preferred_locales.split(/,\\s*/)\n end", "def site_locales\n preferred_locales.split(/,\\s*/)\n end", "def enabled_locales=(values)\n languages = values.reject { |x| x.blank? }\n # add default, since it's the configured fallback it must exist\n languages = (languages << I18n.default_locale.to_s).uniq\n self[:enabled_locales] = languages.join(\",\")\n end", "def get(locale = Localization.default_locale)\n @locales[locale.to_s]\n end", "def all_locales\n locales = []\n Rails.root.glob(\"config/locales/*.yml\").each do |file|\n match = /(\\w+).yml$/.match(file.to_s)\n locales << match[1] if match\n end\n locales\nend", "def accepted_locales\n http_accept_language = request.env['HTTP_ACCEPT_LANGUAGE']\n return [] if http_accept_language.blank?\n langs = http_accept_language.scan(/([a-zA-Z]{2,4})(?:-[a-zA-Z]{2})?(?:;q=(1|0?\\.[0-9]{1,3}))?/).map do |pair|\n lang, q = pair\n [lang.to_sym, (q || '1').to_f]\n end\n langs.sort_by { |lang, q| q }.map { |lang, q| lang }.reverse.uniq\n end", "def supported_languages\n return self.supported_locales.present? ? self.supported_locales : [\"en\"]\n end", "def translated_in=(locales)\n self._locales = locales.map(&:to_sym)\n end", "def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end", "def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end", "def languages(options={})\n res = self.get \"/translate/service/languages\", :query => options\n check_for_errors(res)\n res['response']\n end", "def matching_locales\n @_matching_locales ||= ::I18n.available_locales.select do |locale|\n locale.to_s.split(\"-\")[0] == language_code\n end\n end", "def available_translations\n {\n 'en' => 'English',\n 'es' => 'Español',\n 'pt-BR' => 'Português do Brasil'\n }\n end", "def translations_for route\n available_locales.map do |locale|\n translate_route(route, locale.dup) #we duplicate the locale string to ensure it's not frozen\n end\n end", "def set_variables\n @countries = Country.sorted\n @time_periods = TimePeriod.sorted\n\n @locales = []\n I18n.available_locales.sort.each do |locale|\n @locales << [I18n.t(\"shared.locale.long.#{locale}\"), locale]\n end\n end", "def list_languages\n\t\trender json: Language.all.to_json\n\tend", "def languages\n return @languages\n end", "def GetLocale id\n\n APICall(path: \"locales/#{id}.json\")\n\n end", "def all\n countries\n end", "def index\n @translations = @locale.translations.all(:order => \"raw_key, pluralization_index\")\n end", "def preferred_locales_str\n (preferred_locales || []).join(\",\")\n end", "def locales_menu\n returning html = \"\" do\n html << content_tag(:ul) do\n locales.map do |locale|\n title = locale == I18n.locale ? \"* #{h(locale)}\" : h(locale)\n content_tag(:li) do\n link_to title, change_locale_path(locale), :title => title, :method => :put\n end\n end * \" | \"\n end\n end\n end", "def country_list\n get_request( \"/api/v2_1/api/countries\")\n end", "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def locale\n @grpc.locale\n end", "def locale\n @grpc.locale\n end", "def localized_names\n @localized_names ||= []\n end" ]
[ "0.775015", "0.7720163", "0.7659254", "0.76236016", "0.751332", "0.738009", "0.73524016", "0.73524016", "0.73498744", "0.7231358", "0.72260714", "0.7193378", "0.7131783", "0.7131057", "0.71171355", "0.71171314", "0.7073235", "0.70539683", "0.7050902", "0.7045013", "0.7024242", "0.7024242", "0.701853", "0.6996671", "0.68337107", "0.6805538", "0.6787117", "0.6766044", "0.6734056", "0.6734056", "0.6722445", "0.6653194", "0.6653194", "0.66390747", "0.6617961", "0.6577008", "0.65624046", "0.65408885", "0.6530441", "0.6486887", "0.64579904", "0.64486414", "0.64420736", "0.6433379", "0.6430897", "0.64240324", "0.63476986", "0.6320857", "0.62369454", "0.6225685", "0.6217908", "0.61988145", "0.61966395", "0.61879206", "0.61617696", "0.61455655", "0.608982", "0.6082222", "0.6076544", "0.6074479", "0.60115683", "0.5983503", "0.5972771", "0.5946258", "0.59384984", "0.5935713", "0.59232765", "0.5922594", "0.59169346", "0.59025824", "0.5902563", "0.5878933", "0.58762527", "0.58756685", "0.58756685", "0.5873703", "0.5856157", "0.5835102", "0.58053136", "0.5779111", "0.57701385", "0.57499653", "0.57499653", "0.5749229", "0.57185733", "0.5718015", "0.56952053", "0.56616956", "0.5640608", "0.563079", "0.5572409", "0.5571917", "0.55674285", "0.5560131", "0.55138385", "0.55110043", "0.55105317", "0.55047184", "0.55047184", "0.54854685" ]
0.7620866
4
Assign block to be called on model class.
def setup &block if @setup_block setup_block = @setup_block exec_setup_block = method(:exec_setup_block) @setup_block = lambda do |attributes, options, backend_class| [setup_block, block].each do |blk| exec_setup_block.call(self, attributes, options, backend_class, &blk) end end else @setup_block = block end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block\n end", "def parsed_model(&block)\n parsed_model_class.class_eval(&block)\n end", "def execute(block)\n model = @wrapper.object\n block.call model\n end", "def set_block &b\n @block = b\n end", "def initialize(model_class, block)\n @model_class, @block = model_class, block\n\n @scopes = {}\n @allowed_fields = {}\n @validators = {}\n @fixtures = {}\n end", "def __execute(&block)\n self.instance_eval(&block)\n end", "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "def populate &block\n instance_eval(&block)\n self\n end", "def initialize(model, storage_id = nil, &block)\n super(model, storage_id)\n instance_eval(&block) if block_given?\n end", "def rucas &block\n self.instance_eval(&block)\n end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def new\n\t\t@block = Block.new\n\tend", "def initialize (&block)\n instance_exec(&block)\n end", "def record_block\n @block = true\n end", "def block_class() Block; end", "def initialize(&block)\n yield self\n end", "def initialize(&block)\n instance_exec(&block) if block_given?\n end", "def block_node=(_); end", "def call_block\n @_block.call(self) if @_block\n end", "def setup &block\n block.try(:call, self)\n end", "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "def emotive(klass_name, &block)\n spawn_model klass_name, ActiveRecord::Base do\n acts_as_emotive\n class_eval(&block) if block\n end\n end", "def set_block_class\n @block_class = BlockClass.find(params[:id])\n end", "def set(&block)\n @set = block\n end", "def set(&block)\n @set = block\n end", "def define &block\n new block\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def block(block)\n @components[:__base__] = self.class.build(&block)\n @load_order << :__base__\n true\n end", "def initialize\n @block_args = []\n end", "def block=(_arg0); end", "def block=(_arg0); end", "def use_block(obj, &method)\n\tmethod.call\nend", "def set_block\n @block = Block.find(params[:id])\n\n\n end", "def set_block\n @block = Block.find(params[:id])\n end", "def set_block\n @block = Block.find(params[:id])\n end", "def set_block\n @block = Block.find(params[:id])\n end", "def set_block\n @block = Block.find(params[:id])\n end", "def set_block\n @block = Block.find(params[:id])\n end", "def edit(&block)\n self.instance_eval(&block)\n end", "def initialize(model, &block)\n @model = model\n @associations = {}\n @fields = []\n @attributes = []\n @conditions = []\n @groupings = []\n @options = {}\n @delta_object = nil\n \n initialize_from_builder(&block) if block_given?\n end", "def call(&block)\n block.call(self) if block_given?\n self\n end", "def update(&block)\n instance_eval(&block)\n end", "def post_block\n end", "def post_block\n end", "def alter(&block)\n dup.tap { |o| o.instance_eval(&block) }\n end", "def define &blk\n self.instance_eval(&blk)\n end", "def set_block\n @request = JSON.parse(request.body.read, {:symbolize_names => true})\n @block = Block.find_by(prev_block: @request[:prev_block])\n end", "def block_node; end", "def block_node; end", "def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end", "def block(block)\n @components[:__base__] = block\n @load_order << :__base__\n true\n end", "def initialize\n yield self if block_given?\n end", "def initialize\n yield self if block_given?\n end", "def initialize\n yield self if block_given?\n end", "def initialize\n yield self if block_given?\n end", "def configure(&block)\n self.instance_eval(&block)\n end", "def initialize(&block)\n load_defaults!\n\n instance_eval(&block) if block_given?\n\n set_defaults!\n end", "def client(&block)\n eval('self', block.binding)\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def initialize(&block)\n load_defaults!\n\n instance_eval(&block)\n end", "def run(&block)\n end", "def with( &blk )\n # blk[ self ]\n self.instance_eval &blk\n end", "def blocks; end", "def blocks; end", "def blocks; end", "def initialize(&block)\n @required_options = []\n instance_exec &block\n end", "def initialize(&block)\n yield self\n end", "def update_block(hash, attrs)\n raise \"Not implemented\"\n end", "def callback &block\n super\n end", "def callback &block\n super\n end", "def bind(object)\n BlockAdapter.new(@block, object)\n end", "def block\n options.fetch(:block)\n end", "def initialize(&block)\n @triggers = []\n self.instance_eval(&block)\n end", "def custom=(&block)\n ## FIXME: validate number of arguments\n @route = Proc.new &block\n end", "def create_block_object(&block)\n block\nend", "def initialize(params ={}, &block)\n super\n instance_eval &block\n end" ]
[ "0.70473266", "0.6913146", "0.6913146", "0.68325454", "0.67524666", "0.6699584", "0.66709614", "0.6657844", "0.65972716", "0.65951025", "0.65910745", "0.65881836", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65679044", "0.6552081", "0.65312696", "0.6518613", "0.64675087", "0.6464102", "0.6447443", "0.64379156", "0.6411957", "0.6392361", "0.6390933", "0.6350674", "0.6332543", "0.6332543", "0.63276184", "0.6326905", "0.6326905", "0.6326905", "0.63230205", "0.62615585", "0.6261251", "0.6261251", "0.6253158", "0.6221189", "0.61969745", "0.61969745", "0.61969745", "0.61969745", "0.61969745", "0.6178158", "0.6154761", "0.6146522", "0.6145542", "0.61382186", "0.61382186", "0.6134798", "0.6104911", "0.60802823", "0.6060264", "0.6060264", "0.60459393", "0.60401547", "0.6015377", "0.6015377", "0.6015377", "0.6015377", "0.60004926", "0.59924394", "0.59880185", "0.598739", "0.598739", "0.5986331", "0.5981357", "0.59671587", "0.5958191", "0.5958191", "0.5958191", "0.5948675", "0.59482384", "0.594551", "0.59442514", "0.59442514", "0.5943341", "0.5929886", "0.5927079", "0.591786", "0.59125626", "0.5906927" ]
0.6149898
63
Build a subclass of this backend class for a given set of options
def build_subclass(model_class, options) ConfiguredBackend.build(self, model_class, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(options={})\n klass = options.delete(:type)\n \n if klass\n module_eval \"#{klass.to_s.capitalize}.new(#{options})\"\n else\n assign_options(options)\n end\n end", "def initialize_options(original_options)\n super\n\n case options[:backend]\n when String, Symbol, Class\n @backend, @backend_options = options[:backend], options.dup\n when Array\n @backend, @backend_options = options[:backend]\n @backend_options = @backend_options.merge(options)\n when NilClass\n @backend = @backend_options = nil\n else\n raise ArgumentError, \"backend must be either a backend name, a backend class, or a two-element array\"\n end\n\n @backend = load_backend(backend)\n end", "def build\n klass = create_class(@class_name, @options)\n klass.new\n end", "def initialize(options)\n @classes = options[:classes]\n super\n end", "def build(options = T.unsafe(nil)); end", "def initialize(options={})\n @klass = options[:class] if options.key?(:class)\n super\n end", "def initialize(options)\n super options\n self.options = options\n @facades = self.options[:facades] || [[]]\n @model = self.options[:model]\n @id_group = [self.options[:id_group] || []].flatten\n @key = self.options[:key]\n end", "def initialize(parent, options = {})\n @parent = parent\n @options = options[:backend] || {}\n end", "def initialize(options = {})\n super(options.merge(OPTIONS))\n end", "def initialize(options = {})\n @options = OPTIONS.merge(options)\n end", "def initialize(*)\n super\n self.options = options.dup\n end", "def initialize(options); end", "def build(options = {})\n fail \"The #{self.class} driver does not support the build method!\"\n end", "def initialize **opts\n @options = DEFAULT_OPTIONS.merge opts\n end", "def initialize(options = {})\n super()\n @opts = options\n end", "def initialize( options={} )\n end", "def initialize(*options)\n @options = options\n end", "def initialize(options={})\n options = Subtledata.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end", "def initialize(options = {})\n self.class.validate_options(options)\n end", "def initialize(options)\n\n @options = {\n 'queue' => nil,\n 'forget' => false,\n }.merge(options.inject({}) { |h, (k, v)|\n h[k.to_s] = v; h\n })\n #\n # the inject is here to make sure that all options have String keys\n end", "def initialize(options)\n @options = options\n super()\n end", "def initialize(options = {})\n super\n end", "def initialize(options = {})\n super\n end", "def initialize(options = {})\n super\n end", "def build values, options\n adapter_class.new(values, options).execute\n end", "def initialize(options={})\n options = Rango.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end", "def initialize(options = {})\n super(options)\n end", "def initialize(options = {})\n super(options)\n end", "def initialize(options = {})\n super(options)\n end", "def initialize(options = {})\n super(options)\n end", "def initialize(options = {})\n super(options)\n end", "def initialize(options = {})\n super(options)\n end", "def initialize(options = {})\n @options = OpenStruct.new(options)\n self.class.instance_eval do\n def_delegators :@options, *options.keys\n end\n end", "def initialize(options={})\n \n @options=DEFAULT_OPTIONS.dup.merge(options)\n end", "def initialize(options={})\n \n @options=DEFAULT_OPTIONS.dup.merge(options)\n end", "def initialize(options)\n @options = options\n end", "def initialize(options={})\n end", "def initialize(options)\n @options = {\n 'queue' => nil,\n 'forget' => false,\n }.merge(options.inject({}) { |h, (k, v)|\n h[k.to_s] = v; h\n })\n #\n # the inject is here to make sure that all options have String keys\n end", "def initialize( options = {} )\n super\n end", "def initialize(_options = {})\n end", "def obj_struct_build(options)\n if options.is_a? Array\n vals = group_by_class(options)\n vals.each { |k, v| set_attrs(k, v) }\n elsif options.is_a? Hash\n options.each { |k, v| set_attrs(k, v) } # multiple objects already built\n else\n klass = options.class.to_s.underscore\n set_attrs(klass, options)\n end\n end", "def initialize(options = { })\n super(options)\n end", "def initialize( option_klass )\n @klass = option_klass\n @options = Caty::OptionArray.new\n end", "def initialize(options = {})\n @options = options\n end", "def initialize(options={})\n @options = options\n end", "def initialize(options = {})\n @options = options\n end", "def initialize(options = {})\n @options = options\n end", "def initialize(options = {})\n @options = options\n end", "def construct( &block )\n self.instance_eval(&block)\n @options\n end", "def initialize(options)\n @options = options\n end", "def initialize(options)\n @options = options\n end", "def initialize(options)\n @options = options\n end", "def create(_options)\n raise NotImplementedError\n end", "def initialize(options = {})\n options = Tumblife.options.merge(options)\n Configuration::OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end", "def initialize(options={})\n Wayback::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", options[key] || Wayback.instance_variable_get(:\"@#{key}\"))\n end\n end", "def initialize options={}\n self.options = options\n end", "def initialize(options)\n OPTIONS.each do |var|\n instance_variable_set :\"@#{var}\", options[var] || options[var.to_s]\n end\n end", "def initialize(options)\n @options = options\n end", "def initialize(options)\n @options = options\n end", "def initialize(options)\n @options = options\n end", "def new(opts = {})\n klass.new(opts)\n end", "def initialize( options = {} )\n @default_context = :any\n @render_proc = default_render_proc\n\n options.each do |opt,value|\n case opt\n when :placeholder\n # put special option handling here\n else\n self.send( \"#{opt}=\", value )\n end\n end\n end", "def initialize(options = {})\n init(options)\n end", "def configuration_from_options(options); end", "def initialize(options={})\n Fantasydata::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", options[key] || Fantasydata.instance_variable_get(:\"@#{key}\"))\n end\n end", "def initialize(_options = {}); end", "def initialize(opts={})\n (rec = lambda do |k|\n begin\n k.const_get(:OPTIONS).each do |key, v|\n opts[key] ||= v\n end\n rescue\n ensure\n rec.call(k.superclass) if k.inherits_from? Parsel\n end\n end).call(self.class)\n\n opts.each do |k, v|\n next if VERBOTEN.member? k\n\n instance_variable_set \"@#{ k }\".intern, v\n (class << self; self; end).instance_eval {\n attr_accessor k\n }\n end\n\n capture(opts[:capture]) if opts[:capture]\n end", "def initialize(options = {})\n @options = options || {}\n end", "def initialize(options = {})\n @options = options || {}\n end", "def initialize(options = {})\n @options = options || {}\n end", "def initialize(*args)\n DEFAULT_OPTIONS.each do |option|\n self.send(:\"#{option}=\", self.class.send(:class_variable_get, :\"@@default_#{option}\") )\n end\n end", "def initialize(options = {})\n @options = options.freeze\n end", "def initialize(options = {})\n @options = options\n end", "def initialize(options)\n\n @options = options\n\n @conf = (@options['conf'] || 'params, fields, options').split(/\\s*,\\s*/)\n @conf = %w[ params fields options ] if @conf.include?('all')\n\n @field_prefix = @options['field_prefix'] || ''\n end", "def initialize(options={})\n options = Yapper.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end", "def initialize(options={})\n @options = options\n add_metadata\n add_labels\n\n options.delete('metadata')\n options.delete('labels')\n super(options)\n end", "def initialize(options = 0)\n @options = options\n end", "def use(klass, options=nil)\n @ustack ||= []\n @ustack << [klass, options]\n end", "def initialize(*args)\n @options = Hash.new\n @config = Hash.new\n \n # Set the banner\n @banner = self.class.banner\n \n # Dupe the class options for this instance\n klass_options = self.class.options\n klass_options.keys.inject(@options) { |memo, key| memo[key] = klass_options[key].dup; memo }\n \n # Set the default configuration values for this instance\n @options.each do |config_key, config_opts|\n config_opts[:on] ||= :on\n config_opts[:boolean] ||= false\n config_opts[:required] ||= false\n config_opts[:proc] ||= nil\n config_opts[:show_options] ||= false\n config_opts[:exit] ||= nil\n \n if config_opts.has_key?(:default)\n @config[config_key] = config_opts[:default]\n end\n end\n \n super(*args)\n end", "def initialize(options) # :nodoc:\n @options = options\n end", "def initialize(options = {})\n @options = options.symbolize_keys\n @q = @options.delete(:q) || { }\n @r = @options.delete(:r) || { }\n end", "def initialize(options); @options = options end", "def klass_option_obj(klass, option_obj)\n return option_obj if option_obj.instance_of?(klass)\n option_obj ||= {} # if nil, makes it empty hash\n return klass.send( :new, option_obj )\n end", "def initialize(cls, name, options)\n @cls = cls\n @name = name\n @options = options.dup\n end", "def initialize(options = {})\n options.each { |k, v| self.send :\"#{k}=\", v }\n end", "def initialize(options = {})\n options.each { |k, v| self.send :\"#{k}=\", v }\n end", "def build(attrs = {})\n choose_right_class(attrs).new(attrs)\n end", "def initialize(options = {})\n @options = default_options.merge(options)\n @app = @options.delete(:app)\n end", "def initialize\n @options = {}\n end", "def initialize\n @options = {}\n end", "def initialize\n @options = {}\n end", "def build_operation_class(*args)\n class_builder(self).(*args) # Uber::Builder::class_builder(context)\n end", "def initialize(options={})\n @web_client = options.fetch(:http_client)\n @parser = options[:parser] || JSON\n @proxy_factory_class = options[:factory] || ProxyFactory\n @url_encoder = options[:url_encoder] || CGI\n if options.has_key?(:proxy_cache)\n @proxy_cache = options[:proxy_cache]\n else\n @proxy_cache = ProxyCache.new\n end\n\n @metadata = options[:metadata]\n if @metadata\n configure_with_metadata(@metadata)\n else\n @metadata_factory = options[:metadata_factory] || Metadata\n end\n end", "def initialize(options)\n opts = string_keys(options)\n config = JSON.load(opts.delete(\"config\") || \"{}\")\n append_config_source opts # high priority\n append_config_source config # lower priority\n end", "def initialize(args=[], options={}, config={})\n super\n @options = @options.dup\n end", "def initialize(options = {})\n @configuration = PyramidScheme::Configuration.new\n @index_provider = @configuration[:index_provider_class].new\n @indexer_class = @configuration[:indexer_class]\n end", "def initialize(options={})\n\t\t\tPlayapi::Configurable.keys.each do |key|\n\t\t\t\tinstance_variable_set(:\"@#{key}\", options[key] || Playapi.instance_variable_get(:\"@#{key}\"))\n\t\t\tend\n\t\tend", "def initialize(options={})\n Surveygizmo::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", options[key] || Surveygizmo.instance_variable_get(:\"@#{key}\"))\n end\n end", "def initialize(options = {})\n parse_options options\n end", "def initialize(options = {})\n parse_options options\n end" ]
[ "0.6497293", "0.644078", "0.6379249", "0.63658696", "0.6317947", "0.62407863", "0.61906207", "0.6120596", "0.60955805", "0.607285", "0.6040165", "0.6028494", "0.6020593", "0.6006312", "0.59902906", "0.59701794", "0.59594756", "0.59489304", "0.58794874", "0.5850741", "0.5849962", "0.5849955", "0.5849955", "0.58442014", "0.58377045", "0.5836008", "0.5833865", "0.5833865", "0.5833865", "0.5833865", "0.5833865", "0.5833865", "0.58051", "0.5804393", "0.5804393", "0.5793185", "0.5784964", "0.57765764", "0.5760367", "0.5760015", "0.57586837", "0.575821", "0.57575345", "0.5754006", "0.5751651", "0.5746441", "0.5746441", "0.5746441", "0.57443583", "0.5741176", "0.5741176", "0.5741176", "0.5737293", "0.5736212", "0.57350326", "0.57233214", "0.57173556", "0.57080436", "0.57080436", "0.57080436", "0.57080007", "0.57068753", "0.57064337", "0.57043195", "0.56994075", "0.5697098", "0.56911767", "0.56698805", "0.56698805", "0.56698805", "0.56589663", "0.5655484", "0.564401", "0.56389725", "0.5633502", "0.563012", "0.56297696", "0.562436", "0.56240326", "0.56139517", "0.56120193", "0.5601775", "0.56012005", "0.5599081", "0.55932623", "0.55932623", "0.55927676", "0.55832815", "0.5581804", "0.5581804", "0.5581804", "0.5567667", "0.5567129", "0.5563894", "0.5560897", "0.5558362", "0.5557666", "0.55492485", "0.554599", "0.554599" ]
0.7384247
0
Create instance and class methods to access value on options hash
def option_reader(name) module_eval <<-EOM, __FILE__, __LINE__ + 1 def self.#{name} options[:#{name}] end def #{name} self.class.options[:#{name}] end EOM end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options ; @options ||= get(:options) end", "def get_options; end", "def method_missing(sym, *args)\n return @options[sym]\n end", "def options\n self[:options] || {}\n end", "def options\n @options ||= self.class.options\n end", "def options\n self.class.options\n end", "def options(opt); end", "def options(opt); end", "def options\n self[:options] || {}\n end", "def options(opt)\n end", "def options\n data[:options]\n end", "def options() end", "def options \n @options ||= OpenStruct.new\n end", "def option(opt)\n @options[opt]\n end", "def options\n @options ||= Options.new\n end", "def options\n @options ||= Options.new\n end", "def options\n @options ||= OpenStruct.new\n end", "def options\n @options ||= OpenStruct.new\n end", "def options\n @options ||= {}\n @options\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def initialize\n @option = Tools::Option.new\n end", "def value\n options_hash[option_id]\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def option\n return @manager.configurable.class.configuration.options[key]\n end", "def get_options\n @options\n end", "def options\n @options ||= OpenStruct.new\n end", "def options\n @options ||= OpenStruct.new\nend", "def options\n @options ||= OpenStruct.new\nend", "def options\n @options ||= OpenStruct.new\nend", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def initialize\n @options = {}\n end", "def initialize\n @options = {}\n end", "def initialize\n @options = {}\n end", "def options\n @_options ||= {}\n end", "def [](key)\n @options[key]\n end", "def options\n @options\n end", "def options\n @options\n end", "def initialize options={}\n @own_options = options\n end", "def method_missing method_name, *arg\n if method_name.to_s =~ /(.*)=$/\n key = $1\n if @options.has_key? key\n @options[key] = arg[0]\n return @options[key]\n end\n else\n key = method_name.to_s\n if @options.has_key? key\n return @options[key]\n end\n end\n raise NoMethodError.new(\"undefined method `#{key}' for Options:Class\", \"unknown_key\")\n end", "def []( name )\n @options[ name ]\n end", "def _get_option(name)\n\n # Start with nothing\n value = nil\n\n # First, get the default value by cycling through the allowed options\n method = self.class.metadata[:allowed_options].each do |allowed_option|\n value = allowed_option[:default] if allowed_option[:name] == name\n end\n\n # Then, cycle through the user-provided options\n @user_options.each do |user_option|\n value = user_option[name] if user_option.key?(name)\n end\n\n value\n end", "def user_options; end", "def initialize\n OPTIONS.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n end", "def options\n Properties[self.class] ||= {}\n return Properties[self.class][:opts] || []\n end", "def initialize options={}\n self.options = options\n end", "def options; @opts end", "def options\n @@options\n end", "def options\n @@options\n end", "def options\n @@options\n end", "def initialize(options)\n\t\t\t@options = options\n\t\t\toptions.keys.each do |key|\n\t\t\t\tif respond_to?(key)\n\t\t\t\t\tsend(\"#{key}=\",options[key])\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def method_missing(symbol, *args, &block)\n if @options.key?(symbol)\n @options[symbol]\n else\n super(symbol, *args, &block)\n end\n end", "def options\n @options\n end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end", "def options; end" ]
[ "0.7246439", "0.7124633", "0.7010595", "0.70088863", "0.6865761", "0.6853084", "0.68266654", "0.68260986", "0.6800341", "0.67721343", "0.6762285", "0.6753329", "0.674094", "0.66978514", "0.66870797", "0.66870797", "0.6676867", "0.6676867", "0.66763216", "0.66605836", "0.66605836", "0.66605836", "0.6655533", "0.66124076", "0.66089463", "0.66089463", "0.6597024", "0.65850824", "0.6565845", "0.6565637", "0.6565637", "0.6565637", "0.6554932", "0.6554932", "0.6554932", "0.6551746", "0.6551746", "0.6551746", "0.65496224", "0.6532905", "0.65189123", "0.65189123", "0.65172803", "0.651481", "0.6513289", "0.6505202", "0.65034306", "0.6486718", "0.6466419", "0.64628774", "0.6455998", "0.6416081", "0.6416081", "0.6416081", "0.6410063", "0.64050657", "0.6399398", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063", "0.63916063" ]
0.0
-1
Call setup block on a class with attributes and options.
def setup_model(model_class, attribute_names) return unless setup_block = @setup_block exec_setup_block(model_class, attribute_names, options, self, &setup_block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(&block)\n define_method(:setup, &block)\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def initialize(*args, &blk)\n setup(*args, &blk)\n end", "def setup(klass, *methods)\n \n end", "def setup!\n setup_instance_methods!\n self\n end", "def setup(&block)\n self.setup_blocks << block\n end", "def setup(&block)\n @setup = block\n end", "def setup(options); end", "def setup(options); end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup(options = {}); end", "def setup(&block)\n passed_through_setup = self.setup_chained\n self.setup_chained = lambda { instance_eval(&passed_through_setup);instance_eval(&block) }\n define_method :setup, &self.setup_chained\n end", "def setup(&blk)\n @setup_block = blk\n end", "def setup(test_class)\n block = self\n test_class.setup { block.run(self) }\n end", "def setup(&block)\n Config.setup(&block)\n end", "def setup &block\n if @setup_block\n setup_block = @setup_block\n exec_setup_block = method(:exec_setup_block)\n @setup_block = lambda do |attributes, options, backend_class|\n [setup_block, block].each do |blk|\n exec_setup_block.call(self, attributes, options, backend_class, &blk)\n end\n end\n else\n @setup_block = block\n end\n end", "def setup(&block)\n if block\n @setup = block\n else\n @setup\n end\n end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def setup!\n setup_defaults!\n setup_instance_methods!\n @owner_class.embedded = true\n self\n end", "def setup(*args) ; end", "def setup &block\n block.try(:call, self)\n end", "def setup(klass)\n @klass = klass\n end", "def setup\n add_standard_properties\n #\n create_banner\n create_standard_options\n create_advanced_options\n create_mode_options\n create_application_options\n create_feature_options\n create_tail_options\n #\n parse_options\n load_config_configuration\n create_result_directory\n load_results_archive\n end", "def setup(klass)\n @klass = klass\n end", "def setup\n yield self\n end", "def setup\n yield self\n end", "def setup(&block)\n block.call config if block_given?\n end", "def setup\n yield self\n end", "def setup\n yield self\n end", "def setup\n yield self\n end", "def setup\n yield self\n end", "def setup\n yield self\n end", "def setup\n yield self\n end", "def setup(&block)\n @setups << block\nend", "def setup(&code)\n @setup = code\n end", "def setup\n yield self\n self\n end", "def setup\n yield self\n self\n end", "def setup(&block)\n yield self if block_given?\n end", "def setup(options)\n NotImplementedError \n end", "def setup(&block)\n settings.instance_eval(&block) if block_given?\n end", "def setup\n raise \"setup must be defined in a subclass\"\n end", "def setup\n #implement in subclass;\n end", "def setup(hash_args); end", "def setup(*args)\n\t\tload_wrapped_object() # => @wrapped_object\n\t\t# ^ runs #setup on the new object\n\tend", "def setup\n # override this if needed\n end", "def setup(&block)\n scenario.setups << block\n end", "def before _type = nil, &block\n define_method :setup do\n super()\n self.instance_eval(&block)\n end\n end", "def setup(&b)\r\n\t\t\t@setup = b\r\n\t\tend", "def setup(&block)\n block ? @setup << block : @setup\n end", "def addSetupBlock( &block ); self.class.addSetupBlock( &block ); end", "def invoke_setup!\n source_command_wrapper\n @setup_block.call(self) if @setup_block\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup(model_class); end", "def setup(model_class); end", "def configure!\n yield self\n setup\n end", "def setup\n raise NotImplementedError\n end", "def setup\n # noop\n end", "def setup\n yield(configuration)\n end", "def setup()\n end", "def setup\n raise \"Unimplemented method #setup\"\n end", "def initialize(&block)\n @required_options = []\n instance_exec &block\n end", "def setup\n self.setup! unless self.setup?\n end", "def setup(info)\n @info = info \n end", "def setup(&b)\n return @setup unless block_given?\n @setup = b\n end", "def setup\n for c in @advised_classes\n apply(c)\n end\n end", "def method_missing( method, *args, &block )\n if method.to_s =~ /^setup_(.*)$/ && args.empty?\n add( $1.to_sym, caller.first, &block )\n else\n super\n end\n end", "def setup(_context)\n end", "def setup\n # override and do something appropriate\n end", "def setup_trait(options);end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup_class\n _config = create_configuration\n @client = Client.new(config: _config)\n _auth_managers = @client.auth_managers\n end", "def initialize(conf = {})\n super(conf) ;\n setup() ;\n end", "def setup\n @configure = Hatemile::Util::Configure.new\n end", "def setup!( options )\n self.level = options[:level]\n end", "def setup\n\t\tend", "def setup\n\t\tend", "def initialize(config)\n @config = config\n setup\n end", "def setup!\n configuration = RfmAdaptor::Configuration.new(:database)\n database = configuration.__send__(self.database_name)\n raise \"Database: #{self.database_name} configuration file not exists.\" if database.blank?\n raise \"Database: #{self.database_name} environment[#{self.env}] not exists.\" if database[self.env].blank?\n self.attributes = database[self.env]\n self.setup_state = true\n end", "def command_setup(args)\n setup(args)\n end", "def setup\n debug 'No custom setup defined'\n end", "def setup(&block)\n before(:each, &block)\n end", "def initialize(*args)\n @options = Hash.new\n @config = Hash.new\n \n # Set the banner\n @banner = self.class.banner\n \n # Dupe the class options for this instance\n klass_options = self.class.options\n klass_options.keys.inject(@options) { |memo, key| memo[key] = klass_options[key].dup; memo }\n \n # Set the default configuration values for this instance\n @options.each do |config_key, config_opts|\n config_opts[:on] ||= :on\n config_opts[:boolean] ||= false\n config_opts[:required] ||= false\n config_opts[:proc] ||= nil\n config_opts[:show_options] ||= false\n config_opts[:exit] ||= nil\n \n if config_opts.has_key?(:default)\n @config[config_key] = config_opts[:default]\n end\n end\n \n super(*args)\n end", "def setup\n\n end", "def setup\n\n end", "def initialize(options)\n @classes = options[:classes]\n super\n end", "def initialize( options = {}, &block )\n @mutex = Mutex.new\n\n setup!(options)\n block.call(self) if block\n end", "def initialize(...)\n super()\n configure(...)\n end", "def setup\n yield(application_config)\n end", "def setup(&blk)\n @config.read(&blk)\n @config\n end", "def setup\r\n end", "def setup\n Wizard.new do |config|\n yield config\n end\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end" ]
[ "0.7373911", "0.73719925", "0.7358792", "0.7341957", "0.7304759", "0.7248919", "0.71910113", "0.7184338", "0.7184338", "0.70105827", "0.6975673", "0.69716394", "0.692515", "0.6921935", "0.69026744", "0.688502", "0.6875963", "0.68683666", "0.68347543", "0.6834604", "0.68089736", "0.6709568", "0.67007005", "0.6691646", "0.669085", "0.669085", "0.66765726", "0.66568303", "0.66568303", "0.66568303", "0.66568303", "0.66568303", "0.66568303", "0.6649214", "0.6640525", "0.6627822", "0.6622779", "0.66169655", "0.656453", "0.6537821", "0.6508855", "0.6494954", "0.6467306", "0.6445893", "0.6411464", "0.6380394", "0.63642126", "0.63423", "0.63105625", "0.6301264", "0.62799263", "0.62779486", "0.62779486", "0.62779486", "0.62779486", "0.62779486", "0.62685955", "0.62685955", "0.6256907", "0.62515175", "0.62372994", "0.6229587", "0.6150869", "0.61502194", "0.614959", "0.61223257", "0.61186314", "0.61050856", "0.6103369", "0.6102271", "0.60997546", "0.60993415", "0.60934776", "0.6093353", "0.6093353", "0.6088318", "0.60871905", "0.6072938", "0.6069495", "0.6059415", "0.6059415", "0.6048917", "0.60472286", "0.6044666", "0.6020047", "0.60103995", "0.59997183", "0.5985377", "0.5985377", "0.598458", "0.59597415", "0.5956092", "0.5948631", "0.59463555", "0.5942249", "0.5936613", "0.5934734", "0.5934734", "0.5934734", "0.5934734" ]
0.66891235
26
Show subclassed backend class name, if it has one.
def inspect (name = superclass.name) ? "#<#{name}>" : super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_name\n klass = single_class\n while klass.name == ''\n klass = klass.superclass\n end\n if list_context?\n \"[#{klass}]\"\n else\n klass.name\n end\n end", "def backend_klass; end", "def display_name\n class_name\n end", "def sg_base_class_name # :nodoc:\n @sg_base_class_name ||= self.base_class.name\n end", "def polymorphic_name\n store_full_class_name ? base_class.name : base_class.name.demodulize\n end", "def name\n @label || self.class.to_s.rpartition('::').last\n end", "def class_name; end", "def class_name; end", "def class_name\n @class_name ||= derive_class_name\n end", "def current_class_name\n @klass.to_s\n end", "def to_s\n \"Inspec::Backend::Class\"\n end", "def base_class_name\n split('::').last\n end", "def super_class_name\n nil\n end", "def backend_name\n self.class.name.split(\"::\")[-1].split(\"Store\")[0].downcase\n end", "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end", "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end", "def name\n @class_name\n end", "def class_name\n self.class.to_s.split('::').last\n end", "def class_info?; \"#{self.class.name}\" end", "def name\n @klass\n end", "def name\n @ruby_class.name\n end", "def name\n self.class.name || self.class.to_s\n end", "def class_name\n (self.type.to_s || self.class.name).demodulize\n end", "def name\n has_module?(klass) ? klass[(klass.index(\"::\")+2)..-1] : klass\n end", "def current_extend_class_name\n @klass.extend_class_name\n end", "def class_name\n name = @klass.name\n name.name\n end", "def full_name\n klass.name\n end", "def class_name\n self.class.name.split(\"::\").last\n end", "def inspect\n \"Inspec::Backend::Class @transport=#{backend.class}\"\n end", "def to_s\n \"#{DbAgile::RubyTools::unqualified_class_name(self.class)}: #{name}\"\n end", "def class_name\n self.class.name.split(\"::\").last.downcase\n end", "def name\n klass.name.split('::').last\n end", "def class_name\n self.class.class_name\n end", "def class_name\n self.class.to_s\n end", "def class_name\n self.class.to_s\n end", "def class_name\n self.class == Class ? self.name : self.class.name\n end", "def class_name\n self.to_s.demodulize.underscore\n end", "def name; self.class.name; end", "def _class\n special_attribute('@class'.freeze) || self.class.name.demodulize\n end", "def name_and_class\n [name, self['class']].compact.join('.')\n end", "def className\n\t\tself.class.to_s\n\tend", "def className\n\t\tself.class.to_s\n\tend", "def class_name\n @class_name ||= (@options[:class_name] || @name).to_s.camelize\n end", "def display_name\n job_class\n end", "def name\n self.class.to_s.split('::').last\n end", "def name; self.class.to_s; end", "def display_class(name)\n klass = class_cache[name]\n @display.display_class_info klass\n end", "def ruby_class_name\n @ruby_class_name\n end", "def class_names op, deep_inheritance=false\n raise \"#{self.class}.class_names not implemented\"\n end", "def className\r\n\t\tself.class.to_s\r\n\tend", "def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\n end", "def name\n self.class.simple_name\n end", "def __ext_class\n self_class.name || '???'\n end", "def className\r\n self.class.to_s\r\n end", "def name\n super.to_s\n end", "def name\n super.to_s\n end", "def name\n\t\tself.class.name\n\tend", "def shortname\n\t\treturn self.class.shortname\n\tend", "def name\n self.class.name\n end", "def name\n self.class.name\n end", "def display_class_info\n end", "def print_class(*) end", "def test_subclass_name\n bo1 = Pt::Boundary::MyA.new(\"\\n===\\n\")\n assert_equal \"Part::Boundary::MyA\", bo1.subclass_name\n assert_equal \"Boundary::MyA\", bo1.subclass_name(index_ini: 1)\n assert_equal \"MyA\", bo1.subclass_name(index_ini: 2)\n\n ss = PlainText::Part::Section::Subsection.new [\"abc\"]\n assert_equal \"Part::Section::Subsection\", ss.subclass_name\n assert_equal \"Section::Subsection\", ss.subclass_name(index_ini: 1)\n end", "def name\n self.class.name\n end", "def class_name\r\n assert_exists\r\n option_class_name\r\n end", "def full_class_name\n @class_names.join(\"::\")\n end", "def type_name\n self.class.name.split('::').last.upcase\n end", "def name\n self.class.name.split('::').last\n end", "def name\n self.class.name.split('::').last\n end", "def determine_class_name\n clazz = class_for_target\n\n name = clazz.name\n name = clazz.superclass.name if name.nil? || name == ''\n name = ANONYMOUS_CLASS if name.nil? || name == OBJECT_CLASS_NAME\n name\n end", "def getTabCaption; self.class.name; end", "def display_class name\n return if name =~ /#|\\./\n\n found, klasses, includes, extends =\n classes_and_includes_and_extends_for name\n\n context = klasses.reverse.inject do |merged, k|\n merged.merge k\n end\n\n return if found.empty?\n\n out = class_document name, found, klasses, includes, extends\n\n @history.go name, out, context\n\n display out, context\n end", "def full_implementation_class_name\n full_item_type_name.ns_camelize\n end", "def to_s; \"#{self.class} #{super}\"; end", "def class_name\n @class_name ||= active_record.name\n end", "def name\n self.class.name\n end", "def name\n self.class.name\n end", "def klass\n @object.name if (defined? @object.class.name)\n end", "def name\n self.class.name.split(\"::\").last.downcase\n end", "def human_name(klass = T.unsafe(nil)); end", "def human_name(klass = T.unsafe(nil)); end", "def name\n prefix_length = 19 # 'bindl::subcommand::'.length\n self.class.name.downcase[prefix_length..-1]\n end", "def name\n self.class.name.split('::').last\n end", "def readable_klass(klass_name)\n\t\tklass_name.blank? ? '' : klass_name.underscore.humanize.titleize\n\tend", "def klass\n name.gsub(module_name+\"::\",\"\")\n end", "def stripped_class_name\n name.demodulize\n end", "def class\n `$q(this.__native__.className)`\n end", "def framework_name\n self.name.split(\"::\").last.downcase\n end", "def framework_name\n self.name.split(\"::\").last.downcase\n end", "def name\n self.class.name.split(\"::\").last\n end", "def backend_name\n config['backend']\n end", "def classname\n @classname ||= self.class.name.split(\"::\")[1..-1].join(\"::\")\n end", "def json_class_name\n [self.class.domain_module, self.class.name.demodulize].join('::')\n end", "def to_s\n\t\tself.class.name\n\tend", "def name\n Properties[self.class] ||= {}\n return Properties[self.class][:name] || \"\"\n end", "def klass_name\n \"#{params[:klass_name].classify}\"\n end", "def protocol_name\n self.class.to_s\n end", "def class_name\n Jaspion::Kilza::Class.normalize(@original_name)\n end", "def qualified_name\n self.class.name\n end", "def mobility_backend_class(name)\n @backends ||= BackendsCache.new(self)\n @backends[name.to_sym]\n end", "def pretty_class_name\n return self.class.to_s.split(/(?=[A-Z])/).join(' ')\n end" ]
[ "0.6831985", "0.6440317", "0.64034855", "0.6316508", "0.6314508", "0.62795836", "0.626747", "0.626747", "0.62649447", "0.62633145", "0.62614065", "0.62553453", "0.6237324", "0.6225607", "0.619343", "0.619343", "0.61895573", "0.61798745", "0.6176625", "0.61765593", "0.6152883", "0.6115555", "0.6110647", "0.6104453", "0.60778224", "0.60673535", "0.60585237", "0.6056917", "0.60497826", "0.6045511", "0.60219705", "0.6009039", "0.59736586", "0.5969301", "0.5969301", "0.5967624", "0.59599036", "0.59544075", "0.5948045", "0.594443", "0.58826596", "0.58826596", "0.58818066", "0.58626366", "0.586173", "0.58563346", "0.58523756", "0.5843362", "0.58424765", "0.5841367", "0.5830221", "0.5829785", "0.5814684", "0.5805366", "0.5795503", "0.5795503", "0.5795486", "0.5794346", "0.57896066", "0.57896066", "0.5787892", "0.57719487", "0.57668644", "0.5752812", "0.57384396", "0.57377666", "0.57225513", "0.5719599", "0.5714316", "0.5713412", "0.57002777", "0.5700146", "0.5680966", "0.56795794", "0.5664944", "0.5645351", "0.5645351", "0.5644019", "0.5641772", "0.56398124", "0.56398124", "0.56363505", "0.56320983", "0.5632024", "0.56234163", "0.56227154", "0.561499", "0.5610946", "0.5610946", "0.559888", "0.55979645", "0.5597395", "0.5567532", "0.5565338", "0.5563354", "0.5562003", "0.55476767", "0.5539621", "0.5536257", "0.55294466", "0.5527686" ]
0.0
-1